Annotation of embedaddon/php/acinclude.m4, revision 1.1
1.1 ! misho 1: dnl
! 2: dnl $Id: acinclude.m4 315258 2011-08-21 22:57:13Z rasmus $
! 3: dnl
! 4: dnl This file contains local autoconf functions.
! 5: dnl
! 6:
! 7: dnl -------------------------------------------------------------------------
! 8: dnl Output stylize macros for configure (help/runtime)
! 9: dnl -------------------------------------------------------------------------
! 10:
! 11: dnl
! 12: dnl PHP_HELP_SEPARATOR(title)
! 13: dnl
! 14: dnl Adds separator title into the configure --help display.
! 15: dnl
! 16: AC_DEFUN([PHP_HELP_SEPARATOR],[
! 17: AC_ARG_ENABLE([],[
! 18: $1
! 19: ],[])
! 20: ])
! 21:
! 22: dnl
! 23: dnl PHP_CONFIGURE_PART(title)
! 24: dnl
! 25: dnl Adds separator title configure output (idea borrowed from mm)
! 26: dnl
! 27: AC_DEFUN([PHP_CONFIGURE_PART],[
! 28: AC_MSG_RESULT()
! 29: AC_MSG_RESULT([${T_MD}$1${T_ME}])
! 30: ])
! 31:
! 32: dnl -------------------------------------------------------------------------
! 33: dnl Build system helper macros
! 34: dnl -------------------------------------------------------------------------
! 35:
! 36: dnl
! 37: dnl PHP_DEF_HAVE(what)
! 38: dnl
! 39: dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [ ])'
! 40: dnl
! 41: AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___), 1, [ ])])
! 42:
! 43: dnl
! 44: dnl PHP_RUN_ONCE(namespace, variable, code)
! 45: dnl
! 46: dnl execute code, if variable is not set in namespace
! 47: dnl
! 48: AC_DEFUN([PHP_RUN_ONCE],[
! 49: changequote({,})
! 50: unique=`echo $2|$SED 's/[^a-zA-Z0-9]/_/g'`
! 51: changequote([,])
! 52: cmd="echo $ac_n \"\$$1$unique$ac_c\""
! 53: if test -n "$unique" && test "`eval $cmd`" = "" ; then
! 54: eval "$1$unique=set"
! 55: $3
! 56: fi
! 57: ])
! 58:
! 59: dnl
! 60: dnl PHP_EXPAND_PATH(path, variable)
! 61: dnl
! 62: dnl expands path to an absolute path and assigns it to variable
! 63: dnl
! 64: AC_DEFUN([PHP_EXPAND_PATH],[
! 65: if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
! 66: $2=$1
! 67: else
! 68: changequote({,})
! 69: ep_dir="`echo $1|$SED 's%/*[^/][^/]*/*$%%'`"
! 70: changequote([,])
! 71: ep_realdir="`(cd \"$ep_dir\" && pwd)`"
! 72: $2="$ep_realdir/`basename \"$1\"`"
! 73: fi
! 74: ])
! 75:
! 76: dnl
! 77: dnl PHP_DEFINE(WHAT [, value[, directory]])
! 78: dnl
! 79: dnl Creates builddir/include/what.h and in there #define WHAT value
! 80: dnl
! 81: AC_DEFUN([PHP_DEFINE],[
! 82: [echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]
! 83: ])
! 84:
! 85: dnl
! 86: dnl PHP_SUBST(varname)
! 87: dnl
! 88: dnl Adds variable with it's value into Makefile, e.g.:
! 89: dnl CC = gcc
! 90: dnl
! 91: AC_DEFUN([PHP_SUBST],[
! 92: PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
! 93: ])
! 94:
! 95: dnl
! 96: dnl PHP_SUBST_OLD(varname)
! 97: dnl
! 98: dnl Same as PHP_SUBST() but also substitutes all @VARNAME@
! 99: dnl instances in every file passed to AC_OUTPUT()
! 100: dnl
! 101: AC_DEFUN([PHP_SUBST_OLD],[
! 102: PHP_SUBST($1)
! 103: AC_SUBST($1)
! 104: ])
! 105:
! 106: dnl
! 107: dnl PHP_OUTPUT(file)
! 108: dnl
! 109: dnl Adds "file" to the list of files generated by AC_OUTPUT
! 110: dnl This macro can be used several times.
! 111: dnl
! 112: AC_DEFUN([PHP_OUTPUT],[
! 113: PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
! 114: ])
! 115:
! 116:
! 117: dnl -------------------------------------------------------------------------
! 118: dnl Build system base macros
! 119: dnl -------------------------------------------------------------------------
! 120:
! 121: dnl
! 122: dnl PHP_CANONICAL_HOST_TARGET
! 123: dnl
! 124: AC_DEFUN([PHP_CANONICAL_HOST_TARGET],[
! 125: AC_REQUIRE([AC_CANONICAL_HOST])dnl
! 126: AC_REQUIRE([AC_CANONICAL_TARGET])dnl
! 127: dnl Make sure we do not continue if host_alias is empty.
! 128: if test -z "$host_alias" && test -n "$host"; then
! 129: host_alias=$host
! 130: fi
! 131: if test -z "$host_alias"; then
! 132: AC_MSG_ERROR([host_alias is not set!])
! 133: fi
! 134: ])
! 135:
! 136: dnl
! 137: dnl PHP_INIT_BUILD_SYSTEM
! 138: dnl
! 139: AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
! 140: AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
! 141: test -d include || $php_shtool mkdir include
! 142: > Makefile.objects
! 143: > Makefile.fragments
! 144: dnl We need to play tricks here to avoid matching the grep line itself
! 145: pattern=define
! 146: $EGREP $pattern'.*include/php' $srcdir/configure|$SED 's/.*>//'|xargs touch 2>/dev/null
! 147: ])
! 148:
! 149: dnl
! 150: dnl PHP_GEN_GLOBAL_MAKEFILE
! 151: dnl
! 152: dnl Generates the global makefile.
! 153: dnl
! 154: AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[
! 155: cat >Makefile <<EOF
! 156: srcdir = $abs_srcdir
! 157: builddir = $abs_builddir
! 158: top_srcdir = $abs_srcdir
! 159: top_builddir = $abs_builddir
! 160: EOF
! 161: for i in $PHP_VAR_SUBST; do
! 162: eval echo "$i = \$$i" >> Makefile
! 163: done
! 164:
! 165: cat $abs_srcdir/Makefile.global Makefile.fragments Makefile.objects >> Makefile
! 166: ])
! 167:
! 168: dnl
! 169: dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]])
! 170: dnl
! 171: dnl Processes a file called Makefile.frag in the source directory
! 172: dnl of the most recently added extension. $(srcdir) and $(builddir)
! 173: dnl are substituted with the proper paths. Can be used to supply
! 174: dnl custom rules and/or additional targets.
! 175: dnl
! 176: AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[
! 177: ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1)
! 178: ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2)
! 179: ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3)
! 180: test -f "$src" && $SED -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments
! 181: ])
! 182:
! 183: dnl
! 184: dnl PHP_ADD_SOURCES(source-path, sources [, special-flags [, type]])
! 185: dnl
! 186: dnl Adds sources which are located relative to source-path to the
! 187: dnl array of type type. Sources are processed with optional
! 188: dnl special-flags which are passed to the compiler. Sources
! 189: dnl can be either written in C or C++ (filenames shall end in .c
! 190: dnl or .cpp, respectively).
! 191: dnl
! 192: dnl Note: If source-path begins with a "/", the "/" is removed and
! 193: dnl the path is interpreted relative to the top build-directory.
! 194: dnl
! 195: dnl which array to append to?
! 196: AC_DEFUN([PHP_ADD_SOURCES],[
! 197: PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,ifelse($4,cgi,PHP_CGI_OBJS,ifelse($4,fpm,PHP_FPM_OBJS,PHP_GLOBAL_OBJS)))))
! 198: ])
! 199:
! 200: dnl
! 201: dnl _PHP_ASSIGN_BUILD_VARS(type)
! 202: dnl internal, don't use
! 203: AC_DEFUN([_PHP_ASSIGN_BUILD_VARS],[
! 204: ifelse($1,shared,[
! 205: b_c_pre=$shared_c_pre
! 206: b_cxx_pre=$shared_cxx_pre
! 207: b_c_meta=$shared_c_meta
! 208: b_cxx_meta=$shared_cxx_meta
! 209: b_c_post=$shared_c_post
! 210: b_cxx_post=$shared_cxx_post
! 211: ],[
! 212: b_c_pre=$php_c_pre
! 213: b_cxx_pre=$php_cxx_pre
! 214: b_c_meta=$php_c_meta
! 215: b_cxx_meta=$php_cxx_meta
! 216: b_c_post=$php_c_post
! 217: b_cxx_post=$php_cxx_post
! 218: ])dnl
! 219: b_lo=[$]$1_lo
! 220: ])
! 221:
! 222: dnl
! 223: dnl PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]])
! 224: dnl
! 225: dnl Additional to PHP_ADD_SOURCES (see above), this lets you set the
! 226: dnl name of the array target-var directly, as well as whether
! 227: dnl shared objects will be built from the sources.
! 228: dnl
! 229: dnl Should not be used directly.
! 230: dnl
! 231: AC_DEFUN([PHP_ADD_SOURCES_X],[
! 232: dnl relative to source- or build-directory?
! 233: dnl ac_srcdir/ac_bdir include trailing slash
! 234: case $1 in
! 235: ""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;;
! 236: /*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
! 237: *[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;;
! 238: esac
! 239:
! 240: dnl how to build .. shared or static?
! 241: ifelse($5,yes,_PHP_ASSIGN_BUILD_VARS(shared),_PHP_ASSIGN_BUILD_VARS(php))
! 242:
! 243: dnl iterate over the sources
! 244: old_IFS=[$]IFS
! 245: for ac_src in $2; do
! 246:
! 247: dnl remove the suffix
! 248: IFS=.
! 249: set $ac_src
! 250: ac_obj=[$]1
! 251: IFS=$old_IFS
! 252:
! 253: dnl append to the array which has been dynamically chosen at m4 time
! 254: $4="[$]$4 [$]ac_bdir[$]ac_obj.lo"
! 255:
! 256: dnl choose the right compiler/flags/etc. for the source-file
! 257: case $ac_src in
! 258: *.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
! 259: *.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
! 260: *.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
! 261: *.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
! 262: esac
! 263:
! 264: dnl create a rule for the object/source combo
! 265: cat >>Makefile.objects<<EOF
! 266: $ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
! 267: $ac_comp
! 268: EOF
! 269: done
! 270: ])
! 271:
! 272: dnl -------------------------------------------------------------------------
! 273: dnl Compiler characteristics checks
! 274: dnl -------------------------------------------------------------------------
! 275:
! 276: dnl
! 277: dnl PHP_TARGET_RDYNAMIC
! 278: dnl
! 279: dnl Checks whether -rdynamic is supported by the compiler. This
! 280: dnl is necessary for some targets to populate the global symbol
! 281: dnl table. Otherwise, dynamic modules would not be able to resolve
! 282: dnl PHP-related symbols.
! 283: dnl
! 284: dnl If successful, adds -rdynamic to PHP_LDFLAGS.
! 285: dnl
! 286: AC_DEFUN([PHP_TARGET_RDYNAMIC],[
! 287: if test -n "$GCC"; then
! 288: dnl we should use a PHP-specific macro here
! 289: PHP_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes)
! 290: if test "$gcc_rdynamic" = "yes"; then
! 291: PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic"
! 292: fi
! 293: fi
! 294: ])
! 295:
! 296: dnl
! 297: dnl PHP_RUNPATH_SWITCH
! 298: dnl
! 299: dnl Checks for -R, etc. switch
! 300: dnl
! 301: AC_DEFUN([PHP_RUNPATH_SWITCH],[
! 302: AC_MSG_CHECKING([if compiler supports -R])
! 303: AC_CACHE_VAL(php_cv_cc_dashr,[
! 304: SAVE_LIBS=$LIBS
! 305: LIBS="-R /usr/$PHP_LIBDIR $LIBS"
! 306: AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
! 307: LIBS=$SAVE_LIBS])
! 308: AC_MSG_RESULT([$php_cv_cc_dashr])
! 309: if test $php_cv_cc_dashr = "yes"; then
! 310: ld_runpath_switch=-R
! 311: else
! 312: AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
! 313: AC_CACHE_VAL(php_cv_cc_rpath,[
! 314: SAVE_LIBS=$LIBS
! 315: LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
! 316: AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
! 317: LIBS=$SAVE_LIBS])
! 318: AC_MSG_RESULT([$php_cv_cc_rpath])
! 319: if test $php_cv_cc_rpath = "yes"; then
! 320: ld_runpath_switch=-Wl,-rpath,
! 321: else
! 322: dnl something innocuous
! 323: ld_runpath_switch=-L
! 324: fi
! 325: fi
! 326: if test "$PHP_RPATH" = "no"; then
! 327: ld_runpath_switch=
! 328: fi
! 329: ])
! 330:
! 331: dnl
! 332: dnl PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found)
! 333: dnl
! 334: AC_DEFUN([PHP_CHECK_GCC_ARG],[
! 335: gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
! 336: AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
! 337: echo 'void somefunc() { };' > conftest.c
! 338: cmd='$CC $1 -c conftest.c'
! 339: if eval $cmd 2>&1 | $EGREP -e $1 >/dev/null ; then
! 340: ac_result=no
! 341: else
! 342: ac_result=yes
! 343: fi
! 344: eval $gcc_arg_name=$ac_result
! 345: rm -f conftest.*
! 346: ])
! 347: if eval test "\$$gcc_arg_name" = "yes"; then
! 348: $2
! 349: else
! 350: :
! 351: $3
! 352: fi
! 353: ])
! 354:
! 355: dnl
! 356: dnl PHP_LIBGCC_LIBPATH(gcc)
! 357: dnl
! 358: dnl Stores the location of libgcc in libgcc_libpath
! 359: dnl
! 360: AC_DEFUN([PHP_LIBGCC_LIBPATH],[
! 361: changequote({,})
! 362: libgcc_libpath=`$1 --print-libgcc-file-name|$SED 's%/*[^/][^/]*$%%'`
! 363: changequote([,])
! 364: ])
! 365:
! 366: dnl -------------------------------------------------------------------------
! 367: dnl Macros to modify LIBS, INCLUDES, etc. variables
! 368: dnl -------------------------------------------------------------------------
! 369:
! 370: dnl
! 371: dnl PHP_REMOVE_USR_LIB(NAME)
! 372: dnl
! 373: dnl Removes all -L/usr/$PHP_LIBDIR entries from variable NAME
! 374: dnl
! 375: AC_DEFUN([PHP_REMOVE_USR_LIB],[
! 376: unset ac_new_flags
! 377: for i in [$]$1; do
! 378: case [$]i in
! 379: -L/usr/$PHP_LIBDIR|-L/usr/$PHP_LIBDIR/[)] ;;
! 380: *[)] ac_new_flags="[$]ac_new_flags [$]i" ;;
! 381: esac
! 382: done
! 383: $1=[$]ac_new_flags
! 384: ])
! 385:
! 386: dnl
! 387: dnl PHP_EVAL_LIBLINE(libline, SHARED-LIBADD)
! 388: dnl
! 389: dnl Use this macro, if you need to add libraries and or library search
! 390: dnl paths to the PHP build system which are only given in compiler
! 391: dnl notation.
! 392: dnl
! 393: AC_DEFUN([PHP_EVAL_LIBLINE],[
! 394: for ac_i in $1; do
! 395: case $ac_i in
! 396: -pthread[)]
! 397: if test "$ext_shared" = "yes"; then
! 398: $2="[$]$2 -pthread"
! 399: else
! 400: PHP_RUN_ONCE(EXTRA_LDFLAGS, [$ac_i], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i"])
! 401: fi
! 402: ;;
! 403: -l*[)]
! 404: ac_ii=`echo $ac_i|cut -c 3-`
! 405: PHP_ADD_LIBRARY($ac_ii,1,$2)
! 406: ;;
! 407: -L*[)]
! 408: ac_ii=`echo $ac_i|cut -c 3-`
! 409: PHP_ADD_LIBPATH($ac_ii,$2)
! 410: ;;
! 411: esac
! 412: done
! 413: ])
! 414:
! 415: dnl
! 416: dnl PHP_EVAL_INCLINE(headerline)
! 417: dnl
! 418: dnl Use this macro, if you need to add header search paths to the PHP
! 419: dnl build system which are only given in compiler notation.
! 420: dnl
! 421: AC_DEFUN([PHP_EVAL_INCLINE],[
! 422: for ac_i in $1; do
! 423: case $ac_i in
! 424: -I*[)]
! 425: ac_ii=`echo $ac_i|cut -c 3-`
! 426: PHP_ADD_INCLUDE($ac_ii)
! 427: ;;
! 428: esac
! 429: done
! 430: ])
! 431:
! 432: dnl internal, don't use
! 433: AC_DEFUN([_PHP_ADD_LIBPATH_GLOBAL],[
! 434: PHP_RUN_ONCE(LIBPATH, $1, [
! 435: test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$1"
! 436: LDFLAGS="$LDFLAGS -L$1"
! 437: PHP_RPATHS="$PHP_RPATHS $1"
! 438: ])
! 439: ])dnl
! 440: dnl
! 441: dnl
! 442: dnl PHP_ADD_LIBPATH(path [, SHARED-LIBADD])
! 443: dnl
! 444: dnl Adds a path to linkpath/runpath (LDFLAGS)
! 445: dnl
! 446: AC_DEFUN([PHP_ADD_LIBPATH],[
! 447: if test "$1" != "/usr/$PHP_LIBDIR" && test "$1" != "/usr/lib"; then
! 448: PHP_EXPAND_PATH($1, ai_p)
! 449: ifelse([$2],,[
! 450: _PHP_ADD_LIBPATH_GLOBAL([$ai_p])
! 451: ],[
! 452: if test "$ext_shared" = "yes"; then
! 453: $2="-L$ai_p [$]$2"
! 454: test -n "$ld_runpath_switch" && $2="$ld_runpath_switch$ai_p [$]$2"
! 455: else
! 456: _PHP_ADD_LIBPATH_GLOBAL([$ai_p])
! 457: fi
! 458: ])
! 459: fi
! 460: ])
! 461:
! 462: dnl
! 463: dnl PHP_UTILIZE_RPATHS()
! 464: dnl
! 465: dnl builds RPATHS/LDFLAGS from PHP_RPATHS
! 466: dnl
! 467: AC_DEFUN([PHP_UTILIZE_RPATHS],[
! 468: OLD_RPATHS=$PHP_RPATHS
! 469: unset PHP_RPATHS
! 470:
! 471: for i in $OLD_RPATHS; do
! 472: dnl Can be passed to native cc/libtool
! 473: PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
! 474: dnl Libtool-specific
! 475: PHP_RPATHS="$PHP_RPATHS -R $i"
! 476: dnl cc-specific
! 477: NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
! 478: done
! 479:
! 480: if test "$PHP_RPATH" = "no"; then
! 481: unset PHP_RPATHS
! 482: unset NATIVE_RPATHS
! 483: fi
! 484: ])
! 485:
! 486: dnl
! 487: dnl PHP_ADD_INCLUDE(path [,before])
! 488: dnl
! 489: dnl add an include path.
! 490: dnl if before is 1, add in the beginning of INCLUDES.
! 491: dnl
! 492: AC_DEFUN([PHP_ADD_INCLUDE],[
! 493: if test "$1" != "/usr/include"; then
! 494: PHP_EXPAND_PATH($1, ai_p)
! 495: PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [
! 496: if test "$2"; then
! 497: INCLUDES="-I$ai_p $INCLUDES"
! 498: else
! 499: INCLUDES="$INCLUDES -I$ai_p"
! 500: fi
! 501: ])
! 502: fi
! 503: ])
! 504:
! 505: dnl internal, don't use
! 506: AC_DEFUN([_PHP_X_ADD_LIBRARY],[dnl
! 507: ifelse([$2],,$3="-l$1 [$]$3", $3="[$]$3 -l$1") dnl
! 508: ])dnl
! 509: dnl
! 510: dnl internal, don't use
! 511: AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[
! 512: case $1 in
! 513: c|c_r|pthread*[)] ;;
! 514: *[)] ifelse($3,,[
! 515: _PHP_X_ADD_LIBRARY($1,$2,$5)
! 516: ],[
! 517: if test "$ext_shared" = "yes"; then
! 518: _PHP_X_ADD_LIBRARY($1,$2,$3)
! 519: else
! 520: $4($1,$2)
! 521: fi
! 522: ]) ;;
! 523: esac
! 524: ])dnl
! 525: dnl
! 526: dnl
! 527: dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]])
! 528: dnl
! 529: dnl add a library to the link line
! 530: dnl
! 531: AC_DEFUN([PHP_ADD_LIBRARY],[
! 532: _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY],[LIBS])
! 533: ])
! 534:
! 535: dnl
! 536: dnl PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]])
! 537: dnl
! 538: dnl add a library to the link line (deferred, not used during configure)
! 539: dnl
! 540: AC_DEFUN([PHP_ADD_LIBRARY_DEFER],[
! 541: _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY_DEFER],[DLIBS])
! 542: ])
! 543:
! 544: dnl
! 545: dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
! 546: dnl
! 547: dnl add a library to the link line and path to linkpath/runpath.
! 548: dnl if shared-libadd is not empty and $ext_shared is yes,
! 549: dnl shared-libadd will be assigned the library information
! 550: dnl
! 551: AC_DEFUN([PHP_ADD_LIBRARY_WITH_PATH],[
! 552: ifelse($3,,[
! 553: if test -n "$2"; then
! 554: PHP_ADD_LIBPATH($2)
! 555: fi
! 556: PHP_ADD_LIBRARY($1)
! 557: ],[
! 558: if test "$ext_shared" = "yes"; then
! 559: $3="-l$1 [$]$3"
! 560: if test -n "$2"; then
! 561: PHP_ADD_LIBPATH($2,$3)
! 562: fi
! 563: else
! 564: PHP_ADD_LIBRARY_WITH_PATH($1,$2)
! 565: fi
! 566: ])
! 567: ])
! 568:
! 569: dnl
! 570: dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd])
! 571: dnl
! 572: dnl add a library to the link line (deferred)
! 573: dnl and path to linkpath/runpath (not deferred)
! 574: dnl if shared-libadd is not empty and $ext_shared is yes,
! 575: dnl shared-libadd will be assigned the library information
! 576: dnl
! 577: AC_DEFUN([PHP_ADD_LIBRARY_DEFER_WITH_PATH],[
! 578: ifelse($3,,[
! 579: if test -n "$2"; then
! 580: PHP_ADD_LIBPATH($2)
! 581: fi
! 582: PHP_ADD_LIBRARY_DEFER($1)
! 583: ],[
! 584: if test "$ext_shared" = "yes"; then
! 585: $3="-l$1 [$]$3"
! 586: if test -n "$2"; then
! 587: PHP_ADD_LIBPATH($2,$3)
! 588: fi
! 589: else
! 590: PHP_ADD_LIBRARY_DEFER_WITH_PATH($1,$2)
! 591: fi
! 592: ])
! 593: ])
! 594:
! 595: dnl
! 596: dnl PHP_ADD_FRAMEWORK(framework [,before])
! 597: dnl
! 598: dnl add a (Darwin / Mac OS X) framework to the link
! 599: dnl line. if before is 1, the framework is added
! 600: dnl to the beginning of the line.
! 601: dnl
! 602: AC_DEFUN([PHP_ADD_FRAMEWORK], [
! 603: PHP_RUN_ONCE(FRAMEWORKS, $1, [
! 604: if test "$2"; then
! 605: PHP_FRAMEWORKS="-framework $1 $PHP_FRAMEWORKS"
! 606: else
! 607: PHP_FRAMEWORKS="$PHP_FRAMEWORKS -framework $1"
! 608: fi
! 609: ])
! 610: ])
! 611:
! 612: dnl
! 613: dnl PHP_ADD_FRAMEWORKPATH(path [,before])
! 614: dnl
! 615: dnl add a (Darwin / Mac OS X) framework path to the link
! 616: dnl and include lines. default paths include (but are
! 617: dnl not limited to) /Local/Library/Frameworks and
! 618: dnl /System/Library/Frameworks, so these don't need
! 619: dnl to be specifically added. if before is 1, the
! 620: dnl framework path is added to the beginning of the
! 621: dnl relevant lines.
! 622: dnl
! 623: AC_DEFUN([PHP_ADD_FRAMEWORKPATH], [
! 624: PHP_EXPAND_PATH($1, ai_p)
! 625: PHP_RUN_ONCE(FRAMEWORKPATH, $ai_p, [
! 626: if test "$2"; then
! 627: PHP_FRAMEWORKPATH="-F$ai_p $PHP_FRAMEWORKPATH"
! 628: else
! 629: PHP_FRAMEWORKPATH="$PHP_FRAMEWORKPATH -F$ai_p"
! 630: fi
! 631: ])
! 632: ])
! 633:
! 634: dnl
! 635: dnl PHP_ADD_FRAMEWORK_WITH_PATH(framework, path)
! 636: dnl
! 637: dnl Adds a (Darwin / Mac OS X) framework path and the
! 638: dnl framework itself to the link and include lines.
! 639: dnl
! 640: AC_DEFUN([PHP_ADD_FRAMEWORK_WITH_PATH], [
! 641: PHP_ADD_FRAMEWORKPATH($2)
! 642: PHP_ADD_FRAMEWORK($1)
! 643: ])
! 644:
! 645: dnl
! 646: dnl PHP_SET_LIBTOOL_VARIABLE(var)
! 647: dnl
! 648: dnl Set libtool variable
! 649: dnl
! 650: AC_DEFUN([PHP_SET_LIBTOOL_VARIABLE],[
! 651: if test -z "$LIBTOOL"; then
! 652: LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
! 653: else
! 654: LIBTOOL="$LIBTOOL $1"
! 655: fi
! 656: ])
! 657:
! 658: dnl -------------------------------------------------------------------------
! 659: dnl Wrapper macros for AC_ARG_WITH / AC_ARG_ENABLE
! 660: dnl -------------------------------------------------------------------------
! 661:
! 662: dnl PHP_ARG_ANALYZE_EX
! 663: dnl internal
! 664: AC_DEFUN([PHP_ARG_ANALYZE_EX],[
! 665: ext_output="yes, shared"
! 666: ext_shared=yes
! 667: case [$]$1 in
! 668: shared,*[)]
! 669: $1=`echo "[$]$1"|$SED 's/^shared,//'`
! 670: ;;
! 671: shared[)]
! 672: $1=yes
! 673: ;;
! 674: no[)]
! 675: ext_output=no
! 676: ext_shared=no
! 677: ;;
! 678: *[)]
! 679: ext_output=yes
! 680: ext_shared=no
! 681: ;;
! 682: esac
! 683:
! 684: PHP_ALWAYS_SHARED([$1])
! 685: ])
! 686:
! 687: dnl PHP_ARG_ANALYZE
! 688: dnl internal
! 689: AC_DEFUN([PHP_ARG_ANALYZE],[
! 690: ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])],[ext_output=ifelse([$]$1,,no,[$]$1)])
! 691: ifelse([$2],,,[AC_MSG_RESULT([$ext_output])])
! 692: ])
! 693:
! 694: dnl
! 695: dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val[, extension-or-not]])
! 696: dnl Sets PHP_ARG_NAME either to the user value or to the default value.
! 697: dnl default-val defaults to no. This will also set the variable ext_shared,
! 698: dnl and will overwrite any previous variable of that name.
! 699: dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run
! 700: dnl the PHP_ARG_ANALYZE_EX.
! 701: dnl
! 702: AC_DEFUN([PHP_ARG_WITH],[
! 703: php_with_[]translit($1,A-Z0-9-,a-z0-9_)=ifelse($4,,no,$4)
! 704: PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)])
! 705: ])
! 706:
! 707: dnl PHP_REAL_ARG_WITH
! 708: dnl internal
! 709: AC_DEFUN([PHP_REAL_ARG_WITH],[
! 710: ifelse([$2],,,[AC_MSG_CHECKING([$2])])
! 711: AC_ARG_WITH($1,[$3],$5=[$]withval,
! 712: [
! 713: $5=ifelse($4,,no,$4)
! 714: ifelse($6,yes,[test "$PHP_ENABLE_ALL" && $5=$PHP_ENABLE_ALL])
! 715: ])
! 716: PHP_ARG_ANALYZE($5,[$2],$6)
! 717: ])
! 718:
! 719: dnl
! 720: dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val[, extension-or-not]])
! 721: dnl Sets PHP_ARG_NAME either to the user value or to the default value.
! 722: dnl default-val defaults to no. This will also set the variable ext_shared,
! 723: dnl and will overwrite any previous variable of that name.
! 724: dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run
! 725: dnl the PHP_ARG_ANALYZE_EX.
! 726: dnl
! 727: AC_DEFUN([PHP_ARG_ENABLE],[
! 728: php_enable_[]translit($1,A-Z0-9-,a-z0-9_)=ifelse($4,,no,$4)
! 729: PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)])
! 730: ])
! 731:
! 732: dnl PHP_REAL_ARG_ENABLE
! 733: dnl internal
! 734: AC_DEFUN([PHP_REAL_ARG_ENABLE],[
! 735: ifelse([$2],,,[AC_MSG_CHECKING([$2])])
! 736: AC_ARG_ENABLE($1,[$3],$5=[$]enableval,
! 737: [
! 738: $5=ifelse($4,,no,$4)
! 739: ifelse($6,yes,[test "$PHP_ENABLE_ALL" && $5=$PHP_ENABLE_ALL])
! 740: ])
! 741: PHP_ARG_ANALYZE($5,[$2],$6)
! 742: ])
! 743:
! 744: dnl -------------------------------------------------------------------------
! 745: dnl Build macros
! 746: dnl -------------------------------------------------------------------------
! 747:
! 748: dnl
! 749: dnl PHP_BUILD_THREAD_SAFE
! 750: dnl
! 751: AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
! 752: enable_maintainer_zts=yes
! 753: if test "$pthreads_working" != "yes"; then
! 754: AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.])
! 755: fi
! 756: ])
! 757:
! 758: dnl
! 759: dnl PHP_REQUIRE_CXX
! 760: dnl
! 761: AC_DEFUN([PHP_REQUIRE_CXX],[
! 762: if test -z "$php_cxx_done"; then
! 763: AC_PROG_CXX
! 764: AC_PROG_CXXCPP
! 765: php_cxx_done=yes
! 766: fi
! 767: ])
! 768:
! 769: dnl
! 770: dnl PHP_BUILD_SHARED
! 771: dnl
! 772: AC_DEFUN([PHP_BUILD_SHARED],[
! 773: PHP_BUILD_PROGRAM
! 774: OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
! 775: php_build_target=shared
! 776:
! 777: php_c_pre=$shared_c_pre
! 778: php_c_meta=$shared_c_meta
! 779: php_c_post=$shared_c_post
! 780: php_cxx_pre=$shared_cxx_pre
! 781: php_cxx_meta=$shared_cxx_meta
! 782: php_cxx_post=$shared_cxx_post
! 783: php_lo=$shared_lo
! 784: ])
! 785:
! 786: dnl
! 787: dnl PHP_BUILD_STATIC
! 788: dnl
! 789: AC_DEFUN([PHP_BUILD_STATIC],[
! 790: PHP_BUILD_PROGRAM
! 791: OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
! 792: php_build_target=static
! 793: ])
! 794:
! 795: dnl
! 796: dnl PHP_BUILD_BUNDLE
! 797: dnl
! 798: AC_DEFUN([PHP_BUILD_BUNDLE],[
! 799: PHP_BUILD_PROGRAM
! 800: OVERALL_TARGET=libs/libphp[]$PHP_MAJOR_VERSION[.bundle]
! 801: php_build_target=static
! 802: ])
! 803:
! 804: dnl
! 805: dnl PHP_BUILD_PROGRAM
! 806: dnl
! 807: AC_DEFUN([PHP_BUILD_PROGRAM],[
! 808: OVERALL_TARGET=[]ifelse($1,,php,$1)
! 809: php_c_pre='$(LIBTOOL) --mode=compile $(CC)'
! 810: php_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)'
! 811: php_c_post=
! 812: php_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)'
! 813: php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)'
! 814: php_cxx_post=
! 815: php_lo=lo
! 816:
! 817: case $with_pic in
! 818: yes) pic_setting='-prefer-pic';;
! 819: no) pic_setting='-prefer-non-pic';;
! 820: esac
! 821:
! 822: shared_c_pre='$(LIBTOOL) --mode=compile $(CC)'
! 823: shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) '$pic_setting
! 824: shared_c_post=
! 825: shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)'
! 826: shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) '$pic_setting
! 827: shared_cxx_post=
! 828: shared_lo=lo
! 829:
! 830: php_build_target=program
! 831: ])
! 832:
! 833: dnl
! 834: dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx, zend_ext)
! 835: dnl
! 836: dnl Basically sets up the link-stage for building module-name
! 837: dnl from object_var in build-dir.
! 838: dnl
! 839: AC_DEFUN([PHP_SHARED_MODULE],[
! 840: install_modules="install-modules"
! 841:
! 842: case $host_alias in
! 843: *aix*[)]
! 844: suffix=so
! 845: link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -Wl,-G -o '$3'/$1.la -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) && mv -f '$3'/.libs/$1.so '$3'/$1.so'
! 846: ;;
! 847: *netware*[)]
! 848: suffix=nlm
! 849: link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php5lib, , -L$(top_builddir)/netware -lphp5lib) $(translit(ifelse($1, php5lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
! 850: ;;
! 851: *[)]
! 852: suffix=la
! 853: link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
! 854: ;;
! 855: esac
! 856:
! 857: if test "x$5" = "xyes"; then
! 858: PHP_ZEND_EX="$PHP_ZEND_EX \$(phplibdir)/$1.$suffix"
! 859: else
! 860: PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.$suffix"
! 861: fi
! 862: PHP_SUBST($2)
! 863: cat >>Makefile.objects<<EOF
! 864: \$(phplibdir)/$1.$suffix: $3/$1.$suffix
! 865: \$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
! 866:
! 867: $3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
! 868: $link_cmd
! 869:
! 870: EOF
! 871: ])
! 872:
! 873: dnl
! 874: dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])
! 875: dnl
! 876: dnl Selects the SAPI name and type (static, shared, programm)
! 877: dnl and optionally also the source-files for the SAPI-specific
! 878: dnl objects.
! 879: dnl
! 880: AC_DEFUN([PHP_SELECT_SAPI],[
! 881: if test "$PHP_SAPI" != "default"; then
! 882: AC_MSG_ERROR([
! 883: +--------------------------------------------------------------------+
! 884: | *** ATTENTION *** |
! 885: | |
! 886: | You've configured multiple SAPIs to be build. You can build only |
! 887: | one SAPI module and CLI binary at the same time. |
! 888: +--------------------------------------------------------------------+
! 889: ])
! 890: fi
! 891:
! 892: PHP_SAPI=$1
! 893:
! 894: case "$2" in
! 895: static[)] PHP_BUILD_STATIC;;
! 896: shared[)] PHP_BUILD_SHARED;;
! 897: bundle[)] PHP_BUILD_BUNDLE;;
! 898: program[)] PHP_BUILD_PROGRAM($5);;
! 899: esac
! 900:
! 901: ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])
! 902: ])
! 903:
! 904: dnl deprecated
! 905: AC_DEFUN([PHP_EXTENSION],[
! 906: sources=`$AWK -f $abs_srcdir/build/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
! 907:
! 908: PHP_NEW_EXTENSION($1, $sources, $2, $3)
! 909:
! 910: if test -r "$ext_srcdir/Makefile.frag"; then
! 911: PHP_ADD_MAKEFILE_FRAGMENT
! 912: fi
! 913: ])
! 914:
! 915: AC_DEFUN([PHP_ADD_BUILD_DIR],[
! 916: ifelse($2,,[
! 917: BUILD_DIR="$BUILD_DIR $1"
! 918: ], [
! 919: $php_shtool mkdir -p $1
! 920: ])
! 921: ])
! 922:
! 923: AC_DEFUN([PHP_GEN_BUILD_DIRS],[
! 924: $php_shtool mkdir -p $BUILD_DIR
! 925: ])
! 926:
! 927: dnl
! 928: dnl PHP_NEW_EXTENSION(extname, sources [, shared [, sapi_class [, extra-cflags [, cxx [, zend_ext]]]]])
! 929: dnl
! 930: dnl Includes an extension in the build.
! 931: dnl
! 932: dnl "extname" is the name of the ext/ subdir where the extension resides.
! 933: dnl "sources" is a list of files relative to the subdir which are used
! 934: dnl to build the extension.
! 935: dnl "shared" can be set to "shared" or "yes" to build the extension as
! 936: dnl a dynamically loadable library. Optional parameter "sapi_class" can
! 937: dnl be set to "cli" to mark extension build only with CLI or CGI sapi's.
! 938: dnl "extra-cflags" are passed to the compiler, with
! 939: dnl @ext_srcdir@ and @ext_builddir@ being substituted.
! 940: dnl "cxx" can be used to indicate that a C++ shared module is desired.
! 941: dnl "zend_ext" indicates a zend extension.
! 942: AC_DEFUN([PHP_NEW_EXTENSION],[
! 943: ext_builddir=[]PHP_EXT_BUILDDIR($1)
! 944: ext_srcdir=[]PHP_EXT_SRCDIR($1)
! 945:
! 946: ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g`])
! 947:
! 948: if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
! 949: dnl ---------------------------------------------- Static module
! 950: [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
! 951: PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
! 952: EXT_STATIC="$EXT_STATIC $1"
! 953: if test "$3" != "nocli"; then
! 954: EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
! 955: fi
! 956: else
! 957: if test "$3" = "shared" || test "$3" = "yes"; then
! 958: dnl ---------------------------------------------- Shared module
! 959: [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=yes
! 960: PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
! 961: case $host_alias in
! 962: *netware*[)]
! 963: PHP_SHARED_MODULE(php$1,shared_objects_$1, $ext_builddir, $6, $7)
! 964: ;;
! 965: *[)]
! 966: PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6, $7)
! 967: ;;
! 968: esac
! 969: AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
! 970: fi
! 971: fi
! 972:
! 973: if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
! 974: dnl ---------------------------------------------- CLI static module
! 975: [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
! 976: PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
! 977: PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cgi)
! 978: PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,fpm)
! 979: EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
! 980: fi
! 981: PHP_ADD_BUILD_DIR($ext_builddir)
! 982:
! 983: dnl Set for phpize builds only
! 984: dnl ---------------------------
! 985: if test "$ext_builddir" = "."; then
! 986: PHP_PECL_EXTENSION=$1
! 987: PHP_SUBST(PHP_PECL_EXTENSION)
! 988: fi
! 989: ])
! 990:
! 991: dnl
! 992: dnl PHP_WITH_SHARED
! 993: dnl
! 994: dnl Checks whether $withval is "shared" or starts with "shared,XXX"
! 995: dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
! 996: dnl from $withval.
! 997: dnl
! 998: AC_DEFUN([PHP_WITH_SHARED],[
! 999: PHP_ARG_ANALYZE_EX(withval)
! 1000: shared=$ext_shared
! 1001: unset ext_shared ext_output
! 1002: ])
! 1003:
! 1004: dnl
! 1005: dnl PHP_ADD_EXTENSION_DEP(extname, depends [, depconf])
! 1006: dnl
! 1007: dnl This macro is scanned by genif.sh when it builds the internal functions
! 1008: dnl list, so that modules can be init'd in the correct order
! 1009: dnl $1 = name of extension, $2 = extension upon which it depends
! 1010: dnl $3 = optional: if true, it's ok for $2 to have not been configured
! 1011: dnl default is false and should halt the build.
! 1012: dnl To be effective, this macro must be invoked *after* PHP_NEW_EXTENSION.
! 1013: dnl The extension on which it depends must also have been configured.
! 1014: dnl See ADD_EXTENSION_DEP in win32 build
! 1015: dnl
! 1016: AC_DEFUN([PHP_ADD_EXTENSION_DEP], [
! 1017: am_i_shared=$[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]
! 1018: is_it_shared=$[PHP_]translit($2,a-z_-,A-Z__)[_SHARED]
! 1019: is_it_enabled=$[PHP_]translit($2,a-z_-,A-Z__)
! 1020: if test "$am_i_shared" = "no" && test "$is_it_shared" = "yes" ; then
! 1021: AC_MSG_ERROR([
! 1022: You've configured extension $1 to build statically, but it
! 1023: depends on extension $2, which you've configured to build shared.
! 1024: You either need to build $1 shared or build $2 statically for the
! 1025: build to be successful.
! 1026: ])
! 1027: fi
! 1028: dnl Some systems require that we link $2 to $1 when building
! 1029: ])
! 1030:
! 1031: dnl -------------------------------------------------------------------------
! 1032: dnl Checks for structures, typedefs, broken functions, etc.
! 1033: dnl -------------------------------------------------------------------------
! 1034:
! 1035: dnl Internal helper macros
! 1036: dnl
! 1037: dnl _PHP_DEF_HAVE_FILE(what, filename)
! 1038: AC_DEFUN([_PHP_DEF_HAVE_FILE], [
! 1039: php_def_have_what=HAVE_[]`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_' `
! 1040: echo "#define $php_def_have_what 1" >> $2
! 1041: ])
! 1042: dnl
! 1043: dnl _PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-found-action]])
! 1044: dnl
! 1045: AC_DEFUN([_PHP_CHECK_SIZEOF], [
! 1046: php_cache_value=php_cv_sizeof_[]$1
! 1047: AC_CACHE_VAL(php_cv_sizeof_[]$1, [
! 1048: old_LIBS=$LIBS
! 1049: LIBS=
! 1050: old_LDFLAGS=$LDFLAGS
! 1051: LDFLAGS=
! 1052: AC_TRY_RUN([#include <stdio.h>
! 1053: #if STDC_HEADERS
! 1054: #include <stdlib.h>
! 1055: #include <stddef.h>
! 1056: #endif
! 1057: #ifdef HAVE_INTTYPES_H
! 1058: #include <inttypes.h>
! 1059: #endif
! 1060: #ifdef HAVE_UNISTD_H
! 1061: #include <unistd.h>
! 1062: #endif
! 1063: $3
! 1064:
! 1065: int main()
! 1066: {
! 1067: FILE *fp = fopen("conftestval", "w");
! 1068: if (!fp) return(1);
! 1069: fprintf(fp, "%d\n", sizeof($1));
! 1070: return(0);
! 1071: }
! 1072: ], [
! 1073: eval $php_cache_value=`cat conftestval`
! 1074: ], [
! 1075: eval $php_cache_value=0
! 1076: ], [
! 1077: ifelse([$2],,[eval $php_cache_value=0], [eval $php_cache_value=$2])
! 1078: ])
! 1079: LDFLAGS=$old_LDFLAGS
! 1080: LIBS=$old_LIBS
! 1081: ])
! 1082: if eval test "\$$php_cache_value" != "0"; then
! 1083: ifelse([$4],[],:,[$4])
! 1084: ifelse([$5],[],,[else $5])
! 1085: fi
! 1086: ])
! 1087:
! 1088: dnl
! 1089: dnl PHP_CHECK_SIZEOF(type, cross-value, extra-headers)
! 1090: dnl
! 1091: AC_DEFUN([PHP_CHECK_SIZEOF], [
! 1092: AC_MSG_CHECKING([size of $1])
! 1093: _PHP_CHECK_SIZEOF($1, $2, $3, [
! 1094: AC_DEFINE_UNQUOTED([SIZEOF_]translit($1,a-z,A-Z_), [$]php_cv_sizeof_[]$1, [Size of $1])
! 1095: AC_DEFINE_UNQUOTED([HAVE_]translit($1,a-z,A-Z_), 1, [Whether $1 is available])
! 1096: ])
! 1097: AC_MSG_RESULT([[$][php_cv_sizeof_]translit($1, ,_)])
! 1098: ])
! 1099:
! 1100: dnl
! 1101: dnl PHP_CHECK_TYPES(type-list, include-file [, extra-headers])
! 1102: dnl
! 1103: AC_DEFUN([PHP_CHECK_TYPES], [
! 1104: for php_typename in $1; do
! 1105: AC_MSG_CHECKING([whether $php_typename exists])
! 1106: _PHP_CHECK_SIZEOF($php_typename, 0, $3, [
! 1107: _PHP_DEF_HAVE_FILE($php_typename, $2)
! 1108: AC_MSG_RESULT([yes])
! 1109: ], [
! 1110: AC_MSG_RESULT([no])
! 1111: ])
! 1112: done
! 1113: ])
! 1114:
! 1115: dnl
! 1116: dnl PHP_CHECK_IN_ADDR_T
! 1117: dnl
! 1118: AC_DEFUN([PHP_CHECK_IN_ADDR_T], [
! 1119: dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
! 1120: AC_MSG_CHECKING([for in_addr_t])
! 1121: AC_CACHE_VAL(ac_cv_type_in_addr_t,
! 1122: [AC_EGREP_CPP(dnl
! 1123: changequote(<<,>>)dnl
! 1124: <<in_addr_t[^a-zA-Z_0-9]>>dnl
! 1125: changequote([,]), [#include <sys/types.h>
! 1126: #if STDC_HEADERS
! 1127: #include <stdlib.h>
! 1128: #include <stddef.h>
! 1129: #endif
! 1130: #ifdef HAVE_NETINET_IN_H
! 1131: #include <netinet/in.h>
! 1132: #endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
! 1133: AC_MSG_RESULT([$ac_cv_type_in_addr_t])
! 1134: if test $ac_cv_type_in_addr_t = no; then
! 1135: AC_DEFINE(in_addr_t, u_int, [ ])
! 1136: fi
! 1137: ])
! 1138:
! 1139: dnl
! 1140: dnl PHP_TIME_R_TYPE
! 1141: dnl
! 1142: dnl Check type of reentrant time-related functions
! 1143: dnl Type can be: irix, hpux or POSIX
! 1144: dnl
! 1145: AC_DEFUN([PHP_TIME_R_TYPE],[
! 1146: AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
! 1147: AC_TRY_RUN([
! 1148: #include <time.h>
! 1149:
! 1150: main() {
! 1151: char buf[27];
! 1152: struct tm t;
! 1153: time_t old = 0;
! 1154: int r, s;
! 1155:
! 1156: s = gmtime_r(&old, &t);
! 1157: r = (int) asctime_r(&t, buf, 26);
! 1158: if (r == s && s == 0) return (0);
! 1159: return (1);
! 1160: }
! 1161: ],[
! 1162: ac_cv_time_r_type=hpux
! 1163: ],[
! 1164: AC_TRY_RUN([
! 1165: #include <time.h>
! 1166: main() {
! 1167: struct tm t, *s;
! 1168: time_t old = 0;
! 1169: char buf[27], *p;
! 1170:
! 1171: s = gmtime_r(&old, &t);
! 1172: p = asctime_r(&t, buf, 26);
! 1173: if (p == buf && s == &t) return (0);
! 1174: return (1);
! 1175: }
! 1176: ],[
! 1177: ac_cv_time_r_type=irix
! 1178: ],[
! 1179: ac_cv_time_r_type=POSIX
! 1180: ],[
! 1181: ac_cv_time_r_type=POSIX
! 1182: ])
! 1183: ],[
! 1184: ac_cv_time_r_type=POSIX
! 1185: ])
! 1186: ])
! 1187: case $ac_cv_time_r_type in
! 1188: hpux[)] AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
! 1189: irix[)] AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
! 1190: esac
! 1191: ])
! 1192:
! 1193: dnl
! 1194: dnl PHP_DOES_PWRITE_WORK
! 1195: dnl internal
! 1196: AC_DEFUN([PHP_DOES_PWRITE_WORK],[
! 1197: AC_TRY_RUN([
! 1198: #include <sys/types.h>
! 1199: #include <sys/stat.h>
! 1200: #include <fcntl.h>
! 1201: #include <unistd.h>
! 1202: #include <errno.h>
! 1203: $1
! 1204: main() {
! 1205: int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
! 1206:
! 1207: if (fd < 0) exit(1);
! 1208: if (pwrite(fd, "text", 4, 0) != 4) exit(1);
! 1209: /* Linux glibc breakage until 2.2.5 */
! 1210: if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
! 1211: exit(0);
! 1212: }
! 1213:
! 1214: ],[
! 1215: ac_cv_pwrite=yes
! 1216: ],[
! 1217: ac_cv_pwrite=no
! 1218: ],[
! 1219: ac_cv_pwrite=no
! 1220: ])
! 1221: ])
! 1222:
! 1223: dnl PHP_DOES_PREAD_WORK
! 1224: dnl internal
! 1225: AC_DEFUN([PHP_DOES_PREAD_WORK],[
! 1226: echo test > conftest_in
! 1227: AC_TRY_RUN([
! 1228: #include <sys/types.h>
! 1229: #include <sys/stat.h>
! 1230: #include <fcntl.h>
! 1231: #include <unistd.h>
! 1232: #include <errno.h>
! 1233: $1
! 1234: main() {
! 1235: char buf[3];
! 1236: int fd = open("conftest_in", O_RDONLY);
! 1237: if (fd < 0) exit(1);
! 1238: if (pread(fd, buf, 2, 0) != 2) exit(1);
! 1239: /* Linux glibc breakage until 2.2.5 */
! 1240: if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
! 1241: exit(0);
! 1242: }
! 1243: ],[
! 1244: ac_cv_pread=yes
! 1245: ],[
! 1246: ac_cv_pread=no
! 1247: ],[
! 1248: ac_cv_pread=no
! 1249: ])
! 1250: rm -f conftest_in
! 1251: ])
! 1252:
! 1253: dnl
! 1254: dnl PHP_PWRITE_TEST
! 1255: dnl
! 1256: AC_DEFUN([PHP_PWRITE_TEST],[
! 1257: AC_CACHE_CHECK(whether pwrite works,ac_cv_pwrite,[
! 1258: PHP_DOES_PWRITE_WORK
! 1259: if test "$ac_cv_pwrite" = "no"; then
! 1260: PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);])
! 1261: if test "$ac_cv_pwrite" = "yes"; then
! 1262: ac_cv_pwrite=64
! 1263: fi
! 1264: fi
! 1265: ])
! 1266:
! 1267: if test "$ac_cv_pwrite" != "no"; then
! 1268: AC_DEFINE(HAVE_PWRITE, 1, [ ])
! 1269: if test "$ac_cv_pwrite" = "64"; then
! 1270: AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default])
! 1271: fi
! 1272: fi
! 1273: ])
! 1274:
! 1275: dnl
! 1276: dnl PHP_PREAD_TEST
! 1277: dnl
! 1278: AC_DEFUN([PHP_PREAD_TEST],[
! 1279: AC_CACHE_CHECK(whether pread works,ac_cv_pread,[
! 1280: PHP_DOES_PREAD_WORK
! 1281: if test "$ac_cv_pread" = "no"; then
! 1282: PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);])
! 1283: if test "$ac_cv_pread" = "yes"; then
! 1284: ac_cv_pread=64
! 1285: fi
! 1286: fi
! 1287: ])
! 1288:
! 1289: if test "$ac_cv_pread" != "no"; then
! 1290: AC_DEFINE(HAVE_PREAD, 1, [ ])
! 1291: if test "$ac_cv_pread" = "64"; then
! 1292: AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default])
! 1293: fi
! 1294: fi
! 1295: ])
! 1296:
! 1297: dnl
! 1298: dnl PHP_MISSING_TIME_R_DECL
! 1299: dnl
! 1300: AC_DEFUN([PHP_MISSING_TIME_R_DECL],[
! 1301: AC_MSG_CHECKING([for missing declarations of reentrant functions])
! 1302: AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[
! 1303: :
! 1304: ],[
! 1305: AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
! 1306: ])
! 1307: AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[
! 1308: :
! 1309: ],[
! 1310: AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
! 1311: ])
! 1312: AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[
! 1313: :
! 1314: ],[
! 1315: AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
! 1316: ])
! 1317: AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[
! 1318: :
! 1319: ],[
! 1320: AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
! 1321: ])
! 1322: AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[
! 1323: :
! 1324: ],[
! 1325: AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared])
! 1326: ])
! 1327: AC_MSG_RESULT([done])
! 1328: ])
! 1329:
! 1330: dnl
! 1331: dnl PHP_READDIR_R_TYPE
! 1332: dnl
! 1333: AC_DEFUN([PHP_READDIR_R_TYPE],[
! 1334: dnl HAVE_READDIR_R is also defined by libmysql
! 1335: AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no)
! 1336: if test "$ac_cv_func_readdir_r" = "yes"; then
! 1337: AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[
! 1338: AC_TRY_RUN([
! 1339: #define _REENTRANT
! 1340: #include <sys/types.h>
! 1341: #include <dirent.h>
! 1342:
! 1343: #ifndef PATH_MAX
! 1344: #define PATH_MAX 1024
! 1345: #endif
! 1346:
! 1347: main() {
! 1348: DIR *dir;
! 1349: char entry[sizeof(struct dirent)+PATH_MAX];
! 1350: struct dirent *pentry = (struct dirent *) &entry;
! 1351:
! 1352: dir = opendir("/");
! 1353: if (!dir)
! 1354: exit(1);
! 1355: if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
! 1356: exit(0);
! 1357: exit(1);
! 1358: }
! 1359: ],[
! 1360: ac_cv_what_readdir_r=POSIX
! 1361: ],[
! 1362: AC_TRY_CPP([
! 1363: #define _REENTRANT
! 1364: #include <sys/types.h>
! 1365: #include <dirent.h>
! 1366: int readdir_r(DIR *, struct dirent *);
! 1367: ],[
! 1368: ac_cv_what_readdir_r=old-style
! 1369: ],[
! 1370: ac_cv_what_readdir_r=none
! 1371: ])
! 1372: ],[
! 1373: ac_cv_what_readdir_r=none
! 1374: ])
! 1375: ])
! 1376: case $ac_cv_what_readdir_r in
! 1377: POSIX)
! 1378: AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);;
! 1379: old-style)
! 1380: AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);;
! 1381: esac
! 1382: fi
! 1383: ])
! 1384:
! 1385: dnl
! 1386: dnl PHP_TM_GMTOFF
! 1387: dnl
! 1388: AC_DEFUN([PHP_TM_GMTOFF],[
! 1389: AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
! 1390: [AC_TRY_COMPILE([#include <sys/types.h>
! 1391: #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
! 1392: ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
! 1393:
! 1394: if test "$ac_cv_struct_tm_gmtoff" = yes; then
! 1395: AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
! 1396: fi
! 1397: ])
! 1398:
! 1399: dnl
! 1400: dnl PHP_STRUCT_FLOCK
! 1401: dnl
! 1402: AC_DEFUN([PHP_STRUCT_FLOCK],[
! 1403: AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock,
! 1404: AC_TRY_COMPILE([
! 1405: #include <unistd.h>
! 1406: #include <fcntl.h>
! 1407: ],
! 1408: [struct flock x;],
! 1409: [
! 1410: ac_cv_struct_flock=yes
! 1411: ],[
! 1412: ac_cv_struct_flock=no
! 1413: ])
! 1414: )
! 1415: if test "$ac_cv_struct_flock" = "yes" ; then
! 1416: AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
! 1417: fi
! 1418: ])
! 1419:
! 1420: dnl
! 1421: dnl PHP_SOCKLEN_T
! 1422: dnl
! 1423: AC_DEFUN([PHP_SOCKLEN_T],[
! 1424: AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
! 1425: AC_TRY_COMPILE([
! 1426: #include <sys/types.h>
! 1427: #include <sys/socket.h>
! 1428: ],[
! 1429: socklen_t x;
! 1430: ],[
! 1431: ac_cv_socklen_t=yes
! 1432: ],[
! 1433: ac_cv_socklen_t=no
! 1434: ]))
! 1435: if test "$ac_cv_socklen_t" = "yes"; then
! 1436: AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
! 1437: fi
! 1438: ])
! 1439:
! 1440: dnl
! 1441: dnl PHP_MISSING_FCLOSE_DECL
! 1442: dnl
! 1443: dnl See if we have broken header files like SunOS has.
! 1444: dnl
! 1445: AC_DEFUN([PHP_MISSING_FCLOSE_DECL],[
! 1446: AC_MSG_CHECKING([for fclose declaration])
! 1447: AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
! 1448: AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ])
! 1449: AC_MSG_RESULT([ok])
! 1450: ],[
! 1451: AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ])
! 1452: AC_MSG_RESULT([missing])
! 1453: ])
! 1454: ])
! 1455:
! 1456: dnl
! 1457: dnl PHP_AC_BROKEN_SPRINTF
! 1458: dnl
! 1459: dnl Check for broken sprintf(), C99 conformance
! 1460: dnl
! 1461: AC_DEFUN([PHP_AC_BROKEN_SPRINTF],[
! 1462: AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
! 1463: AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
! 1464: ac_cv_broken_sprintf=no
! 1465: ],[
! 1466: ac_cv_broken_sprintf=yes
! 1467: ],[
! 1468: ac_cv_broken_sprintf=no
! 1469: ])
! 1470: ])
! 1471: if test "$ac_cv_broken_sprintf" = "yes"; then
! 1472: AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [Whether sprintf is C99 conform])
! 1473: else
! 1474: AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [Whether sprintf is C99 conform])
! 1475: fi
! 1476: ])
! 1477:
! 1478: dnl
! 1479: dnl PHP_AC_BROKEN_SNPRINTF
! 1480: dnl
! 1481: dnl Check for broken snprintf(), C99 conformance
! 1482: dnl
! 1483: AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[
! 1484: AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[
! 1485: AC_TRY_RUN([
! 1486: #define NULL (0L)
! 1487: main() {
! 1488: char buf[20];
! 1489: int res = 0;
! 1490: res = res || (snprintf(buf, 2, "marcus") != 6);
! 1491: res = res || (buf[1] != '\0');
! 1492: /* Implementations may consider this as an encoding error */
! 1493: snprintf(buf, 0, "boerger");
! 1494: /* However, they MUST ignore the pointer */
! 1495: res = res || (buf[0] != 'm');
! 1496: res = res || (snprintf(NULL, 0, "boerger") != 7);
! 1497: res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
! 1498: exit(res);
! 1499: }
! 1500: ],[
! 1501: ac_cv_broken_snprintf=no
! 1502: ],[
! 1503: ac_cv_broken_snprintf=yes
! 1504: ],[
! 1505: ac_cv_broken_snprintf=no
! 1506: ])
! 1507: ])
! 1508: if test "$ac_cv_broken_snprintf" = "yes"; then
! 1509: AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform])
! 1510: else
! 1511: AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform])
! 1512: fi
! 1513: ])
! 1514:
! 1515: dnl
! 1516: dnl PHP_SOLARIS_PIC_WEIRDNESS
! 1517: dnl
! 1518: dnl Solaris requires main code to be position independent in order
! 1519: dnl to let shared objects find symbols. Weird. Ugly.
! 1520: dnl
! 1521: dnl Must be run after all --with-NN options that let the user
! 1522: dnl choose dynamic extensions, and after the gcc test.
! 1523: dnl
! 1524: AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
! 1525: AC_MSG_CHECKING([whether -fPIC is required])
! 1526: if test -n "$EXT_SHARED"; then
! 1527: os=`uname -sr 2>/dev/null`
! 1528: case $os in
! 1529: "SunOS 5.6"|"SunOS 5.7"[)]
! 1530: case $CC in
! 1531: gcc*|egcs*)
! 1532: CFLAGS="$CFLAGS -fPIC";;
! 1533: *[)]
! 1534: CFLAGS="$CFLAGS -fpic";;
! 1535: esac
! 1536: AC_MSG_RESULT([yes]);;
! 1537: *[)]
! 1538: AC_MSG_RESULT([no]);;
! 1539: esac
! 1540: else
! 1541: AC_MSG_RESULT([no])
! 1542: fi
! 1543: ])
! 1544:
! 1545: dnl
! 1546: dnl PHP_SYS_LFS
! 1547: dnl
! 1548: dnl The problem is that the default compilation flags in Solaris 2.6 won't
! 1549: dnl let programs access large files; you need to tell the compiler that
! 1550: dnl you actually want your programs to work on large files. For more
! 1551: dnl details about this brain damage please see:
! 1552: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
! 1553: dnl
! 1554: dnl Written by Paul Eggert <eggert@twinsun.com>.
! 1555: dnl
! 1556: AC_DEFUN([PHP_SYS_LFS],
! 1557: [dnl
! 1558: # If available, prefer support for large files unless the user specified
! 1559: # one of the CPPFLAGS, LDFLAGS, or LIBS variables.
! 1560: AC_MSG_CHECKING([whether large file support needs explicit enabling])
! 1561: ac_getconfs=''
! 1562: ac_result=yes
! 1563: ac_set=''
! 1564: ac_shellvars='CPPFLAGS LDFLAGS LIBS'
! 1565: for ac_shellvar in $ac_shellvars; do
! 1566: case $ac_shellvar in
! 1567: CPPFLAGS[)] ac_lfsvar=LFS_CFLAGS ;;
! 1568: *[)] ac_lfsvar=LFS_$ac_shellvar ;;
! 1569: esac
! 1570: eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
! 1571: (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
! 1572: ac_getconf=`getconf $ac_lfsvar`
! 1573: ac_getconfs=$ac_getconfs$ac_getconf
! 1574: eval ac_test_$ac_shellvar=\$ac_getconf
! 1575: done
! 1576: case "$ac_result$ac_getconfs" in
! 1577: yes[)] ac_result=no ;;
! 1578: esac
! 1579: case "$ac_result$ac_set" in
! 1580: yes?*[)] ac_result="yes, but $ac_set is already set, so use its settings"
! 1581: esac
! 1582: AC_MSG_RESULT([$ac_result])
! 1583: case $ac_result in
! 1584: yes[)]
! 1585: for ac_shellvar in $ac_shellvars; do
! 1586: eval $ac_shellvar=\$ac_test_$ac_shellvar
! 1587: done ;;
! 1588: esac
! 1589: ])
! 1590:
! 1591: dnl
! 1592: dnl PHP_SOCKADDR_CHECKS
! 1593: dnl
! 1594: AC_DEFUN([PHP_SOCKADDR_CHECKS], [
! 1595: dnl Check for struct sockaddr_storage exists
! 1596: AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_sockaddr_storage,
! 1597: [AC_TRY_COMPILE([#include <sys/types.h>
! 1598: #include <sys/socket.h>],
! 1599: [struct sockaddr_storage s; s],
! 1600: [ac_cv_sockaddr_storage=yes], [ac_cv_sockaddr_storage=no])
! 1601: ])
! 1602: if test "$ac_cv_sockaddr_storage" = "yes"; then
! 1603: AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [Whether you have struct sockaddr_storage])
! 1604: fi
! 1605: dnl Check if field sa_len exists in struct sockaddr
! 1606: AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
! 1607: AC_TRY_COMPILE([#include <sys/types.h>
! 1608: #include <sys/socket.h>],
! 1609: [static struct sockaddr sa; int n = (int) sa.sa_len; return n;],
! 1610: [ac_cv_sockaddr_sa_len=yes], [ac_cv_sockaddr_sa_len=no])
! 1611: ])
! 1612: if test "$ac_cv_sockaddr_sa_len" = "yes"; then
! 1613: AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has field sa_len])
! 1614: fi
! 1615: ])
! 1616:
! 1617: dnl
! 1618: dnl PHP_DECLARED_TIMEZONE
! 1619: dnl
! 1620: AC_DEFUN([PHP_DECLARED_TIMEZONE],[
! 1621: AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[
! 1622: AC_TRY_COMPILE([
! 1623: #include <sys/types.h>
! 1624: #include <time.h>
! 1625: #ifdef HAVE_SYS_TIME_H
! 1626: #include <sys/time.h>
! 1627: #endif
! 1628: ],[
! 1629: time_t foo = (time_t) timezone;
! 1630: ],[
! 1631: ac_cv_declared_timezone=yes
! 1632: ],[
! 1633: ac_cv_declared_timezone=no
! 1634: ])])
! 1635: if test "$ac_cv_declared_timezone" = "yes"; then
! 1636: AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone])
! 1637: fi
! 1638: ])
! 1639:
! 1640: dnl
! 1641: dnl PHP_EBCDIC
! 1642: dnl
! 1643: AC_DEFUN([PHP_EBCDIC], [
! 1644: AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
! 1645: AC_TRY_RUN( [
! 1646: int main(void) {
! 1647: return (unsigned char)'A' != (unsigned char)0xC1;
! 1648: }
! 1649: ],[
! 1650: ac_cv_ebcdic=yes
! 1651: ],[
! 1652: ac_cv_ebcdic=no
! 1653: ],[
! 1654: ac_cv_ebcdic=no
! 1655: ])])
! 1656: if test "$ac_cv_ebcdic" = "yes"; then
! 1657: AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
! 1658: fi
! 1659: ])
! 1660:
! 1661: dnl
! 1662: dnl PHP_BROKEN_GETCWD
! 1663: dnl
! 1664: dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a
! 1665: dnl component of the path has execute but not read permissions
! 1666: dnl
! 1667: AC_DEFUN([PHP_BROKEN_GETCWD],[
! 1668: AC_MSG_CHECKING([for broken getcwd])
! 1669: os=`uname -sr 2>/dev/null`
! 1670: case $os in
! 1671: SunOS*[)]
! 1672: AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
! 1673: AC_MSG_RESULT([yes]);;
! 1674: *[)]
! 1675: AC_MSG_RESULT([no]);;
! 1676: esac
! 1677: ])
! 1678:
! 1679: dnl
! 1680: dnl PHP_BROKEN_GLIBC_FOPEN_APPEND
! 1681: dnl
! 1682: AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [
! 1683: AC_MSG_CHECKING([for broken libc stdio])
! 1684: AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[
! 1685: AC_TRY_RUN([
! 1686: #include <stdio.h>
! 1687: int main(int argc, char *argv[])
! 1688: {
! 1689: FILE *fp;
! 1690: long position;
! 1691: char *filename = "/tmp/phpglibccheck";
! 1692:
! 1693: fp = fopen(filename, "w");
! 1694: if (fp == NULL) {
! 1695: perror("fopen");
! 1696: exit(2);
! 1697: }
! 1698: fputs("foobar", fp);
! 1699: fclose(fp);
! 1700:
! 1701: fp = fopen(filename, "a+");
! 1702: position = ftell(fp);
! 1703: fclose(fp);
! 1704: unlink(filename);
! 1705: if (position == 0)
! 1706: return 1;
! 1707: return 0;
! 1708: }
! 1709: ],
! 1710: [_cv_have_broken_glibc_fopen_append=no],
! 1711: [_cv_have_broken_glibc_fopen_append=yes ],
! 1712: AC_TRY_COMPILE([
! 1713: #include <features.h>
! 1714: ],[
! 1715: #if !__GLIBC_PREREQ(2,2)
! 1716: choke me
! 1717: #endif
! 1718: ],
! 1719: [_cv_have_broken_glibc_fopen_append=yes],
! 1720: [_cv_have_broken_glibc_fopen_append=no ])
! 1721: )])
! 1722:
! 1723: if test "$_cv_have_broken_glibc_fopen_append" = "yes"; then
! 1724: AC_MSG_RESULT(yes)
! 1725: AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
! 1726: else
! 1727: AC_MSG_RESULT(no)
! 1728: fi
! 1729: ])
! 1730:
! 1731: dnl
! 1732: dnl PHP_FOPENCOOKIE
! 1733: dnl
! 1734: AC_DEFUN([PHP_FOPENCOOKIE], [
! 1735: AC_CHECK_FUNC(fopencookie, [have_glibc_fopencookie=yes])
! 1736:
! 1737: if test "$have_glibc_fopencookie" = "yes"; then
! 1738: dnl this comes in two flavors:
! 1739: dnl newer glibcs (since 2.1.2 ? )
! 1740: dnl have a type called cookie_io_functions_t
! 1741: AC_TRY_COMPILE([
! 1742: #define _GNU_SOURCE
! 1743: #include <stdio.h>
! 1744: ], [cookie_io_functions_t cookie;], [have_cookie_io_functions_t=yes], [])
! 1745:
! 1746: if test "$have_cookie_io_functions_t" = "yes"; then
! 1747: cookie_io_functions_t=cookie_io_functions_t
! 1748: have_fopen_cookie=yes
! 1749:
! 1750: dnl even newer glibcs have a different seeker definition...
! 1751: AC_TRY_RUN([
! 1752: #define _GNU_SOURCE
! 1753: #include <stdio.h>
! 1754:
! 1755: struct cookiedata {
! 1756: __off64_t pos;
! 1757: };
! 1758:
! 1759: __ssize_t reader(void *cookie, char *buffer, size_t size)
! 1760: { return size; }
! 1761: __ssize_t writer(void *cookie, const char *buffer, size_t size)
! 1762: { return size; }
! 1763: int closer(void *cookie)
! 1764: { return 0; }
! 1765: int seeker(void *cookie, __off64_t *position, int whence)
! 1766: { ((struct cookiedata*)cookie)->pos = *position; return 0; }
! 1767:
! 1768: cookie_io_functions_t funcs = {reader, writer, seeker, closer};
! 1769:
! 1770: main() {
! 1771: struct cookiedata g = { 0 };
! 1772: FILE *fp = fopencookie(&g, "r", funcs);
! 1773:
! 1774: if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
! 1775: exit(0);
! 1776: exit(1);
! 1777: }
! 1778:
! 1779: ], [
! 1780: cookie_io_functions_use_off64_t=yes
! 1781: ], [
! 1782: cookie_io_functions_use_off64_t=no
! 1783: ], [
! 1784: cookie_io_functions_use_off64_t=no
! 1785: ])
! 1786:
! 1787: else
! 1788:
! 1789: dnl older glibc versions (up to 2.1.2 ?)
! 1790: dnl call it _IO_cookie_io_functions_t
! 1791: AC_TRY_COMPILE([
! 1792: #define _GNU_SOURCE
! 1793: #include <stdio.h>
! 1794: ], [ _IO_cookie_io_functions_t cookie; ], [have_IO_cookie_io_functions_t=yes], [])
! 1795: if test "$have_cookie_io_functions_t" = "yes" ; then
! 1796: cookie_io_functions_t=_IO_cookie_io_functions_t
! 1797: have_fopen_cookie=yes
! 1798: fi
! 1799: fi
! 1800:
! 1801: if test "$have_fopen_cookie" = "yes" ; then
! 1802: AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ])
! 1803: AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ])
! 1804: if test "$cookie_io_functions_use_off64_t" = "yes" ; then
! 1805: AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ])
! 1806: fi
! 1807: fi
! 1808: fi
! 1809: ])
! 1810:
! 1811: dnl -------------------------------------------------------------------------
! 1812: dnl Library/function existance and build sanity checks
! 1813: dnl -------------------------------------------------------------------------
! 1814:
! 1815: dnl
! 1816: dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]])
! 1817: dnl
! 1818: dnl Wrapper for AC_CHECK_LIB
! 1819: dnl
! 1820: AC_DEFUN([PHP_CHECK_LIBRARY], [
! 1821: save_old_LDFLAGS=$LDFLAGS
! 1822: ac_stuff="$5"
! 1823:
! 1824: save_ext_shared=$ext_shared
! 1825: ext_shared=yes
! 1826: PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS)
! 1827: AC_CHECK_LIB([$1],[$2],[
! 1828: LDFLAGS=$save_old_LDFLAGS
! 1829: ext_shared=$save_ext_shared
! 1830: $3
! 1831: ],[
! 1832: LDFLAGS=$save_old_LDFLAGS
! 1833: ext_shared=$save_ext_shared
! 1834: unset ac_cv_lib_$1[]_$2
! 1835: $4
! 1836: ])dnl
! 1837: ])
! 1838:
! 1839: dnl
! 1840: dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])
! 1841: dnl
! 1842: dnl El cheapo wrapper for AC_CHECK_LIB
! 1843: dnl
! 1844: AC_DEFUN([PHP_CHECK_FRAMEWORK], [
! 1845: save_old_LDFLAGS=$LDFLAGS
! 1846: LDFLAGS="-framework $1 $LDFLAGS"
! 1847: dnl supplying "c" to AC_CHECK_LIB is technically cheating, but
! 1848: dnl rewriting AC_CHECK_LIB is overkill and this only affects
! 1849: dnl the "checking.." output anyway.
! 1850: AC_CHECK_LIB(c,[$2],[
! 1851: LDFLAGS=$save_old_LDFLAGS
! 1852: $3
! 1853: ],[
! 1854: LDFLAGS=$save_old_LDFLAGS
! 1855: $4
! 1856: ])
! 1857: ])
! 1858:
! 1859: dnl
! 1860: dnl PHP_CHECK_FUNC_LIB(func, libs)
! 1861: dnl
! 1862: dnl This macro checks whether 'func' or '__func' exists
! 1863: dnl in the specified library.
! 1864: dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
! 1865: dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC
! 1866: dnl
! 1867: dnl
! 1868: dnl autoconf undefines the builtin "shift" :-(
! 1869: dnl If possible, we use the builtin shift anyway, otherwise we use
! 1870: dnl the ubercool definition I have tested so far with FreeBSD/GNU m4
! 1871: ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
! 1872: define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
! 1873: ])
! 1874: dnl
! 1875: AC_DEFUN([PHP_CHECK_FUNC_LIB],[
! 1876: ifelse($2,,:,[
! 1877: unset ac_cv_lib_$2[]_$1
! 1878: unset ac_cv_lib_$2[]___$1
! 1879: unset found
! 1880: AC_CHECK_LIB($2, $1, [found=yes], [
! 1881: AC_CHECK_LIB($2, __$1, [found=yes], [found=no])
! 1882: ])
! 1883:
! 1884: if test "$found" = "yes"; then
! 1885: ac_libs=$LIBS
! 1886: LIBS="$LIBS -l$2"
! 1887: AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no])
! 1888: LIBS=$ac_libs
! 1889: fi
! 1890:
! 1891: if test "$found" = "yes"; then
! 1892: PHP_ADD_LIBRARY($2)
! 1893: PHP_DEF_HAVE($1)
! 1894: PHP_DEF_HAVE(lib$2)
! 1895: ac_cv_func_$1=yes
! 1896: else
! 1897: PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@)))
! 1898: fi
! 1899: ])
! 1900: ])
! 1901:
! 1902: dnl
! 1903: dnl PHP_CHECK_FUNC(func, ...)
! 1904: dnl
! 1905: dnl This macro checks whether 'func' or '__func' exists
! 1906: dnl in the default libraries and as a fall back in the specified library.
! 1907: dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
! 1908: dnl
! 1909: AC_DEFUN([PHP_CHECK_FUNC],[
! 1910: unset ac_cv_func_$1
! 1911: unset ac_cv_func___$1
! 1912: unset found
! 1913:
! 1914: AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
! 1915:
! 1916: case $found in
! 1917: yes[)]
! 1918: PHP_DEF_HAVE($1)
! 1919: ac_cv_func_$1=yes
! 1920: ;;
! 1921: ifelse($#,1,,[
! 1922: *[)] PHP_CHECK_FUNC_LIB($@) ;;
! 1923: ])
! 1924: esac
! 1925: ])
! 1926:
! 1927: dnl
! 1928: dnl PHP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs [, extra-source]])
! 1929: dnl
! 1930: dnl This macro checks whether build works and given function exists.
! 1931: dnl
! 1932: AC_DEFUN([PHP_TEST_BUILD], [
! 1933: old_LIBS=$LIBS
! 1934: LIBS="$4 $LIBS"
! 1935: AC_TRY_RUN([
! 1936: $5
! 1937: char $1();
! 1938: int main() {
! 1939: $1();
! 1940: return 0;
! 1941: }
! 1942: ], [
! 1943: LIBS=$old_LIBS
! 1944: $2
! 1945: ],[
! 1946: LIBS=$old_LIBS
! 1947: $3
! 1948: ],[
! 1949: LIBS=$old_LIBS
! 1950: ])
! 1951: ])
! 1952:
! 1953: dnl -------------------------------------------------------------------------
! 1954: dnl Platform characteristics checks
! 1955: dnl -------------------------------------------------------------------------
! 1956:
! 1957: dnl
! 1958: dnl PHP_SHLIB_SUFFIX_NAMES
! 1959: dnl
! 1960: dnl Determines link library suffix SHLIB_SUFFIX_NAME
! 1961: dnl which can be: .so, .sl or .dylib
! 1962: dnl
! 1963: dnl Determines shared library suffix SHLIB_DL_SUFFIX_NAME
! 1964: dnl suffix can be: .so or .sl
! 1965: dnl
! 1966: AC_DEFUN([PHP_SHLIB_SUFFIX_NAMES],[
! 1967: AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
! 1968: PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
! 1969: PHP_SUBST_OLD(SHLIB_DL_SUFFIX_NAME)
! 1970: SHLIB_SUFFIX_NAME=so
! 1971: SHLIB_DL_SUFFIX_NAME=$SHLIB_SUFFIX_NAME
! 1972: case $host_alias in
! 1973: *hpux*[)]
! 1974: SHLIB_SUFFIX_NAME=sl
! 1975: SHLIB_DL_SUFFIX_NAME=sl
! 1976: ;;
! 1977: *darwin*[)]
! 1978: SHLIB_SUFFIX_NAME=dylib
! 1979: SHLIB_DL_SUFFIX_NAME=so
! 1980: ;;
! 1981: esac
! 1982: ])
! 1983:
! 1984: dnl
! 1985: dnl PHP_CHECK_64BIT([do if 32], [do if 64])
! 1986: dnl
! 1987: dnl This macro is used to detect if we're at 64-bit platform or not.
! 1988: dnl It could be useful for those external libs, that have different precompiled
! 1989: dnl versions in different directories.
! 1990: dnl
! 1991: AC_DEFUN([PHP_CHECK_64BIT],[
! 1992: AC_CHECK_SIZEOF(long int, 4)
! 1993: AC_MSG_CHECKING([checking if we're at 64-bit platform])
! 1994: if test "$ac_cv_sizeof_long_int" = "4" ; then
! 1995: AC_MSG_RESULT([no])
! 1996: $1
! 1997: else
! 1998: AC_MSG_RESULT([yes])
! 1999: $2
! 2000: fi
! 2001: ])
! 2002:
! 2003: dnl
! 2004: dnl PHP_C_BIGENDIAN
! 2005: dnl
! 2006: dnl Replacement macro for AC_C_BIGENDIAN
! 2007: dnl
! 2008: AC_DEFUN([PHP_C_BIGENDIAN],
! 2009: [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
! 2010: [
! 2011: ac_cv_c_bigendian_php=unknown
! 2012: AC_TRY_RUN(
! 2013: [
! 2014: int main(void)
! 2015: {
! 2016: short one = 1;
! 2017: char *cp = (char *)&one;
! 2018:
! 2019: if (*cp == 0) {
! 2020: return(0);
! 2021: } else {
! 2022: return(1);
! 2023: }
! 2024: }
! 2025: ], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
! 2026: ])
! 2027: if test $ac_cv_c_bigendian_php = yes; then
! 2028: AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
! 2029: fi
! 2030: ])
! 2031:
! 2032: dnl -------------------------------------------------------------------------
! 2033: dnl Checks for programs: PHP_PROG_<program>
! 2034: dnl -------------------------------------------------------------------------
! 2035:
! 2036: dnl
! 2037: dnl PHP_PROG_SENDMAIL
! 2038: dnl
! 2039: dnl Search for the sendmail binary
! 2040: dnl
! 2041: AC_DEFUN([PHP_PROG_SENDMAIL], [
! 2042: PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
! 2043: AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH)
! 2044: PHP_SUBST(PROG_SENDMAIL)
! 2045: ])
! 2046:
! 2047: dnl
! 2048: dnl PHP_PROG_AWK
! 2049: dnl
! 2050: dnl Some vendors force mawk before gawk; mawk is broken so we don't like that
! 2051: dnl
! 2052: AC_DEFUN([PHP_PROG_AWK], [
! 2053: AC_CHECK_PROGS(AWK, gawk nawk awk mawk, bork, /usr/xpg4/bin/:$PATH)
! 2054: case "$AWK" in
! 2055: *mawk)
! 2056: AC_MSG_WARN([mawk is known to have problems on some systems. You should install GNU awk])
! 2057: ;;
! 2058: *gawk)
! 2059: ;;
! 2060: bork)
! 2061: AC_MSG_ERROR([Could not find awk; Install GNU awk])
! 2062: ;;
! 2063: *)
! 2064: AC_MSG_CHECKING([if $AWK is broken])
! 2065: if ! $AWK 'function foo() {}' >/dev/null 2>&1 ; then
! 2066: AC_MSG_RESULT([yes])
! 2067: AC_MSG_ERROR([You should install GNU awk])
! 2068: else
! 2069: AC_MSG_RESULT([no])
! 2070: fi
! 2071: ;;
! 2072: esac
! 2073: PHP_SUBST(AWK)
! 2074: ])
! 2075:
! 2076: dnl
! 2077: dnl PHP_PROG_BISON
! 2078: dnl
! 2079: dnl Search for bison and check it's version
! 2080: dnl
! 2081: AC_DEFUN([PHP_PROG_BISON], [
! 2082: AC_PROG_YACC
! 2083: LIBZEND_BISON_CHECK
! 2084: PHP_SUBST(YACC)
! 2085: ])
! 2086:
! 2087: dnl
! 2088: dnl PHP_PROG_LEX
! 2089: dnl
! 2090: dnl Search for (f)lex and check it's version
! 2091: dnl
! 2092: AC_DEFUN([PHP_PROG_LEX], [
! 2093: dnl we only support certain flex versions
! 2094: flex_version_list="2.5.4"
! 2095:
! 2096: AC_PROG_LEX
! 2097: if test "$LEX" = "flex"; then
! 2098: dnl AC_DECL_YYTEXT is obsolete since autoconf 2.50 and merged into AC_PROG_LEX
! 2099: dnl this is what causes that annoying "PHP_PROG_LEX is expanded from" warning with autoconf 2.50+
! 2100: dnl it should be removed once we drop support of autoconf 2.13 (if ever)
! 2101: AC_DECL_YYTEXT
! 2102: :
! 2103: fi
! 2104: dnl ## Make flex scanners use const if they can, even if __STDC__ is not
! 2105: dnl ## true, for compilers like Sun's that only set __STDC__ true in
! 2106: dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
! 2107: AC_C_CONST
! 2108: if test "$ac_cv_c_const" = "yes" ; then
! 2109: LEX_CFLAGS="-DYY_USE_CONST"
! 2110: fi
! 2111:
! 2112: if test "$LEX" = "flex"; then
! 2113: AC_CACHE_CHECK([for flex version], php_cv_flex_version, [
! 2114: flex_version=`$LEX -V -v --version 2>/dev/null | $SED -e 's/^.* //'`
! 2115: php_cv_flex_version=invalid
! 2116: for flex_check_version in $flex_version_list; do
! 2117: if test "$flex_version" = "$flex_check_version"; then
! 2118: php_cv_flex_version="$flex_check_version (ok)"
! 2119: fi
! 2120: done
! 2121: ])
! 2122: else
! 2123: flex_version=none
! 2124: fi
! 2125:
! 2126: case $php_cv_flex_version in
! 2127: ""|invalid[)]
! 2128: if test -f "$abs_srcdir/Zend/zend_language_scanner.c" && test -f "$abs_srcdir/Zend/zend_ini_scanner.c"; then
! 2129: AC_MSG_WARN([flex versions supported for regeneration of the Zend/PHP parsers: $flex_version_list (found: $flex_version)])
! 2130: else
! 2131: flex_msg="Supported flex versions are: $flex_version_list"
! 2132: if test "$flex_version" = "none"; then
! 2133: flex_msg="flex not found. flex is required to generate the Zend/PHP parsers! $flex_msg"
! 2134: else
! 2135: flex_msg="Found invalid flex version: $flex_version. $flex_msg"
! 2136: fi
! 2137: AC_MSG_ERROR([$flex_msg])
! 2138: fi
! 2139: LEX="exit 0;"
! 2140: ;;
! 2141: esac
! 2142: PHP_SUBST(LEX)
! 2143: ])
! 2144:
! 2145: dnl
! 2146: dnl PHP_PROG_RE2C
! 2147: dnl
! 2148: dnl Search for the re2c binary and check the version
! 2149: dnl
! 2150: AC_DEFUN([PHP_PROG_RE2C],[
! 2151: AC_CHECK_PROG(RE2C, re2c, re2c)
! 2152: if test -n "$RE2C"; then
! 2153: AC_CACHE_CHECK([for re2c version], php_cv_re2c_version, [
! 2154: re2c_vernum=`$RE2C --vernum 2>/dev/null`
! 2155: if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1304"; then
! 2156: php_cv_re2c_version=invalid
! 2157: else
! 2158: php_cv_re2c_version="`$RE2C --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
! 2159: fi
! 2160: ])
! 2161: fi
! 2162: case $php_cv_re2c_version in
! 2163: ""|invalid[)]
! 2164: AC_MSG_WARN([You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.])
! 2165: RE2C="exit 0;"
! 2166: ;;
! 2167: esac
! 2168: PHP_SUBST(RE2C)
! 2169: ])
! 2170:
! 2171: dnl -------------------------------------------------------------------------
! 2172: dnl Common setup macros: PHP_SETUP_<what>
! 2173: dnl -------------------------------------------------------------------------
! 2174:
! 2175: dnl
! 2176: dnl PHP_SETUP_ICU([shared-add])
! 2177: dnl
! 2178: dnl Common setup macro for ICU
! 2179: dnl
! 2180: AC_DEFUN([PHP_SETUP_ICU],[
! 2181: PHP_ARG_WITH(icu-dir,,
! 2182: [ --with-icu-dir=DIR Specify where ICU libraries and headers can be found], DEFAULT, no)
! 2183:
! 2184: if test "$PHP_ICU_DIR" = "no"; then
! 2185: PHP_ICU_DIR=DEFAULT
! 2186: fi
! 2187:
! 2188: if test "$PHP_ICU_DIR" = "DEFAULT"; then
! 2189: dnl Try to find icu-config
! 2190: AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
! 2191: else
! 2192: ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
! 2193: fi
! 2194:
! 2195: AC_MSG_CHECKING([for location of ICU headers and libraries])
! 2196:
! 2197: dnl Trust icu-config to know better what the install prefix is..
! 2198: icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
! 2199: if test "$?" != "0" || test -z "$icu_install_prefix"; then
! 2200: AC_MSG_RESULT([not found])
! 2201: AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
! 2202: else
! 2203: AC_MSG_RESULT([$icu_install_prefix])
! 2204:
! 2205: dnl Check ICU version
! 2206: AC_MSG_CHECKING([for ICU 3.4 or greater])
! 2207: icu_version_full=`$ICU_CONFIG --version`
! 2208: ac_IFS=$IFS
! 2209: IFS="."
! 2210: set $icu_version_full
! 2211: IFS=$ac_IFS
! 2212: icu_version=`expr [$]1 \* 1000 + [$]2`
! 2213: AC_MSG_RESULT([found $icu_version_full])
! 2214:
! 2215: if test "$icu_version" -lt "3004"; then
! 2216: AC_MSG_ERROR([ICU version 3.4 or later is required])
! 2217: fi
! 2218:
! 2219: ICU_VERSION=$icu_version
! 2220: ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
! 2221: ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
! 2222: PHP_EVAL_INCLINE($ICU_INCS)
! 2223: PHP_EVAL_LIBLINE($ICU_LIBS, $1)
! 2224: fi
! 2225: ])
! 2226:
! 2227: dnl
! 2228: dnl PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]])
! 2229: dnl
! 2230: dnl Common setup macro for kerberos
! 2231: dnl
! 2232: AC_DEFUN([PHP_SETUP_KERBEROS],[
! 2233: found_kerberos=no
! 2234: unset KERBEROS_CFLAGS
! 2235: unset KERBEROS_LIBS
! 2236:
! 2237: dnl First try to find krb5-config
! 2238: if test -z "$KRB5_CONFIG"; then
! 2239: AC_PATH_PROG(KRB5_CONFIG, krb5-config, no, [$PATH:/usr/kerberos/bin:/usr/local/bin])
! 2240: fi
! 2241:
! 2242: dnl If krb5-config is found try using it
! 2243: if test "$PHP_KERBEROS" = "yes" && test -x "$KRB5_CONFIG"; then
! 2244: KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi`
! 2245: KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi`
! 2246:
! 2247: if test -n "$KERBEROS_LIBS"; then
! 2248: found_kerberos=yes
! 2249: PHP_EVAL_LIBLINE($KERBEROS_LIBS, $1)
! 2250: PHP_EVAL_INCLINE($KERBEROS_CFLAGS)
! 2251: fi
! 2252: fi
! 2253:
! 2254: dnl If still not found use old skool method
! 2255: if test "$found_kerberos" = "no"; then
! 2256:
! 2257: if test "$PHP_KERBEROS" = "yes"; then
! 2258: PHP_KERBEROS="/usr/kerberos /usr/local /usr"
! 2259: fi
! 2260:
! 2261: for i in $PHP_KERBEROS; do
! 2262: if test -f $i/$PHP_LIBDIR/libkrb5.a || test -f $i/$PHP_LIBDIR/libkrb5.$SHLIB_SUFFIX_NAME; then
! 2263: PHP_KERBEROS_DIR=$i
! 2264: break
! 2265: fi
! 2266: done
! 2267:
! 2268: if test "$PHP_KERBEROS_DIR"; then
! 2269: found_kerberos=yes
! 2270: PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/$PHP_LIBDIR, $1)
! 2271: PHP_ADD_LIBRARY(gssapi_krb5, 1, $1)
! 2272: PHP_ADD_LIBRARY(krb5, 1, $1)
! 2273: PHP_ADD_LIBRARY(k5crypto, 1, $1)
! 2274: PHP_ADD_LIBRARY(com_err, 1, $1)
! 2275: PHP_ADD_INCLUDE($PHP_KERBEROS_DIR/include)
! 2276: fi
! 2277: fi
! 2278:
! 2279: if test "$found_kerberos" = "yes"; then
! 2280: ifelse([$2],[],:,[$2])
! 2281: ifelse([$3],[],,[else $3])
! 2282: fi
! 2283: ])
! 2284:
! 2285: dnl
! 2286: dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])
! 2287: dnl
! 2288: dnl Common setup macro for openssl
! 2289: dnl
! 2290: AC_DEFUN([PHP_SETUP_OPENSSL],[
! 2291: found_openssl=no
! 2292: unset OPENSSL_INCDIR
! 2293: unset OPENSSL_LIBDIR
! 2294:
! 2295: dnl Empty variable means 'no'
! 2296: test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
! 2297: test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
! 2298:
! 2299: dnl Fallbacks for different configure options
! 2300: if test -n "$PHP_OPENSSL" && test "$PHP_OPENSSL" != "no"; then
! 2301: PHP_OPENSSL_DIR=$PHP_OPENSSL
! 2302: elif test -n "$PHP_IMAP_SSL" && test "$PHP_IMAP_SSL" != "no"; then
! 2303: PHP_OPENSSL_DIR=$PHP_IMAP_SSL
! 2304: fi
! 2305:
! 2306: dnl First try to find pkg-config
! 2307: if test -z "$PKG_CONFIG"; then
! 2308: AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
! 2309: fi
! 2310:
! 2311: dnl If pkg-config is found try using it
! 2312: if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
! 2313: if $PKG_CONFIG --atleast-version=0.9.6 openssl; then
! 2314: found_openssl=yes
! 2315: OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
! 2316: OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
! 2317: OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
! 2318: else
! 2319: AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
! 2320: fi
! 2321:
! 2322: if test -n "$OPENSSL_LIBS" && test -n "$OPENSSL_INCS"; then
! 2323: PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
! 2324: PHP_EVAL_INCLINE($OPENSSL_INCS)
! 2325: fi
! 2326: fi
! 2327:
! 2328: dnl If pkg-config fails for some reason, revert to the old method
! 2329: if test "$found_openssl" = "no"; then
! 2330:
! 2331: if test "$PHP_OPENSSL_DIR" = "yes"; then
! 2332: PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
! 2333: fi
! 2334:
! 2335: for i in $PHP_OPENSSL_DIR; do
! 2336: if test -r $i/include/openssl/evp.h; then
! 2337: OPENSSL_INCDIR=$i/include
! 2338: fi
! 2339: if test -r $i/$PHP_LIBDIR/libssl.a -o -r $i/$PHP_LIBDIR/libssl.$SHLIB_SUFFIX_NAME; then
! 2340: OPENSSL_LIBDIR=$i/$PHP_LIBDIR
! 2341: fi
! 2342: test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
! 2343: done
! 2344:
! 2345: if test -z "$OPENSSL_INCDIR"; then
! 2346: AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
! 2347: fi
! 2348:
! 2349: if test -z "$OPENSSL_LIBDIR"; then
! 2350: AC_MSG_ERROR([Cannot find OpenSSL's libraries])
! 2351: fi
! 2352:
! 2353: old_CPPFLAGS=$CPPFLAGS
! 2354: CPPFLAGS=-I$OPENSSL_INCDIR
! 2355: AC_MSG_CHECKING([for OpenSSL version])
! 2356: AC_EGREP_CPP(yes,[
! 2357: #include <openssl/opensslv.h>
! 2358: #if OPENSSL_VERSION_NUMBER >= 0x0090600fL
! 2359: yes
! 2360: #endif
! 2361: ],[
! 2362: AC_MSG_RESULT([>= 0.9.6])
! 2363: ],[
! 2364: AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
! 2365: ])
! 2366: CPPFLAGS=$old_CPPFLAGS
! 2367:
! 2368: PHP_ADD_INCLUDE($OPENSSL_INCDIR)
! 2369:
! 2370: PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
! 2371: PHP_ADD_LIBRARY(crypto,,$1)
! 2372: ],[
! 2373: AC_MSG_ERROR([libcrypto not found!])
! 2374: ],[
! 2375: -L$OPENSSL_LIBDIR
! 2376: ])
! 2377:
! 2378: old_LIBS=$LIBS
! 2379: LIBS="$LIBS -lcrypto"
! 2380: PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
! 2381: found_openssl=yes
! 2382: ],[
! 2383: AC_MSG_ERROR([libssl not found!])
! 2384: ],[
! 2385: -L$OPENSSL_LIBDIR
! 2386: ])
! 2387: LIBS=$old_LIBS
! 2388: PHP_ADD_LIBRARY(ssl,,$1)
! 2389: PHP_ADD_LIBRARY(crypto,,$1)
! 2390:
! 2391: PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1)
! 2392: fi
! 2393:
! 2394: if test "$found_openssl" = "yes"; then
! 2395: dnl For apache 1.3.x static build
! 2396: OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
! 2397: AC_SUBST(OPENSSL_INCDIR_OPT)
! 2398:
! 2399: ifelse([$2],[],:,[$2])
! 2400: ifelse([$3],[],,[else $3])
! 2401: fi
! 2402: ])
! 2403:
! 2404: dnl
! 2405: dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
! 2406: dnl
! 2407: dnl Common setup macro for iconv
! 2408: dnl
! 2409: AC_DEFUN([PHP_SETUP_ICONV], [
! 2410: found_iconv=no
! 2411: unset ICONV_DIR
! 2412:
! 2413: # Create the directories for a VPATH build:
! 2414: $php_shtool mkdir -p ext/iconv
! 2415:
! 2416: echo > ext/iconv/php_have_bsd_iconv.h
! 2417: echo > ext/iconv/php_have_ibm_iconv.h
! 2418: echo > ext/iconv/php_have_glibc_iconv.h
! 2419: echo > ext/iconv/php_have_libiconv.h
! 2420: echo > ext/iconv/php_have_iconv.h
! 2421: echo > ext/iconv/php_php_iconv_impl.h
! 2422: echo > ext/iconv/php_iconv_aliased_libiconv.h
! 2423: echo > ext/iconv/php_php_iconv_h_path.h
! 2424: echo > ext/iconv/php_iconv_supports_errno.h
! 2425:
! 2426: dnl
! 2427: dnl Check libc first if no path is provided in --with-iconv
! 2428: dnl
! 2429: if test "$PHP_ICONV" = "yes"; then
! 2430: AC_CHECK_FUNC(iconv, [
! 2431: found_iconv=yes
! 2432: ],[
! 2433: AC_CHECK_FUNC(libiconv,[
! 2434: PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
! 2435: AC_DEFINE(HAVE_LIBICONV, 1, [ ])
! 2436: found_iconv=yes
! 2437: ])
! 2438: ])
! 2439: fi
! 2440:
! 2441: dnl
! 2442: dnl Check external libs for iconv funcs
! 2443: dnl
! 2444: if test "$found_iconv" = "no"; then
! 2445:
! 2446: for i in $PHP_ICONV /usr/local /usr; do
! 2447: if test -r $i/include/giconv.h; then
! 2448: AC_DEFINE(HAVE_GICONV_H, 1, [ ])
! 2449: ICONV_DIR=$i
! 2450: iconv_lib_name=giconv
! 2451: break
! 2452: elif test -r $i/include/iconv.h; then
! 2453: ICONV_DIR=$i
! 2454: iconv_lib_name=iconv
! 2455: break
! 2456: fi
! 2457: done
! 2458:
! 2459: if test -z "$ICONV_DIR"; then
! 2460: AC_MSG_ERROR([Please specify the install prefix of iconv with --with-iconv=<DIR>])
! 2461: fi
! 2462:
! 2463: if test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.a ||
! 2464: test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME
! 2465: then
! 2466: PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
! 2467: found_iconv=yes
! 2468: PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
! 2469: AC_DEFINE(HAVE_LIBICONV,1,[ ])
! 2470: PHP_DEFINE([ICONV_ALIASED_LIBICONV],1,[ext/iconv])
! 2471: AC_DEFINE([ICONV_ALIASED_LIBICONV],1,[iconv() is aliased to libiconv() in -liconv])
! 2472: ], [
! 2473: PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
! 2474: found_iconv=yes
! 2475: ], [], [
! 2476: -L$ICONV_DIR/$PHP_LIBDIR
! 2477: ])
! 2478: ], [
! 2479: -L$ICONV_DIR/$PHP_LIBDIR
! 2480: ])
! 2481: fi
! 2482: fi
! 2483:
! 2484: if test "$found_iconv" = "yes"; then
! 2485: PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
! 2486: AC_DEFINE(HAVE_ICONV,1,[ ])
! 2487: if test -n "$ICONV_DIR"; then
! 2488: PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/$PHP_LIBDIR, $1)
! 2489: PHP_ADD_INCLUDE($ICONV_DIR/include)
! 2490: fi
! 2491: $2
! 2492: ifelse([$3],[],,[else $3])
! 2493: fi
! 2494: ])
! 2495:
! 2496: dnl
! 2497: dnl PHP_SETUP_LIBXML(shared-add [, action-found [, action-not-found]])
! 2498: dnl
! 2499: dnl Common setup macro for libxml
! 2500: dnl
! 2501: AC_DEFUN([PHP_SETUP_LIBXML], [
! 2502: AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
! 2503: [
! 2504: for i in $PHP_LIBXML_DIR /usr/local /usr; do
! 2505: if test -x "$i/bin/xml2-config"; then
! 2506: ac_cv_php_xml2_config_path="$i/bin/xml2-config"
! 2507: break
! 2508: fi
! 2509: done
! 2510: ])
! 2511:
! 2512: if test -x "$ac_cv_php_xml2_config_path"; then
! 2513: XML2_CONFIG="$ac_cv_php_xml2_config_path"
! 2514: libxml_full_version=`$XML2_CONFIG --version`
! 2515: ac_IFS=$IFS
! 2516: IFS="."
! 2517: set $libxml_full_version
! 2518: IFS=$ac_IFS
! 2519: LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
! 2520: if test "$LIBXML_VERSION" -ge "2006011"; then
! 2521: LIBXML_LIBS=`$XML2_CONFIG --libs`
! 2522: LIBXML_INCS=`$XML2_CONFIG --cflags`
! 2523: PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
! 2524: PHP_EVAL_INCLINE($LIBXML_INCS)
! 2525:
! 2526: dnl Check that build works with given libs
! 2527: AC_CACHE_CHECK(whether libxml build works, php_cv_libxml_build_works, [
! 2528: PHP_TEST_BUILD(xmlInitParser,
! 2529: [
! 2530: php_cv_libxml_build_works=yes
! 2531: ], [
! 2532: AC_MSG_RESULT(no)
! 2533: AC_MSG_ERROR([build test failed. Please check the config.log for details.])
! 2534: ], [
! 2535: [$]$1
! 2536: ])
! 2537: ])
! 2538: if test "$php_cv_libxml_build_works" = "yes"; then
! 2539: AC_DEFINE(HAVE_LIBXML, 1, [ ])
! 2540: fi
! 2541: $2
! 2542: else
! 2543: AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.])
! 2544: fi
! 2545: ifelse([$3],[],,[else $3])
! 2546: fi
! 2547: ])
! 2548:
! 2549: dnl -------------------------------------------------------------------------
! 2550: dnl Misc. macros
! 2551: dnl -------------------------------------------------------------------------
! 2552:
! 2553: dnl
! 2554: dnl PHP_INSTALL_HEADERS(path [, file ...])
! 2555: dnl
! 2556: dnl PHP header files to be installed
! 2557: dnl
! 2558: AC_DEFUN([PHP_INSTALL_HEADERS],[
! 2559: ifelse([$2],[],[
! 2560: for header_file in $1; do
! 2561: PHP_RUN_ONCE(INSTALLHEADERS, $header_file, [
! 2562: INSTALL_HEADERS="$INSTALL_HEADERS $header_file"
! 2563: ])
! 2564: done
! 2565: ], [
! 2566: header_path=$1
! 2567: for header_file in $2; do
! 2568: hp_hf="$header_path/$header_file"
! 2569: PHP_RUN_ONCE(INSTALLHEADERS, $hp_hf, [
! 2570: INSTALL_HEADERS="$INSTALL_HEADERS $hp_hf"
! 2571: ])
! 2572: done
! 2573: ])
! 2574: ])
! 2575:
! 2576: dnl
! 2577: dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
! 2578: dnl
! 2579: dnl This macro is used to get a comparable
! 2580: dnl version for apache1/2.
! 2581: dnl
! 2582: AC_DEFUN([PHP_AP_EXTRACT_VERSION],[
! 2583: ac_output=`$1 -v 2>&1 | grep version | $SED -e 's/Oracle-HTTP-//'`
! 2584: ac_IFS=$IFS
! 2585: IFS="- /.
! 2586: "
! 2587: set $ac_output
! 2588: IFS=$ac_IFS
! 2589:
! 2590: APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
! 2591: ])
! 2592:
! 2593: dnl
! 2594: dnl PHP_DEBUG_MACRO(filename)
! 2595: dnl
! 2596: AC_DEFUN([PHP_DEBUG_MACRO],[
! 2597: DEBUG_LOG=$1
! 2598: cat >$1 <<X
! 2599: CONFIGURE: $CONFIGURE_COMMAND
! 2600: CC: $CC
! 2601: CFLAGS: $CFLAGS
! 2602: CPPFLAGS: $CPPFLAGS
! 2603: CXX: $CXX
! 2604: CXXFLAGS: $CXXFLAGS
! 2605: INCLUDES: $INCLUDES
! 2606: LDFLAGS: $LDFLAGS
! 2607: LIBS: $LIBS
! 2608: DLIBS: $DLIBS
! 2609: SAPI: $PHP_SAPI
! 2610: PHP_RPATHS: $PHP_RPATHS
! 2611: uname -a: `uname -a`
! 2612:
! 2613: X
! 2614: cat >conftest.$ac_ext <<X
! 2615: main()
! 2616: {
! 2617: exit(0);
! 2618: }
! 2619: X
! 2620: (eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1
! 2621: rm -fr conftest*
! 2622: ])
! 2623:
! 2624: dnl
! 2625: dnl PHP_CONFIG_NICE(filename)
! 2626: dnl
! 2627: dnl Generates the config.nice file
! 2628: dnl
! 2629: AC_DEFUN([PHP_CONFIG_NICE],[
! 2630: AC_REQUIRE([AC_PROG_EGREP])
! 2631: AC_REQUIRE([LT_AC_PROG_SED])
! 2632: PHP_SUBST_OLD(EGREP)
! 2633: PHP_SUBST_OLD(SED)
! 2634: test -f $1 && mv $1 $1.old
! 2635: rm -f $1.old
! 2636: cat >$1<<EOF
! 2637: #! /bin/sh
! 2638: #
! 2639: # Created by configure
! 2640:
! 2641: EOF
! 2642:
! 2643: for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS EXTRA_LDFLAGS_PROGRAM LIBS CC CXX; do
! 2644: eval val=\$$var
! 2645: if test -n "$val"; then
! 2646: echo "$var='$val' \\" >> $1
! 2647: fi
! 2648: done
! 2649:
! 2650: echo "'[$]0' \\" >> $1
! 2651: if test `expr -- [$]0 : "'.*"` = 0; then
! 2652: CONFIGURE_COMMAND="$CONFIGURE_COMMAND '[$]0'"
! 2653: else
! 2654: CONFIGURE_COMMAND="$CONFIGURE_COMMAND [$]0"
! 2655: fi
! 2656: for arg in $ac_configure_args; do
! 2657: if test `expr -- $arg : "'.*"` = 0; then
! 2658: if test `expr -- $arg : "--.*"` = 0; then
! 2659: break;
! 2660: fi
! 2661: echo "'[$]arg' \\" >> $1
! 2662: CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS '[$]arg'"
! 2663: else
! 2664: if test `expr -- $arg : "'--.*"` = 0; then
! 2665: break;
! 2666: fi
! 2667: echo "[$]arg \\" >> $1
! 2668: CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS [$]arg"
! 2669: fi
! 2670: done
! 2671: echo '"[$]@"' >> $1
! 2672: chmod +x $1
! 2673: CONFIGURE_COMMAND="$CONFIGURE_COMMAND $CONFIGURE_OPTIONS"
! 2674: PHP_SUBST_OLD(CONFIGURE_COMMAND)
! 2675: PHP_SUBST_OLD(CONFIGURE_OPTIONS)
! 2676: ])
! 2677:
! 2678: dnl
! 2679: dnl PHP_CHECK_CONFIGURE_OPTIONS
! 2680: dnl
! 2681: AC_DEFUN([PHP_CHECK_CONFIGURE_OPTIONS],[
! 2682: for arg in $ac_configure_args; do
! 2683: case $arg in
! 2684: --with-*[)]
! 2685: arg_name="`echo [$]arg | $SED -e 's/--with-/with-/g' -e 's/=.*//g'`"
! 2686: ;;
! 2687: --without-*[)]
! 2688: arg_name="`echo [$]arg | $SED -e 's/--without-/with-/g' -e 's/=.*//g'`"
! 2689: ;;
! 2690: --enable-*[)]
! 2691: arg_name="`echo [$]arg | $SED -e 's/--enable-/enable-/g' -e 's/=.*//g'`"
! 2692: ;;
! 2693: --disable-*[)]
! 2694: arg_name="`echo [$]arg | $SED -e 's/--disable-/enable-/g' -e 's/=.*//g'`"
! 2695: ;;
! 2696: *[)]
! 2697: continue
! 2698: ;;
! 2699: esac
! 2700: case $arg_name in
! 2701: # Allow --disable-all / --enable-all
! 2702: enable-all[)];;
! 2703:
! 2704: # Allow certain libtool options
! 2705: enable-libtool-lock | with-pic | with-tags | enable-shared | enable-static | enable-fast-install | with-gnu-ld[)];;
! 2706:
! 2707: # Allow certain TSRM options
! 2708: with-tsrm-pth | with-tsrm-st | with-tsrm-pthreads[)];;
! 2709:
! 2710: # Allow certain Zend options
! 2711: with-zend-vm | enable-maintainer-zts | enable-inline-optimization[)];;
! 2712:
! 2713: # All the rest must be set using the PHP_ARG_* macros
! 2714: # PHP_ARG_* macros set php_enable_<arg_name> or php_with_<arg_name>
! 2715: *[)]
! 2716: # Options that exist before PHP 6
! 2717: if test "$PHP_MAJOR_VERSION" -lt "6"; then
! 2718: case $arg_name in
! 2719: enable-zend-multibyte[)] continue;;
! 2720: esac
! 2721: fi
! 2722:
! 2723: is_arg_set=php_[]`echo [$]arg_name | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-' 'abcdefghijklmnopqrstuvwxyz_'`
! 2724: if eval test "x\$$is_arg_set" = "x"; then
! 2725: PHP_UNKNOWN_CONFIGURE_OPTIONS="$PHP_UNKNOWN_CONFIGURE_OPTIONS
! 2726: [$]arg"
! 2727: fi
! 2728: ;;
! 2729: esac
! 2730: done
! 2731: ])
! 2732:
! 2733: dnl
! 2734: dnl PHP_CHECK_PDO_INCLUDES([found [, not-found]])
! 2735: dnl
! 2736: AC_DEFUN([PHP_CHECK_PDO_INCLUDES],[
! 2737: AC_CACHE_CHECK([for PDO includes], pdo_inc_path, [
! 2738: AC_MSG_CHECKING([for PDO includes])
! 2739: if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
! 2740: pdo_inc_path=$abs_srcdir/ext
! 2741: elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
! 2742: pdo_inc_path=$abs_srcdir/ext
! 2743: elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
! 2744: pdo_inc_path=$prefix/include/php/ext
! 2745: fi
! 2746: ])
! 2747: if test -n "$pdo_inc_path"; then
! 2748: ifelse([$1],[],:,[$1])
! 2749: else
! 2750: ifelse([$2],[],[AC_MSG_ERROR([Cannot find php_pdo_driver.h.])],[$2])
! 2751: fi
! 2752: ])
! 2753:
! 2754: dnl
! 2755: dnl PHP_DETECT_ICC
! 2756: dnl Detect Intel C++ Compiler and unset $GCC if ICC found
! 2757: AC_DEFUN([PHP_DETECT_ICC],
! 2758: [
! 2759: ICC="no"
! 2760: AC_MSG_CHECKING([for icc])
! 2761: AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
! 2762: ICC="no"
! 2763: AC_MSG_RESULT([no]),
! 2764: ICC="yes"
! 2765: GCC="no"
! 2766: AC_MSG_RESULT([yes])
! 2767: )
! 2768: ])
! 2769:
! 2770: dnl PHP_DETECT_SUNCC
! 2771: dnl Detect if the systems default compiler is suncc.
! 2772: dnl We also set some usefull CFLAGS if the user didn't set any
! 2773: AC_DEFUN([PHP_DETECT_SUNCC],[
! 2774: SUNCC="no"
! 2775: AC_MSG_CHECKING([for suncc])
! 2776: AC_EGREP_CPP([^__SUNPRO_C], [__SUNPRO_C],
! 2777: SUNCC="no"
! 2778: AC_MSG_RESULT([no]),
! 2779: SUNCC="yes"
! 2780: GCC="no"
! 2781: test -n "$auto_cflags" && CFLAGS="-O -xs -xstrconst -zlazyload"
! 2782: GCC=""
! 2783: AC_MSG_RESULT([yes])
! 2784: )
! 2785: ])
! 2786:
! 2787: dnl
! 2788: dnl PHP_CRYPT_R_STYLE
! 2789: dnl detect the style of crypt_r() is any is available
! 2790: dnl see APR_CHECK_CRYPT_R_STYLE() for original version
! 2791: dnl
! 2792: AC_DEFUN([PHP_CRYPT_R_STYLE],
! 2793: [
! 2794: AC_CACHE_CHECK([which data struct is used by crypt_r], php_cv_crypt_r_style,[
! 2795: php_cv_crypt_r_style=none
! 2796: AC_TRY_COMPILE([
! 2797: #define _REENTRANT 1
! 2798: #include <crypt.h>
! 2799: ],[
! 2800: CRYPTD buffer;
! 2801: crypt_r("passwd", "hash", &buffer);
! 2802: ],
! 2803: php_cv_crypt_r_style=cryptd)
! 2804:
! 2805: if test "$php_cv_crypt_r_style" = "none"; then
! 2806: AC_TRY_COMPILE([
! 2807: #define _REENTRANT 1
! 2808: #include <crypt.h>
! 2809: ],[
! 2810: struct crypt_data buffer;
! 2811: crypt_r("passwd", "hash", &buffer);
! 2812: ],
! 2813: php_cv_crypt_r_style=struct_crypt_data)
! 2814: fi
! 2815:
! 2816: if test "$php_cv_crypt_r_style" = "none"; then
! 2817: AC_TRY_COMPILE([
! 2818: #define _REENTRANT 1
! 2819: #define _GNU_SOURCE
! 2820: #include <crypt.h>
! 2821: ],[
! 2822: struct crypt_data buffer;
! 2823: crypt_r("passwd", "hash", &buffer);
! 2824: ],
! 2825: php_cv_crypt_r_style=struct_crypt_data_gnu_source)
! 2826: fi
! 2827: ])
! 2828:
! 2829: if test "$php_cv_crypt_r_style" = "cryptd"; then
! 2830: AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
! 2831: fi
! 2832: if test "$php_cv_crypt_r_style" = "struct_crypt_data" -o "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
! 2833: AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data])
! 2834: fi
! 2835: if test "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
! 2836: AC_DEFINE(CRYPT_R_GNU_SOURCE, 1, [Define if struct crypt_data requires _GNU_SOURCE])
! 2837: fi
! 2838: if test "$php_cv_crypt_r_style" = "none"; then
! 2839: AC_MSG_ERROR([Unable to detect data struct used by crypt_r])
! 2840: fi
! 2841: ])
! 2842:
! 2843: dnl
! 2844: dnl PHP_TEST_WRITE_STDOUT
! 2845: dnl
! 2846: AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
! 2847: AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[
! 2848: AC_TRY_RUN([
! 2849: #ifdef HAVE_UNISTD_H
! 2850: #include <unistd.h>
! 2851: #endif
! 2852:
! 2853: #define TEXT "This is the test message -- "
! 2854:
! 2855: main()
! 2856: {
! 2857: int n;
! 2858:
! 2859: n = write(1, TEXT, sizeof(TEXT)-1);
! 2860: return (!(n == sizeof(TEXT)-1));
! 2861: }
! 2862: ],[
! 2863: ac_cv_write_stdout=yes
! 2864: ],[
! 2865: ac_cv_write_stdout=no
! 2866: ],[
! 2867: ac_cv_write_stdout=no
! 2868: ])
! 2869: ])
! 2870: if test "$ac_cv_write_stdout" = "yes"; then
! 2871: AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works])
! 2872: fi
! 2873: ])
! 2874:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>