summaryrefslogtreecommitdiff
path: root/configure.in
blob: d24049a6e41e452670a43208ed68895c750297fd (plain)
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
AC_CONFIG_AUX_DIR(./helpers)
OS=`./config.guess`
OS=`./config.sub $OS` 

# These added to allow default directories to be used...
DEFAULT_OSDIR="unix"
MODULES="file_io network_io threadproc misc locks time mmap" 

echo "Configuring APR library"
echo "Platform: ${OS}"
echo "(Default will be ${DEFAULT_OSDIR})"

dnl Process this file with autoconf to produce a configure script.
AC_INIT(configure.in)

AC_CONFIG_HEADER(include/apr_config.h)

AC_ARG_WITH(optim,[  --with-optim="FLAGS"      compiler optimisation flags],
	[OPTIM="$withval"])

# Most platforms use a prefix of 'lib' on their library files.
LIBPREFIX='lib'

dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_MAKE_SET
AC_CHECK_PROG(RM, rm, rm)
AC_CHECK_PROG(AR, ar, ar)

AC_ARG_WITH(debug,[  --with-debug              Turn on debugging and compile time warnings],
	[if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -g -Wall"; else CFLAGS="$CFLAGS -g"; fi])

dnl # this is the place to put specific options for platform/compiler
dnl # combinations
case "$OS:$CC" in
    *-hp-hpux*:cc ) CFLAGS="$CFLAGS -Ae +DAportable" ;;
esac


# This macro needs to be here in case we are on an AIX box.
AC_AIX

dnl Checks for standard typedefs
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE(ssize_t, int)
AC_C_INLINE

dnl Checks for integer size
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(long double, 12)
AC_CHECK_SIZEOF(long long, 8)

if test "$ac_cv_sizeof_short" = "2"; then
    short_value=short
fi
if test "$ac_cv_sizeof_int" = "4"; then
    int_value=int
fi
if test "$ac_cv_sizeof_long" = "8"; then
    long_value=long
fi
if test "$ac_cv_sizeof_long_double" = "8"; then
    long_value="long double"
fi
if test "$ac_cv_sizeof_long_long" = "8"; then
    long_value="long long"
fi
if test "$ac_cv_sizeof_longlong" = "8"; then
    long_value="__int64"
fi
AC_SUBST(short_value)
AC_SUBST(int_value)
AC_SUBST(long_value)

if test "$ac_cv_type_off_t" = "yes"; then
    off_t_value="off_t"
else
    off_t_value="ap_int32_t"
fi
if test "$ac_cv_type_size_t" = "yes"; then
    size_t_value="size_t"
else
    size_t_value="ap_int32_t"
fi
if test "$ac_cv_type_ssize_t" = "yes"; then
    ssize_t_value="ssize_t"
else
    ssize_t_value="ap_int32_t"
fi

AC_SUBST(off_t_value)
AC_SUBST(size_t_value)
AC_SUBST(ssize_t_value)

AC_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)

# Use /bin/sh if it exists, otherwise go looking for sh in the path
if test ".$SH" = . -a -f /bin/sh; then
  SH="/bin/sh"
fi
AC_CHECK_PROG(SH, sh, sh)

AC_CHECK_DEFINE(LOCK_EX, sys/file.h)
AC_CHECK_DEFINE(F_SETLK, fcntl.h)
AC_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)

dnl Checks for libraries.
AC_BEGIN_DECISION([lock implementation method])
AC_IFALLYES(header:sys/file.h define:LOCK_EX,
            AC_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
AC_IFALLYES(header:sys/ipc.h header:sys/sem.h header:sys/file.h dnl
            func:semget func:semctl,
            AC_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
AC_IFALLYES(header:fcntl.h define:F_SETLK,
            AC_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
AC_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
            custom:use_pthread_cross,
            AC_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread mutex]))
AC_DECISION_FORCE(USE_FCNTL_SERIALIZE)
AC_END_DECISION
AC_DEFINE_UNQUOTED($ac_decision) 

AC_CHECK_LIB(pthread, pthread_mutex_init, AC_DEFINE(USE_PTHREAD_SERIALIZE))
AC_CHECK_LIB(c_r, pthread_mutex_init, AC_DEFINE(USE_PTHREAD_SERIALIZE))
ac_cv_define_READDIR_IS_THREAD_SAFE=no
AC_CHECK_LIB(c_r, readdir, AC_DEFINE(READDIR_IS_THREAD_SAFE))


case "$OS" in
   *-os2*)
       CFLAGS="$CFLAGS -DOS2 -Zmt"
       OSDIR="os2"
       LIBPREFIX=""
       ;;
   *beos*)
       OSDIR="beos"
       CFLAGS="$CFLAGS -DBEOS"
       ;;
   *)
       OSDIR="unix"
       ;;
esac

AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(pthread, pthread_mutex_init)
AC_CHECK_LIB(c_r, pthread_mutex_init)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(crypt,crypt)
AC_CHECK_LIB(ufc,crypt)

if test ".$SYS_SW" = ".AIX"; then
    CFLAGS="$CFLAGS -U__STR__"
    case "$SYS_KV" in
	[12]*)
	    AC_DEFINE(USEBCOPY)
	    ;;
	3*)
	    AC_DEFINE(NEED_RLIM_T)
	    ;;
	41*)
	    AC_DEFINE(NEED_RLIM_T)
	    ;;
    esac
fi

dnl Checks for header files.
AC_HEADER_STDC

