📄 configure.in
字号:
dnl $Id: configure.in,v 1.1 2005/02/23 23:08:42 dansguardian Exp $dnl Process this file with autoconf to produce a configure script.AC_INIT(include/class.h)AC_CONFIG_AUX_DIR(autoconf)AC_CONFIG_HEADER(include/setup.h)AC_PREFIX_DEFAULT(/usr/sbin)PACKAGE=DansGuardianVERSION=2.0AC_SUBST(PACKAGE)AC_SUBST(VERSION)if test -z "$MAKE"; then MAKE=make echo WARNING: No make command specified, assuming `which $MAKE` echo WARNING: To specify a different make, use MAKE="<command>" $0fidnl Checks for programs.AC_PROG_CCif test "x$CFLAGS" = "x"; then if test "x$GCC" = "xyes"; then CFLAGS="-g -O2 -Wunused -Wall -ggdb -Wshadow -Wmissing-declarations" else CFLAGS="-g" fifiAC_ISC_POSIXAC_PROG_MAKE_SETAC_PATH_PROG(RM, rm)AC_PATH_PROG(CP, cp)AC_PATH_PROG(MV, mv)AC_PATH_PROG(SED, sed)AC_PATH_PROG(AR, ar)AC_PROG_YACCAC_PROG_INSTALLAC_PROG_LEXAC_PROG_RANLIBdnl use directory structure of cached as default (hack)if test "$libexecdir" = '${exec_prefix}/libexec' && test "$localstatedir" = '${prefix}/var'; then libexecdir='${bindir}' localstatedir='${prefix}'fi dnl Checks for libraries.AC_CHECK_LIB(socket, socket)AC_CHECK_FUNC(dlopen,, AC_CHECK_LIB(dl, dlopen,,AC_MSG_ERROR(**dlopen could not be found - DansGuardian will not compile without it **)))# The GNU linker requires the -export-dynamic option to make# all symbols visible in the dynamic symbol table.hold_ldflags=$LDFLAGSAC_MSG_CHECKING(for the ld -export-dynamic flag)LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"AC_TRY_LINK(, [int i;], found=yes, found=no)LDFLAGS=$hold_ldflagsAC_MSG_RESULT($found)if test $found = yes; then LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"fiAC_MSG_CHECKING(for compiler option to produce PIC)if test "$ac_cv_prog_gcc" = "yes"; then AC_MSG_RESULT(gcc: -fPIC -DPIC -shared) PICFLAGS="-fPIC -DPIC -shared"else case `uname -s` in SunOS*) AC_MSG_RESULT(SunOS - Assuming Sun Workshop compiler: -KPIC -DPIC -G) PICFLAGS="-KPIC -DPIC -G" ;; *) AC_MSG_RESULT(no) AC_MSG_ERROR(could not find a way to produce position independent code.) ;; esacfiAC_SUBST(PICFLAGS)AC_CHECK_FUNC(crypt,, AC_CHECK_LIB(descrypt, crypt,,AC_CHECK_LIB(crypt, crypt,,)))dnl Check for gettext, but it's ok if we don't have it.dnl The /usr/local/lib check is pretty ugly but I don't see a better way.dnl can't cache this check since we do it twice.unset ac_cv_lib_intl_gettextAC_CHECK_FUNCS(gettext,, AC_CHECK_LIB(intl, gettext,,))if test "$ac_cv_func_gettext" = "no" -a "$ac_cv_lib_intl_gettext" = "no"; then AC_MSG_CHECKING(in /usr/local/lib ) unset ac_cv_lib_intl_gettext SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LDFLAGS="$LDFLAGS -L/usr/local/lib" CPPFLAGS="$CPPFLAGS -I/usr/local/include" AC_CHECK_LIB(intl, gettext,,LDFLAGS=$SAVEDLDFLAGS; CFLAG=$SAVEDCFLAGS)fidnl Checks for header files.AC_HEADER_STDCAC_CHECK_HEADERS(sys/param.h unistd.h errno.h string.h strings.h sys/syslog.h stdlib.h stddef.h getopt.h) dnl See whether we can include both string.h and strings.h.AC_DEFUN(GCC_HEADER_STRING,[AC_CACHE_CHECK([whether string.h and strings.h may both be included], gcc_cv_header_string,[AC_TRY_COMPILE([#include <string.h>#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])if test $gcc_cv_header_string = yes; then AC_DEFINE(STRING_WITH_STRINGS)fi])GCC_HEADER_STRINGdnl check for socklen_tdnl we can't use ac_check_Type because it doesnt include the required filesAC_DEFUN(CHECK_SOCKLEN_T,[ AC_MSG_CHECKING(for socklen_t) AC_CACHE_VAL(have_socklen_t, [ AC_TRY_COMPILE( [#include <sys/types.h> #include <sys/socket.h>], [socklen_t xxx = 75;], have_socklen_t=yes, have_socklen_t=no) ]) AC_MSG_RESULT($have_socklen_t) if test "$have_socklen_t" = yes; then AC_DEFINE(HAVE_SOCKLEN_T) fi])CHECK_SOCKLEN_Tdnl Check for stdarg.h - if we can't find it, halt configureAC_CHECK_HEADER(stdarg.h, , AC_MSG_ERROR(** stdarg.h could not be found - DansGuardian will not compile without it **))nlist_lib=""AC_CHECK_FUNC(nlist,, AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl", AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf", AC_MSG_WARN(** cannot locate nlist() **)) ))dnl Checks for the existance of strlcatAC_CHECK_FUNCS(strlcat strlcpy)dnl We need to find out whether underscores are appended to symbol names in executablednl files. First, though, we need to see where nlist.h is hiding.AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ] , )if test x"$nlist_h" = "x"; then AC_MSG_WARN(** cannot locate an nlist.h **)fiAC_MSG_CHECKING(for extra underscores prepended to symbol names)AC_CACHE_VAL(symbol_underscores, [cat > conftest.c << EOF#include <$nlist_h>#include <stdio.h>void _modinit(void);int main(int argc, char *argv[[]]) { int i; struct nlist nl[[4]]; /* fill the names in this way, so it'll work almost everywhere */ nl[[0]].n_name = "_modinit"; nl[[1]].n_name = "__modinit"; nl[[2]].n_name = "___modinit"; nl[[3]].n_name = "____modinit"; nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL; if(argc < 2) exit(-1); i = nlist(argv[[1]], nl); if(i == -1) exit(-1); for(i=0; i<4; i++) { if(nl[[i]].n_value != NULL) { int j; for(j=0; j<i; j++) { printf("_"); } exit(i); } } exit(-1);}void _modinit(void) { return;}EOF $CC $CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1 symbol_underscores=`./conftest conftest` AC_MSG_RESULT($symbol_underscores) $RM -f conftest conftest.c])AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}")dnl openssl?AC_ARG_ENABLE(openssl,[ --enable-openssl Enable openssl-dependant crypto functions. --disable-openssl Disable openssl-dependant crypto functions. ],[ case "$enableval" in yes) ac_cv_func_openssl='yes' ;; no) ac_cv_func_openssl='no' ;; esac])dnl check for netio plugin stuffdnl Enable poll()AC_ARG_ENABLE(poll,[ --enable-poll Enable poll() support. --disable-poll Disable poll() support. ],[ case "$enableval" in yes) echo "Forcing poll() to be enabled" ac_cv_func_poll='yes' ;; no) echo "Forcing poll() to be disabled" ac_cv_func_poll='no' ;; esac])dnl Enable select()AC_ARG_ENABLE(select,[ --enable-select Enable select() support. --disable-select Disable select() support. ],[ case "$enableval" in yes) echo "Forcing select() to be enabled" ac_cv_func_select='yes' ;; no) echo "Forcing select() to be disabled" ac_cv_func_select='no' ;; esac])dnl Enable kqueue()AC_ARG_ENABLE(kqueue,[ --enable-kqueue Enable kqueue() support. --disable-kqueue Disable kqueue() support. ],[ case "$enableval" in yes) echo "Forcing kqueue() to be enabled" ac_cv_func_kqueue='yes' ;; no) echo "Forcing kqueue() to be disabled" ac_cv_func_kqueue='no' ;;esac])dnl Enable devpollAC_ARG_ENABLE(devpoll,[ --enable-devpoll Enable /dev/poll support. --disable-devpoll Disable /dev/poll support. ],[ case "$enableval" in yes) echo "Forcing devpoll to be enabled" ac_cv_func_devpoll='yes' ;; no) echo "Forcing devpoll to be disabled" ac_cv_func_devpoll='no' ;;esac])dnl Checks for library functions.AC_PROG_GCC_TRADITIONALdnl checl for opensslAC_CHECK_FUNC(openssl, ac_cv_func_openssl='yes',)AC_MSG_CHECKING(for how to include files in Makefile)cat >conftest <<__EOF__mytest: @touch conftest.t.include "/dev/null"__EOF__rm -f conftest.t$MAKE -f conftest mytest >/dev/null >/dev/nullif test -f conftest.t; then AC_MSG_RESULT(.include) INCDEP=".include \".depend\""else AC_MSG_RESULT(include) INCDEP="include .depend"firm -f conftest.t conftestAC_CHECK_TYPE(u_int32_t, unsigned long)rm -f conftest conftest.fdnl check for poll() callAC_CHECK_FUNC(poll, ac_cv_func_poll='yes',)dnl Magic which checks whether we are forcing a type of comm loop wednl are actually going to (ab)usednl Actually do the define magic nowdnl mostly ripped from squid-commloops, thanks to adrian and bennoif test "$ac_cv_func_kqueue" = "yes" ; then SELECT_TYPE="kqueue" AC_DEFINE(USE_KQUEUE)elif test "$ac_cv_func_devpoll" = "yes" ; then SELECT_TYPE="devpoll" AC_DEFINE(HAVE_DEVPOLL) AC_DEFINE(USE_DEVPOLL)elif test "$ac_cv_func_poll" = "yes" ; then SELECT_TYPE="poll" AC_DEFINE(USE_POLL)elif test "$ac_cv_func_select" = "yes" ; then SELECT_TYPE="select" AC_DEFINE(USE_SELECT)else echo "Eep! Can't find kqueue, devpoll, poll _or_ select!" echo "I'll try select and hope for the best." SELECT_TYPE="select" AC_DEFINE(USE_SELECT)fiecho "Using ${SELECT_TYPE} for select loop."AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE")AC_SUBST(SELECT_SRC)dnl set a define for openssl if we are doing thatif test "$ac_cv_func_openssl" = "yes" ; then echo "Building with openssl." SSL_DEFINE="-DOPENSSL" SSL_LIBS="-lcrypto"else SSL_DEFINE="" SSL_LIBS=""fiAC_SUBST(SSL_DEFINE)AC_SUBST(SSL_LIBS)if test "$ac_cv_func_gettext" = "yes" -o "$ac_cv_lib_intl_gettext" = "yes"; then echo "Building with gettext." MSGFMT="msgfmt -o" SUBDIR_MESSAGES="messages"else MSGFMT="echo" SUBDIR_MESSAGES=""fidnl ipv6?AC_ARG_ENABLE(ipv6,[ --enable-ipv6 Enable IPV6 support. --disable-ipv6 Disable IPV6 support. ],[ case $enableval in yes) ac_cv_ipv6="yes" ;; no) ac_cv_ipv6="no" ;; esac])if test "$ac_cv_ipv6" = "yes" ; then AC_DEFINE(IPV6) echo "Using IPv6 support"fiAC_SUBST(INCDEP)AC_SUBST(SUBDIR_MESSAGES)AC_SUBST(LDFLAGS)AC_SUBST(MSGFMT)AC_OUTPUT( \ Makefile \ iauth/Makefile \ iauth/source/Makefile \ contrib/Makefile \ src/Makefile \ adns/Makefile \ include/Makefile \ messages/Makefile \ messages/translations/Makefile \ modules/Makefile \ tools/Makefile \ doc/Makefile \ gnats/Makefile \ gnats/send-pr \)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -