You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 lines
4.6 KiB

19 years ago
18 years ago
23 years ago
21 years ago
  1. dnl This file becomes configure.in for self-contained extensions.
  2. AC_PREREQ(2.59)
  3. AC_INIT(config.m4)
  4. ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], [])
  5. PHP_CONFIG_NICE(config.nice)
  6. dnl
  7. AC_DEFUN([PHP_EXT_BUILDDIR],[.])dnl
  8. AC_DEFUN([PHP_EXT_DIR],[""])dnl
  9. AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir])dnl
  10. AC_DEFUN([PHP_ALWAYS_SHARED],[
  11. ext_output="yes, shared"
  12. ext_shared=yes
  13. test "[$]$1" = "no" && $1=yes
  14. ])dnl
  15. dnl
  16. test -z "$CFLAGS" && auto_cflags=1
  17. abs_srcdir=`(cd $srcdir && pwd)`
  18. abs_builddir=`pwd`
  19. AC_PROG_CC([cc gcc])
  20. PHP_DETECT_ICC
  21. PHP_DETECT_SUNCC
  22. AC_PROG_CC_C_O
  23. dnl Support systems with system libraries in e.g. /usr/lib64
  24. PHP_ARG_WITH(libdir, for system library directory,
  25. [ --with-libdir=NAME Look for libraries in .../NAME rather than .../lib], lib, no)
  26. PHP_RUNPATH_SWITCH
  27. PHP_SHLIB_SUFFIX_NAMES
  28. dnl Find php-config script
  29. PHP_ARG_WITH(php-config,,
  30. [ --with-php-config=PATH Path to php-config [php-config]], php-config, no)
  31. dnl For BC
  32. PHP_CONFIG=$PHP_PHP_CONFIG
  33. prefix=`$PHP_CONFIG --prefix 2>/dev/null`
  34. phpincludedir=`$PHP_CONFIG --include-dir 2>/dev/null`
  35. INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
  36. EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null`
  37. PHP_EXECUTABLE=`$PHP_CONFIG --php-binary 2>/dev/null`
  38. if test -z "$prefix"; then
  39. AC_MSG_ERROR([Cannot find php-config. Please use --with-php-config=PATH])
  40. fi
  41. php_shtool=$srcdir/build/shtool
  42. PHP_INIT_BUILD_SYSTEM
  43. AC_MSG_CHECKING([for PHP prefix])
  44. AC_MSG_RESULT([$prefix])
  45. AC_MSG_CHECKING([for PHP includes])
  46. AC_MSG_RESULT([$INCLUDES])
  47. AC_MSG_CHECKING([for PHP extension directory])
  48. AC_MSG_RESULT([$EXTENSION_DIR])
  49. AC_MSG_CHECKING([for PHP installed headers prefix])
  50. AC_MSG_RESULT([$phpincludedir])
  51. dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS
  52. AC_MSG_CHECKING([if debug is enabled])
  53. old_CPPFLAGS=$CPPFLAGS
  54. CPPFLAGS="-I$phpincludedir"
  55. AC_EGREP_CPP(php_debug_is_enabled,[
  56. #include <main/php_config.h>
  57. #if ZEND_DEBUG
  58. php_debug_is_enabled
  59. #endif
  60. ],[
  61. PHP_DEBUG=yes
  62. ],[
  63. PHP_DEBUG=no
  64. ])
  65. CPPFLAGS=$old_CPPFLAGS
  66. AC_MSG_RESULT([$PHP_DEBUG])
  67. AC_MSG_CHECKING([if zts is enabled])
  68. old_CPPFLAGS=$CPPFLAGS
  69. CPPFLAGS="-I$phpincludedir"
  70. AC_EGREP_CPP(php_zts_is_enabled,[
  71. #include <main/php_config.h>
  72. #if ZTS
  73. php_zts_is_enabled
  74. #endif
  75. ],[
  76. PHP_THREAD_SAFETY=yes
  77. ],[
  78. PHP_THREAD_SAFETY=no
  79. ])
  80. CPPFLAGS=$old_CPPFLAGS
  81. AC_MSG_RESULT([$PHP_DEBUG])
  82. dnl Support for building and testing Zend extensions
  83. ZEND_EXT_TYPE="zend_extension"
  84. PHP_SUBST(ZEND_EXT_TYPE)
  85. dnl Discard optimization flags when debugging is enabled
  86. if test "$PHP_DEBUG" = "yes"; then
  87. PHP_DEBUG=1
  88. ZEND_DEBUG=yes
  89. changequote({,})
  90. CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
  91. CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
  92. changequote([,])
  93. dnl add -O0 only if GCC or ICC is used
  94. if test "$GCC" = "yes" || test "$ICC" = "yes"; then
  95. CFLAGS="$CFLAGS -O0"
  96. CXXFLAGS="$CXXFLAGS -g -O0"
  97. fi
  98. if test "$SUNCC" = "yes"; then
  99. if test -n "$auto_cflags"; then
  100. CFLAGS="-g"
  101. CXXFLAGS="-g"
  102. else
  103. CFLAGS="$CFLAGS -g"
  104. CXXFLAGS="$CFLAGS -g"
  105. fi
  106. fi
  107. else
  108. PHP_DEBUG=0
  109. ZEND_DEBUG=no
  110. fi
  111. dnl Always shared
  112. PHP_BUILD_SHARED
  113. dnl Required programs
  114. PHP_PROG_RE2C
  115. PHP_PROG_AWK
  116. sinclude(config.m4)
  117. enable_static=no
  118. enable_shared=yes
  119. dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX).
  120. dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler.
  121. AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
  122. undefine([AC_PROG_CXX])
  123. AC_DEFUN([AC_PROG_CXX], [])
  124. undefine([AC_PROG_CXXCPP])
  125. AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
  126. ])
  127. AC_PROG_LIBTOOL
  128. all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
  129. install_targets="install-modules install-headers"
  130. phplibdir="`pwd`/modules"
  131. CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
  132. CFLAGS_CLEAN='$(CFLAGS)'
  133. CXXFLAGS_CLEAN='$(CXXFLAGS)'
  134. test "$prefix" = "NONE" && prefix="/usr/local"
  135. test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
  136. PHP_SUBST(PHP_MODULES)
  137. PHP_SUBST(PHP_ZEND_EX)
  138. PHP_SUBST(all_targets)
  139. PHP_SUBST(install_targets)
  140. PHP_SUBST(prefix)
  141. PHP_SUBST(exec_prefix)
  142. PHP_SUBST(libdir)
  143. PHP_SUBST(prefix)
  144. PHP_SUBST(phplibdir)
  145. PHP_SUBST(phpincludedir)
  146. PHP_SUBST(CC)
  147. PHP_SUBST(CFLAGS)
  148. PHP_SUBST(CFLAGS_CLEAN)
  149. PHP_SUBST(CPP)
  150. PHP_SUBST(CPPFLAGS)
  151. PHP_SUBST(CXX)
  152. PHP_SUBST(CXXFLAGS)
  153. PHP_SUBST(CXXFLAGS_CLEAN)
  154. PHP_SUBST(EXTENSION_DIR)
  155. PHP_SUBST(PHP_EXECUTABLE)
  156. PHP_SUBST(EXTRA_LDFLAGS)
  157. PHP_SUBST(EXTRA_LIBS)
  158. PHP_SUBST(INCLUDES)
  159. PHP_SUBST(LFLAGS)
  160. PHP_SUBST(LDFLAGS)
  161. PHP_SUBST(SHARED_LIBTOOL)
  162. PHP_SUBST(LIBTOOL)
  163. PHP_SUBST(SHELL)
  164. PHP_SUBST(INSTALL_HEADERS)
  165. PHP_GEN_BUILD_DIRS
  166. PHP_GEN_GLOBAL_MAKEFILE
  167. test -d modules || $php_shtool mkdir modules
  168. touch .deps
  169. AC_CONFIG_HEADER(config.h)
  170. AC_OUTPUT()