######################################################################## # # $Id: configure.in,v 1.38 2006/05/30 23:41:24 mavrik Exp $ # ######################################################################## dnl #################################################################### dnl # dnl # Initialize. dnl # dnl #################################################################### AC_INIT(src/webjob.c) AC_PREREQ(2.53) AC_PREFIX_DEFAULT(/usr/local/webjob) cgidir='${exec_prefix}/cgi' docdir='${exec_prefix}/doc' etcdir='${exec_prefix}/etc' logdir='${exec_prefix}/log' mandir='${exec_prefix}/man' rundir='${exec_prefix}/run' AC_SUBST(cgidir) AC_SUBST(docdir) AC_SUBST(etcdir) AC_SUBST(logdir) AC_SUBST(mandir) AC_SUBST(rundir) additional_testdirs= ap_srcs= ap_incs= extension= AC_CANONICAL_SYSTEM case "$target_os" in *aix*) OS_CFLAGS="-DUNIX" AC_DEFINE(WEBJOB_AIX, 1, [Define to 1 if the target OS is AIX.]) AC_DEFINE(USE_AP_SNPRINTF, 1, [Define to 1 if snprintf() support is enabled.]) ap_srcs=ap_snprintf.c ap_incs=ap_snprintf.h ;; *bsd*) OS_CFLAGS="-DUNIX" AC_DEFINE(WEBJOB_BSD, 1, [Define to 1 if the target OS is BSD.]) ;; *cygwin*) OS_CFLAGS="-DUNIX -DCYGWIN" AC_DEFINE(WEBJOB_CYGWIN, 1, [Define to 1 if the target OS is Cygwin.]) extension=.exe ;; *darwin*) OS_CFLAGS="-DUNIX" AC_DEFINE(WEBJOB_MACOS, 1, [Define to 1 if the target OS is MacOS.]) ;; *hpux*) OS_CFLAGS="-DUNIX" AC_DEFINE(WEBJOB_HPUX, 1, [Define to 1 if the target OS is HP-UX.]) AC_DEFINE(USE_AP_SNPRINTF, 1, [Define to 1 if snprintf() support is enabled.]) ap_srcs=ap_snprintf.c ap_incs=ap_snprintf.h ;; *linux*) OS_CFLAGS="-DUNIX" AC_DEFINE(WEBJOB_LINUX, 1, [Define to 1 if the target OS is Linux.]) ;; *mingw32*) OS_CFLAGS="-DWIN32 -DMINGW32" LIBS="-lwsock32 -lws2_32 -lgdi32" AC_DEFINE(WEBJOB_MINGW32, 1, [Define to 1 if the target OS is MinGW32.]) extension=.exe ;; *solaris*) OS_CFLAGS="-DUNIX" AC_DEFINE(WEBJOB_SOLARIS, 1, [Define to 1 if the target OS is Solaris.]) AC_DEFINE(USE_AP_SNPRINTF, 1, [Define to 1 if snprintf() support is enabled.]) ap_srcs=ap_snprintf.c ap_incs=ap_snprintf.h ;; *) echo echo "The target operating system, $target_os, is not currently supported." echo exit ;; esac AC_SUBST(ap_srcs) AC_SUBST(ap_incs) AC_SUBST(extension) case $host_cpu in alpha*) AC_DEFINE(K_CPU_ALPHA, 1, [Define to 1 if the host cpu is alpha.]) ;; amd64*) AC_DEFINE(K_CPU_AMD64, 1, [Define to 1 if the host cpu is amd64.]) ;; hppa*) AC_DEFINE(K_CPU_HPPA, 1, [Define to 1 if the host cpu is hppa.]) ;; ia64*) AC_DEFINE(K_CPU_IA64, 1, [Define to 1 if the host cpu is ia64.]) ;; x86_64*) AC_DEFINE(K_CPU_X86_64, 1, [Define to 1 if the host cpu is x86_64.]) ;; i?86*) AC_DEFINE(K_CPU_I386, 1, [Define to 1 if the host cpu is iX86.]) ;; powerpc*) AC_DEFINE(K_CPU_POWERPC, 1, [Define to 1 if the host cpu is powerpc.]) ;; sparc*) AC_DEFINE(K_CPU_SPARC, 1, [Define to 1 if the host cpu is sparc.]) ;; *) echo echo "The target cpu, $host_cpu, is not currently supported." echo exit ;; esac dnl #################################################################### dnl # dnl # Initialize CFLAGS before AC_PROG_CC does. dnl # dnl #################################################################### if test -n "$CFLAGS" ; then CFLAGS="$CFLAGS -Wall $OS_CFLAGS" else CFLAGS="-O2 -Wall $OS_CFLAGS" fi dnl #################################################################### dnl # dnl # Check for programs. dnl # dnl #################################################################### AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET dnl #################################################################### dnl # dnl # Check for libraries. dnl # dnl #################################################################### AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(socket, socket) dnl #################################################################### dnl # dnl # Check for header files. dnl # dnl #################################################################### AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h signal.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/statfs.h sys/statvfs.h sys/time.h sys/vfs.h unistd.h]) AC_CHECK_HEADERS(sys/mount.h,,, [ #if HAVE_SYS_TYPES_H #include #endif ] ) dnl #################################################################### dnl # dnl # Check for typedefs, structures, and compiler characteristics. dnl # dnl #################################################################### AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME AC_SYS_LARGEFILE dnl #################################################################### dnl # dnl # Check for library functions. dnl # dnl #################################################################### AC_FUNC_FORK AC_FUNC_LSTAT AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_FUNC_STAT AC_FUNC_STRFTIME AC_CHECK_FUNCS([alarm getenv gethostbyname gettimeofday longjmp kill memset modf putenv setenv setjmp snprintf socket strcasecmp strchr strerror strncasecmp strstr strtoul uname]) dnl #################################################################### dnl # dnl # Check for OpenSSL. dnl # dnl #################################################################### CheckSSLComponents() { SSLDIR="$1" INCLUDE_LIST="crypto.h err.h pem.h rand.h ssl.h x509.h" for INCLUDE_FILE in ${INCLUDE_LIST}; do if test ! -f "${SSLDIR}/include/openssl/${INCLUDE_FILE}"; then return 1 fi done ssldir=${SSLDIR} return 0 } AC_MSG_CHECKING([for OpenSSL support]) AC_ARG_WITH(ssl, [ --with-ssl=DIR Use OpenSSL with includes and libs from [DIR]/include/openssl and [DIR]/lib --without-ssl Disable OpenSSL support], [ dnl ################################################################ dnl # dnl # Check the specified location only. dnl # dnl ################################################################ case `echo $withval | tr "A-Z" "a-z"` in no) use_ssl=0 ;; *) use_ssl=1 CheckSSLComponents "$withval" ;; esac ], [ dnl ################################################################ dnl # dnl # Search common OpenSSL locations. dnl # dnl ################################################################ use_ssl=1 for basedir in /usr /usr/local /usr/pkg /opt /opt/local; do for dir in $basedir $basedir/openssl $basedir/ssl; do CheckSSLComponents $dir && break 2 done done ] ) if test $use_ssl -ne 0; then AC_DEFINE(USE_SSL, 1, [Define to 1 if OpenSSL support is enabled.]) if test -z "$ssldir"; then AC_MSG_RESULT(missing or incomplete) echo echo "Unable to locate required OpenSSL components. Use --with-ssl=DIR" echo "to specify a known or different location. The files that must exist" echo "for this check to pass are:" echo echo " DIR/include/openssl/crypto.h" echo " DIR/include/openssl/err.h" echo " DIR/include/openssl/pem.h" echo " DIR/include/openssl/rand.h" echo " DIR/include/openssl/ssl.h" echo " DIR/include/openssl/x509.h" echo exit 1 else AC_MSG_RESULT($ssldir) ssl_srcs=ssl.c ssl_incs="ssl.h ssl-pool.h" ssl_incflags="-I$ssldir/include" ssl_libflags="-L$ssldir/lib -lssl -lcrypto" AC_SUBST(ssl_srcs) AC_SUBST(ssl_incs) AC_SUBST(ssl_incflags) AC_SUBST(ssl_libflags) fi else AC_MSG_RESULT(check explicitly disabled) fi dnl #################################################################### dnl # dnl # Check whether or not to include Digital Signature Verification dnl # (DSV) support. Note: DSV support is automatically disabled if SSL dnl # support is disabled (i.e., the user specified --without-ssl). dnl # dnl #################################################################### AC_MSG_CHECKING([whether to include Digital Signature Verification (DSV) support]) AC_ARG_ENABLE(dsv, [ --disable-dsv Disable DSV support (enabled by default)], [ case `echo $enableval | tr "A-Z" "a-z"` in no) enable_dsv=0 ;; *) enable_dsv=1 ;; esac ], [ if test $use_ssl -eq 0; then enable_dsv=0 else enable_dsv=1 fi ] ) if test $enable_dsv -eq 1; then if test $use_ssl -eq 0; then AC_MSG_RESULT(missing or incomplete) echo echo "Digital Signature Verification (DSV) support requires OpenSSL support, which has been explicitly disabled." echo exit 1 fi AC_MSG_RESULT(yes) AC_DEFINE(USE_DSV, 1, [Define to 1 if Digital Signature Verification (DSV) support is enabled.]) dsv_srcs=dsv.c dsv_incs=dsv.h AC_SUBST(dsv_srcs) AC_SUBST(dsv_incs) else AC_MSG_RESULT(no) fi dnl #################################################################### dnl # dnl # Check whether or not to compile using pre-mem{set,cpy} MD5 logic. dnl # dnl #################################################################### AC_MSG_CHECKING([whether to compile using pre-mem{set,cpy} MD5 logic]) AC_ARG_ENABLE(md5-pre-msmc, [ --enable-md5-pre-msmc Enable pre-mem{set,cpy} MD5 logic (disabled by default)], [ AC_MSG_RESULT(yes) AC_DEFINE(MD5_PRE_MEMSET_MEMCPY, 1, [Define to 1 if pre-mem{set,cpy} MD5 logic is enabled.])], [ AC_MSG_RESULT(no) ] ) dnl #################################################################### dnl # dnl # Check whether or not to compile using pre-mem{set,cpy} SHA1 logic. dnl # dnl #################################################################### AC_MSG_CHECKING([whether to compile using pre-mem{set,cpy} SHA1 logic]) AC_ARG_ENABLE(sha1-pre-msmc, [ --enable-sha1-pre-msmc Enable pre-mem{set,cpy} SHA1 logic (disabled by default)], [ AC_MSG_RESULT(yes) AC_DEFINE(SHA1_PRE_MEMSET_MEMCPY, 1, [Define to 1 if pre-mem{set,cpy} SHA1 logic is enabled.])], [ AC_MSG_RESULT(no) ] ) dnl #################################################################### dnl # dnl # Check whether or not to install server-side components. dnl # dnl #################################################################### server_subdirs= server_makefiles= AC_MSG_CHECKING([whether to install server-side components]) AC_ARG_WITH(server-side, [ --with-server-side Install server-side components (disabled by default)], [ case `echo $withval | tr "A-Z" "a-z"` in no) install_server=0 ;; *) install_server=1 ;; esac ], [ install_server=0 ] ) if test $install_server -ne 0; then AC_MSG_RESULT(yes) server_subdirs="cgi" server_makefiles="cgi/Makefile" else AC_MSG_RESULT(no) fi AC_SUBST(server_subdirs) dnl #################################################################### dnl # dnl # Check whether or not to install various tools. dnl # dnl #################################################################### html_files="webjob.html" man1_files="webjob.1" tool_subdirs= tool_makefiles="tools/Makefile" test_makefiles= AC_MSG_CHECKING([whether to install all utilities]) AC_ARG_WITH(all-tools, [ --with-all-tools Install all utilities (disabled by default)], [ case `echo $withval | tr "A-Z" "a-z"` in no) install_all=0 ;; *) install_all=1 ;; esac ], [ install_all=0 ] ) if test $install_all -ne 0; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING([whether to install dsv utilities]) AC_ARG_WITH(dsv-tools, [ --with-dsv-tools Install dsv utilities (disabled by default)], [ case `echo $withval | tr "A-Z" "a-z"` in no) install_dsv=0 ;; *) install_dsv=1 ;; esac ], [ if test $install_all -eq 0; then install_dsv=0 else install_dsv=1 fi ] ) if test $install_dsv -ne 0; then if test $use_ssl -eq 0; then AC_MSG_RESULT(missing or incomplete) echo echo "DSV utilities require OpenSSL support, which has been explicitly disabled." echo exit 1 fi AC_MSG_RESULT(yes) html_files="$html_files webjob-dsvtool.html" man1_files="$man1_files webjob-dsvtool.1" tool_subdirs="$tool_subdirs webjob-dsvtool" tool_makefiles="$tool_makefiles tools/webjob-dsvtool/Makefile" additional_testdirs="$additional_testdirs webjob-dsvtool" test_makefiles=" $test_makefiles tests/webjob-dsvtool/Makefile tests/webjob-dsvtool/common/Makefile tests/webjob-dsvtool/common/sign/Makefile tests/webjob-dsvtool/common/sign/test_1/Makefile tests/webjob-dsvtool/common/verify/Makefile tests/webjob-dsvtool/common/verify/test_1/Makefile " else AC_MSG_RESULT(no) fi AC_MSG_CHECKING([whether to install pad utilities]) AC_ARG_WITH(pad-tools, [ --with-pad-tools Install pad utilities (disabled by default)], [ case `echo $withval | tr "A-Z" "a-z"` in no) install_pad=0 ;; *) install_pad=1 ;; esac ], [ if test $install_all -eq 0; then install_pad=0 else install_pad=1 fi ] ) if test $install_pad -ne 0; then AC_MSG_RESULT(yes) tool_subdirs="$tool_subdirs ../pad" tool_makefiles="$tool_makefiles pad/Makefile" else AC_MSG_RESULT(no) fi AC_SUBST(html_files) AC_SUBST(man1_files) AC_SUBST(tool_subdirs) AC_SUBST(additional_testdirs) dnl #################################################################### dnl # dnl # Create Makefiles. dnl # dnl #################################################################### AC_CONFIG_FILES( [ Makefile Mk/common.mk Mk/common-macros.mk Mk/common-tests.mk $server_makefiles doc/Makefile etc/Makefile src/Makefile tests/Makefile tests/webjob/Makefile tests/webjob/common/Makefile tests/webjob/common/hashsum/Makefile tests/webjob/common/hashsum/test_1/Makefile tests/webjob/common/hashsum/test_2/Makefile tests/webjob/common/hashsum/test_3/Makefile $test_makefiles $tool_makefiles ] ) AC_CONFIG_HEADERS( [src/config.h], [ for dir in $tool_subdirs ; do cp -f src/config.h tools/$dir/ done ], [ tool_subdirs="$tool_subdirs" ] ) AC_OUTPUT