config.m4.in 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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%, for %EXTNAME% support,
  6. dnl Make sure that the comment is aligned:
  7. dnl [ --with-%EXTNAME% Include %EXTNAME% support])
  8. dnl Otherwise use enable:
  9. PHP_ARG_ENABLE(%EXTNAME%, whether to enable %EXTNAME% support,
  10. dnl Make sure that the comment is aligned:
  11. [ --enable-%EXTNAME% Enable %EXTNAME% support], no)
  12. if test "$PHP_%EXTNAMECAPS%" != "no"; then
  13. dnl Write more examples of tests here...
  14. dnl # get library FOO build options from pkg-config output
  15. dnl AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  16. dnl AC_MSG_CHECKING(for libfoo)
  17. dnl if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists foo; then
  18. dnl if $PKG_CONFIG foo --atleast-version 1.2.3; then
  19. dnl LIBFOO_CFLAGS=\`$PKG_CONFIG foo --cflags\`
  20. dnl LIBFOO_LIBDIR=\`$PKG_CONFIG foo --libs\`
  21. dnl LIBFOO_VERSON=\`$PKG_CONFIG foo --modversion\`
  22. dnl AC_MSG_RESULT(from pkgconfig: version $LIBFOO_VERSON)
  23. dnl else
  24. dnl AC_MSG_ERROR(system libfoo is too old: version 1.2.3 required)
  25. dnl fi
  26. dnl else
  27. dnl AC_MSG_ERROR(pkg-config not found)
  28. dnl fi
  29. dnl PHP_EVAL_LIBLINE($LIBFOO_LIBDIR, %EXTNAMECAPS%_SHARED_LIBADD)
  30. dnl PHP_EVAL_INCLINE($LIBFOO_CFLAGS)
  31. dnl # --with-%EXTNAME% -> check with-path
  32. dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
  33. dnl SEARCH_FOR="/include/%EXTNAME%.h" # you most likely want to change this
  34. dnl if test -r $PHP_%EXTNAMECAPS%/$SEARCH_FOR; then # path given as parameter
  35. dnl %EXTNAMECAPS%_DIR=$PHP_%EXTNAMECAPS%
  36. dnl else # search default path list
  37. dnl AC_MSG_CHECKING([for %EXTNAME% files in default path])
  38. dnl for i in $SEARCH_PATH ; do
  39. dnl if test -r $i/$SEARCH_FOR; then
  40. dnl %EXTNAMECAPS%_DIR=$i
  41. dnl AC_MSG_RESULT(found in $i)
  42. dnl fi
  43. dnl done
  44. dnl fi
  45. dnl
  46. dnl if test -z "$%EXTNAMECAPS%_DIR"; then
  47. dnl AC_MSG_RESULT([not found])
  48. dnl AC_MSG_ERROR([Please reinstall the %EXTNAME% distribution])
  49. dnl fi
  50. dnl # --with-%EXTNAME% -> add include path
  51. dnl PHP_ADD_INCLUDE($%EXTNAMECAPS%_DIR/include)
  52. dnl # --with-%EXTNAME% -> check for lib and symbol presence
  53. dnl LIBNAME=%EXTNAMECAPS% # you may want to change this
  54. dnl LIBSYMBOL=%EXTNAMECAPS% # you most likely want to change this
  55. dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
  56. dnl [
  57. dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $%EXTNAMECAPS%_DIR/$PHP_LIBDIR, %EXTNAMECAPS%_SHARED_LIBADD)
  58. dnl AC_DEFINE(HAVE_%EXTNAMECAPS%LIB,1,[ ])
  59. dnl ],[
  60. dnl AC_MSG_ERROR([wrong %EXTNAME% lib version or lib not found])
  61. dnl ],[
  62. dnl -L$%EXTNAMECAPS%_DIR/$PHP_LIBDIR -lm
  63. dnl ])
  64. dnl
  65. dnl PHP_SUBST(%EXTNAMECAPS%_SHARED_LIBADD)
  66. dnl # In case of no dependencies
  67. AC_DEFINE(HAVE_%EXTNAMECAPS%, 1, [ Have %EXTNAME% support ])
  68. PHP_NEW_EXTENSION(%EXTNAME%, %EXTNAME%.c, $ext_shared)
  69. fi