forked from SWI-Prolog/packages-clib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
214 lines (188 loc) · 5.11 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
dnl Process this file with autoconf to produce a configure script.
m4_ifdef([HAS_TOP],[m4_ignore],[
AC_INIT(install-sh)
AC_PREREQ([2.50])
AC_CONFIG_HEADER(config.h)
])
AC_SUBST(CLIB_TARGETS)
AC_SUBST(CLIB_PLTARGETS)
AC_SUBST(CLIB_NETLIBS)
AC_SUBST(CLIB_CRYPTLIBS)
AC_SUBST(CLIB_CRYPTOBJ)
AC_SUBST(CLIB_LIBUUID)
AC_SUBST(CLIB_CPPFLAGS)
m4_ifdef([HAS_TOP],[m4_ignore],[
m4_include([../ac_swi_c.m4])
])
CLIB_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,
[CLIB_NETLIBS="$CLIB_NETLIBS -lws2_32"])
AC_CHECK_LIB(gdi32, main,
[CLIB_NETLIBS="$CLIB_NETLIBS -lgdi32"])
;;
*)
CLIB_TARGETS="$CLIB_TARGETS uid.$SO unix.$SO"
;;
esac
AC_CHECK_FUNC(socket, [], [
AC_CHECK_LIB(socket, socket,
[CLIB_NETLIBS="$CLIB_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,
[CLIB_NETLIBS="$CLIB_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.
# brew in OSX
if test -d /usr/local/opt/ossp-uuid; then
CPPFLAGS="$CPPFLAGS -I /usr/local/opt/ossp-uuid/include"
UUID_LIB_PATH="-L /usr/local/opt/ossp-uuid/lib"
fi
# /opt
if test -d /opt/include/ossp; then
CPPFLAGS="$CPPFLAGS -I /opt/include"
UUID_LIB_PATH="-L /opt/lib"
fi
# /usr/local
if test -d /opt/include/ossp; then
CPPFLAGS="$CPPFLAGS -I /opt/include"
UUID_LIB_PATH="-L /opt/lib"
fi
if test x"$UUID_H" = "x"; then
AC_CHECK_HEADER(ossp/uuid.h,
[ UUID_H=ossp/uuid.h
has_uuid=true],
[],
[/*first*/])
fi
if test x"$UUID_H" = "x" -a ! -d /usr/include/uuid; then
AC_CHECK_HEADER(uuid/uuid.h,
[ UUID_H=uuid/uuid.h
has_uuid=true ],
[],
[/*first*/])
fi
if test x"$UUID_H" = "x"; then
AC_CHECK_HEADER(uuid.h,
[ UUID_H=uuid.h
has_uuid=true ],
[],
[/*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. ])
has_uuid=true
fi
if test x"$has_uuid" != "x"; then
AC_CHECK_FUNC(uuid_create,
[has_uuid=true],
[
if test x"$CLIB_LIBUUID" = "x"; then
AC_CHECK_LIB(uuid, uuid_create,
[ CLIB_LIBUUID="$UUID_LIB_PATH -luuid"
has_uuid=true
])
fi
if test x"$has_uuid" = "x"; then
AC_MSG_WARN([ Cannot find libossp-uuid or libuuid -- dropping uuid.pl])
fi
]
)
fi
oldlibs="$LIBS"
AC_CHECK_LIB(crypt, crypt)
CLIB_CRYPTLIBS="$LIBS"
AC_CHECK_FUNC(crypt,
[],
[CLIB_CRYPTOBJ=bsd-crypt.o])
AC_DEFINE(HAVE_CRYPT, 1,
"Define if you have the crypt function.")
LIBS="$oldlibs"
AC_CHECK_FUNC(syslog,
[ CLIB_TARGETS="$CLIB_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
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
CLIB_TARGETS="$CLIB_TARGETS rlimit.$SO"
else
AC_MSG_WARN([Cannot find getrlimit"()" -- dropping rlimit.pl])
fi
CLIB_PLTARGETS=`echo $CLIB_TARGETS | sed -e "s/\.$SO/.pl/g" -e "s/files.pl/filesex.pl/"`
if echo "$CLIB_PLTARGETS" | grep socket.pl 2>&1 >/dev/null; then
CLIB_PLTARGETS="$CLIB_PLTARGETS streampool.pl"
fi
CLIB_CPPFLAGS="$CPPFLAGS"
m4_ifdef([HAS_TOP],[m4_ignore],[
AC_OUTPUT(Makefile)
])