Annotation of embedaddon/php/acinclude.m4, revision 1.1.1.4.2.1.2.1

1.1       misho       1: dnl
1.1.1.4.2.1.2  1(misho     2:4): dnl $Id: acinclude.m4,v 1.1.1.4.2.1 2013/10/14 08:17:37 misho Exp $
1.1       misho       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({,})
1.1.1.4   misho      69:     ep_dir=`echo $1|$SED 's%/*[^/][^/]*/*$%%'`
1.1       misho      70:     changequote([,])
1.1.1.4   misho      71:     ep_realdir=`(cd "$ep_dir" && pwd)`
                     72:     $2="$ep_realdir"/`basename "$1"`
1.1       misho      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],[
1.1.1.2   misho     197:   PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS))
1.1       misho     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
1.1.1.2   misho     765:     PHP_ADD_LIBRARY(stdc++)
1.1       misho     766:     php_cxx_done=yes
                    767:   fi
                    768: ])
                    769: 
                    770: dnl
                    771: dnl PHP_BUILD_SHARED
                    772: dnl
                    773: AC_DEFUN([PHP_BUILD_SHARED],[
                    774:   PHP_BUILD_PROGRAM
                    775:   OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
1.1.1.2   misho     776:   php_sapi_module=shared
1.1       misho     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: 
                    787: dnl
                    788: dnl PHP_BUILD_STATIC
                    789: dnl
                    790: AC_DEFUN([PHP_BUILD_STATIC],[
                    791:   PHP_BUILD_PROGRAM
                    792:   OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
1.1.1.2   misho     793:   php_sapi_module=static
1.1       misho     794: ])
                    795: 
                    796: dnl
                    797: dnl PHP_BUILD_BUNDLE
                    798: dnl
                    799: AC_DEFUN([PHP_BUILD_BUNDLE],[
                    800:   PHP_BUILD_PROGRAM
                    801:   OVERALL_TARGET=libs/libphp[]$PHP_MAJOR_VERSION[.bundle]
1.1.1.2   misho     802:   php_sapi_module=static
1.1       misho     803: ])
                    804: 
                    805: dnl
                    806: dnl PHP_BUILD_PROGRAM
                    807: dnl
                    808: AC_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: 
                    831: dnl
                    832: dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx, zend_ext)
                    833: dnl
                    834: dnl Basically sets up the link-stage for building module-name
                    835: dnl from object_var in build-dir.
                    836: dnl
                    837: AC_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: 
                    868: EOF
                    869: ])
                    870: 
                    871: dnl
                    872: dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])
                    873: dnl
1.1.1.2   misho     874: dnl Selects the SAPI name and type (static, shared, bundle, program)
1.1       misho     875: dnl and optionally also the source-files for the SAPI-specific
                    876: dnl objects.
                    877: dnl
                    878: AC_DEFUN([PHP_SELECT_SAPI],[
1.1.1.2   misho     879:   if test "$2" = "program"; then
                    880:     PHP_BINARIES="$PHP_BINARIES $1"
                    881:   elif test "$PHP_SAPI" != "none"; then
                    882:     AC_MSG_ERROR([
1.1       misho     883: +--------------------------------------------------------------------+
                    884: |                        *** ATTENTION ***                           |
                    885: |                                                                    |
                    886: | You've configured multiple SAPIs to be build. You can build only   |
1.1.1.2   misho     887: | one SAPI module plus CGI, CLI and FPM binaries at the same time.   |
1.1       misho     888: +--------------------------------------------------------------------+
                    889: ])
1.1.1.2   misho     890:   else
                    891:     PHP_SAPI=$1
                    892:   fi  
1.1       misho     893: 
1.1.1.2   misho     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:   ])
1.1       misho     913: ])
                    914: 
                    915: dnl deprecated
                    916: AC_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: 
                    926: AC_DEFUN([PHP_ADD_BUILD_DIR],[
                    927:   ifelse($2,,[
                    928:     BUILD_DIR="$BUILD_DIR $1"
                    929:   ], [
                    930:     $php_shtool mkdir -p $1
                    931:   ])
                    932: ])
                    933: 
                    934: AC_DEFUN([PHP_GEN_BUILD_DIRS],[
                    935:   $php_shtool mkdir -p $BUILD_DIR
                    936: ])
                    937: 
                    938: dnl
                    939: dnl PHP_NEW_EXTENSION(extname, sources [, shared [, sapi_class [, extra-cflags [, cxx [, zend_ext]]]]])
                    940: dnl
                    941: dnl Includes an extension in the build.
                    942: dnl
                    943: dnl "extname" is the name of the ext/ subdir where the extension resides.
                    944: dnl "sources" is a list of files relative to the subdir which are used
                    945: dnl to build the extension.
                    946: dnl "shared" can be set to "shared" or "yes" to build the extension as
                    947: dnl a dynamically loadable library. Optional parameter "sapi_class" can
                    948: dnl be set to "cli" to mark extension build only with CLI or CGI sapi's.
                    949: dnl "extra-cflags" are passed to the compiler, with 
                    950: dnl @ext_srcdir@ and @ext_builddir@ being substituted.
                    951: dnl "cxx" can be used to indicate that a C++ shared module is desired.
                    952: dnl "zend_ext" indicates a zend extension.
                    953: AC_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
                    960: dnl ---------------------------------------------- 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
                    969: dnl ---------------------------------------------- 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
                    985: dnl ---------------------------------------------- CLI static module
                    986:     [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
1.1.1.4.2.1.2  1(misho   987:4):     case "$PHP_SAPI" in
                    988:4):       cgi|embed[)]
                    989:4):         PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
                    990:4):         EXT_STATIC="$EXT_STATIC $1"
                    991:4):         ;;
                    992:4):       *[)]
