dnl Process this file with autoconf to produce a configure script. dnl initialization AC_PREREQ(2.13) AC_INIT(gw/alt_charsets.h) AC_CONFIG_HEADER(config.h) AC_SUBST(SHELL) AC_CONFIG_AUX_DIR(.) dnl Gateway version number. AC_DEFINE_UNQUOTED(VERSION, "`head -1 VERSION`") dnl Target installation directory for documentation AC_SUBST(docdir) docdir='${prefix}/share/doc/kannel' dnl Checks Sytem Type. AC_CANONICAL_HOST case "$host" in *-sun-solaris*) CFLAGS="$CFLAGS -DSunOS=1";; esac dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_YACC AC_PROG_LEX AC_PATH_PROG(PERL, perl) dnl Checks for libraries. AC_CHECK_LIB(m, log) AC_CHECK_LIB(socket, accept) AC_CHECK_LIB(nsl, inet_ntoa) AC_CHECK_LIB(pthread, pthread_exit) if test -z "$pthread"; then AC_CHECK_LIB(c_r, pthread_exit, [LIBS="$LIBS -lc_r"]) fi AC_PATH_PROGS(XML_CONFIG, xml2-config xml-config, no) if test "$XML_CONFIG" = "no"; then echo "You MUST have the gnome-xml library installed"; exit 1 else AC_MSG_CHECKING([libxml version]) xml_version=`$XML_CONFIG --version` AC_MSG_RESULT([$xml_version]) changequote(<<, >>)dnl case $xml_version in *2.2.[5-9]*) ;; *2.2.[1-9][0-9]*) ;; *2.[3-9].[0-9]*) ;; *) AC_MSG_ERROR(<>) ;; esac changequote([, ])dnl LIBS="$LIBS `$XML_CONFIG --libs`" CFLAGS="$CFLAGS `$XML_CONFIG --cflags`" fi AC_CHECK_LIB(resolv, inet_ntop) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(sys/ioctl.h sys/time.h sys/types.h unistd.h sys/poll.h) AC_CHECK_HEADERS(pthread.h getopt.h syslog.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_TRY_COMPILE(, [char *func = __FUNCTION__;], AC_DEFINE(HAVE___FUNCTION__)) AC_TRY_COMPILE(, [char *func = __func__;], AC_DEFINE(HAVE___FUNC__)) dnl Checks for library functions. AC_CHECK_FUNCS(gettimeofday select socket strdup getopt_long) AC_CHECK_FUNC(getopt, , LIBOBJS="$LIBOBJS utils/attgetopt.o") AC_SUBST(LIBOBJS) dnl Extra feature checks dnl GW_HAVE_TYPE_FROM(HDRNAME, TYPE, HAVENAME, DESCRIPTION) AC_DEFUN(GW_HAVE_TYPE_FROM, [ AC_CACHE_CHECK([for $2 in <$1>], gw_cv_type_$3, AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H #include #endif #include <$1> ], [$2 foo;], gw_cv_type_$3=yes, gw_cv_type_$3=no)) if test $gw_cv_type_$3 = yes; then AC_DEFINE($3, 1, $4) fi ]) dnl GW_HAVE_FUNC_FROM(HDRNAME, FUNC, HAVENAME, DESCRIPTION) AC_DEFUN(GW_HAVE_FUNC_FROM, [ AC_CACHE_CHECK([for $2 in <$1>], gw_cv_func_$3, AC_TRY_COMPILE([#include <$1>], [void *foo = $2;], gw_cv_func_$3=yes, gw_cv_func_$3=no)) if test $gw_cv_func_$3 = yes; then AC_DEFINE($3, 1, $4) fi ]) GW_HAVE_TYPE_FROM(sys/socket.h, socklen_t, HAVE_SOCKLEN_T, [Defined if there is a socklen_t in ]) GW_HAVE_FUNC_FROM(stdio.h, getopt, HAVE_GETOPT_IN_STDIO_H, [Does declare getopt()?]) GW_HAVE_FUNC_FROM(unistd.h, getopt, HAVE_GETOPT_IN_UNISTD_H, [Does declare getopt()?]) dnl Misfeature checks AC_MSG_CHECKING(for working pthreads) AC_TRY_RUN([#include #include int pid; void testpid(void* foo); int main(void){ pthread_t child; pid=getpid(); pthread_create(&child,NULL,(void*)testpid,NULL); pthread_join(child,NULL); return 0; } void testpid(void* foo){ int mypid=getpid(); if(mypid!=pid){ /* Pthreads states that all threads should have the same PID * we dont! */ exit(1); }else{ exit(0); } } ],echo yes , echo no ;CFLAGS="$CFLAGS -DBROKEN_PTHREADS=1", echo Cross compiling - assuming they work) dnl DocBook stuff AC_CHECK_PROG(JADE, jade, jade, :) AC_CHECK_PROG(JADETEX, jadetex, jadetex, :) AC_CHECK_PROG(DVIPS, dvips, dvips, :) AC_CHECK_PROG(FIG2DEV, fig2dev, fig2dev, :) AC_CHECK_PROG(PS2PDF, ps2pdf, ps2pdf, :) AC_SUBST(HTML_DSL) for file in /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl \ /usr/lib/sgml/stylesheets/nwalsh-modular/html/docbook.dsl do AC_CHECK_FILE($file,HTML_DSL=$file) done AC_SUBST(TEX_DSL) for file in /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl \ /usr/lib/sgml/stylesheets/nwalsh-modular/print/docbook.dsl do AC_CHECK_FILE($file,TEX_DSL=$file) done dnl Implement --with-defaults option. AC_ARG_WITH(defaults, [ --with-defaults set default configure options: speed/debug], [ case "$withval" in speed) assertiondefault=no mallocdefault=native ;; debug) assertiondefault=yes mallocdefault=check ;; *) echo "unknown --with-defaults parameter $withval" exit 1 ;; esac ], [ dnl Same as debug assertiondefault=yes mallocdefault=check ]) dnl Implement --enable-docs option. AC_SUBST(DOCSTARGET) if test "x$HTML_DSL" = "x" -o "x$TEX_DSL" = "x" then DOCSTARGET="no-docs" else DOCSTARGET="docs" fi AC_ARG_ENABLE(docs, [ --enable-docs enable building of documentation], [ if test "$enableval" = "yes" then DOCSTARGET="docs" else DOCSTARGET="no-docs" fi ]) case "$DOCSTARGET" in no-docs) echo Not building documentation. ;; docs) echo Documentation will be built as well. ;; esac dnl Implement the --enable-pam option. AC_ARG_ENABLE(pam, [ --enable-pam enable pam authentication --disable-pam disable pam authentication ], [ if test "$enableval" = "yes" then AC_CHECK_LIB(pam, pam_end) AC_CHECK_LIB(dl,main) AC_CHECK_HEADERS(security/pam_appl.h) PAMTARGET="pam" else PAMTARGET="no-pam" fi ]) case "$PAMTARGET" in no-pam) echo pam authentication is disabled. ;; pam) echo pam authetication is enabled. ;; esac dnl Implement --enable-debug option. AC_ARG_ENABLE(debug, [ --enable-debug enable non-reentrant debugging for wmls compiler], [ echo enabling WMLScript compiler debugging if test -n "$GCC"; then CFLAGS="$CFLAGS -Wall" fi AC_DEFINE(WS_DEBUG) ]) dnl Implement --enable-localtime option. AC_ARG_ENABLE(localtime, [ --enable-localtime log file time stamps in local time, not GMT], [ if test "$enableval" = yes; then AC_DEFINE(LOG_TIMESTAMP_LOCALTIME) fi ]) dnl Implement --disable-assertions option. AC_ARG_ENABLE(assertions, [ --disable-assertions turn off assertion checking], [ if test "$enableval" = "no" then echo disabling assertion checking AC_DEFINE(NO_GWASSERT) fi ], [ if test "$assertiondefault" = "no" then echo disabling assertion checking AC_DEFINE(NO_GWASSERT) fi ]) dnl --with-malloc=native/fast/checking/slow AC_ARG_WITH(malloc, [ --with-malloc select malloc wrapper to use: native/checking/slow], [ case "$withval" in native) AC_DEFINE(USE_GWMEM_NATIVE) echo using native malloc ;; check) AC_DEFINE(USE_GWMEM_CHECK) echo using checking malloc ;; slow) AC_DEFINE(USE_GWMEM_SLOW) echo using slow malloc ;; *) echo "Unknown malloc wrapper $withval. Oops."; exit 1 ;; esac ], [ case "$mallocdefault" in native) AC_DEFINE(USE_GWMEM_NATIVE) echo using native malloc ;; slow) AC_DEFINE(USE_GWMEM_SLOW) echo using slow malloc ;; *) AC_DEFINE(USE_GWMEM_CHECK) echo using checking malloc ;; esac ]) dnl --enable-mutex-stats option. AC_ARG_ENABLE(mutex-stats, [ --enable-mutex-stats produce information about lock contention], [ if test "$enableval" = yes; then AC_DEFINE(MUTEX_STATS) fi ]) dnl --enable-start-stop-daemon option. AC_ARG_ENABLE(start-stop-daemon, [ --enable-start-stop-daemon compile the start-stop-daemon program], [ if test "$enableval" = yes; then STARTSTOPDAEMONSRC="utils/start-stop-daemon.c" fi ]) AC_SUBST(STARTSTOPDAEMONSRC) dnl Final Output AC_OUTPUT(Makefile)