dnl Process this file with autoconf to produce a configure script. dnl $Id: configure.in,v 1.11 2002/10/07 05:43:05 mrsam Exp $ dnl Copyright 2000 Double Precision, Inc. See COPYING for dnl distribution information. AC_INIT(soxwrap.c) AM_INIT_AUTOMAKE(soxwrap,0.10,0) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_AWK AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_LN_S AC_PROG_CC dnl Check for options AC_ARG_WITH(socks, [--without-socks - Do not use SOCKSv5 --with-socks - Use SOCKSv5 (libsocks5.a) --with-socks=dynamic - Optionally load libsocks5_sh (dlopen)], socks="$withval",socks="") dnl Checks for libraries. saveLIBS="$LIBS" NETLIBS="" USENSL=no AC_CHECK_LIB(socket,socket,result=yes,result=no) if test $result = yes; then NETLIBS="-lsocket" else AC_CHECK_LIB(socket,socket,result=yes,result=no,-lnsl) if test $result = yes; then NETLIBS = "-lsocket -lnsl" USENSL=yes else AC_CHECK_LIB(socket,connect,result=yes,result=no) if test $result = yes; then NETLIBS="-lsocket" else AC_CHECK_LIB(socket,connect,result=yes,result=no,-lnsl) if test $result = yes; then NETLIBS="-lsocket -lnsl" USENSL=yes fi fi fi fi if test $USENSL != yes; then LIBS="$LIBS $NETLIBS" AC_TRY_LINK_FUNC(inet_addr, [ : ], [ AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no) if test $result = yes; then NETLIBS="$NETLIBS -lnsl" fi ]) fi LIBS="$saveLIBS" SOCKLIBS=$NETLIBS dnl Checks for header files. dnl dnl Because autoconf sets macros for C preprocessor where dnl AC_CHECK_HEADERS appears first, the first AC_CHECK_HEADERS dnl must not place in conditional level but top level. dnl AC_CHECK_HEADERS(dlfcn.h) AC_CHECK_HEADERS(sys/types.h sys/time.h sys/stat.h fcntl.h) AC_HEADER_TIME AC_SUBST(SOCKLIBS) CONFNAME="libsocks5.conf" if test "$socks" != "no" then LIBS="$saveLIBS $SOCKLIBS" is_dante=0 # If we detect Dante's libsocks.so, use it. Otherwise # if we detect Socks5's libsocks5.so, use that. Otherwise assume # we'll be using Dante anyway, dynamically at runtime. dnl dnl Dante support temporarily disabled until non-blocking sockets dnl are working. dnl dnl AC_CHECK_LIB(socks, SOCKSinit, [ LIBSOCKS="-lsocks"; is_dante=1 ], dnl [ dnl AC_CHECK_LIB(socks5, SOCKSinit, LIBSOCKS="-lsocks5", dnl is_dante=1) dnl ]) AC_CHECK_LIB(socks5, SOCKSinit, LIBSOCKS="-lsocks5") if test "$is_dante" = 1 then CONFNAME="socks.conf" AC_DEFINE_UNQUOTED(HAVE_DANTE,1, [ Whether Dante is configured instead of socks5 ]) fi LIBS="$saveLIBS $SOCKLIBS" if test "$LIBSOCKS" = "" then if test "$socks" = "yes" then AC_MSG_ERROR(Cannot find socks proxy library) exit 1 fi fi AC_CHECK_HEADERS(socks.h) AC_CHECK_HEADER(socks.h, , if test "$socks" = "yes" then AC_MSG_ERROR(socks.h not found) exit 1 fi) AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl"; LIBS="-ldl") AC_CHECK_FUNC(dlopen, if test "$socks" = "" then socks="dynamic" fi , if test "$socks" = "dynamic" then AC_MSG_ERROR(Cannot find libdl) fi ) fi LIBS="$saveLIBS" AC_SUBST(CONFNAME) if test "$socks" = "no" then LIBDL="" LIBSOCKS="" else if test "$socks" = "dynamic" then AC_DEFINE_UNQUOTED(SOX_DYNAMIC, 1, [ Whether to load libsocks5_sh.so via dlopen ]) LIBSOCKS="" else LIBDL="" fi fi echo $LIBDL $LIBSOCKS >soxlibs.dep dnl Checks for typedefs, structures, and compiler characteristics. AC_CACHE_CHECK(whether sys/socket.h defines socklen_t,soxwrap_cv_have_socklen_t, [ AC_TRY_COMPILE([ #include #include ],[ socklen_t t; ],[soxwrap_cv_have_socklen_t=yes], [soxwrap_cv_have_socklen_t=no] ) ] ) if test "$soxwrap_cv_have_socklen_t" = "no" then AC_DEFINE_UNQUOTED(socklen_t,int, [ Whether to provide a missing definition of socklen_t ]) fi dnl Checks for library functions. AC_ARG_WITH(libconffile, [--with-libconffile=file - Specify your libsock5.conf file], libconffile="$withval", libconffile="") if test "$libconffile" = "no" then libconffile="" fi CPPFLAGS="-I.. -I$srcdir/.. $CPPFLAGS" AC_SUBST(libconffile) AC_OUTPUT(Makefile)