1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(install-sh)
4AC_PREREQ([2.50])
5AC_CONFIG_HEADER(config.h)
6
7AC_SUBST(TARGETS)
8AC_SUBST(PLTARGETS)
9AC_SUBST(NETLIBS)
10AC_SUBST(CRYPTLIBS)
11
12m4_include([../ac_swi_c.m4])
13
14TARGETS="random.$SO unix.$SO socket.$SO cgi.$SO memfile.$SO files.$SO mime.$SO crypt.$SO"
15
16AC_CHECK_FUNC(socket, [], [
17             AC_CHECK_LIB(socket, socket,
18                      [NETLIBS="$NETLIBS -lsocket"; LIBS="$LIBS -lsocket"]
19                      AC_DEFINE(HAVE_LIBSOCKET, 1,
20                      "Define if you have the socket library (-lsocket)."))])
21AC_CHECK_FUNC(gethostent, [], [
22             AC_CHECK_LIB(nsl, gethostent,
23                      [NETLIBS="$NETLIBS -lnsl"]
24                      AC_DEFINE(HAVE_LIBNSL, 1,
25                      "Define if you have the nsl library (-lnsl)."))])
26
27oldlibs="$LIBS"
28AC_CHECK_LIB(crypt, crypt)
29CRYPTLIBS="$LIBS"
30AC_CHECK_FUNCS(crypt)
31LIBS="$oldlibs"
32
33AC_MSG_CHECKING("Configuring MIME libraries")
34case "$CC" in
35	.*) ACC="../../$CC"
36	    ;;
37	*)  ACC="$CC"
38esac
39case "$LD" in
40	.*) ALD="../../$LD"
41	    ;;
42	*)  ALD="$LD"
43esac
44case "$CPP" in
45	.*) ACPP="../../$CPP"
46	;;
47	*) ACPP="$CPP"
48esac
49( CC=$ACC; LD=$ALD; CPP=$ACPP; CFLAGS=$CFLAGS; LDFLAGS=$LDFLAGS;
50  export CC LD CFLAGS LDFLAGS
51
52  (cd maildrop/rfc822 && $SHELL configure)
53  (cd maildrop/rfc2045 && $SHELL configure)
54)
55AC_MSG_RESULT("Done")
56
57AC_MSG_CHECKING(h_errno)
58AC_TRY_COMPILE(
59[
60#include <sys/types.h>
61#include <sys/socket.h>
62#include <netdb.h>
63#include <netinet/in.h>
64],
65[ int x = h_errno;
66], AC_DEFINE(HAVE_H_ERRNO, 1,
67	     [Define of h_errno is provided])
68   AC_MSG_RESULT(yes),
69   AC_MSG_RESULT(no))
70
71AC_CHECK_HEADERS(malloc.h alloca.h unistd.h sys/time.h fcntl.h utime.h)
72AC_CHECK_HEADERS(execinfo.h sys/resource.h crypt.h)
73AC_CHECK_HEADERS(sys/types.h sys/wait.h sys/stat.h)
74AC_CHECK_HEADERS(netinet/tcp.h)
75
76AC_CHECK_FUNCS(setsid strerror setitimer utime getrlimit)
77AC_CHECK_TYPES(socklen_t, [], [],
78[
79#include <sys/types.h>
80#include <sys/socket.h>
81])
82AC_CHECK_TYPES(ssize_t, [], [],
83[
84#include <sys/types.h>
85#include <sys/socket.h>
86])
87
88AC_MSG_CHECKING(_XOPEN_SOURCE)
89AC_TRY_COMPILE(
90[
91#define _XOPEN_SOURCE
92#include <unistd.h>
93],
94[
95], AC_DEFINE(DEFINE_XOPEN_SOURCE, 1,
96	     "Define if _XOPEN_SOURCE is needed")
97   AC_MSG_RESULT(yes),
98   AC_MSG_RESULT(no))
99
100with_time=yes
101AC_ARG_WITH(time, [  --without-time		  Exclude alarm library],
102	    [case "$withval" in
103		yes)	with_time=yes ;;
104		no)     with_time=no ;;
105	     esac])
106
107if test "$with_time" = yes; then
108  if test "$ac_cv_func_setitimer" = "yes"; then
109    TARGETS="$TARGETS time.$SO"
110  else
111    echo "WARNING: no setitimer(); dropping time.pl from targets"
112  fi
113fi
114
115if test "$ac_cv_func_getrlimit" = "yes"; then
116  TARGETS="$TARGETS rlimit.$SO"
117else
118  "WARNING: no getrlimit(); dropping rlimit.pl from targets"
119fi
120
121PLTARGETS=`echo $TARGETS | sed -e "s/\.$SO/.pl/g" -e "s/files.pl/filesex.pl/"`
122if echo "$PLTARGETS" | grep socket.pl 2>&1 >/dev/null; then
123  PLTARGETS="$PLTARGETS streampool.pl"
124fi
125
126AC_OUTPUT(Makefile)
127
128
129
130