Annotation of embedaddon/php/sapi/caudium/config.m4, revision 1.1.1.2

1.1       misho       1: dnl
1.1.1.2 ! misho       2: dnl $Id$
1.1       misho       3: dnl 
                      4: 
                      5: RESULT=no
                      6: PHP_ARG_WITH(caudium,,
                      7: [  --with-caudium[=DIR]    Build PHP as a Pike module for use with Caudium.
                      8:                           DIR is the Caudium server dir [/usr/local/caudium/server]], no, no)
                      9: 
                     10: AC_MSG_CHECKING([for Caudium support])
                     11: 
                     12: if test "$PHP_CAUDIUM" != "no"; then
                     13:   if test "$prefix" = "NONE"; then CPREF=/usr/local/; fi
                     14:   if test ! -d $PHP_CAUDIUM ; then
                     15:     if test "$prefix" = "NONE"; then
                     16:       PHP_CAUDIUM=/usr/local/caudium/server/
                     17:     else
                     18:       PHP_CAUDIUM=$prefix/caudium/server/
                     19:     fi
                     20:   fi
                     21:   if test -f $PHP_CAUDIUM/bin/caudium; then
                     22:     PIKE=$PHP_CAUDIUM/bin/caudium
                     23:   elif test -f $PHP_CAUDIUM/bin/pike; then
                     24:     PIKE=$PHP_CAUDIUM/bin/pike
                     25:   else
                     26:     AC_MSG_ERROR([Could not find a pike in $PHP_CAUDIUM/bin/])
                     27:   fi
                     28:   if $PIKE -e 'float v; int rel;sscanf(version(), "Pike v%f release %d", v, rel);v += rel/10000.0; if(v < 7.0268) exit(1); exit(0);'; then
                     29:     PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
                     30:     PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,' `
                     31:     if test -z "$PIKE_INCLUDE_DIR" || test -z "$PIKE_MODULE_DIR"; then
                     32:       AC_MSG_ERROR(Failed to figure out Pike module and include directories)
                     33:     fi
                     34:     AC_MSG_RESULT(yes)
                     35:     PIKE=`echo $PIKE | pike -e 'int tries=100;
                     36:        string orig,pike=Stdio.File("stdin")->read()-"\n";
                     37:        orig=pike;
                     38:        if(search(orig, "/"))
                     39:          orig = combine_path(getcwd(), orig);
                     40:        while(!catch(pike=readlink(pike)) && tries--)
                     41:          ;
                     42:        write(combine_path(dirname(orig), pike)); '`
                     43:     PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
                     44:     if test "$prefix" != "NONE"; then
                     45:       PIKE_C_INCLUDE=$prefix/include/`basename $PIKE`
                     46:     else
                     47:       PIKE_C_INCLUDE=/usr/local/include/`basename $PIKE`
                     48:     fi
                     49:     AC_MSG_CHECKING([for C includes in $PIKE_C_INCLUDE])
                     50:     if test -f $PIKE_C_INCLUDE/version.h; then
                     51:       PIKE_TEST_VER=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
                     52:       ###### VERSION MATCH CHECK #######
                     53:       PMAJOR="^#define PIKE_MAJOR_VERSION"
                     54:       PMINOR="^#define PIKE_MINOR_VERSION"
                     55:       PBUILD="^#define PIKE_BUILD_VERSION"
                     56: 
                     57:       PIKE_CMAJOR_VERSION=0
                     58:       PIKE_CMINOR_VERSION=0
                     59:       PIKE_CBUILD_VERSION=0
                     60: 
                     61:       PIKE_CMAJOR_VERSION=`grep "$PMAJOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
                     62:       if test -z "$PIKE_CMAJOR_VERSION"; then
                     63:         if test -n "`grep f_version $PIKE_C_INCLUDE/version.h`"; then
                     64:           PIKE_CMAJOR_VERSION=6
                     65:         fi
                     66:       else
                     67:         PIKE_CMINOR_VERSION=`grep "$PMINOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
                     68:         PIKE_CBUILD_VERSION=`grep "$PBUILD" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
                     69:       fi
                     70: 
                     71:       if test "$PIKE_TEST_VER" = "${PIKE_CMAJOR_VERSION}.${PIKE_CMINOR_VERSION}.${PIKE_CBUILD_VERSION}"; then
                     72:         PHP_ADD_INCLUDE($PIKE_C_INCLUDE)
                     73:         PIKE_INCLUDE_DIR="$PIKE_INCLUDE_DIR, $PIKE_C_INCLUDE"
                     74:         AC_MSG_RESULT(found)
                     75:       else
                     76:         AC_MSG_RESULT(version mismatch)
                     77:       fi
                     78:     else
                     79:       AC_MSG_RESULT(not found)
                     80:     fi
                     81:   else
                     82:     AC_MSG_ERROR([Caudium PHP5 requires Pike 7.0 or newer])
                     83:   fi
                     84:   PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`   
                     85:   AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
                     86:   PHP_SELECT_SAPI(caudium, shared, caudium.c)
                     87:   INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_CAUDIUM/lib/$PIKE_VERSION/PHP5.so"
                     88:   RESULT="  *** Pike binary used:         $PIKE
                     89:   *** Pike include dir(s) used: $PIKE_INCLUDE_DIR
                     90:   *** Pike version:             $PIKE_VERSION"
                     91:   dnl Always use threads since thread-free support really blows.
                     92:   PHP_BUILD_THREAD_SAFE
                     93: fi
                     94: AC_MSG_RESULT($RESULT)
                     95: 
                     96: dnl ## Local Variables:
                     97: dnl ## tab-width: 4
                     98: dnl ## End:

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