1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
dnl $Id: configure.ac,v 1.15 2010/01/13 17:20:39 armin Exp $
dnl ------------------------------------------------------------------
AC_INIT(dnsproxy, 1.16)
AC_PREREQ(2.59)
AC_REVISION([$Revision: 1.15 $])
AC_CONFIG_HEADERS(config.h)
dnl ------------------------------------------------------------------
dnl Check for programs
dnl ------------------------------------------------------------------
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_CACHE_SAVE
dnl ------------------------------------------------------------------
dnl Check for headers
dnl ------------------------------------------------------------------
AC_C_CONST
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/types.h sys/socket.h sys/time.h)
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
AC_CHECK_HEADERS(errno.h syslog.h)
AC_TYPE_SIGNAL
AC_CACHE_SAVE
dnl ------------------------------------------------------------------
dnl Check for functions
dnl ------------------------------------------------------------------
AC_CHECK_FUNCS(strchr memcpy)
AC_CHECK_FUNCS(setregid setresgid setresuid setreuid)
AC_CACHE_SAVE
dnl ------------------------------------------------------------------
dnl Check for additional libraries
dnl ------------------------------------------------------------------
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket], [], [
AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], [],
[-lnsl])
])
AC_CACHE_SAVE
dnl ------------------------------------------------------------------
dnl Enable extended warnings while developing
dnl ------------------------------------------------------------------
AC_ARG_ENABLE(warnings, [
--enable-warnings enable all sorts of warnings for debugging],
[
CFLAGS="${CFLAGS} -Wall -Werror -Wcast-qual -Wmissing-declarations \
-W -Wmissing-prototypes -Wnested-externs -Wshadow \
-Wwrite-strings -Wno-unused -Wno-sign-compare"
])
AC_SUBST(CFLAGS)
dnl ------------------------------------------------------------------
dnl Check for libevent library
dnl ------------------------------------------------------------------
lefound="no"
LIBS="$LIBS -levent"
AC_MSG_CHECKING(for libevent)
AC_ARG_WITH(libevent,
AC_HELP_STRING(
[--with-libevent=PATH],
[directory prefix where libevent is found]
),
[
if test -f $withval/include/event.h; then
CFLAGS="${CFLAGS} -I$withval/include"
elif test -f $withval/event.h; then
CFLAGS="${CFLAGS} -I$withval"
else
AC_ERROR([event.h not found])
fi
if test -f $withval/lib; then
LDFLAGS="${LDFLAGS} -L$withval/lib"
else
LDFLAGS="${LDFLAGS} -L$withval"
fi
AC_MSG_RESULT([using $withval])
lefound="yes"
],
[
saved_CFLAGS=$CFLAGS
saved_LDFLAGS=$LDFLAGS
for testdir in "" $prefix /usr/local /opt/csw; do
if test -z "$testdir"; then
CFLAGS="$saved_CFLAGS"
LDFLAGS="$saved_LDFLAGS"
else
CFLAGS="$saved_CFLAGS -I$testdir/include"
LDFLAGS="$saved_LDFLAGS -L$testdir/lib"
fi
AC_TRY_LINK([#include <sys/time.h>
#include <sys/types.h>
#include <event.h>],
[ event_init(); ],
[ lefound="$testdir" ],
[ lefound="no" ])
if test "$lefound" != "no"; then
if test -z "$testdir"; then
AC_MSG_RESULT([found])
else
AC_MSG_RESULT([found in $lefound])
fi
break
fi
done
]
)
if test "$lefound" = "no"; then
AC_MSG_ERROR([
This software requires the libevent library
available at http://monkey.org/~provos/libevent/
You may specify it's directory prefix with
./configure --with-libevent=/prefix/of/libevent
])
fi
dnl ------------------------------------------------------------------
dnl Check for available nroff and manpage macro package
dnl ------------------------------------------------------------------
AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$PATH:/usr/ucb])
if ${NROFF} -mdoc dnsproxy.1 >/dev/null 2>&1; then
MAN=mdoc
else
MAN=man
fi
AC_SUBST(MAN)
dnl ------------------------------------------------------------------
dnl Generate Makefile by default. Others only if their .in file
dnl exists in the current directory, which happens in my workdir
dnl but not for distributed tarballs.
dnl ------------------------------------------------------------------
AC_CONFIG_FILES(Makefile)
if test -r "README.in"; then
AC_CONFIG_FILES(README)
fi
if test -r "dnsproxy.1.in"; then
AC_CONFIG_FILES(dnsproxy.1)
fi
AC_OUTPUT()
AC_MSG_RESULT()
AC_MSG_RESULT([Configured successfully. Now run make.])
AC_MSG_RESULT()
|