1dnl config.m4 for extension igbinary 2 3dnl Comments in this file start with the string 'dnl'. 4dnl Remove where necessary. This file will not work 5dnl without editing. 6 7dnl If your extension references something external, use with: 8 9dnl PHP_ARG_WITH(igbinary, for igbinary support, 10dnl Make sure that the comment is aligned: 11dnl [ --with-igbinary Include igbinary support]) 12 13dnl Otherwise use enable: 14 15PHP_ARG_ENABLE(igbinary, whether to enable igbinary support, 16 [ --enable-igbinary Enable igbinary support]) 17 18if test "$PHP_IGBINARY" != "no"; then 19 AC_CHECK_HEADERS([stdbool.h],, AC_MSG_ERROR([stdbool.h not exists])) 20 AC_CHECK_HEADERS([stddef.h],, AC_MSG_ERROR([stddef.h not exists])) 21 AC_CHECK_HEADERS([stdint.h],, AC_MSG_ERROR([stdint.h not exists])) 22 23 AC_MSG_CHECKING(PHP version) 24 25 PHP_IGBINARY_SRC_FILES="src/php7/igbinary.c src/php7/hash_si.c src/php7/hash_si_ptr.c" 26 if test -n "$phpincludedir" -a -d "$phpincludedir"; then 27 IGBINARY_PHPINCLUDEDIR=$phpincludedir 28 else 29 IGBINARY_PHPINCLUDEDIR=$abs_srcdir 30 fi 31 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 32 #include <$IGBINARY_PHPINCLUDEDIR/main/php_version.h> 33 ]], [[ 34#if PHP_MAJOR_VERSION < 7 35#error PHP < 7 36#endif 37 ]])],[ 38 AC_MSG_RESULT([PHP 7]) 39 ],[ 40 AC_MSG_ERROR([PHP 5 is not supported by igbinary 3. Use igbinary 2 instead for PHP5 support.]) 41 ]) 42 43 AC_MSG_CHECKING([for APCu includes]) 44 if test -f "$IGBINARY_PHPINCLUDEDIR/ext/apcu/apc_serializer.h"; then 45 apc_inc_path="$IGBINARY_PHPINCLUDEDIR" 46 AC_MSG_RESULT([APCu in $apc_inc_path]) 47 AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable APCu support]) 48 else 49 AC_MSG_RESULT([not found]) 50 fi 51 52 AC_CHECK_SIZEOF([long]) 53 54 dnl GCC 55 AC_MSG_CHECKING(compiler type) 56 if test ! -z "`$CC --version | grep -i CLANG`"; then 57 AC_MSG_RESULT(clang) 58 if test -z "`echo $CFLAGS | grep -- -O0`"; then 59 PHP_IGBINARY_CFLAGS="$CFLAGS -Wall -O2" 60 fi 61 elif test "$GCC" = yes; then 62 AC_MSG_RESULT(gcc) 63 if test -z "`echo $CFLAGS | grep -- '-O[0123]'`"; then 64 PHP_IGBINARY_CFLAGS="$CFLAGS -O2 -Wall -Wpointer-arith -Wcast-align -Wwrite-strings -Wswitch -finline-limit=10000 --param large-function-growth=10000 --param inline-unit-growth=10000" 65 fi 66 elif test "$ICC" = yes; then 67 AC_MSG_RESULT(icc) 68 if test -z "`echo $CFLAGS | grep -- -O0`"; then 69 PHP_IGBINARY_CFLAGS="$CFLAGS -no-prec-div -O3 -x0 -unroll2" 70 fi 71 else 72 AC_MSG_RESULT(other) 73 fi 74 75 PHP_ADD_MAKEFILE_FRAGMENT(Makefile.bench) 76 PHP_INSTALL_HEADERS([ext/igbinary], [igbinary.h src/php7/igbinary.h php_igbinary.h src/php7/php_igbinary.h]) 77 PHP_NEW_EXTENSION(igbinary, $PHP_IGBINARY_SRC_FILES, $ext_shared,, $PHP_IGBINARY_CFLAGS) 78 PHP_ADD_EXTENSION_DEP(igbinary, session, true) 79 AC_DEFINE(HAVE_IGBINARY, 1, [Have igbinary support]) 80 PHP_ADD_BUILD_DIR($abs_builddir/src/php7, 1) 81 PHP_SUBST(IGBINARY_SHARED_LIBADD) 82fi 83