1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT(postal.cpp)
AC_CONFIG_HEADER(conf.h)
AC_SUBST(version)
version="0.70"
AC_ARG_ENABLE(stripping,
[ --disable-stripping disables stripping of installed binaries],
STRIPPING=$strippingval, STRIPPING=no)
AC_SUBST(stripping)
if [[ ! "$STRIPPING" = "no" ]]; then
stripping=""
else
stripping="-s"
fi
AC_ARG_ENABLE(openssl,
[ --disable-openssl disables openssl support],
DISABLEOPENSSL=$opensslval, DISABLEOPENSSL=no)
AC_ARG_ENABLE(gnutls,
[ --disable-gnutls disables gnutls support],
DISABLEGNUTLS=$gnutlsval, DISABLEGNUTLS=no)
dnl Checks for programs.
AC_LANG_CPLUSPLUS
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_SUBST(semun)
AC_TRY_COMPILE(#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
, union semun sem; , semun="yes")
if [[ -n "$semun" ]]; then
semun="#define SEMUN_IN_SEM_H"
fi
AC_SUBST(bool)
AC_TRY_COMPILE([], [bool var;] , , bool="typedef bool char;")
AC_SUBST(true_false)
AC_TRY_COMPILE(, [char c = true; char d = false;
] , true_false="0", true_false="1")
AC_SUBST(snprintf)
AC_TRY_LINK([#include <stdio.h>], char buf[[10]]; snprintf(buf, sizeof(buf), "abc");,,snprintf="no");
if [[ -n "$snprintf" ]]; then
snprintf="#define NO_SNPRINTF"
fi
AC_SUBST(extra_ldflags)
extra_ldflags=
AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths],
use_extra_libs=$withval,
use_extra_libs=NONE
)
if test -n "$use_extra_libs" && \
test "$use_extra_libs" != "NONE"; then
ac_save_ifs=$IFS
IFS=':'
for dir in $use_extra_libs; do
extra_ldflags="$extra_ldflags -L$dir"
done
IFS=$ac_save_ifs
fi
extra_ldflags=`/usr/bin/uname -a | grep -q SunOS && echo -lrt`
dnl Checks for library -l socket.
AC_CHECK_LIB(socket, bind, extra_ldflags="$extra_ldflags -lsocket -lnsl")
dnl Checks for header files.
AC_SUBST(gnutls)
AC_SUBST(openssl)
AC_SUBST(extra_objs)
if [[ "$DISABLEGNUTLS" = "no" ]]; then
AC_CHECK_HEADER(gnutls/gnutls.h, GNUTLS=yes, GNUTLS=no)
else
GNUTLS=no
fi
if [[ "$GNUTLS" = "yes" ]]; then
DISABLEOPENSSL=yes
fi
if [[ "$DISABLEOPENSSL" = "no" ]]; then
AC_CHECK_HEADER(openssl/crypto.h, OPENSSL=yes, OPENSSL=no)
else
OPENSSL=no
fi
if [[ "$OPENSSL" = "no" ]]; then
extra_objs="md5.o"
fi
AC_SUBST(linux_pthread)
AC_TRY_COMPILE([#define _GNU_SOURCE
#include <pthread.h>
] , [pthread_mutexattr_t attr;
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);]
, linux_pthread="yes")
if [[ -n "$linux_pthread" ]]; then
linux_pthread="#define LINUX_PTHREAD"
fi
LDFLAGS=-lpthread
AC_TRY_LINK([#include <pthread.h>
void * thread_func(void * param) { return NULL; }
] , [pthread_t thread_info;
pthread_attr_t attr;
pthread_create(&thread_info, &attr, &thread_func, NULL);]
, extra_ldflags="$extra_ldflags -lpthread"
, extra_ldflags="$extra_ldflags -pthread")
AC_SUBST(crypt_ldflags)
crypt_ldflags="$extra_ldflags"
if [[ "$GNUTLS" = "no" ]]; then
gnutls=""
else
gnutls="#define USE_GNUTLS"
crypt_ldflags="$extra_ldflags -lgnutls"
fi
if [[ "$OPENSSL" = "no" ]]; then
openssl=""
else
openssl="#define USE_OPENSSL"
crypt_ldflags="$extra_ldflags -lssl -lcrypto"
fi
AC_SUBST(large_file)
large_file=""
AC_SUBST(socklen_t)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
] , [socklen_t * namelen;], , no_socklen_t="true")
if [[ -n "$no_socklen_t" ]]; then
socklen_t="#define socklen_t int"
fi
AC_CHECK_HEADERS(vector ext/hash_map)
dnl Checks for library functions.
AC_OUTPUT(Makefile postal.h port.h postal.spec sun/pkginfo)
|