dnl Process this file with autoconf to produce a configure script. AC_INIT(newpki-tests, 2.0.0-0, info@newpki.org) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([tests.cpp]) AM_CONFIG_HEADER([config.h]) dnl Checks for programs. AC_PROG_CXX(c++ g++ cpp gcc) AC_PROG_CC(gcc) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h string.h sys/time.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_FUNC_SELECT_ARGTYPES AC_FUNC_VPRINTF AC_CHECK_FUNCS([gethostbyname gethostname inet_ntoa memset select setlocale socket strdup strerror strrchr strstr strtoul]) AC_LANG_PUSH(C) dnl Checking openssl includes AC_ARG_WITH(openssl-include, AC_HELP_STRING([--with-openssl-include=path], [Where openssl includes are installed (optional)]), CPPFLAGS="-I$with_openssl_include $CPPFLAGS", []) dnl Checking openssl lib AC_ARG_WITH(openssl-lib, AC_HELP_STRING([--with-openssl-lib=path], [Where openssl lib are installed (optional)]), LDFLAGS=["-L$with_openssl_lib -Wl,-rpath -Wl,$with_openssl_lib $LDFLAGS"], []) dnl Checking newpki includes AC_ARG_WITH(newpki-lib, AC_HELP_STRING([--with-newpki-lib=path], [Where NewPKI's lib is installed (optional)]), LDFLAGS=["-L$with_newpki_lib -Wl,-rpath -Wl,$with_newpki_lib $LDFLAGS"], []) AC_ARG_WITH(newpki-include, AC_HELP_STRING([--with-newpki-include=path], [Where NewPKI's includes are installed (optional)]), CPPFLAGS="-I$with_newpki_include $CPPFLAGS", []) dnl Checking openssl version AC_MSG_CHECKING(openssl version) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[#include ]], [[return ((OPENSSL_VERSION_NUMBER < 0x0090702fL)?1:0);]])], [AC_MSG_RESULT([OK])], [AC_MSG_ERROR([openssl must be at least 0.9.7b])]) AC_LANG_PUSH(C++) AC_CHECK_HEADERS("NewPKI.h", [], [AC_MSG_ERROR([could not find the NewPKI.h include])]) AC_LANG_POP AC_CHECK_HEADERS("openssl/opensslv.h", [], [AC_MSG_ERROR([could not find the openssl/opensslv.h include])]) AC_CHECK_LIB(crypto, OCSP_RESPONSE_new, [], [AC_MSG_ERROR([libcrypto not found])]) AC_CHECK_HEADERS("openssl/ssl.h", [], [AC_MSG_ERROR([could not find the openssl/ssl.h include])]) AC_CHECK_LIB(ssl, SSL_connect, [], [AC_MSG_ERROR([libssl not found])]) AC_CHECK_HEADERS("pthread.h", [], [AC_MSG_ERROR([could not find pthread.h include])]) AC_CHECK_LIB(pthread, pthread_mutex_init, [], [AC_MSG_ERROR([pthread_mutex_init not found])]) AC_CHECK_FUNC(gethostent, [], AC_CHECK_LIB(nsl, gethostent, [], [AC_MSG_ERROR([gethostent not found])])) AC_CHECK_FUNC(setsockopt, [], AC_CHECK_LIB(socket, setsockopt, [], [AC_MSG_ERROR([setsockopt not found])])) AC_LANG_POP LIBS="-lnewpki $LIBS" AC_OUTPUT([Makefile])