1.1       misho     993:         PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
1.1.1.4.2.1.2  1(misho   994:4):         ;;
                    995:4):     esac
1.1       misho     996:     EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
                    997:   fi
                    998:   PHP_ADD_BUILD_DIR($ext_builddir)
                    999: 
                   1000: dnl Set for phpize builds only
                   1001: dnl --------------------------- 
                   1002:   if test "$ext_builddir" = "."; then
                   1003:     PHP_PECL_EXTENSION=$1
                   1004:     PHP_SUBST(PHP_PECL_EXTENSION)
                   1005:   fi
                   1006: ])
                   1007: 
                   1008: dnl
                   1009: dnl PHP_WITH_SHARED
                   1010: dnl
                   1011: dnl Checks whether $withval is "shared" or starts with "shared,XXX"
                   1012: dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
                   1013: dnl from $withval.
                   1014: dnl
                   1015: AC_DEFUN([PHP_WITH_SHARED],[
                   1016:   PHP_ARG_ANALYZE_EX(withval)
                   1017:   shared=$ext_shared
                   1018:   unset ext_shared ext_output
                   1019: ])
                   1020: 
                   1021: dnl
                   1022: dnl PHP_ADD_EXTENSION_DEP(extname, depends [, depconf])
                   1023: dnl
                   1024: dnl This macro is scanned by genif.sh when it builds the internal functions
                   1025: dnl list, so that modules can be init'd in the correct order
                   1026: dnl $1 = name of extension, $2 = extension upon which it depends
                   1027: dnl $3 = optional: if true, it's ok for $2 to have not been configured
                   1028: dnl default is false and should halt the build.
                   1029: dnl To be effective, this macro must be invoked *after* PHP_NEW_EXTENSION.
                   1030: dnl The extension on which it depends must also have been configured.
                   1031: dnl See ADD_EXTENSION_DEP in win32 build 
                   1032: dnl
                   1033: AC_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([
                   1039: You've configured extension $1 to build statically, but it
                   1040: depends on extension $2, which you've configured to build shared.
                   1041: You either need to build $1 shared or build $2 statically for the
                   1042: build to be successful.
                   1043: ])
                   1044:   fi
1.1.1.4.2.1.2  1(misho  1045:4):   if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then
                   1046:4):     AC_MSG_ERROR([
                   1047:4): You've configured extension $1, which depends on extension $2,
                   1048:4): but you've either not enabled $2, or have disabled it.
                   1049:4): ])
                   1050:4):   fi
