forked from SWI-Prolog/packages-clib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
186 lines (160 loc) · 4.36 KB
/
configure.in
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
dnl Process this file with autoconf to produce a configure script.
AC_INIT(install-sh)
AC_PREREQ([2.50])
AC_CONFIG_HEADER(config.h)
AC_SUBST(TARGETS)
AC_SUBST(PLTARGETS)
AC_SUBST(NETLIBS)
AC_SUBST(CRYPTLIBS)
AC_SUBST(CRYPTOBJ)
AC_SUBST(LIBUUID)
m4_include([../ac_swi_c.m4])
TARGETS="socket.$SO cgi.$SO memfile.$SO files.$SO mime.$SO crypt.$SO time.$SO"
case "$PLARCH" in
*-win32|*-win64)
AC_CHECK_LIB(ws2_32, main,
[NETLIBS="$NETLIBS -lws2_32"])
AC_CHECK_LIB(gdi32, main,
[NETLIBS="$NETLIBS -lgdi32"])
;;
*)
TARGETS="$TARGETS uid.$SO unix.$SO"
;;
esac
AC_CHECK_FUNC(socket, [], [
AC_CHECK_LIB(socket, socket,
[NETLIBS="$NETLIBS -lsocket"; LIBS="$LIBS -lsocket"]
AC_DEFINE(HAVE_LIBSOCKET, 1,
"Define if you have the socket library (-lsocket)."))])
AC_CHECK_FUNC(gethostent, [], [
AC_CHECK_LIB(nsl, gethostent,
[NETLIBS="$NETLIBS -lnsl"]
AC_DEFINE(HAVE_LIBNSL, 1,
"Define if you have the nsl library (-lnsl)."))])
dnl Configure UUID library. We use the OSSP UUID library, but it seems
dnl to be installed in various places.
if test x"$LIBUUID" = "x"; then
AC_CHECK_LIB(ossp-uuid, uuid_create,
[ LIBUUID=-lossp-uuid
])
fi
if test x"$LIBUUID" = "x"; then
AC_CHECK_LIB(uuid, uuid_create,
[ LIBUUID=-luuid
])
fi
if test x"$LIBUUID" = "x"; then
AC_MSG_WARN([ Cannot find libossp-uuid or libuuid -- dropping uuid.pl])
else
if test x"$UUID_H" = "x"; then
AC_CHECK_HEADER(ossp/uuid.h,
[ UUID_H=ossp/uuid.h ],
[],
[/*first*/])
fi
if test x"$UUID_H" = "x"; then
AC_CHECK_HEADER(uuid.h,
[ UUID_H=uuid.h ],
[],
[/*first*/])
fi
if test x"$UUID_H" = "x"; then
AC_MSG_WARN([ Cannot find uuid.h -- dropping uuid.pl])
else
AC_DEFINE_UNQUOTED([UUID_H], [<$UUID_H>],
[ Define to name of the UUID header file. ])
TARGETS="$TARGETS uuid.$SO"
fi
fi
oldlibs="$LIBS"
AC_CHECK_LIB(crypt, crypt)
CRYPTLIBS="$LIBS"
AC_CHECK_FUNC(crypt,
[],
[CRYPTOBJ=bsd-crypt.o])
AC_DEFINE(HAVE_CRYPT, 1,
"Define if you have the crypt function.")
LIBS="$oldlibs"
AC_CHECK_FUNC(syslog,
[ TARGETS="$TARGETS syslog.$SO" ],
AC_MSG_WARN([Cannot find syslog"()" -- dropping syslog.pl]))
AC_MSG_CHECKING("Configuring MIME libraries")
case "$CC" in
.*) ACC="../../$CC"
;;
*) ACC="$CC"
esac
case "$LD" in
.*) ALD="../../$LD"
;;
*) ALD="$LD"
esac
case "$CPP" in
.*) ACPP="../../$CPP"
;;
*) ACPP="$CPP"
esac
( CC=$ACC; LD=$ALD; CPP=$ACPP; CFLAGS=$CFLAGS; LDFLAGS=$LDFLAGS;
export CC LD CFLAGS LDFLAGS
(cd maildrop/rfc822 && $SHELL configure --host=$host)
(cd maildrop/rfc2045 && $SHELL configure --host=$host)
)
AC_MSG_RESULT("Done")
AC_MSG_CHECKING(h_errno)
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
],
[ int x = h_errno;
], AC_DEFINE(HAVE_H_ERRNO, 1,
[Define of h_errno is provided])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_CHECK_HEADERS(malloc.h alloca.h unistd.h sys/time.h fcntl.h utime.h)
AC_CHECK_HEADERS(execinfo.h sys/resource.h crypt.h syslog.h)
AC_CHECK_HEADERS(sys/types.h sys/wait.h sys/stat.h)
AC_CHECK_HEADERS(netinet/tcp.h crt_externs.h)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_FUNCS(setsid strerror utime getrlimit strcasestr vfork _NSGetEnviron)
AC_CHECK_FUNCS(pipe2)
AC_CHECK_TYPES(socklen_t, [], [],
[
#include <sys/types.h>
#include <sys/socket.h>
])
AC_CHECK_TYPES(ssize_t, [], [],
[
#include <sys/types.h>
#include <sys/socket.h>
])
AC_MSG_CHECKING(_XOPEN_SOURCE)
AC_TRY_COMPILE(
[
#define _XOPEN_SOURCE
#include <unistd.h>
],
[
], AC_DEFINE(DEFINE_XOPEN_SOURCE, 1,
"Define if _XOPEN_SOURCE is needed")
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
with_time=yes
AC_ARG_WITH(time, [ --without-time Exclude alarm library],
[case "$withval" in
yes) with_time=yes ;;
no) with_time=no ;;
esac])
if test "$ac_cv_func_getrlimit" = "yes"; then
TARGETS="$TARGETS rlimit.$SO"
else
AC_MSG_WARN([Cannot find getrlimit"()" -- dropping rlimit.pl])
fi
PLTARGETS=`echo $TARGETS | sed -e "s/\.$SO/.pl/g" -e "s/files.pl/filesex.pl/"`
if echo "$PLTARGETS" | grep socket.pl 2>&1 >/dev/null; then
PLTARGETS="$PLTARGETS streampool.pl"
fi
AC_OUTPUT(Makefile)