|
| 1 | +dnl Autotools config.m4 for PHP extension nop |
| 2 | + |
| 3 | +dnl Comments in this file start with the string 'dnl' (discard to next line). |
| 4 | +dnl Remove where necessary. |
| 5 | + |
| 6 | +dnl If extension references and depends on an external library package, use |
| 7 | +dnl the '--with-nop' configure option: |
| 8 | +dnl PHP_ARG_WITH([nop], |
| 9 | +dnl [for nop support], |
| 10 | +dnl [AS_HELP_STRING([--with-nop], |
| 11 | +dnl [Include nop support])]) |
| 12 | + |
| 13 | +dnl Otherwise use the '--enable-nop' configure option: |
| 14 | +PHP_ARG_ENABLE([nop], |
| 15 | + [whether to enable nop support], |
| 16 | + [AS_HELP_STRING([--enable-nop], |
| 17 | + [Enable nop support])], |
| 18 | + [no]) |
| 19 | + |
| 20 | +AS_VAR_IF([PHP_NOP], [no],, [ |
| 21 | + dnl This section is executed when extension is enabled with one of the above |
| 22 | + dnl configure options. Adjust and add tests here. |
| 23 | +
|
| 24 | + dnl |
| 25 | + dnl Use and adjust this code block if extension depends on external library |
| 26 | + dnl package which supports pkg-config. |
| 27 | + dnl |
| 28 | + dnl Find library package with pkg-config. |
| 29 | + dnl PKG_CHECK_MODULES([LIBFOO], [foo]) |
| 30 | + dnl |
| 31 | + dnl Or if you need to check for a particular library version with pkg-config, |
| 32 | + dnl you can use comparison operators. For example: |
| 33 | + dnl PKG_CHECK_MODULES([LIBFOO], [foo >= 1.2.3]) |
| 34 | + dnl PKG_CHECK_MODULES([LIBFOO], [foo < 3.4]) |
| 35 | + dnl PKG_CHECK_MODULES([LIBFOO], [foo = 1.2.3]) |
| 36 | + dnl |
| 37 | + dnl Add library compilation and linker flags to extension. |
| 38 | + dnl PHP_EVAL_INCLINE([$LIBFOO_CFLAGS]) |
| 39 | + dnl PHP_EVAL_LIBLINE([$LIBFOO_LIBS], [NOP_SHARED_LIBADD]) |
| 40 | + dnl |
| 41 | + dnl Check for library and symbol presence. |
| 42 | + dnl LIBNAME=nop # you may want to change this |
| 43 | + dnl LIBSYMBOL=nop # you most likely want to change this |
| 44 | + dnl |
| 45 | + dnl If you need to check for a particular library function (e.g. a conditional |
| 46 | + dnl or version-dependent feature) and you are using pkg-config: |
| 47 | + dnl PHP_CHECK_LIBRARY([$LIBNAME], [$LIBSYMBOL], |
| 48 | + dnl [AC_DEFINE([HAVE_NOP_FEATURE], [1], |
| 49 | + dnl [Define to 1 if nop has the 'FEATURE'.])], |
| 50 | + dnl [AC_MSG_FAILURE([FEATURE not supported by your nop library.])], |
| 51 | + dnl [$LIBFOO_LIBS]) |
| 52 | + dnl |
| 53 | +
|
| 54 | + dnl |
| 55 | + dnl Or use and adjust this code block if extension depends on external library |
| 56 | + dnl package, which does not support pkg-config. |
| 57 | + dnl |
| 58 | + dnl Path to library package can be given as parameter (--with-nop=<DIR>) |
| 59 | + dnl SEARCH_PATH="/usr/local /usr" # you might want to change this |
| 60 | + dnl SEARCH_FOR="/include/nop.h" # you most likely want to change this |
| 61 | + dnl AS_IF([test -r $PHP_NOP/$SEARCH_FOR], |
| 62 | + dnl [NOP_DIR=$PHP_NOP], |
| 63 | + dnl [ |
| 64 | + dnl for i in $SEARCH_PATH; do |
| 65 | + dnl AS_IF([test -r $i/$SEARCH_FOR], |
| 66 | + dnl [NOP_DIR=$i; break;]) |
| 67 | + dnl done |
| 68 | + dnl ]) |
| 69 | + dnl |
| 70 | + dnl AC_MSG_CHECKING([for nop library package]) |
| 71 | + dnl AS_VAR_IF([NOP_DIR],, [ |
| 72 | + dnl AC_MSG_RESULT([not found]) |
| 73 | + dnl AC_MSG_ERROR([Please reinstall the nop library package]) |
| 74 | + dnl ], [AC_MSG_RESULT([found in $NOP_DIR])]) |
| 75 | + dnl |
| 76 | + dnl Add include flag where library package headers are located on the system. |
| 77 | + dnl PHP_ADD_INCLUDE([$NOP_DIR/include]) |
| 78 | + dnl |
| 79 | + dnl Check for library and symbol presence. |
| 80 | + dnl LIBNAME=nop # you may want to change this |
| 81 | + dnl LIBSYMBOL=nop # you most likely want to change this |
| 82 | + dnl |
| 83 | + dnl If you need to check for a particular library function (e.g. a conditional |
| 84 | + dnl or version-dependent feature) and you are not using pkg-config: |
| 85 | + dnl PHP_CHECK_LIBRARY([$LIBNAME], [$LIBSYMBOL], [ |
| 86 | + dnl PHP_ADD_LIBRARY_WITH_PATH([$LIBNAME], |
| 87 | + dnl [$NOP_DIR/$PHP_LIBDIR], |
| 88 | + dnl [NOP_SHARED_LIBADD]) |
| 89 | + dnl AC_DEFINE([HAVE_NOP_FEATURE], [1], |
| 90 | + dnl [Define to 1 if nop has the 'FEATURE'.]) |
| 91 | + dnl ], |
| 92 | + dnl [AC_MSG_FAILURE([FEATURE not supported by your nop library.])], |
| 93 | + dnl [-L$NOP_DIR/$PHP_LIBDIR -lm]) |
| 94 | + dnl |
| 95 | +
|
| 96 | + dnl Add linked libraries flags for shared extension to the generated Makefile. |
| 97 | + dnl PHP_SUBST([NOP_SHARED_LIBADD]) |
| 98 | +
|
| 99 | + dnl Define a preprocessor macro to indicate that this PHP extension can |
| 100 | + dnl be dynamically loaded as a shared module or is statically built into PHP. |
| 101 | + AC_DEFINE([HAVE_NOP], [1], |
| 102 | + [Define to 1 if the PHP extension 'nop' is available.]) |
| 103 | +
|
| 104 | + dnl Configure extension sources and compilation flags. |
| 105 | + PHP_NEW_EXTENSION([nop], |
| 106 | + [nop.c], |
| 107 | + [$ext_shared],, |
| 108 | + [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) |
| 109 | +]) |
0 commit comments