1dnl config.m4 for extension %EXTNAME% 2 3dnl Comments in this file start with the string 'dnl'. 4dnl Remove where necessary. 5 6dnl If your extension references something external, use 'with': 7 8dnl PHP_ARG_WITH([%EXTNAME%], 9dnl [for %EXTNAME% support], 10dnl [AS_HELP_STRING([--with-%EXTNAME%], 11dnl [Include %EXTNAME% support])]) 12 13dnl Otherwise use 'enable': 14 15PHP_ARG_ENABLE([%EXTNAME%], 16 [whether to enable %EXTNAME% support], 17 [AS_HELP_STRING([--enable-%EXTNAME%], 18 [Enable %EXTNAME% support])], 19 [no]) 20 21if test "$PHP_%EXTNAMECAPS%" != "no"; then 22 dnl Write more examples of tests here... 23 24 dnl Remove this code block if the library does not support pkg-config. 25 dnl PKG_CHECK_MODULES([LIBFOO], [foo]) 26 dnl PHP_EVAL_INCLINE($LIBFOO_CFLAGS) 27 dnl PHP_EVAL_LIBLINE($LIBFOO_LIBS, %EXTNAMECAPS%_SHARED_LIBADD) 28 29 dnl If you need to check for a particular library version using PKG_CHECK_MODULES, 30 dnl you can use comparison operators. For example: 31 dnl PKG_CHECK_MODULES([LIBFOO], [foo >= 1.2.3]) 32 dnl PKG_CHECK_MODULES([LIBFOO], [foo < 3.4]) 33 dnl PKG_CHECK_MODULES([LIBFOO], [foo = 1.2.3]) 34 35 dnl Remove this code block if the library supports pkg-config. 36 dnl --with-%EXTNAME% -> check with-path 37 dnl SEARCH_PATH="/usr/local /usr" # you might want to change this 38 dnl SEARCH_FOR="/include/%EXTNAME%.h" # you most likely want to change this 39 dnl if test -r $PHP_%EXTNAMECAPS%/$SEARCH_FOR; then # path given as parameter 40 dnl %EXTNAMECAPS%_DIR=$PHP_%EXTNAMECAPS% 41 dnl else # search default path list 42 dnl AC_MSG_CHECKING([for %EXTNAME% files in default path]) 43 dnl for i in $SEARCH_PATH ; do 44 dnl if test -r $i/$SEARCH_FOR; then 45 dnl %EXTNAMECAPS%_DIR=$i 46 dnl AC_MSG_RESULT(found in $i) 47 dnl fi 48 dnl done 49 dnl fi 50 dnl 51 dnl if test -z "$%EXTNAMECAPS%_DIR"; then 52 dnl AC_MSG_RESULT([not found]) 53 dnl AC_MSG_ERROR([Please reinstall the %EXTNAME% distribution]) 54 dnl fi 55 56 dnl Remove this code block if the library supports pkg-config. 57 dnl --with-%EXTNAME% -> add include path 58 dnl PHP_ADD_INCLUDE($%EXTNAMECAPS%_DIR/include) 59 60 dnl Remove this code block if the library supports pkg-config. 61 dnl --with-%EXTNAME% -> check for lib and symbol presence 62 dnl LIBNAME=%EXTNAMECAPS% # you may want to change this 63 dnl LIBSYMBOL=%EXTNAMECAPS% # you most likely want to change this 64 65 dnl If you need to check for a particular library function (e.g. a conditional 66 dnl or version-dependent feature) and you are using pkg-config: 67 dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, 68 dnl [ 69 dnl AC_DEFINE(HAVE_%EXTNAMECAPS%_FEATURE, 1, [ ]) 70 dnl ],[ 71 dnl AC_MSG_ERROR([FEATURE not supported by your %EXTNAME% library.]) 72 dnl ], [ 73 dnl $LIBFOO_LIBS 74 dnl ]) 75 76 dnl If you need to check for a particular library function (e.g. a conditional 77 dnl or version-dependent feature) and you are not using pkg-config: 78 dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, 79 dnl [ 80 dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $%EXTNAMECAPS%_DIR/$PHP_LIBDIR, %EXTNAMECAPS%_SHARED_LIBADD) 81 dnl AC_DEFINE(HAVE_%EXTNAMECAPS%_FEATURE, 1, [ ]) 82 dnl ],[ 83 dnl AC_MSG_ERROR([FEATURE not supported by your %EXTNAME% library.]) 84 dnl ],[ 85 dnl -L$%EXTNAMECAPS%_DIR/$PHP_LIBDIR -lm 86 dnl ]) 87 dnl 88 dnl PHP_SUBST(%EXTNAMECAPS%_SHARED_LIBADD) 89 90 dnl In case of no dependencies 91 AC_DEFINE(HAVE_%EXTNAMECAPS%, 1, [ Have %EXTNAME% support ]) 92 93 PHP_NEW_EXTENSION(%EXTNAME%, %EXTNAME%.c, $ext_shared) 94fi 95