dnl dnl Autoconfiguration files for proxytest (a MiX proxy) dnl Konrad Rieck dnl AC_INIT([proxytest],[0.0.2]) AM_INIT_AUTOMAKE AC_PREREQ(2.57) AC_CONFIG_SRCDIR([proxytest.cpp]) AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL AC_PROG_RANLIB AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([int main(){return 0;}],[],[AC_MSG_FAILURE([Could not run C++ compiler])]) AC_LANG_POP(C++) CFLAGS="" CXXFLAGS="" if test "x$GCC" = "xyes" ; then CFLAGS="-Wall -D_REENTRANT" CXXFLAGS=$CFLAGS else echo "You need the GNU C Compiler to compile proxytest." exit fi LIBS="$LIBS -L/usr/lib -L/usr/local/lib" case "$host" in *-*-solaris*) LIBS="$LIBS -lnsl -lsocket" ;; *-*-linux*) LIBS="$LIBS -lpthread" ;; *-*-irix*) CFLAGS="$CFLAGS " ;; alpha*) CXXFLAGS="$CXXFLAGS -mieee" ;; *) ;; esac OFLAGS="-O3" case "$host_cpu" in i686) OFLAGS="$OFLAGS -march=i686" ;; esac dnl Checks for Headers AC_HEADER_STDC AC_CHECK_HEADERS(sys/filio.h) dnl Checks for library functions. AC_FUNC_ALLOCA AC_CHECK_FUNCS([strerror]) AC_CHECK_FUNCS(vsnprintf) AC_CHECK_FUNCS(poll) dnl Checks for declarations. AC_CHECK_DECL(TCP_KEEPALIVE,[AC_DEFINE(HAVE_TCP_KEEPALIVE,,[Define if your OS supports the TCP socket option TCP_KEEPALIVE])],[],[#include ]) AC_CHECK_DECL(AF_UNIX,[AC_DEFINE(HAVE_UNIX_DOMAIN_PROTOCOL,,[Define if your OS supports the Unix Domain protocol])],[],[#include ]) AC_CHECK_DECL(O_BINARY,[],[AC_DEFINE(O_BINARY,0,[This flag is used in open(), in order to open a file in binary mode])]) AC_CHECK_DECL(MAX_PATH,[],[AC_DEFINE(MAX_PATH,4096,[This is the maximum length of a file system path])]) AC_CHECK_DECL(INADDR_NONE,[],[AC_DEFINE(INADDR_NONE,-1,[This is the value, which is returned from inet_addr(), in case of an error])],[#include ]) AC_CHECK_DECL(FIONREAD,[AC_DEFINE(HAVE_FIONREAD,,[This is a flag to ioctl() to get the number of available bytes on a socket])],[],[#include ]) AC_CHECK_DECL(MSG_NOSIGNAL,[],[AC_DEFINE(MSG_NOSIGNAL,0,[This is a flag to read(), to tell the os to get no signals])],[#include ]) dnl Checks for types AC_CHECK_TYPE(socklen_t,[AC_DEFINE(HAVE_SOCKLEN_T,,[Define if the type socklen_t is available])],[],[#include ]) dnl Checks for libraries. dnl Check for OpenSSL libs and includes. Adopted from OpenSSH configure.in AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], [ if test "x$withval" != "$xno" ; then tryssldir=$withval fi ] ) saved_LIBS="$LIBS" saved_LDFLAGS="$LDFLAGS" saved_CFLAGS="$CFLAGS" if test "x$prefix" != "xNONE" ; then tryssldir="$tryssldir $prefix" fi AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [ for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl \ /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg \ /opt /opt/openssl $HOME/ssl $HOME/openssl ; do if test ! -z "$ssldir" ; then LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir" CFLAGS="$saved_CFLAGS -I$ssldir/include" if test ! -z "$need_dash_r" ; then LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir" fi else LDFLAGS="$saved_LDFLAGS" fi LIBS="$saved_LIBS -lcrypto" # Basic test to check for compatible version and correct # linking, *does not* test for RSA - that comes later. AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main(void) { char a[2048]; memset(a, 0, sizeof(a)); RAND_add(a, sizeof(a), sizeof(a)); return(RAND_status() <= 0); } ]])],[ found_crypto=1 break; ],[ ],[]) if test ! -z "$found_crypto" ; then break; fi done if test -z "$found_crypto" ; then AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install]) fi if test -z "$ssldir" ; then ssldir="(system)" fi ac_cv_openssldir=$ssldir ]) if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then AC_DEFINE(HAVE_OPENSSL,,[Define if you have OpenSSL (which is needed!)]) dnl Need to recover ssldir - test above runs in subshell ssldir=$ac_cv_openssldir CFLAGS="$saved_CFLAGS -I$ssldir/include" LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir" if test ! -z "$need_dash_r" ; then LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir" fi if test ! -z "$blibpath" ; then blibpath="$blibpath:$ssldir:$ssldir/lib" fi fi LIBS="$saved_LIBS -lcrypto" dnl Check for Xerces-C AC_LANG_PUSH(C++) dnl Check for XML includes. xmlincludedir="/usr/local/include" AC_ARG_WITH(xml-include, [ --with-xml-include=PATH Specify path to XERCES-C include files (without a trailing '/xercesc')], [ if test "x$withval" != "$xno" ; then xmlincludedir=$withval fi ] ) XMLINCLUDEFLAGS="-I/usr/include/xercesc -I$xmlincludedir -I$xmlincludedir/xercesc" CFLAGS="$CFLAGS $XMLINCLUDEFLAGS" CXXFLAGS=$CFLAGS AC_CHECK_HEADER([dom/DOM.hpp],AC_MSG_RESULT([Xerces-C includes found]), AC_MSG_ERROR([Xerces-C includes NOT found - please use --with-xml-include]),[//Check]) xmllibdir="/usr/local/lib" AC_ARG_WITH(xml-lib, [ --with-xml-lib=PATH Specify path to XERCES-C library files], [ if test "x$withval" != "$xno" ; then xmllibdir=$withval fi ] ) XMLLIBFLAGS="-L$xmllibdir -lxerces-c" LIBS="$LIBS $XMLLIBFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include "util/XercesDefs.hpp" #include "util/PlatformUtils.hpp" #if (_XERCES_VERSION >= 20200) XERCES_CPP_NAMESPACE_USE #endif ]], [[XMLPlatformUtils::Initialize() ]])],[AC_MSG_RESULT(XercesC-Lib found)],[AC_MSG_ERROR(Xerces-C Lib NOT found - please use --with-xml-lib)]) AC_LANG_POP(C++) AC_ARG_WITH(debug, [ --with-debug Enable debug mode], [ if test "x$withval" != "$xno" ; then CFLAGS="$CFLAGS -g -D_DEBUG" OFLAGS="" fi ] ) CFLAGS="$CFLAGS $OFLAGS" CXXFLAGS=$CFLAGS AC_CONFIG_FILES([Makefile popt/Makefile xml/Makefile aes/Makefile trio/Makefile]) AC_OUTPUT