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