AC_CHECK_HEADERS(conio.h)
AC_CHECK_HEADERS(crypt.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(dir.h)
AC_CHECK_HEADERS(dirent.h, direnth="1", dirent="0")
AC_CHECK_HEADERS(errno.h, errnoh="1", errnoh="0")
AC_CHECK_HEADERS(net/errno.h)
AC_CHECK_HEADERS(fcntl.h, fcntlh="1", fcntl="0")
AC_CHECK_HEADERS(features.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(io.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(math.h)
AC_CHECK_HEADERS(memory.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(osreldate.h)
AC_CHECK_HEADERS(process.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(setjmp.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(stdarg.h, stdargh="1", stdargh="0")
AC_CHECK_HEADERS(stddef.h)
AC_CHECK_HEADERS(stdio.h, stdioh="1", stdioh"0")
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(sysapi.h)
AC_CHECK_HEADERS(sysgtime.h)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/times.h)
AC_CHECK_HEADERS(tpfeq.h)
AC_CHECK_HEADERS(tpfio.h)
AC_CHECK_HEADERS(sys/uio.h, sys_uioh="1", sys_uioh="0")
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(poll.h)
AC_CHECK_HEADERS(unix.h)
AC_CHECK_HEADERS(winsock.h)

AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(netinet/in.h, netinet_inh="1", netinet_inh="0")
AC_CHECK_HEADERS(netinet/tcp.h)

AC_CHECK_HEADERS(sys/file.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/signal.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(sys/types.h, sys_typesh="1", sys_typesh="0")
AC_CHECK_HEADERS(sys/wait.h)

AC_CHECK_HEADERS(kernel/OS.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_FUNC_MMAP
AC_FUNC_SETPGRP

if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then 
    mmap="#define APR_HAS_MMAP 1"
    AC_SUBST(mmap)
else
    mmap="#define APR_HAS_MMAP 0"
    AC_SUBST(mmap)
fi

AC_MSG_CHECKING(looking for union semun in sys/sem.h)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
],[
union semun arg;
semctl(0, 0, 0, arg);
], AC_DEFINE(HAVE_STRUCT_UNION_SEMUN)
msg=yes,dnl
msg=no)
AC_MSG_RESULT([$msg])

dnl Checks for library functions.
AC_CHECK_FUNCS(pthread_sigmask)
AC_CHECK_FUNCS(strcasecmp stricmp poll setsid)
AC_CHECK_FUNCS(sigaction writev)
AC_CHECK_FUNCS(sendfile, [ sendfile="#define APR_HAS_SENDFILE 1" ], [ sendfile="APR_HAS_SENDFILE 0" ]) 
AC_CHECK_FUNCS(getpass)
AC_CHECK_FUNC(_getch)
AC_SUBST(sendfile)

AC_CHECK_FUNCS(gmtime_r localtime_r)

AC_MSG_CHECKING(whether to enable thread support)
AC_ARG_ENABLE(threads,
[  --enable-threads  Enable threading support in APR.],
[
  if test "$enableval" = "no"; then 
    threads="#define APR_HAS_THREADS 0"
    pthreadh="0"
    AC_SUBST(threads)
    AC_SUBST(pthreadh)
    AC_MSG_RESULT(no)
  else
    if test "$enableval" = "pthread"; then
      AC_CHECK_HEADERS(pthread.h, [ 
          threads="#define APR_HAS_THREADS 1"
          pthreadh="1"
          AC_SUBST(pthreadh)
          AC_SUBST(threads) ], [
          threads="#define APR_HAS_THREADS 0"
          pthreadh="0"
          AC_SUBST(pthreadh)
          AC_SUBST(threads) ] )
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
],
[
  AC_CHECK_HEADERS(pthread.h, [
          threads="#define APR_HAS_THREADS 1"
          pthreadh="1"
          AC_SUBST(pthreadh)
          AC_SUBST(threads) ], [
          threads="#define APR_HAS_THREADS 0"
          pthreadh="0"
          AC_SUBST(pthreadh)
          AC_SUBST(threads) ] )
]) 


dnl Start building stuff from our information
AC_SUBST(LDLIBS)
AC_SUBST(OPTIM)
AC_SUBST(RANLIB)
AC_SUBST(AR)
AC_SUBST(RM)
AC_SUBST(OSDIR)
AC_SUBST(DEFAULT_OSDIR)
AC_SUBST(LIBPREFIX)
AC_SUBST(EXEEXT)
AC_SUBST(errnoh)
AC_SUBST(direnth)
AC_SUBST(fcntlh)
AC_SUBST(netinet_inh)
AC_SUBST(stdargh)
AC_SUBST(stdioh)
AC_SUBST(sys_typesh)
AC_SUBST(sys_uioh)


MAKEFILE1="Makefile lib/Makefile "
SUBDIRS="lib "
for dir in $MODULES
do
    if test -f $dir/$OSDIR/Makefile.in; then
        MAKEFILE2="$MAKEFILE2 $dir/$OSDIR/Makefile "
        SUBDIRS="$SUBDIRS $dir/$OSDIR "
    else
        MAKEFILE2="$MAKEFILE2 $dir/$DEFAULT_OSDIR/Makefile "
        SUBDIRS="$SUBDIRS $dir/$DEFAULT_OSDIR "
    fi
done

MAKEFILE3="test/Makefile"
AC_SUBST(SUBDIRS)
AC_SUBST(MODULES)
AC_OUTPUT($MAKEFILE1 $MAKEFILE2 $MAKEFILE3 include/apr.h)