1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.50])
5AC_INIT(mod_qos, 9.0, pbuchbinder@users.sourceforge.net)
6AC_CONFIG_SRCDIR([src/qscheck.c])
7AM_INIT_AUTOMAKE
8AM_CONFIG_HEADER([config.h])
9
10# Checks for programs.
11AC_PROG_CC
12
13# Checks for libraries.
14
15# Checks for header files.
16AC_CHECK_HEADERS([fcntl.h netdb.h stdlib.h string.h strings.h sys/socket.h unistd.h])
17
18# Checks for typedefs, structures, and compiler characteristics.
19AC_TYPE_PID_T
20AC_TYPE_UID_T
21
22# Checks for library functions.
23AC_FUNC_FORK
24AC_FUNC_MALLOC
25AC_CHECK_FUNCS([ftruncate gethostbyname memset regcomp select socket strchr strerror strrchr strstr])
26
27# START customize settings
28AC_ARG_ENABLE([use-static], AS_HELP_STRING(--enable-use-static,Try to use archives instead of shared libraries))
29AC_ARG_ENABLE([full-static], AS_HELP_STRING(--enable-full-static,Try to compile a statical linked executable))
30AC_ARG_ENABLE([ssl], AS_HELP_STRING(--disable-ssl,Disable ssl support (not supported yet)))
31
32AC_ARG_WITH(apr,AS_HELP_STRING(--with-apr=PATH,path to apr-1-config script),
33	[if test ! -x $withval/apr-1-config; then AC_MSG_ERROR($withval/apr-1-config do not exist or is not executable); else APR_CONFIG="$withval/apr-1-config"; fi],
34	[APR_CONFIG="apr-1-config"])
35AC_ARG_WITH(apr-util,AS_HELP_STRING(--with-apr-util=PATH,path to apu-1-config script),
36	[if test ! -x $withval/apu-1-config; then AC_MSG_ERROR($withval/apu-1-config do not exist or is not executable); else APU_CONFIG="$withval/apu-1-config"; fi],
37	[APU_CONFIG="apu-1-config"])
38AC_ARG_WITH(pcre,AS_HELP_STRING(--with-pcre=PATH,path to pcre-config script),
39	[if test ! -x $withval/pcre-config; then AC_MSG_ERROR($withval/pcre-config do not exist or is not executable); else PCRE_CONFIG="$withval/pcre-config"; fi],
40	[PCRE_CONFIG="pcre-config"])
41AC_ARG_WITH(png,AS_HELP_STRING(--with-png=PATH,path to libpng-config script),
42	[if test ! -x $withval/libpng-config; then AC_MSG_ERROR($withval/libpng-config do not exist or is not executable); else PNG_CONFIG="$withval/libpng-config"; fi],
43	[PNG_CONFIG="libpng-config"])
44AC_ARG_WITH(ssl,AS_HELP_STRING(--with-ssl=PATH,path to openssl source),
45	[if test ! -d $withval; then AC_MSG_ERROR($withval is not a directory); else OPENSSL_LIB_PATH="-L${withval}"; OPENSSL_INCLUDES="-I${withval}/include"; fi],
46	[OPENSSL_LIB_PATH=""; OPENSSL_INCLUDES=""])
47
48APR_VERSION=`$APR_CONFIG --version`
49if test ! "$?" = "0"; then
50  echo "libapr is missing, use --with-apr=PATH"
51  exit -1
52fi
53APU_VERSION=`$APU_CONFIG --version`
54if test ! "$?" = "0"; then
55  echo "libaprutil is missing, use --with-apr-util=PATH"
56  exit -1
57fi
58PCRE_VERSION=`$PCRE_CONFIG --version`
59if test ! "$?" = "0"; then
60  echo "libpcre is missing, use --with-pcre=PATH to specify the location of your pcre library"
61  exit -1
62fi
63PNG_VERSION=`$PNG_CONFIG --version`
64if test ! "$?" = "0"; then
65  echo "libpng is missing, use --with-png=PATH to specify the location of your png library"
66  #exit -1
67fi
68
69# Store settings for includes, libs and flags
70INCLUDES="`$APR_CONFIG --includes` `$APU_CONFIG --includes` $OPENSSL_INCLUDES"
71CFLAGS="`$APR_CONFIG --cflags` `$PCRE_CONFIG --cflags` `$PNG_CONFIG --cflags` $CFLAGS $INCLUDES"
72CPPFLAGS="`$APR_CONFIG --cppflags` $CPPFLAGS"
73LIBS="$OPENSSL_LIB_PATH -lssl -lcrypto `$APR_CONFIG --link-ld`  `$APU_CONFIG --link-ld` `$APR_CONFIG --libs` `$APU_CONFIG --libs` `$PCRE_CONFIG --libs` `$PNG_CONFIG --libs` -lz"
74
75# if link static
76if test "$enable_full_static" = "yes"; then
77  LDFLAGS="-all-static"
78fi
79
80# if link static
81if test "$enable_use_static" = "yes"; then
82  LDFLAGS="-static"
83fi
84# END	 customize settings
85
86AC_CONFIG_FILES([Makefile
87                 src/Makefile])
88AC_OUTPUT
89