Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
552 lines (492 sloc) 16.8 KB
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(roadsend-pcc)
AC_CONFIG_SRCDIR([runtime/opaque-math.h])
AC_CONFIG_HEADER([runtime/config.h])
# items we want defined in config.h
AH_TEMPLATE(HAVE_PCRE,[perl compatible regular expressions])
AH_TEMPLATE(HAVE_FCGI,[FastCGI web backend support])
AH_TEMPLATE(HAVE_XML,[libxml extension])
AH_TEMPLATE(HAVE_MYSQL,[MySQL extension])
AH_TEMPLATE(HAVE_LIBREADLINE,[readline support])
AH_TEMPLATE(PCC_OS,[target os])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CANONICAL_SYSTEM
# requirements
# can't figure out how to get this into AC_CHECK_PROG_VER below?
# have to change it there too
want_bigloo="3.0c, 3.1a, 3.1b, 3.2a, 3.2b, 3.2c, 3.3a, 3.4a"
want_curl=7.15.1
# defaults
with_pccwin=no
#with_pdo=check
with_pdo_mysql=no
with_pdo_sqlite=no
# default ext list. unfortunately we have two, because the lib names are different
# from the directory names, and we need both
EXT_LIST="standard curl"
PCC_EXT_LIST="php-std php-curl"
PHP_EXT_LIST=""
PDO_DRIVER_LIST="" # for use in Makefile, actual source files, delimited by space
PDO_DRIVER_ARRAY="" # for use in PHP array, quoted and delimited by comma
BE_LIST="micro"
# bigloo
AC_CHECK_PROG_VER([HAVE_BIGLOO],
bigloo,
-revision,
[\([2-9].[0-9][a-z]\)],
[3.0c | 3.1a | 3.1b | 3.2a | 3.2b | 3.2c | 3.3a | 3.4a],
AC_MSG_FAILURE([Bigloo version $want_bigloo required in the system path]))
BIGLOO_VERSION=$ac_prog_version
BIGLOO_LIB_PATH=`bigloo -eval "(display *default-lib-dir*)(exit 0)"`
BIGLOO_GC_LIB=`bigloo -eval "(display *gc-lib*)(exit 0)"`
AC_CHECK_PROG([HAVE_ENVSUBST], envsubst, envsubst, false)
if test "x$HAVE_ENVSUBST" != "xenvsubst"
then
AC_MSG_FAILURE([envsubst is missing (usually supplied with gettext)])
fi
# XXX for now we require PCC_HOME variable
#AC_MSG_CHECKING([for existence of PCC_HOME variable])
#AS_IF([test -z $PCC_HOME ],
# AC_MSG_ERROR([You *MUST* define the PCC_HOME environment variable to point to the source root directory!]),
# AC_MSG_RESULT($PCC_HOME))
# curl
AC_CHECK_CURL([$want_curl],
AC_DEFINE([HAVE_CURL], [1],[Define if you have curl]),
AC_MSG_FAILURE([libcurl version $want_curl required]))
with_curl=yes
AC_PATH_PROG(curlconfig,curl-config)
if test [ -z "$curlconfig" ]
then
AC_MSG_FAILURE([curl is required, but test for pkg-config not found])
else
CURL_CFLAGS="`curl-config --cflags` \$(EXTENSION_DLL_CFLAGS) -DCURL_STATICLIB"
CURL_STATIC_CFLAGS="\$(CURL_CFLAGS)"
CURL_LIBS="`curl-config --libs`"
fi
# pdo
AC_ARG_WITH([pdo],
[AS_HELP_STRING([--with-pdo],
[support PDO database abstraction extension @<:@default=check@:>@])],
,
[with_pdo=check])
# readline
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline],
[support fancy command line editing @<:@default=check@:>@])],
[],
[with_readline=check])
LIBREADLINE=
AS_IF([test "x$with_readline" != xno],
[AC_CHECK_LIB([readline], [main],
[AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
AC_DEFINE([HAVE_LIBREADLINE], [1],
[Define if you have libreadline])
with_readline=yes
],
[if test "x$with_readline" != xcheck; then
AC_MSG_FAILURE(
[--with-readline was given, but test for readline failed])
fi
], -lncurses)])
# PCRE
AC_ARG_WITH([pcre],
[AS_HELP_STRING([--with-pcre],
[support pcre extension @<:@default=check@:>@])],
[],
[with_pcre=check])
AS_IF([test "x$with_pcre" != xno],
[AC_PATH_PROG(pcreconfig,pcre-config)
if test [ -z "$pcreconfig" ]
then
if test "x$with_pcre" != xcheck; then
AC_MSG_FAILURE([--with-pcre was given, but test for pcre-config not found])
fi
with_pcre=no
else
with_pcre=yes
AC_DEFINE([HAVE_PCRE], [1],[Define if you have pcre])
PCRE_LIBS=`${pcreconfig} --libs`
PCRE_CFLAGS="`${pcreconfig} --cflags` \$(EXTENSION_DLL_CFLAGS)"
EXT_LIST="$EXT_LIST pcre"
PCC_EXT_LIST="$PCC_EXT_LIST php-pcre"
fi
])
# FASTCGI
AC_ARG_WITH([fcgi],
[AS_HELP_STRING([--with-fcgi],
[support FastCGI web backend @<:@default=check@:>@])],
[],
[with_fcgi=check])
AS_IF([test "x$with_fcgi" != xno],
[AC_CHECK_LIB([fcgi], [FCGX_Accept_r],
[AC_SUBST([FCGI_LIBS], ["-lfcgi"])
with_fcgi=yes
FCGI_LIBS=-lfcgi
FCGI_CFLAGS=
AC_DEFINE([HAVE_FCGI], [1],[Define if you have FastCGI])
BE_LIST="$BE_LIST fastcgi"
],
[if test "x$with_fcgi" != xcheck; then
AC_MSG_FAILURE(
[--with-fcgi was given, but test for FastCGI failed])
fi
with_fcgi=no
])
])
# XML
AC_ARG_WITH([xml],
[AS_HELP_STRING([--with-xml],
[support xml extension @<:@default=check@:>@])],
[],
[with_xml=check])
AS_IF([test "x$with_xml" != xno],
[AC_PATH_PROG(pkgconfig,pkg-config)
if test [ -z "$pkgconfig" ] || [ ! $pkgconfig --exists libxml-2.0 ]
then
if test "x$with_xml" != xcheck; then
AC_MSG_FAILURE([--with-xml was given, but test for pkg-config not found])
fi
with_xml=no
else
with_xml=yes
AC_DEFINE([HAVE_XML], [1],[Define if you have libxml2])
XML_LIBS=`${pkgconfig} --libs libxml-2.0`
XML_CFLAGS="`${pkgconfig} --cflags libxml-2.0` \$(EXTENSION_DLL_CFLAGS)"
EXT_LIST="$EXT_LIST xml"
PCC_EXT_LIST="$PCC_EXT_LIST php-xml"
fi
])
# MYSQL
AC_ARG_WITH([mysql],
[AS_HELP_STRING([--with-mysql],
[support mysql extension @<:@default=check@:>@])],
[],
[with_mysql=check])
AS_IF([test "x$with_mysql" != xno],
[AC_PATH_PROG(mysqlconfig,mysql_config)
# remove doubled slashes because they made mysql_config on
# os/x return different cflags (!)
mysqlconfig=`echo $mysqlconfig | sed s'/\/\//\//g'`
if test [ -z "$mysqlconfig" ]
then
if test "x$with_mysql" != xcheck; then
AC_MSG_FAILURE([--with-mysql was given, but test for mysqlconfig not found])
fi
with_mysql=no
else
with_mysql=yes
AC_DEFINE([HAVE_MYSQL], [1],[Define if you have MySQL])
MYSQL_LIBS=`${mysqlconfig} --libs`
MYSQL_CFLAGS="`${mysqlconfig} --cflags` \$(EXTENSION_DLL_CFLAGS)"
echo "set mysqlcflags to $MYSQL_CFLAGS thanks to ${mysqlconfig} --cflags"
EXT_LIST="$EXT_LIST mysql"
PCC_EXT_LIST="$PCC_EXT_LIST php-mysql"
# pdo-mysql
AS_IF([test "x$with_pdo" != xno],
[
with_pdo=yes
with_pdo_mysql=yes
PDO_DRIVER_LIST="$PDO_DRIVER_LIST pdo_mysql"
PDO_DRIVER_ARRAY="$PDO_DRIVER_ARRAY 'pdo_mysql',"
])
fi
])
# SQLITE (see acinclude)
AX_LIB_SQLITE3
if test "x$with_sqlite3" == xyes; then
EXT_LIST="$EXT_LIST sqlite"
PCC_EXT_LIST="$PCC_EXT_LIST php-sqlite"
# pdo-sqlite
AS_IF([test "x$with_pdo" != xno],
[
with_pdo=yes
with_pdo_sqlite=yes
PDO_DRIVER_LIST="$PDO_DRIVER_LIST pdo_sqlite"
PDO_DRIVER_ARRAY="$PDO_DRIVER_ARRAY 'pdo_sqlite',"
SQLITE3_CFLAGS="\$(EXTENSION_DLL_CFLAGS)"
SQLITE3_LDFLAGS="\$(EXTENSION_DLL_LIBS) -L/usr/local/lib -lsqlite3"
])
fi
# ODBC
AC_ARG_WITH([odbc],
[AS_HELP_STRING([--with-odbc],
[support ODBC extension @<:@default=check@:>@])],
[],
[with_odbc=check])
AS_IF([test "x$with_odbc" != xno],
[AC_PATH_PROG(odbcconfig,odbc_config,iodbc-config)
if test [ -z "$odbcconfig" ]
then
if test "x$with_odbc" != xcheck; then
AC_MSG_FAILURE([--with-odbc was given, but test for odbc-config not found])
fi
with_odbc=no
else
with_odbc=yes
AC_DEFINE([HAVE_ODBC], [1],[Define if you have ODBC])
ODBC_LIBS=`${odbcconfig} --libs`
ODBC_CFLAGS="`${odbcconfig} --cflags` \$(EXTENSION_DLL_CFLAGS)"
EXT_LIST="$EXT_LIST odbc"
PCC_EXT_LIST="$PCC_EXT_LIST php-odbc"
fi
])
# gtk1
AC_ARG_WITH([gtk],
[AS_HELP_STRING([--with-gtk],
[support PHP-GTK extension @<:@default=no@:>@])],
[],
[with_gtk=no])
AS_IF([test "x$with_gtk" != xno],
[AC_PATH_PROG(gtkconfig,gtk-config)
if test [ -z "$gtkconfig" ]
then
if test "x$with_gtk" != xcheck; then
AC_MSG_FAILURE([--with-gtk was given, but test for gtk-config not found])
fi
with_gtk=no
else
with_gtk=yes
AC_DEFINE([HAVE_GTK], [1],[Define if you have GTK])
# XXX fixme, this is in the gtk makefile right now
#GTK_LIBS=`${odbcconfig} --libs`
#GTK_CFLAGS=`${odbcconfig} --cflags`
EXT_LIST="$EXT_LIST gtk"
PCC_EXT_LIST="$PCC_EXT_LIST php-gtk"
fi
])
# gtk2
AC_ARG_WITH([gtk2],
[AS_HELP_STRING([--with-gtk2],
[support PHP-GTK 2 extension @<:@default=no@:>@])],
[],
[with_gtk2=no])
AS_IF([test "x$with_gtk2" != xno],
EXT_LIST="$EXT_LIST gtk2")
# sockets
AC_ARG_WITH([sockets],
[AS_HELP_STRING([--with-sockets],
[support sockets extension @<:@default=yes@:>@])],
[],
[with_sockets=yes])
AS_IF([test "x$with_socket" != xno],
EXT_LIST="$EXT_LIST sockets")
# target OS
case "$target_os" in
linux*)
AC_MSG_NOTICE([configuring for linux])
AC_DEFINE(PCC_OS, ["PCC_LINUX"])
PCC_OS="PCC_LINUX"
PCC_LINK_OPTIONS=
# SHARED_FLAG="-shared"
RESOLVER_LIB="-lresolv"
SO_EXT="so"
STD_LIBS="-lresolv -lm -lcrypt"
STD_CFLAGS=""
LD_LIBRARY_PATH_VAR=LD_LIBRARY_PATH
;;
freebsd*)
AC_MSG_NOTICE([configuring for FreeBSD])
AC_DEFINE(PCC_OS, ["PCC_FREEBSD"])
PCC_OS="PCC_FREEBSD"
PCC_LINK_OPTIONS=
# SHARED_FLAG="-shared"
RESOLVER_LIB=""
SO_EXT="so"
STD_LIBS="-lcrypt"
STD_CFLAGS=""
LD_LIBRARY_PATH_VAR=LD_LIBRARY_PATH
;;
mingw*)
AC_MSG_NOTICE([configuring for windows/mingw])
AC_DEFINE(PCC_OS, ["PCC_MINGW"])
PCC_OS="PCC_MINGW"
PCC_LINK_OPTIONS="-ldopt \" -Wl,--enable-auto-import \""
# SHARED_FLAG="-shared"
SO_EXT="dll"
RESOLVER_LIB=""
#jfcouic 2008-10-30 begin : report Makefile.mingw
#on windows, the DLLs cannot have unresolved symbols
RUNTIME_DLL_LIBS="-L ../libs/ \$(PROFILER_LIB) -lws2_32 -liberty"
COMPILER_DLL_LIBS="-L ../libs/ \$(RUNTIME_LIB) \$(PROFILER_LIB) \$(WEBCONNECT_LIB) -lws2_32"
WEBCONNECT_DLL_LIBS="-L ../libs/ \$(RUNTIME_LIB) \$(PROFILER_LIB) -lws2_32"
FASTCGI_DLL_LIBS="-L ../../libs/ \$(RUNTIME_LIB) \$(PROFILER_LIB) \$(PHPEVAL_LIB) \$(WEBCONNECT_LIB) -L/usr/local/lib -lfcgi -lws2_32"
CGI_DLL_LIBS="-L ../../libs/ \$(RUNTIME_LIB) \$(PROFILER_LIB) \$(PHPEVAL_LIB) \$(WEBCONNECT_LIB) -lws2_32"
MHTTPD_DLL_LIBS="-L ../../libs/ \$(RUNTIME_LIB) \$(PROFILER_LIB) \$(PHPEVAL_LIB) \$(WEBCONNECT_LIB) -L/usr/local/lib -lwebserver -lws2_32"
EXTENSION_DLL_CFLAGS="-DBGL_BUILDING_DLL -IC:/msys/1.0/local/include"
EXTENSION_DLL_LIBS="-Wl,--enable-auto-import -L \$(LIB) \$(RUNTIME_LIB) \$(PROFILER_LIB) \$(PHPEVAL_LIB) -lws2_32 -lm"
PROFILER_DLL_LIBS="-L /usr/local/lib -lgw32c -lole32 -luuid"
DOTEST_LIBS="-L /usr/local/lib -lgw32c -lws2_32"
#jfcouic 2008-10-30 end
#jfcouic 2008-11-01 begin
# report compatibility for time and flock to compile
# in the profiler
WINDOWS_TIME_SUPPORT="windows-time"
# in the runtime
WINDOWS_C_SUPPORT="windows-time windows-flock"
#jfcouic 2008-11-01 end
#-future version with the SU SUV selection
# STD_LIBS="-lws2_32 \$(BIGLOO_LIBS)"
#-ugly-current for testing
STD_LIBS="-Wl,--enable-auto-import -LC:/msys/1.0/local/lib -lws2_32 \$(BIGLOO_LIBS)"
STD_CFLAGS="\$(EXTENSION_DLL_CFLAGS)"
LD_LIBRARY_PATH_VAR=PATH
with_pccwin=yes
;;
darwin*)
AC_MSG_NOTICE([configuring for Mac OS/X])
AC_DEFINE(PCC_OS, ["PCC_MACOSX"])
PCC_OS="PCC_MACOSX"
PCC_LINK_OPTIONS=
# SHARED_FLAG="-r -dynamiclib -undefined dynamic_lookup"
SO_EXT="dylib"
RESOLVER_LIB="-lresolv"
STD_LIBS="-lresolv -lm"
STD_CFLAGS=""
;;
*)
AC_MSG_NOTICE([unknown/unsupported target operating system: $target_os])
esac
# final pdo check
AS_IF([test "x$with_pdo" == xyes],
[
PHP_EXT_LIST="$PHP_EXT_LIST pdo"
])
# Checks for header files.
AC_HEADER_RESOLV
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
#AC_HEADER_STAT
#AC_C_CONST
#AC_TYPE_UID_T
#AC_TYPE_MODE_T
#AC_TYPE_PID_T
#AC_C_RESTRICT
#AC_TYPE_SIZE_T
#AC_HEADER_TIME
#AC_STRUCT_TM
#AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
#AC_FUNC_MALLOC
#AC_FUNC_MEMCMP
#AC_FUNC_REALLOC
#AC_FUNC_SELECT_ARGTYPES
#AC_FUNC_STAT
#AC_CHECK_FUNCS([gethostbyname inet_ntoa memchr memmove memset select socket strcasecmp strchr strerror strstr strtol])
AC_DEFINE_DIR(CONF_HOME, sysconfdir, [pcc conf home])
AC_DEFINE_DIR(PCC_LIBS, libdir, [pcc lib dir])
AC_DEFINE_DIR(PCC_BIN, bindir, [pcc bin dir])
# Substitutions
AC_SUBST(PCC_OS, $PCC_OS)
AC_SUBST(PCC_LINK_OPTIONS, $PCC_LINK_OPTIONS)
#jfcouic 2008-10-30 begin
AC_SUBST(RUNTIME_DLL_LIBS, $RUNTIME_DLL_LIBS)
AC_SUBST(COMPILER_DLL_LIBS, $COMPILER_DLL_LIBS)
AC_SUBST(WEBCONNECT_DLL_LIBS, $WEBCONNECT_DLL_LIBS)
AC_SUBST(EXTENSION_DLL_CFLAGS, $EXTENSION_DLL_CFLAGS)
AC_SUBST(EXTENSION_DLL_LIBS, $EXTENSION_DLL_LIBS)
AC_SUBST(FASTCGI_DLL_LIBS, $FASTCGI_DLL_LIBS)
AC_SUBST(CGI_DLL_LIBS, $CGI_DLL_LIBS)
AC_SUBST(MHTTPD_DLL_LIBS, $MHTTPD_DLL_LIBS)
AC_SUBST(PROFILER_DLL_LIBS, $PROFILER_DLL_LIBS)
AC_SUBST(DOTEST_LIBS, $DOTEST_LIBS)
#jfcouic 2008-10-30 end
#jfcouic 2008-11-01 begin
AC_SUBST(WINDOWS_TIME_SUPPORT, $WINDOWS_TIME_SUPPORT)
AC_SUBST(WINDOWS_C_SUPPORT, $WINDOWS_C_SUPPORT)
#jfcouic 2008-11-01 end
AC_SUBST(EXT_LIST, $EXT_LIST)
AC_SUBST(PHP_EXT_LIST, $PHP_EXT_LIST)
AC_SUBST(BE_LIST, $BE_LIST)
#AC_SUBST(SHARED_FLAG, $SHARED_FLAG)
AC_SUBST(SO_EXT, $SO_EXT)
AC_SUBST(BIGLOO_VERSION, $BIGLOO_VERSION)
AC_SUBST(BIGLOO_LIB_PATH, $BIGLOO_LIB_PATH)
AC_SUBST(RESOLVER_LIB, $RESOLVER_LIB)
AC_SUBST(MYSQL_CFLAGS, $MYSQL_CFLAGS)
AC_SUBST(MYSQL_LIBS, $MYSQL_LIBS)
AC_SUBST(ODBC_CFLAGS, $ODBC_CFLAGS)
AC_SUBST(ODBC_LIBS, $ODBC_LIBS)
AC_SUBST(SQLITE_CFLAGS, $SQLITE3_CFLAGS)
AC_SUBST(SQLITE_LIBS, $SQLITE3_LDFLAGS)
AC_SUBST(CURL_CFLAGS, $CURL_CFLAGS)
AC_SUBST(CURL_STATIC_CFLAGS, $CURL_CFLAGS) # ??
AC_SUBST(CURL_LIBS, $CURL_LIBS)
AC_SUBST(XML_CFLAGS, $XML_CFLAGS)
AC_SUBST(XML_LIBS, $XML_LIBS)
AC_SUBST(PCRE_CFLAGS, $PCRE_CFLAGS)
AC_SUBST(PCRE_LIBS, $PCRE_LIBS)
AC_SUBST(STD_CFLAGS, $STD_CFLAGS)
AC_SUBST(STD_LIBS, $STD_LIBS)
AC_SUBST(FCGI_CFLAGS, $FCGI_CFLAGS)
AC_SUBST(FCGI_LIBS, $FCGI_LIBS)
AC_SUBST(PCC_EXT_LIST, $PCC_EXT_LIST)
AC_SUBST(PDO_DRIVER_LIST, $PDO_DRIVER_LIST)
AC_SUBST(PDO_DRIVER_ARRAY, $PDO_DRIVER_ARRAY)
AC_SUBST(CONF_HOME, $CONF_HOME)
AC_SUBST(PCC_LIBS, $PCC_LIBS)
AC_SUBST(BIGLOO_GC_LIB, $BIGLOO_GC_LIB)
AC_SUBST(LD_LIBRARY_PATH_VAR, $LD_LIBRARY_PATH_VAR)
AC_SUBST(prefix, $prefix)
AC_SUBST(exec_prefix, $exec_prefix)
AC_SUBST(libdir, $libdir)
AC_SUBST(bindir, $bindir)
AC_SUBST(srcdir, $srcdir)
AC_SUBST(sysconfdir, $sysconfdir)
# need PCRE_STATIC_CLAGS?
# gtk missing
#AC_SUBST(_CFLAGS, $_CFLAGS)
#AC_SUBST(_LIBS, $_LIBS)
AC_CONFIG_FILES([Makefile.config])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([doc/pcc.conf.var])
AC_CONFIG_FILES([sa-tests/pcc-test.conf])
AC_CONFIG_FILES([webconnect/Makefile])
AC_CONFIG_FILES([runtime/php-ext/php-extensions.mk])
AC_CONFIG_FILES([runtime/php-ext/pdo/Makefile])
AC_CONFIG_FILES([runtime/php-ext/pdo/pdo_class.php])
AC_CONFIG_FILES([compiler/config.scm])
#AC_CONFIG_SUBDIRS([tools/libwebserver])
AC_OUTPUT
dnl ==========================================================================
echo "
Roadsend PHP Configuration Summary
======================================
prefix: ${prefix}
libdir: ${PCC_LIBS}
bindir: ${PCC_BIN}
sysconfdir: ${CONF_HOME}
c compiler: ${CC}
cflags: ${CFLAGS}
bigloo version: ${BIGLOO_VERSION}
bigloo libs: ${BIGLOO_LIB_PATH}
bigloo gc: ${BIGLOO_GC_LIB}
readline: ${with_readline}
= Web Backends =
MicroServer: always enabled
FastCGI: ${with_fcgi}
= Native Extensions =
Standard: always enabled
Sockets: ${with_sockets}
PCRE: ${with_pcre}
MySQL: ${with_mysql}
XML: ${with_xml}
CURL: ${with_curl}
SQLite3: ${with_sqlite3}
ODBC: ${with_odbc}
PHP-GTK 1: ${with_gtk}
PHP-GTK 2: ${with_gtk2}
PCC-WIN: ${with_pccwin}
= PHP Based Extensions =
PDO Base: ${with_pdo}
PDO_Mysql: ${with_pdo_mysql}
PDO_Sqlite: ${with_pdo_sqlite}
"