config.m4.in 3.4 KB

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