-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathconfig.m4
81 lines (65 loc) · 2.5 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
dnl Copyright (c) 2026 - 2024 Gregor Kralik <g.kralik+php-sapnwrfc (at) gmail.com>
dnl
dnl This source code is licensed under the MIT license found in the
dnl LICENSE file in the root directory of this source tree.
dnl
dnl Author: Gregor Kralik <g.kralik+php-sapnwrfc (at) gmail.com>
dnl config.m4 for extension sapnwrfc
PHP_ARG_WITH(sapnwrfc, for SAP NW RFC support,
dnl Make sure that the comment is aligned:
[ --with-sapnwrfc Include SAP NW RFC support])
if test "$PHP_SAPNWRFC" != "no"; then
dnl # --with-sapnwrfc -> check with-path
SEARCH_PATH="/usr/sap/nwrfcsdk /usr/local/sap/nwrfcsdk /usr/local/nwrfcsdk /opt/nwrfcsdk"
SEARCH_FOR="/include/sapnwrfc.h"
if test -r $PHP_SAPNWRFC/$SEARCH_FOR; then # path given as parameter
SAPNWRFC_DIR=$PHP_SAPNWRFC
else # search default path list
AC_MSG_CHECKING([for sapnwrfc files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
SAPNWRFC_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$SAPNWRFC_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please install the SAP NW RFC SDK - missing sapnwrfc.h])
fi
# add include path
SAPNWRFC_INCLUDE_DIR=$SAPNWRFC_DIR/include
PHP_ADD_INCLUDE($SAPNWRFC_INCLUDE_DIR)
SDK_LIB_NAMES="sapnwrfc sapucum"
SDK_LIB_SUFFIX=".so"
case $host_alias in
*darwin*)
SDK_LIB_SUFFIX=".dylib"
;;
esac
# check for libraries
for f in $SDK_LIB_NAMES ; do
AC_MSG_CHECKING([for lib$f$SDK_LIB_SUFFIX])
if test ! -f $SAPNWRFC_DIR/lib/lib$f$SDK_LIB_SUFFIX; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([SAP NW RFC shared library lib$f$SDK_LIB_SUFFIX missing])
fi
AC_MSG_RESULT([found])
PHP_ADD_LIBRARY_WITH_PATH($f, $SAPNWRFC_DIR/lib, SAPNWRFC_SHARED_LIBADD)
done
PHP_SUBST(SAPNWRFC_SHARED_LIBADD)
# Check for uchar.h
# If not found, include the uchar.h from SAP note 2573953
AC_CHECK_HEADER([uchar.h], [], [
AC_MSG_NOTICE([using bundled uchar.h])
PHP_ADD_INCLUDE(ext)
])
# Check for RFC_ATTRIBUTES.partnerIP and RFC_ATTRIBUTES.partnerIPv6 (added in SDK 7.50.6)
# Defines HAVE_RFC_ATTRIBUTES_PARTNERIP and HAVE_RFC_ATTRIBUTES_PARTNERIPV6
AC_CHECK_MEMBERS([RFC_ATTRIBUTES.partnerIP, RFC_ATTRIBUTES.partnerIPv6], [], [], [[#include "$SAPNWRFC_INCLUDE_DIR/sapnwrfc.h"]] )
# set up CFLAGS
PHP_SAPNWRFC_CFLAGS="-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=gnu11 -DSAPwithUNICODE -Wall"
PHP_BUILD_SHARED()
PHP_NEW_EXTENSION(sapnwrfc, sapnwrfc.c exceptions.c string_helper.c rfc_parameters.c, $ext_shared,, $PHP_SAPNWRFC_CFLAGS)
PHP_ADD_MAKEFILE_FRAGMENT()
fi