diff options
author | jcid <devnull@localhost> | 2007-10-07 00:36:34 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2007-10-07 00:36:34 +0200 |
commit | 93715c46a99c96d6c866968312691ec9ab0f6a03 (patch) | |
tree | 573f19ec6aa740844f53a7c0eb7114f04096bf64 /configure.in |
Initial revision
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 475 |
1 files changed, 475 insertions, 0 deletions
diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..dd52bc1a --- /dev/null +++ b/configure.in @@ -0,0 +1,475 @@ +dnl Process this file with aclocal, autoconf and automake. + +AC_INIT(src/dillo.cc) + +dnl Detect the canonical host and target build environment +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(dillo, f15) +AM_CONFIG_HEADER(config.h) + +dnl Options + +AC_ARG_WITH(jpeg-lib, [ --with-jpeg-lib=DIR Specify where to find libjpeg], LIBJPEG_LIBDIR=$withval) +AC_ARG_WITH(jpeg-inc, [ --with-jpeg-inc=DIR Specify where to find libjpeg's headers], LIBJPEG_INCDIR=$withval) + +AC_ARG_ENABLE(efence, [ --enable-efence Try to compile and run with Electric Fence], + , enable_efence=no) +AC_ARG_ENABLE(gprof, [ --enable-gprof Try to compile and run with profiling enabled], + , enable_gprof=no) +AC_ARG_ENABLE(insure, [ --enable-insure Try to compile and run with Insure++], + , enable_insure=no) +AC_ARG_ENABLE(ansi, [ --enable-ansi Try to compile and run with ANSI flags], + , enable_ansi=no) +AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Build with support for IPv6], , ) +AC_ARG_ENABLE(rtfl, [ --enable-rtfl Build with rtfl messages], enable_rtfl=yes) +AC_ARG_ENABLE(cookies,[ --disable-cookies Don't compile support for cookies], + , enable_cookies=yes) +AC_ARG_ENABLE(png, [ --disable-png Disable support for PNG images], + enable_png=$enableval, enable_png=yes) +AC_ARG_ENABLE(jpeg, [ --disable-jpeg Disable support for JPEG images], + enable_jpeg=$enableval, enable_jpeg=yes) +AC_ARG_ENABLE(gif, [ --disable-gif Disable support for GIF images], + enable_gif=$enableval, enable_gif=yes) +AC_ARG_ENABLE(ssl, [ --disable-ssl Disable ssl features (eg. https)], + enable_ssl=$enableval, enable_ssl=yes) +AC_ARG_ENABLE(threaded-dns,[ --disable-threaded-dns Disable the advantage of a reentrant resolver library], + enable_threaded_dns=$enableval, enable_threaded_dns=yes) + +AC_PROG_CC +AC_PROG_CXX +AM_PROG_CC_STDC +AC_PROG_RANLIB +AC_PROG_CPP + +dnl ---------------------------- +dnl Check our char and int types +dnl ---------------------------- +dnl +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(void *) + +case 2 in +$ac_cv_sizeof_short) gint16=short;; +$ac_cv_sizeof_int) gint16=int;; +esac +case 4 in +$ac_cv_sizeof_short) gint32=short;; +$ac_cv_sizeof_int) gint32=int;; +$ac_cv_sizeof_long) gint32=long;; +esac + +cat >d_size.h <<_______EOF +#ifndef __D_SIZE_H__ +#define __D_SIZE_H__ + + +#include "config.h" + +#if HAVE_STDINT_H == 0 +#include <stdint.h> +#else +typedef signed $gint16 int16_t; +typedef unsigned $gint16 uint16_t; +typedef signed $gint32 int32_t; +typedef unsigned $gint32 uint32_t; +#endif +typedef unsigned char uchar_t; +typedef unsigned short ushort_t; +typedef unsigned long ulong_t; +typedef unsigned int uint_t; +typedef int bool_t; + + +#endif /* __D_SIZE_H__ */ +_______EOF + + +dnl -------------------------------------- +dnl Check whether to add /usr/local or not +dnl (this is somewhat a religious problem) +dnl -------------------------------------- +dnl +if test "`$CPP -v < /dev/null 2>&1 | grep '/usr/local/include' 2>&1`" = ""; then + CPPFLAGS="$CPPFLAGS -I/usr/local/include" + LDFLAGS="$LDFLAGS -L/usr/local/lib" +fi + +dnl ------------------------------------ +dnl Check for socket libs (AIX, Solaris) +dnl ------------------------------------ +dnl +AC_CHECK_FUNCS(gethostbyname,, + [AC_CHECK_LIB(nsl,gethostbyname,,[AC_CHECK_LIB(socket,gethostbyname)])]) +AC_CHECK_FUNCS(setsockopt,,[AC_CHECK_LIB(socket,setsockopt)]) + +dnl -------------------- +dnl Checks for socklen_t +dnl -------------------- +dnl +AC_MSG_CHECKING([for socklen_t]) +ac_cv_socklen_t="" +AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> +],[ +socklen_t a=0; +getsockname(0,(struct sockaddr*)0, &a); +], +ac_cv_socklen_t="socklen_t", +AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> +],[ +int a=0; +getsockname(0,(struct sockaddr*)0, &a); +], +ac_cv_socklen_t="int", +ac_cv_socklen_t="size_t" +) +) +AC_MSG_RESULT($ac_cv_socklen_t) +if test "$ac_cv_socklen_t" != "socklen_t"; then + AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, + [Define the real type of socklen_t]) +fi + + +dnl ---------------------- +dnl Test for FLTK2 library +dnl ---------------------- +dnl +dnl For debugging and to be user friendly +AC_MSG_CHECKING([FLTK2]) +if sh -c "fltk2-config --version" >/dev/null 2>&1 +then AC_MSG_RESULT(yes) + LIBFLTK_CXXFLAGS=`fltk2-config --cxxflags` + LIBFLTK_LIBS=`fltk2-config --use-images --ldflags` +else if sh -c "fltk-config --version" >/dev/null 2>&1 + then AC_MSG_RESULT(yes) + LIBFLTK_CXXFLAGS=`fltk-config --cxxflags` + LIBFLTK_LIBS=`fltk-config --ldflags` + else AC_MSG_RESULT(no) + AC_ERROR(FLTK2 must be installed!) + fi +fi + + +dnl ---------------- +dnl Test for libjpeg +dnl ---------------- +dnl +if test "x$enable_jpeg" = "xyes"; then + AC_CHECK_HEADER(jpeglib.h, jpeg_ok=yes, jpeg_ok=no) + + if test "x$jpeg_ok" = "xyes"; then + old_libs="$LIBS" + AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, jpeg_ok=yes, jpeg_ok=no) + LIBS="$old_libs" + fi + + if test "x$jpeg_ok" = "xyes"; then + LIBJPEG_LIBS="-ljpeg" + if test -n "$LIBJPEG_LIBDIR"; then + LIBJPEG_LDFLAGS="-L$LIBJPEG_LIBDIR" + fi + if test -n "$LIBJPEG_INCDIR"; then + LIBJPEG_CPPFLAGS="-I$LIBJPEG_INCDIR" + fi + else + AC_MSG_WARN([*** No libjpeg found. Disabling jpeg images.***]) + fi +fi + +if test "x$jpeg_ok" = "xyes"; then + AC_DEFINE([ENABLE_JPEG], [], [Enable JPEG images]) +fi + +dnl ------------------------------ +dnl Test for zlib (libpng uses it) +dnl ------------------------------ +dnl +if test "x$enable_png" = "xyes"; then + AC_CHECK_HEADER(zlib.h, libz_ok=yes, libz_ok=no) + + if test "x$libz_ok" = "xyes"; then + old_libs="$LIBS" + AC_CHECK_LIB(z, zlibVersion, libz_ok=yes, libz_ok=no) + LIBS="$old_libs" + fi + + if test "x$libz_ok" = xyes; then + LIBZ_LIBS="-lz" + else + AC_MSG_WARN([*** No libz found. Disabling PNG images ***]) + fi +fi + +dnl --------------- +dnl Test for libpng +dnl --------------- +dnl +if test "x$enable_png" = "xyes" && test "x$libz_ok" = "xyes"; then + AC_MSG_CHECKING([for libpng-config]) + +dnl Check if the user hasn't set the variable $PNG_CONFIG + if test -z "$PNG_CONFIG"; then + PNG_CONFIG=`which libpng12-config` + if test -z "$PNG_CONFIG"; then + PNG_CONFIG=`which libpng-config` + fi + if test -z "$PNG_CONFIG"; then + PNG_CONFIG=`which libpng10-config` + fi + fi + +dnl Check if the libpng-config script was found and is executable + if test -n "$PNG_CONFIG" && test -x "$PNG_CONFIG"; then + AC_MSG_RESULT([$PNG_CONFIG]) + png_ok="yes" + else + AC_MSG_RESULT([missing]) + png_ok="no" + fi + + if test "x$png_ok" = "xyes"; then +dnl For debugging and to be user friendly + AC_MSG_CHECKING([for libpng version]) + png_version=`$PNG_CONFIG --version` + case $png_version in + 1.2.*) AC_MSG_RESULT([$png_version (newer version)]) ;; + 1.0.*) AC_MSG_RESULT([$png_version (older version)]) ;; + *) AC_MSG_RESULT([ERROR]) ;; + esac + +dnl Try to use options that are supported by all libpng-config versions... + LIBPNG_CFLAGS=`$PNG_CONFIG --cflags` + LIBPNG_LIBS=`$PNG_CONFIG --ldflags` + case $png_version in + 1.2.4*) LIBPNG_LIBS="$LIBPNG_LIBS `$PNG_CONFIG --libs`" ;; + esac + else +dnl Try to find libpng even though libpng-config wasn't found + AC_CHECK_HEADERS(png.h libpng/png.h, png_ok=yes && break, png_ok=no) + + if test "x$png_ok" = "xyes"; then + old_libs="$LIBS" + AC_CHECK_LIB(png, png_check_sig, png_ok=yes, png_ok=no, $LIBZ_LIBS -lm) + LIBS="$old_libs" + + if test "x$png_ok" = "xyes"; then + LIBPNG_LIBS="-lpng -lm" + fi + fi + + if test "x$png_ok" = "xno"; then + AC_MSG_WARN([*** No libpng found. Disabling PNG images ***]) + fi + fi +fi + +if test "x$png_ok" = "xyes"; then + AC_DEFINE([ENABLE_PNG], [], [Enable PNG images]) +fi + +dnl Check if support for GIF images should be compiled in +if test "x$enable_gif" = "xyes"; then + AC_DEFINE([ENABLE_GIF], [], [Enable GIF images]) +fi + +dnl -------------------------- +dnl Test for support for SSL +dnl -------------------------- +dnl +if test "x$enable_ssl" = "xyes"; then + AC_CHECK_HEADER(openssl/ssl.h, ssl_ok=yes, ssl_ok=no) + + if test "x$ssl_ok" = "xyes"; then + old_libs="$LIBS" + AC_CHECK_LIB(ssl, SSL_library_init, ssl_ok=yes, ssl_ok=no, -lcrypto) + LIBS="$old_libs" + fi + + if test "x$ssl_ok" = "xyes"; then + LIBSSL_LIBS="-lcrypto -lssl" + else + AC_MSG_WARN([*** No libssl found. Disabling ssl support.***]) + fi +fi + +if test "x$ssl_ok" = "xyes"; then + AC_DEFINE([ENABLE_SSL], [], [Enable SSL support]) +fi + + +dnl ---------------------- +dnl Test for POSIX threads +dnl ---------------------- +dnl +if test -z "$LIBPTHREAD_LIBS"; then +case $target in + *-*-linux*|*-*-solaris*) + old_libs="$LIBS" + AC_CHECK_LIB(pthread, pthread_create, LIBPTHREAD_LIBS="-lpthread") + LIBS="$old_libs" + ;; + + *-*-osf1*) + AC_MSG_CHECKING(whether pthreads work) + LIBPTHREAD_LIBS="-lpthread -lexc -ldb" + AC_MSG_WARN([*** _Untested pthreads_ try setting LIBPTHREAD_LIBS manually if it doesn't work ***]) + ;; + + *) + AC_MSG_CHECKING(whether threads work with -pthread) + LDSAVEFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -pthread" + AC_TRY_LINK_FUNC(pthread_create, pthread_ok=yes, pthread_ok=no) + LDFLAGS=$LDSAVEFLAGS + + if test "x$pthread_ok" = "xyes"; then + AC_MSG_RESULT(yes) + LIBPTHREAD_LDFLAGS="-pthread" + else + AC_MSG_RESULT(no. Now we will try some libraries.) + + AC_SEARCH_LIBS(pthread_create, pthread, + LIBPTHREADS_LIBS="-lpthread", + AC_SEARCH_LIBS(pthread_create, pthreads, + LIBPTHREADS_LIBS="-lpthreads", + AC_SEARCH_LIBS(pthread_create, c_r, + LIBPTHREADS_LIBS="-lc_r", thread_ok=no))) + + if test "x$thread_ok" = "xno"; then + AC_MSG_WARN([*** No pthreads found. ***]) + AC_MSG_ERROR([*** Try setting LIBPTHREAD_LIBS manually to point to your pthreads library. ***]) + exit 1 + else + AC_MSG_WARN([found a way to link threads, but it may not work...]) + fi + fi + ;; + +esac +fi + +dnl ------------------------------------ +dnl Workaround for nanosleep and solaris +dnl ------------------------------------ +dnl +case $target in + *-*-solaris*) + AC_MSG_CHECKING(whether SunOS has -lrt ) + LDSAVEFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -lrt" + AC_TRY_LINK_FUNC(nanosleep, rt_ok=yes, rt_ok=no) + if test "x$rt_ok" = "xyes"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(whether SunOS has -lposix4 ) + LDFLAGS="$LDSAVEFLAGS -lposix4" + AC_TRY_LINK_FUNC(nanosleep, posix_ok=yes, posix_ok=no) + if test "x$posix_ok" = "xyes"; then + AC_MSG_RESULT(yes) + else + LDFLAGS=$LDSAVEFLAGS + AC_MSG_RESULT(no) + AC_MSG_WARN([*** Try setting LIBS or LDFLAGS manually to point to the library with nanosleep()***]) + fi + fi + ;; +esac + +dnl -------------------- +dnl Command line options +dnl -------------------- +dnl +if test "x$enable_cookies" = "xno" ; then + CFLAGS="$CFLAGS -DDISABLE_COOKIES" +fi +if test "x$enable_ipv6" = "xyes" ; then + CFLAGS="$CFLAGS -DENABLE_IPV6" +fi +if test "x$enable_efence" = "xyes" ; then + LIBS="-lefence $LIBS" +fi +if test "x$enable_gprof" = "xyes" ; then + CFLAGS="$CFLAGS -pg" +fi +if test "x$enable_insure" = "xyes" ; then + CC="insure -Zoi \"compiler $CC\"" + LIBS="$LIBS -lstdc++-2-libc6.1-1-2.9.0" +fi +if test "x$enable_rtfl" = "xyes" ; then + CFLAGS="$CFLAGS -DDBG_RTFL" +fi +if test "x$enable_threaded_dns" = "xyes" ; then + CFLAGS="$CFLAGS -DD_DNS_THREADED" +fi + +dnl ----------------------- +dnl Checks for header files +dnl ----------------------- +dnl +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h unistd.h sys/uio.h) + +dnl -------------------------- +dnl Check for compiler options +dnl -------------------------- +dnl +if eval "test x$GCC = xyes"; then + if test "`echo $CFLAGS | grep '\-D_REENTRANT' 2> /dev/null`" = ""; then + CFLAGS="$CFLAGS -D_REENTRANT" + fi + if test "`echo $CFLAGS | grep '\-D_THREAD_SAFE' 2> /dev/null`" = ""; then + CFLAGS="$CFLAGS -D_THREAD_SAFE" + fi + if test "`echo $CFLAGS | grep '\-Wall' 2> /dev/null`" = ""; then + CFLAGS="$CFLAGS -Wall" + fi + if test "`echo $CFLAGS | grep '\-W[^a]' 2> /dev/null`" = ""; then + if test "`$CC -v 2>&1 | grep 'version 3'`" != ""; then + CFLAGS="$CFLAGS -W -Wno-unused-parameter" + fi + fi + if test "`echo $CFLAGS | grep '\-Waggregate-return' 2> /dev/null`" = ""; then + CFLAGS="$CFLAGS -Waggregate-return" + fi + + if eval "test x$enable_ansi = xyes"; then + if test "`echo $CFLAGS | grep '\-ansi' 2> /dev/null`" = ""; then + CFLAGS="$CFLAGS -ansi" + fi + + if test "`echo $CFLAGS | grep '\-pedantic' 2> /dev/null`" = ""; then + CFLAGS="$CFLAGS -pedantic" + fi + fi +fi +dnl ----------- +dnl CXX options +dnl ----------- +dnl +CXXFLAGS="$CXXFLAGS -Wall -W -Wno-unused-parameter" + +AC_SUBST(LIBJPEG_LIBS) +AC_SUBST(LIBJPEG_LDFLAGS) +AC_SUBST(LIBJPEG_CPPFLAGS) +AC_SUBST(LIBPNG_LIBS) +AC_SUBST(LIBPNG_CFLAGS) +AC_SUBST(LIBZ_LIBS) +AC_SUBST(LIBSSL_LIBS) +AC_SUBST(LIBPTHREAD_LIBS) +AC_SUBST(LIBPTHREAD_LDFLAGS) +AC_SUBST(LIBFLTK_CXXFLAGS) +AC_SUBST(LIBFLTK_LIBS) +AC_SUBST(datadir) +AC_SUBST(src doc) + +AC_OUTPUT(Makefile dlib/Makefile dpip/Makefile dpid/Makefile dpi/Makefile doc/Makefile src/Makefile src/IO/Makefile) + |