# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # # Portions copyright 2003 Chris Kuethe. # Copyright 2003 Richard Laager. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY RICHARD LAAGER ``AS IS'' AND ANY EXPRESS # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL MARC HOROWITZ BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # AC_PREREQ(2.57) AC_INIT(pks, 0.9.6+cvs, rlaager@users.sourceforge.net) AC_CONFIG_SRCDIR(armor.c) AC_CONFIG_HEADER(config.h) # Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PATH_PROG(CAT, cat, /bin/cat, $PATH:/sbin:/bin:/usr/sbin:/usr/bin) AC_PATH_PROG(DATE, date, /usr/bin/date, $PATH:/sbin:/bin:/usr/sbin:/usr/bin) AC_PATH_PROG(MV, mv, /bin/mv, $PATH:/sbin:/bin:/usr/sbin:/usr/bin) AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail, $PATH:/usr/lib:/usr/sbin:/usr/etc:/etc) AC_PATH_PROG(TRUE, true, /bin/true, $PATH:/sbin:/bin:/usr/sbin:/usr/bin) # Support Debugging Mode AC_ARG_ENABLE( debug, [ --enable-debug Enable Debugging Mode], [ AC_DEFINE(DEBUG) AC_MSG_RESULT(Debugging Mode Activated) cflags="$cflags -g" ] ) # Support Compiler Optimizations AC_ARG_ENABLE( optimizations, [ --enable-optimizations Enable Compiler Optimizations], [ AC_MSG_RESULT(Compiler Optimizations Enabled) cflags="$cflags -O2" ] ) # Checks for libraries. dnl Checks for Berkeley DB AC_MSG_CHECKING(for Berkeley DB) AC_ARG_WITH(db, [ --with-db=DIR Use Berkeley DB in DIR], [DBINC=NO DBLIB=NO DBHDR=NO S=1 case "$withval" in yes|no) AC_ERROR(Berkeley DB was not found. Please check your installation or use --with-db=PATH) ;; *) AC_MSG_RESULT($withval) if test x${withval} = x ; then withval=/tmp fi if test $S -a -r ${withval}/build_unix/db4.h -a \ -r "`ls ${withval}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1`"; then DBINC=-I`echo ${withval}/build_unix/` DBLIB=`ls ${withval}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1` DBHDR="db4.h" grep 'DB_VERSION_MAJOR 4$' ${withval}/build_unix/db4.h >/dev/null 2>&1 S=$? fi if test $S -a -r ${withval}/build_unix/db.h -a \ -r "`ls ${withval}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1`"; then DBINC=-I`echo ${withval}/build_unix` DBLIB=`ls ${withval}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1` DBHDR="db.h" grep 'DB_VERSION_MAJOR 4$' ${withval}/build_unix/db.h >/dev/null 2>&1 S=$? fi if test $S -a -r ${withval}/include/db4/db.h -a \ -r ${withval}/lib/db4/libdb.a ; then DBINC="-I${withval}/include/db4" DBLIB="-L${withval}/lib/db4 -ldb" DBHDR="db.h" grep 'DB_VERSION_MAJOR 4$' ${withval}/include/db4/db.h >/dev/null 2>&1 S=$? fi if test $S -a -r ${withval}/include/db4.h -a \ -r ${withval}/lib/libdb.a ; then DBINC="-I${withval}/include" DBLIB="-L${withval}/lib -ldb" DBHDR="db4.h" grep 'DB_VERSION_MAJOR 4$' ${withval}/include/db4.h >/dev/null 2>&1 S=$? fi if test $S -a -r ${withval}/include/db.h -a \ -r ${withval}/lib/libdb.a ; then DBINC="-I${withval}/include" DBLIB="-L${withval}/lib -ldb" DBHDR="db.h" grep 'DB_VERSION_MAJOR 4$' ${withval}/include/db.h >/dev/null 2>&1 S=$? fi if test $S -eq 1 ; then AC_ERROR(Berkeley DB was not found. Please check your installation or use --with-db=DIR) fi AC_MSG_RESULT(yes) esac ], [DBINC=NO DBLIB=NO DBHDR=NO S=1 if test $S -a -r /usr/local/include/db4.h -a \ -r /usr/local/lib/libdb.a ; then DBINC="-I/usr/local/include" DBLIB="-L/usr/local/lib -ldb" DBHDR="db4.h" grep 'DB_VERSION_MAJOR 4$' /usr/local/include/db4.h >/dev/null 2>&1 S=$? fi if test $S -a -r /usr/local/include/db.h -a \ -r /usr/local/lib/libdb.a ; then DBINC="-I/usr/local/include" DBLIB="-L/usr/local/lib -ldb" DBHDR="db.h" grep 'DB_VERSION_MAJOR 4$' /usr/local/include/db.h >/dev/null 2>&1 S=$? fi if test $S -a -r /usr/include/db4.h -a \ -r /usr/lib/libdb.a ; then DBINC="" DBLIB="-L/usr/lib -ldb" DBHDR="db4.h" grep 'DB_VERSION_MAJOR 4$' /usr/include/db4.h >/dev/null 2>&1 S=$? fi if test $S -a -r /usr/include/db.h -a \ -r /usr/lib/libdb.a ; then DBINC="" DBLIB="-L/usr/lib -ldb" DBHDR="db.h" grep 'DB_VERSION_MAJOR 4$' /usr/include/db.h >/dev/null 2>&1 S=$? fi DIR=`ls -d ../db-4.*/. 2>/dev/null | tail -1` if test $S -a -r ${DIR}/build_unix/db4.h -a \ -r "`ls ${DIR}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1`"; then DBINC=-I`echo ${DIR}/build_unix/` DBLIB=`ls ${DIR}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1` DBHDR="db4.h" grep 'DB_VERSION_MAJOR 4$' ${DIR}/build_unix/db4.h >/dev/null 2>&1 S=$? fi if test $S -a -r ${DIR}/build_unix/db.h -a \ -r "`ls ${DIR}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1`"; then DBINC=-I`echo ${DIR}/build_unix` DBLIB=`ls ${DIR}/build_unix/.libs/libdb-4.*.a 2>/dev/null | tail -1` DBHDR="db.h" grep 'DB_VERSION_MAJOR 4$' ${DIR}/build_unix/db.h >/dev/null 2>&1 S=$? fi if test $S -eq 1 ; then AC_ERROR(Berkeley DB was not found. Please check your installation or use --with-db=DIR) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(DBINC) AC_SUBST(DBLIB) AC_SUBST(DBHDR) dnl Checks for IPv6 AC_MSG_CHECKING(if IPv6 support is enabled) AC_ARG_WITH(ipv6, [ --with-ipv6 Enable IPv6 Support], [AC_DEFINE(WITH_IPV6, 1, [Enable IPv6 Support]) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no) ) dnl Checks for TCP Wrappers AC_ARG_WITH(libwrap, [ --with-libwrap Use libwrap (TCP Wrappers)], AC_CHECK_LIB(wrap, main)) dnl Checks for OpenSSL AC_MSG_CHECKING(for OpenSSL) AC_ARG_WITH(openssl, [ --with-openssl=DIR Use OpenSSL in DIR], [OPENSSLINC=NO OPENSSLLIB=NO S=1 case "$withval" in yes|no) AC_ERROR(OpenSSL was not found. Please check your installation or use --with-openssl=PATH) ;; *) AC_MSG_RESULT($withval) if test x${withval} = x ; then withval=/tmp fi if test $S -a -r ${withval}/include/openssl/ssl.h -a \ -r ${withval}/libcrypto.a ; then OPENSSLINC="-I${withval}/include" OPENSSLLIB="${withval}/libcrypto.a" S=0 fi if test $S -a -r ${withval}/include/openssl/ssl.h -a \ -r ${withval}/lib/libcrypto.a ; then OPENSSLINC="-I${withval}/include" OPENSSLLIB="-L${withval}/lib -lcrypto" S=0 fi if test $S -eq 1 ; then AC_ERROR(OpenSSL was not found. Please check your installation or use --with-openssl=DIR) fi AC_MSG_RESULT(yes) esac ], [OPENSSLINC=NO OPENSSLLIB=NO OPENSSLHDR=NO S=1 if test $S -a -r /usr/local/ssl/include/openssl/ssl.h -a \ -r /usr/local/ssl/lib/libcrypto.a ; then OPENSSLINC="-I/usr/local/ssl/include" OPENSSLLIB="-L/usr/local/ssl/lib -lcrypto" S=0 fi if test $S -a -r /usr/local/include/openssl/ssl.h -a \ -r /usr/local/lib/libcrypto.a ; then OPENSSLINC="-I/usr/local/include" OPENSSLLIB="-L/usr/local/lib -lcrypto" S=0 fi if test $S -a -r /usr/include/openssl/ssl.h -a \ -r /usr/lib/libcrypto.a ; then OPENSSLINC="" OPENSSLLIB="-L/usr/lib -lcrypto" S=0 fi DIR=`ls -d ../openssl-*.*.*/. 2>/dev/null | tail -1` if test $S -a -r ${DIR}/include/openssl/ssl.h -a \ -r "`ls ${DIR}/libcrypto.a 2>/dev/null | tail -1`"; then OPENSSLINC=-I`echo ${DIR}/include` OPENSSLLIB=`ls ${DIR}/libcrypto.a 2>/dev/null | tail -1` S=0 fi if test $S -eq 1 ; then AC_ERROR(OpenSSL was not found. Please check your installation or use --with-openssl=DIR) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(OPENSSLINC) AC_SUBST(OPENSSLLIB) # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(bstring.h) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(errno.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADERS(signal.h) AC_CHECK_HEADERS(stdio.h) AC_CHECK_HEADERS(stdlib.h) AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(sys/mman.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/stat.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_HEADERS(syslog.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(unistd.h) # Checks for typedefs, structures, and compiler characteristics. case "$ac_cv_prog_gcc" in yes) cflags="$cflags -Wall -pedantic";; esac AC_SUBST(cflags) AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_CACHE_CHECK("for socklen_t", pks_cv_socklen_t, AC_TRY_COMPILE([#include #include ], [socklen_t socklen; socklen = sizeof(struct sockaddr);], pks_cv_socklen_t=yes, pks_cv_socklen_t=no)) if test "$pks_cv_socklen_t" = "yes" ; then AC_DEFINE(HAVE_SOCKLEN_T) fi AC_STRUCT_TM # Checks for library functions. # If we can't find connect, try looking in -lsocket and -lnsl. The # Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has # libsocket.so which has a bad implementation of gethostbyname (it # only looks in /etc/hosts), so we only look for -lsocket if we need # it. AC_CHECK_FUNCS([connect], :, [AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, gethostbyname)]) AC_CHECK_FUNCS([dup2],,AC_MSG_ERROR(dup2 missing)) AC_FUNC_FORK AC_CHECK_FUNCS([gethostbyaddr],,AC_MSG_ERROR(gethostbyaddr missing)) AC_CHECK_FUNCS([inet_ntoa],,AC_MSG_ERROR(inet_ntoa missing)) AC_CHECK_FUNCS([madvise]) AC_FUNC_MALLOC AC_CHECK_FUNCS([memchr],,AC_MSG_ERROR(memchr missing)) AC_FUNC_MEMCMP AC_CHECK_FUNCS([memmove],,AC_MSG_ERROR(memmove missing)) AC_CHECK_FUNCS([memset],,AC_MSG_ERROR(memset missing)) AC_FUNC_MMAP AC_CHECK_FUNCS([munmap],,AC_MSG_ERROR(munmap missing)) AC_FUNC_REALLOC AC_CHECK_FUNCS([select],,AC_MSG_ERROR(select missing)) AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS([socket],,AC_MSG_ERROR(socket missing)) AC_CHECK_FUNCS([strchr],,AC_MSG_ERROR(strchr missing)) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(db_selector.h) AC_OUTPUT(mkpksdconf pks-mail.sh pks-queue-run.sh)