1.1       misho    1051:   dnl Some systems require that we link $2 to $1 when building
                   1052: ])
                   1053: 
                   1054: dnl -------------------------------------------------------------------------
                   1055: dnl Checks for structures, typedefs, broken functions, etc.
                   1056: dnl -------------------------------------------------------------------------
                   1057: 
                   1058: dnl Internal helper macros
                   1059: dnl
                   1060: dnl _PHP_DEF_HAVE_FILE(what, filename)
                   1061: AC_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: ])
                   1065: dnl
                   1066: dnl _PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-found-action]])
                   1067: dnl
                   1068: AC_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: 
                   1088: int 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
                   1106: ifelse([$4],[],:,[$4])
                   1107: ifelse([$5],[],,[else $5])
                   1108:   fi
                   1109: ])
                   1110: 
                   1111: dnl
                   1112: dnl PHP_CHECK_SIZEOF(type, cross-value, extra-headers)
                   1113: dnl
                   1114: AC_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: 
                   1123: dnl
                   1124: dnl PHP_CHECK_TYPES(type-list, include-file [, extra-headers])
                   1125: dnl
                   1126: AC_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: 
                   1138: dnl
                   1139: dnl PHP_CHECK_IN_ADDR_T
                   1140: dnl
                   1141: AC_DEFUN([PHP_CHECK_IN_ADDR_T], [
                   1142: dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
                   1143: AC_MSG_CHECKING([for in_addr_t])
                   1144: AC_CACHE_VAL(ac_cv_type_in_addr_t,
                   1145: [AC_EGREP_CPP(dnl
                   1146: changequote(<<,>>)dnl
                   1147: <<in_addr_t[^a-zA-Z_0-9]>>dnl
                   1148: changequote([,]), [#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
                   1156: AC_MSG_RESULT([$ac_cv_type_in_addr_t])
                   1157: if test $ac_cv_type_in_addr_t = no; then
                   1158:   AC_DEFINE(in_addr_t, u_int, [ ])
                   1159: fi
                   1160: ])
                   1161: 
                   1162: dnl
                   1163: dnl PHP_TIME_R_TYPE
                   1164: dnl
                   1165: dnl Check type of reentrant time-related functions
                   1166: dnl Type can be: irix, hpux or POSIX
                   1167: dnl
                   1168: AC_DEFUN([PHP_TIME_R_TYPE],[
                   1169: AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
                   1170: AC_TRY_RUN([
                   1171: #include <time.h>
                   1172: 
                   1173: main() {
                   1174: char buf[27];
                   1175: struct tm t;
                   1176: time_t old = 0;
                   1177: int r, s;
                   1178: 
                   1179: s = gmtime_r(&old, &t);
                   1180: r = (int) asctime_r(&t, buf, 26);
                   1181: if (r == s && s == 0) return (0);
                   1182: return (1);
                   1183: }
                   1184: ],[
                   1185:   ac_cv_time_r_type=hpux
                   1186: ],[
                   1187:   AC_TRY_RUN([
                   1188: #include <time.h>
                   1189: main() {
                   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: 
                   1216: dnl
                   1217: dnl PHP_DOES_PWRITE_WORK
                   1218: dnl internal
                   1219: AC_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: 
                   1246: dnl PHP_DOES_PREAD_WORK
                   1247: dnl internal
                   1248: AC_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: 
                   1276: dnl
                   1277: dnl PHP_PWRITE_TEST
                   1278: dnl
                   1279: AC_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: 
                   1298: dnl
                   1299: dnl PHP_PREAD_TEST
                   1300: dnl
                   1301: AC_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: 
                   1320: dnl
                   1321: dnl PHP_MISSING_TIME_R_DECL
                   1322: dnl
                   1323: AC_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: 
                   1353: dnl
                   1354: dnl PHP_READDIR_R_TYPE
                   1355: dnl 
                   1356: AC_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: 
                   1370: main() {
                   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>
                   1389: int 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: 
                   1408: dnl
                   1409: dnl PHP_TM_GMTOFF
                   1410: dnl 
                   1411: AC_DEFUN([PHP_TM_GMTOFF],[
                   1412: AC_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: 
                   1417: if test "$ac_cv_struct_tm_gmtoff" = yes; then
                   1418:   AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
                   1419: fi
                   1420: ])
                   1421: 
                   1422: dnl
                   1423: dnl PHP_STRUCT_FLOCK
                   1424: dnl
                   1425: AC_DEFUN([PHP_STRUCT_FLOCK],[
                   1426: AC_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: )
                   1438: if test "$ac_cv_struct_flock" = "yes" ; then
                   1439:     AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
                   1440: fi
                   1441: ])
                   1442: 
                   1443: dnl
                   1444: dnl PHP_SOCKLEN_T
                   1445: dnl
                   1446: AC_DEFUN([PHP_SOCKLEN_T],[
                   1447: AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
                   1448:   AC_TRY_COMPILE([
                   1449: #include <sys/types.h>
                   1450: #include <sys/socket.h>
                   1451: ],[
                   1452: socklen_t x;
                   1453: ],[
                   1454:   ac_cv_socklen_t=yes
                   1455: ],[
                   1456:   ac_cv_socklen_t=no
                   1457: ]))
                   1458: if test "$ac_cv_socklen_t" = "yes"; then
                   1459:   AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
                   1460: fi
                   1461: ])
                   1462: 
                   1463: dnl
                   1464: dnl PHP_MISSING_FCLOSE_DECL
                   1465: dnl
                   1466: dnl See if we have broken header files like SunOS has.
                   1467: dnl
                   1468: AC_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: 
                   1479: dnl
                   1480: dnl PHP_AC_BROKEN_SPRINTF
                   1481: dnl
                   1482: dnl Check for broken sprintf(), C99 conformance
                   1483: dnl
                   1484: AC_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: 
                   1501: dnl
                   1502: dnl PHP_AC_BROKEN_SNPRINTF
                   1503: dnl
                   1504: dnl Check for broken snprintf(), C99 conformance
                   1505: dnl
                   1506: AC_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)
                   1510: main() {
                   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: 
                   1538: dnl
                   1539: dnl PHP_SOLARIS_PIC_WEIRDNESS
                   1540: dnl
                   1541: dnl Solaris requires main code to be position independent in order
                   1542: dnl to let shared objects find symbols.  Weird.  Ugly.
                   1543: dnl
                   1544: dnl Must be run after all --with-NN options that let the user
                   1545: dnl choose dynamic extensions, and after the gcc test.
                   1546: dnl
                   1547: AC_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: 
                   1568: dnl
                   1569: dnl PHP_SYS_LFS
                   1570: dnl
                   1571: dnl The problem is that the default compilation flags in Solaris 2.6 won't
                   1572: dnl let programs access large files;  you need to tell the compiler that
                   1573: dnl you actually want your programs to work on large files.  For more
                   1574: dnl details about this brain damage please see:
                   1575: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
                   1576: dnl
                   1577: dnl Written by Paul Eggert <eggert@twinsun.com>.
                   1578: dnl
                   1579: AC_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: 
                   1614: dnl
                   1615: dnl PHP_SOCKADDR_CHECKS
                   1616: dnl
                   1617: AC_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: 
                   1640: dnl
                   1641: dnl PHP_DECLARED_TIMEZONE
                   1642: dnl
                   1643: AC_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: 
                   1663: dnl
                   1664: dnl PHP_EBCDIC
                   1665: dnl
                   1666: AC_DEFUN([PHP_EBCDIC], [
                   1667:   AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
                   1668:   AC_TRY_RUN( [
                   1669: int 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: 
                   1684: dnl
                   1685: dnl PHP_BROKEN_GETCWD
                   1686: dnl
                   1687: dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a
                   1688: dnl component of the path has execute but not read permissions
                   1689: dnl
                   1690: AC_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: 
                   1702: dnl
                   1703: dnl PHP_BROKEN_GLIBC_FOPEN_APPEND
                   1704: dnl
                   1705: AC_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>
                   1710: int main(int argc, char *argv[])
                   1711: {
                   1712:   FILE *fp;
                   1713:   long position;
                   1714:   char *filename = "/tmp/phpglibccheck";
                   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 ],
                   1735: AC_TRY_COMPILE([
                   1736: #include <features.h>
                   1737: ],[
                   1738: #if !__GLIBC_PREREQ(2,2)
                   1739: choke 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: 
                   1754: dnl
                   1755: dnl PHP_FOPENCOOKIE
                   1756: dnl
                   1757: AC_DEFUN([PHP_FOPENCOOKIE], [
                   1758:   AC_CHECK_FUNC(fopencookie, [have_glibc_fopencookie=yes])
                   1759: 
                   1760:   if test "$have_glibc_fopencookie" = "yes"; then
                   1761: dnl this comes in two flavors:
                   1762: dnl newer glibcs (since 2.1.2 ? )
                   1763: dnl have a type called cookie_io_functions_t
                   1764: AC_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: 
                   1773: dnl even newer glibcs have a different seeker definition...
                   1774: AC_TRY_RUN([
                   1775: #define _GNU_SOURCE
                   1776: #include <stdio.h>
                   1777: 
                   1778: struct 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; }
                   1786: int closer(void *cookie)
                   1787: { return 0; }
                   1788: int seeker(void *cookie, __off64_t *position, int whence)
                   1789: { ((struct cookiedata*)cookie)->pos = *position; return 0; }
                   1790: 
                   1791: cookie_io_functions_t funcs = {reader, writer, seeker, closer};
                   1792: 
                   1793: main() {
                   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: 
                   1812: dnl older glibc versions (up to 2.1.2 ?)
                   1813: dnl call it _IO_cookie_io_functions_t
                   1814: AC_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: 
                   1834: dnl -------------------------------------------------------------------------
1.1.1.3   misho    1835: dnl Library/function existence and build sanity checks
1.1       misho    1836: dnl -------------------------------------------------------------------------
                   1837: 
                   1838: dnl
                   1839: dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]])
                   1840: dnl
                   1841: dnl Wrapper for AC_CHECK_LIB
                   1842: dnl
                   1843: AC_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: 
                   1862: dnl
                   1863: dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])
                   1864: dnl
                   1865: dnl El cheapo wrapper for AC_CHECK_LIB
                   1866: dnl
                   1867: AC_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: 
                   1882: dnl
                   1883: dnl PHP_CHECK_FUNC_LIB(func, libs)
                   1884: dnl
                   1885: dnl This macro checks whether 'func' or '__func' exists
                   1886: dnl in the specified library.
                   1887: dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
                   1888: dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC
                   1889: dnl
                   1890: dnl
                   1891: dnl autoconf undefines the builtin "shift" :-(
                   1892: dnl If possible, we use the builtin shift anyway, otherwise we use
                   1893: dnl the ubercool definition I have tested so far with FreeBSD/GNU m4
                   1894: ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
                   1895: define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
                   1896: ])
                   1897: dnl
                   1898: AC_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: 
                   1925: dnl
                   1926: dnl PHP_CHECK_FUNC(func, ...)
                   1927: dnl
                   1928: dnl This macro checks whether 'func' or '__func' exists
                   1929: dnl in the default libraries and as a fall back in the specified library.
                   1930: dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
                   1931: dnl
                   1932: AC_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: 
                   1950: dnl
                   1951: dnl PHP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs [, extra-source]])
                   1952: dnl
                   1953: dnl This macro checks whether build works and given function exists.
                   1954: dnl
                   1955: AC_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: 
                   1976: dnl -------------------------------------------------------------------------
                   1977: dnl Platform characteristics checks
                   1978: dnl -------------------------------------------------------------------------
                   1979: 
                   1980: dnl
                   1981: dnl PHP_SHLIB_SUFFIX_NAMES
                   1982: dnl
                   1983: dnl Determines link library suffix SHLIB_SUFFIX_NAME
                   1984: dnl which can be: .so, .sl or .dylib
                   1985: dnl
                   1986: dnl Determines shared library suffix SHLIB_DL_SUFFIX_NAME
                   1987: dnl suffix can be: .so or .sl
                   1988: dnl
                   1989: AC_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: 
                   2007: dnl
                   2008: dnl PHP_CHECK_64BIT([do if 32], [do if 64])
                   2009: dnl
                   2010: dnl This macro is used to detect if we're at 64-bit platform or not.
                   2011: dnl It could be useful for those external libs, that have different precompiled 
                   2012: dnl versions in different directories.
                   2013: dnl
                   2014: AC_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: 
                   2026: dnl
                   2027: dnl PHP_C_BIGENDIAN
                   2028: dnl
                   2029: dnl Replacement macro for AC_C_BIGENDIAN
                   2030: dnl
                   2031: AC_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:   [
                   2037: int 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: 
                   2055: dnl -------------------------------------------------------------------------
                   2056: dnl Checks for programs: PHP_PROG_<program>
                   2057: dnl -------------------------------------------------------------------------
                   2058: 
                   2059: dnl
                   2060: dnl PHP_PROG_SENDMAIL
                   2061: dnl
                   2062: dnl Search for the sendmail binary
                   2063: dnl
                   2064: AC_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: 
                   2070: dnl
                   2071: dnl PHP_PROG_AWK
                   2072: dnl
                   2073: dnl Some vendors force mawk before gawk; mawk is broken so we don't like that
                   2074: dnl
                   2075: AC_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: 
                   2099: dnl
                   2100: dnl PHP_PROG_BISON
                   2101: dnl
                   2102: dnl Search for bison and check it's version
                   2103: dnl
                   2104: AC_DEFUN([PHP_PROG_BISON], [
                   2105:   AC_PROG_YACC
                   2106:   LIBZEND_BISON_CHECK
                   2107:   PHP_SUBST(YACC)
                   2108: ])
                   2109: 
                   2110: dnl
                   2111: dnl PHP_PROG_LEX
                   2112: dnl
                   2113: dnl Search for (f)lex and check it's version
                   2114: dnl
                   2115: AC_DEFUN([PHP_PROG_LEX], [
                   2116: dnl we only support certain flex versions
                   2117:   flex_version_list="2.5.4"
                   2118:    
                   2119:   AC_PROG_LEX
                   2120:   if test "$LEX" = "flex"; then
                   2121: dnl AC_DECL_YYTEXT is obsolete since autoconf 2.50 and merged into AC_PROG_LEX
                   2122: dnl this is what causes that annoying "PHP_PROG_LEX is expanded from" warning with autoconf 2.50+
                   2123: dnl 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: 
                   2168: dnl
                   2169: dnl PHP_PROG_RE2C
                   2170: dnl
                   2171: dnl Search for the re2c binary and check the version
                   2172: dnl
                   2173: AC_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: 
                   2194: dnl -------------------------------------------------------------------------
                   2195: dnl Common setup macros: PHP_SETUP_<what>
                   2196: dnl -------------------------------------------------------------------------
                   2197: 
                   2198: dnl
                   2199: dnl PHP_SETUP_ICU([shared-add])
                   2200: dnl
                   2201: dnl Common setup macro for ICU
                   2202: dnl
                   2203: AC_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 3.4 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 "3004"; then
                   2239:       AC_MSG_ERROR([ICU version 3.4 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: 
                   2250: dnl
                   2251: dnl PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]])
                   2252: dnl
                   2253: dnl Common setup macro for kerberos
                   2254: dnl
                   2255: AC_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
                   2303: ifelse([$2],[],:,[$2])
                   2304: ifelse([$3],[],,[else $3])
                   2305:   fi
                   2306: ])
                   2307: 
                   2308: dnl 
                   2309: dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])
                   2310: dnl
                   2311: dnl Common setup macro for openssl
                   2312: dnl
                   2313: AC_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
1.1.1.4.2.1.2  1(misho  2323:4):   if test "$PHP_OPENSSL" != "no"; then
1.1       misho    2324:     PHP_OPENSSL_DIR=$PHP_OPENSSL
1.1.1.4.2.1.2  1(misho  2325:4):   elif test "$PHP_IMAP_SSL" != "no"; then
1.1       misho    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: 
1.1.1.3   misho    2345:     if test -n "$OPENSSL_LIBS"; then
1.1       misho    2346:       PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
1.1.1.3   misho    2347:     fi
                   2348:     if test -n "$OPENSSL_INCS"; then
1.1       misho    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: 
                   2424: ifelse([$2],[],:,[$2])
                   2425: ifelse([$3],[],,[else $3])
                   2426:   fi
                   2427: ])
                   2428: 
                   2429: dnl 
                   2430: dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
                   2431: dnl
                   2432: dnl Common setup macro for iconv
                   2433: dnl
                   2434: AC_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
1.1.1.3   misho    2454: 
1.1       misho    2455:   if test "$PHP_ICONV" = "yes"; then
1.1.1.3   misho    2456:     dnl Reset LIBS temporarily as it may have already been included
                   2457:     dnl -liconv in.
                   2458:     LIBS_save="$LIBS"
                   2459:     LIBS=
1.1       misho    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:     ])
1.1.1.3   misho    2469:     LIBS="$LIBS_save"
1.1       misho    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
                   2523: ifelse([$3],[],,[else $3])
                   2524:   fi
                   2525: ])
                   2526: 
                   2527: dnl 
                   2528: dnl PHP_SETUP_LIBXML(shared-add [, action-found [, action-not-found]])
                   2529: dnl
                   2530: dnl Common setup macro for libxml
                   2531: dnl
                   2532: AC_DEFUN([PHP_SETUP_LIBXML], [
                   2533: AC_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
                   2576: ifelse([$3],[],,[else $3])
                   2577:   fi
                   2578: ])
                   2579: 
                   2580: dnl -------------------------------------------------------------------------
                   2581: dnl Misc. macros
                   2582: dnl -------------------------------------------------------------------------
                   2583: 
                   2584: dnl 
                   2585: dnl PHP_INSTALL_HEADERS(path [, file ...])
                   2586: dnl
                   2587: dnl PHP header files to be installed
                   2588: dnl
                   2589: AC_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: 
                   2607: dnl
                   2608: dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
                   2609: dnl
                   2610: dnl This macro is used to get a comparable
                   2611: dnl version for apache1/2.
                   2612: dnl
                   2613: AC_DEFUN([PHP_AP_EXTRACT_VERSION],[
                   2614:   ac_output=`$1 -v 2>&1 | grep version | $SED -e 's/Oracle-HTTP-//'`
                   2615:   ac_IFS=$IFS
                   2616: IFS="- /.
                   2617: "
                   2618:   set $ac_output
                   2619:   IFS=$ac_IFS
                   2620: 
                   2621:   APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
                   2622: ])
                   2623: 
                   2624: dnl
                   2625: dnl PHP_DEBUG_MACRO(filename)
                   2626: dnl 
                   2627: AC_DEFUN([PHP_DEBUG_MACRO],[
                   2628:   DEBUG_LOG=$1
                   2629:   cat >$1 <<X
                   2630: CONFIGURE:  $CONFIGURE_COMMAND
                   2631: CC:         $CC
                   2632: CFLAGS:     $CFLAGS
                   2633: CPPFLAGS:   $CPPFLAGS
                   2634: CXX:        $CXX
                   2635: CXXFLAGS:   $CXXFLAGS
                   2636: INCLUDES:   $INCLUDES
                   2637: LDFLAGS:    $LDFLAGS
                   2638: LIBS:       $LIBS
                   2639: DLIBS:      $DLIBS
                   2640: SAPI:       $PHP_SAPI
                   2641: PHP_RPATHS: $PHP_RPATHS
                   2642: uname -a:   `uname -a`
                   2643: 
                   2644: X
                   2645:     cat >conftest.$ac_ext <<X
                   2646: main()
                   2647: {
                   2648:   exit(0);
                   2649: }
                   2650: X
                   2651:     (eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1
                   2652:     rm -fr conftest*
                   2653: ])
                   2654: 
                   2655: dnl
                   2656: dnl PHP_CONFIG_NICE(filename)
                   2657: dnl
                   2658: dnl Generates the config.nice file
                   2659: dnl
                   2660: AC_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: 
                   2672: EOF
                   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
1.1.1.2   misho    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
1.1       misho    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: 
                   2709: dnl
                   2710: dnl PHP_CHECK_CONFIGURE_OPTIONS
                   2711: dnl
                   2712: AC_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: 
                   2764: dnl
                   2765: dnl PHP_CHECK_PDO_INCLUDES([found [, not-found]])
                   2766: dnl
                   2767: AC_DEFUN([PHP_CHECK_PDO_INCLUDES],[
1.1.1.2   misho    2768:   AC_CACHE_CHECK([for PDO includes], pdo_cv_inc_path, [
1.1       misho    2769:     AC_MSG_CHECKING([for PDO includes])
                   2770:     if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
1.1.1.2   misho    2771:       pdo_cv_inc_path=$abs_srcdir/ext
1.1       misho    2772:     elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
1.1.1.2   misho    2773:       pdo_cv_inc_path=$abs_srcdir/ext
1.1       misho    2774:     elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
1.1.1.2   misho    2775:       pdo_cv_inc_path=$prefix/include/php/ext
1.1       misho    2776:     fi
                   2777:   ])
1.1.1.2   misho    2778:   if test -n "$pdo_cv_inc_path"; then
1.1       misho    2779: ifelse([$1],[],:,[$1])
                   2780:   else
                   2781: ifelse([$2],[],[AC_MSG_ERROR([Cannot find php_pdo_driver.h.])],[$2])
                   2782:   fi
                   2783: ])
                   2784: 
                   2785: dnl
                   2786: dnl PHP_DETECT_ICC
                   2787: dnl Detect Intel C++ Compiler and unset $GCC if ICC found
                   2788: AC_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: 
                   2801: dnl PHP_DETECT_SUNCC
                   2802: dnl Detect if the systems default compiler is suncc.
                   2803: dnl We also set some usefull CFLAGS if the user didn't set any
                   2804: AC_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: 
                   2818: dnl
                   2819: dnl PHP_CRYPT_R_STYLE
                   2820: dnl detect the style of crypt_r() is any is available
                   2821: dnl see APR_CHECK_CRYPT_R_STYLE() for original version
                   2822: dnl
                   2823: AC_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: ],[
                   2831: CRYPTD buffer;
                   2832: crypt_r("passwd", "hash", &buffer);
                   2833: ], 
                   2834: php_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: ],[
                   2841: struct crypt_data buffer;
                   2842: crypt_r("passwd", "hash", &buffer);
                   2843: ], 
                   2844: php_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: ],[
                   2853: struct crypt_data buffer;
                   2854: crypt_r("passwd", "hash", &buffer);
                   2855: ], 
                   2856: php_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: 
                   2874: dnl
                   2875: dnl PHP_TEST_WRITE_STDOUT
                   2876: dnl
                   2877: AC_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: 
                   2886: main()
                   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: 
1.1.1.2   misho    2906: dnl
                   2907: dnl PHP_INIT_DTRACE(providerdesc, header-file, sources [, module])
                   2908: dnl
                   2909: AC_DEFUN([PHP_INIT_DTRACE],[
                   2910: dnl 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: 
                   2917: dnl providerdesc
                   2918:   ac_provsrc=$1
                   2919:   old_IFS=[$]IFS
                   2920:   IFS=.
                   2921:   set $ac_provsrc
                   2922:   ac_provobj=[$]1
                   2923:   IFS=$old_IFS
                   2924: 
                   2925: dnl header-file
                   2926:   ac_hdrobj=$2
                   2927: 
1.1.1.4   misho    2928: dnl Add providerdesc.o or .lo into global objects when needed
1.1.1.2   misho    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*)
1.1.1.4   misho    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"
1.1.1.2   misho    2939:     ;;
                   2940:   esac
                   2941: 
                   2942: dnl 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: 
                   2964: dnl Generate Makefile.objects entries
1.1.1.4   misho    2965: dnl The empty $ac_provsrc command stops an implicit circular dependency
                   2966: dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
1.1.1.2   misho    2967:   cat>>Makefile.objects<<EOF
                   2968: 
1.1.1.4   misho    2969: $abs_srcdir/$ac_provsrc:;
                   2970: 
1.1.1.2   misho    2971: $ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
1.1.1.4   misho    2972:        CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
1.1.1.2   misho    2973: 
                   2974: \$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
                   2975: 
1.1.1.4   misho    2976: EOF
                   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;
                   2987: dnl 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: 
                   3003: EOF
                   3004: 
                   3005:     ;;
                   3006:   *)
                   3007: cat>>Makefile.objects<<EOF
1.1.1.2   misho    3008: $ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
1.1.1.4   misho    3009:        CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
1.1.1.2   misho    3010: 
                   3011: EOF
1.1.1.4   misho    3012:     ;;
                   3013:   esac
1.1.1.2   misho    3014: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>