~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl 
 
2
dnl Autoconf configuration file for APR
 
3
dnl 
 
4
dnl Process this file with autoconf to produce a configure script.
 
5
dnl Use ./buildconf to prepare build files and run autoconf for APR.
 
6
 
 
7
AC_PREREQ(2.50)
 
8
 
 
9
AC_INIT(build/apr_common.m4)
 
10
AC_CONFIG_HEADER(include/arch/unix/apr_private.h)
 
11
AC_CONFIG_AUX_DIR(build)
 
12
 
 
13
dnl 
 
14
dnl Include our own M4 macros along with those for libtool
 
15
dnl 
 
16
sinclude(build/apr_common.m4)
 
17
sinclude(build/apr_network.m4)
 
18
sinclude(build/apr_threads.m4)
 
19
sinclude(build/apr_hints.m4)
 
20
sinclude(build/libtool.m4)
 
21
sinclude(build/ltsugar.m4)
 
22
 
 
23
dnl Hard-coded inclusion at the tail end of apr_private.h:
 
24
AH_BOTTOM([
 
25
/* switch this on if we have a BeOS version below BONE */
 
26
#if BEOS && !HAVE_BONE_VERSION
 
27
#define BEOS_R5 1
 
28
#else
 
29
#define BEOS_BONE 1
 
30
#endif
 
31
 
 
32
/*
 
33
 * Include common private declarations.
 
34
 */
 
35
#include "../apr_private_common.h"
 
36
])
 
37
 
 
38
dnl Save user-defined environment settings for later restoration
 
39
dnl
 
40
APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
 
41
APR_SAVE_THE_ENVIRONMENT(CFLAGS)
 
42
APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
 
43
APR_SAVE_THE_ENVIRONMENT(LIBS)
 
44
APR_SAVE_THE_ENVIRONMENT(INCLUDES)
 
45
 
 
46
dnl Generate ./config.nice for reproducing runs of configure
 
47
dnl
 
48
APR_CONFIG_NICE(config.nice)
 
49
 
 
50
AC_CANONICAL_SYSTEM
 
51
echo "Configuring APR library"
 
52
echo "Platform: $host"
 
53
 
 
54
dnl Some initial steps for configuration.  We setup the default directory
 
55
dnl and which files are to be configured.
 
56
 
 
57
dnl Setup the directory macros now
 
58
 
 
59
# Absolute source/build directory
 
60
apr_srcdir=`(cd $srcdir && pwd)`
 
61
apr_builddir=`pwd`
 
62
AC_SUBST(apr_srcdir)
 
63
AC_SUBST(apr_builddir)
 
64
 
 
65
if test "$apr_builddir" != "$apr_srcdir"; then
 
66
  USE_VPATH=1
 
67
  APR_CONFIG_LOCATION=build
 
68
else
 
69
  APR_CONFIG_LOCATION=source
 
70
fi
 
71
 
 
72
AC_SUBST(APR_CONFIG_LOCATION)
 
73
 
 
74
# Libtool might need this symbol -- it must point to the location of
 
75
# the generated libtool script (not necessarily the "top" build dir).
 
76
#
 
77
top_builddir="$apr_builddir"
 
78
AC_SUBST(top_builddir)
 
79
 
 
80
# Directory containing apr build macros, helpers, and make rules
 
81
# NOTE: make rules (apr_rules.mk) will be in the builddir for vpath
 
82
#
 
83
apr_buildout=$apr_builddir/build
 
84
apr_builders=$apr_srcdir/build
 
85
AC_SUBST(apr_builders)
 
86
 
 
87
MKDIR=$apr_builders/mkdir.sh
 
88
 
 
89
dnl Initialize mkdir -p functionality.
 
90
APR_MKDIR_P_CHECK($apr_builders/mkdir.sh)
 
91
 
 
92
# get our version information
 
93
get_version="$apr_builders/get-version.sh"
 
94
version_hdr="$apr_srcdir/include/apr_version.h"
 
95
APR_MAJOR_VERSION="`$get_version major $version_hdr APR`"
 
96
APR_DOTTED_VERSION="`$get_version all $version_hdr APR`"
 
97
 
 
98
AC_SUBST(APR_DOTTED_VERSION)
 
99
AC_SUBST(APR_MAJOR_VERSION)
 
100
 
 
101
echo "APR Version: ${APR_DOTTED_VERSION}"
 
102
 
 
103
dnl Enable the layout handling code, then reparse the prefix-style
 
104
dnl arguments due to autoconf being a PITA.
 
105
APR_ENABLE_LAYOUT(apr)
 
106
APR_PARSE_ARGUMENTS
 
107
 
 
108
dnl Set optional CC hints here in case autoconf makes an inappropriate choice.
 
109
dnl This allows us to suggest what the compiler should be, but still
 
110
dnl allows the user to override CC externally.
 
111
APR_CC_HINTS
 
112
 
 
113
dnl Do the various CC checks *before* preloading values. The preload code
 
114
dnl may need to use compiler characteristics to make decisions. This macro
 
115
dnl can only be used once within a configure script, so this prevents a
 
116
dnl preload section from invoking the macro to get compiler info.
 
117
AC_PROG_CC
 
118
 
 
119
dnl Preload
 
120
APR_PRELOAD
 
121
 
 
122
dnl These added to allow default directories to be used...
 
123
DEFAULT_OSDIR="unix"
 
124
echo "(Default will be ${DEFAULT_OSDIR})"
 
125
 
 
126
apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random"
 
127
 
 
128
dnl Checks for programs.
 
129
AC_PROG_MAKE_SET
 
130
AC_PROG_CPP
 
131
AC_PROG_AWK
 
132
AC_PROG_LN_S
 
133
AC_PROG_RANLIB
 
134
AC_PROG_INSTALL
 
135
AC_CHECK_PROG(RM, rm, rm)
 
136
AC_CHECK_PROG(AS, as, as)
 
137
AC_CHECK_PROG(ASCPP, cpp, cpp)
 
138
AC_CHECK_TOOL(AR, ar, ar)
 
139
 
 
140
dnl Various OS checks that apparently set required flags
 
141
AC_AIX
 
142
AC_ISC_POSIX
 
143
AC_MINIX
 
144
 
 
145
APR_EBCDIC
 
146
 
 
147
dnl this is our library name
 
148
APR_LIBNAME="apr${libsuffix}"
 
149
AC_SUBST(APR_LIBNAME)
 
150
 
 
151
dnl prep libtool
 
152
dnl
 
153
echo "performing libtool configuration..."
 
154
 
 
155
AC_ARG_ENABLE(experimental-libtool,[  --enable-experimental-libtool Use experimental custom libtool],
 
156
  [experimental_libtool=$enableval],[experimental_libtool=no])
 
157
 
 
158
case $host in
 
159
*-os2*)
 
160
    # Use a custom-made libtool replacement
 
161
    echo "using aplibtool"
 
162
    LIBTOOL="$srcdir/build/aplibtool"
 
163
    gcc $CFLAGS $CPPFLAGS -o $LIBTOOL.exe $LIBTOOL.c
 
164
    ;;
 
165
*)
 
166
    if test "x$LTFLAGS" = "x"; then
 
167
        LTFLAGS='--silent'
 
168
    fi
 
169
    if test "$experimental_libtool" = "yes"; then
 
170
        # Use a custom-made libtool replacement
 
171
        echo "using jlibtool"
 
172
        LIBTOOL="$apr_builddir/libtool"
 
173
        LIBTOOL_SRC="$apr_srcdir/build/jlibtool.c"
 
174
        $CC $CFLAGS $CPPFLAGS -o $LIBTOOL $LIBTOOL_SRC
 
175
        eval `$apr_builddir/libtool --config | grep "^shlibpath_var=[[A-Z_]]*$"`
 
176
        if test "x$shlibpath_var" = "x"; then
 
177
            shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
 
178
        fi
 
179
    else
 
180
    dnl libtoolize requires that the following not be indented
 
181
AC_PROG_LIBTOOL
 
182
        # get libtool's setting of shlibpath_var
 
183
        eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool`
 
184
        if test "x$shlibpath_var" = "x"; then
 
185
            shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
 
186
        fi
 
187
    fi
 
188
    ;;
 
189
esac
 
190
 
 
191
AC_ARG_WITH(installbuilddir, [  --with-installbuilddir=DIR location to store APR build files (defaults to '${datadir}/build')],
 
192
  [ installbuilddir=$withval ], [ installbuilddir="${datadir}/build-${APR_MAJOR_VERSION}" ] )
 
193
AC_SUBST(installbuilddir)
 
194
 
 
195
AC_ARG_WITH(libtool, [  --without-libtool       avoid using libtool to link the library],
 
196
  [ use_libtool=$withval ], [ use_libtool="yes" ] )
 
197
 
 
198
if test "x$use_libtool" = "xyes"; then
 
199
      lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@'
 
200
      LT_VERSION="-version-info `$get_version libtool $version_hdr APR`"
 
201
      link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) ${LT_VERSION} \$(ALL_LDFLAGS) -o \$@"
 
202
      so_ext='lo'
 
203
      lib_target='-rpath $(libdir) $(OBJECTS)'
 
204
      export_lib_target='-rpath \$(libdir) \$(OBJECTS)'
 
205
else
 
206
      lt_compile='$(COMPILE) -o $@ -c $<'
 
207
      link='$(AR) cr $(TARGET_LIB) $(OBJECTS); $(RANLIB) $(TARGET_LIB)'
 
208
      so_ext='o'
 
209
      lib_target=''
 
210
      export_lib_target=''
 
211
fi
 
212
 
 
213
case $host in
 
214
    *-solaris2*)
 
215
        apr_platform_runtime_link_flag="-R"
 
216
        ;;
 
217
    *)
 
218
        ;;
 
219
esac
 
220
 
 
221
AC_SUBST(lt_compile)
 
222
AC_SUBST(link)
 
223
AC_SUBST(so_ext)
 
224
AC_SUBST(lib_target)
 
225
AC_SUBST(export_lib_target)
 
226
AC_SUBST(shlibpath_var)
 
227
AC_SUBST(LTFLAGS)
 
228
AC_SUBST(LT_LDFLAGS)
 
229
 
 
230
dnl ----------------------------- Checks for compiler flags
 
231
nl='
 
232
'
 
233
echo "${nl}Check for compiler flags..."
 
234
 
 
235
dnl AC_PROG_CC sets -g in CFLAGS (and -O2 for gcc) by default.
 
236
dnl On OS/390 this causes the compiler to insert extra debugger
 
237
dnl hook instructions.  That's fine for debug/maintainer builds, not fine
 
238
dnl otherwise.
 
239
 
 
240
case $host in
 
241
    *os390)
 
242
        if test "$ac_test_CFLAGS" != set; then
 
243
           APR_REMOVEFROM(CFLAGS,-g)
 
244
        fi
 
245
        ;;
 
246
esac
 
247
 
 
248
AC_ARG_ENABLE(debug,[  --enable-debug          Turn on debugging and compile time warnings],
 
249
  [APR_ADDTO(CFLAGS,-g)
 
250
   if test "$GCC" = "yes"; then
 
251
     APR_ADDTO(CFLAGS,-Wall)
 
252
   elif test "$AIX_XLC" = "yes"; then
 
253
     APR_ADDTO(CFLAGS,-qfullpath)
 
254
   fi
 
255
])dnl
 
256
 
 
257
AC_ARG_ENABLE(maintainer-mode,[  --enable-maintainer-mode  Turn on debugging and compile time warnings],
 
258
  [APR_ADDTO(CFLAGS,-g)
 
259
   if test "$GCC" = "yes"; then
 
260
     APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations])
 
261
   elif test "$AIX_XLC" = "yes"; then
 
262
     APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
 
263
   fi
 
264
])dnl
 
265
 
 
266
AC_ARG_ENABLE(profile,[  --enable-profile        Turn on profiling for the build (GCC)],
 
267
  if test "$GCC" = "yes"; then
 
268
    APR_ADDTO(CFLAGS, -pg)
 
269
    APR_REMOVEFROM(CFLAGS, -g)
 
270
    if test "$host" = "i586-pc-beos"; then
 
271
        APR_REMOVEFROM(CFLAGS, -O2)
 
272
        APR_ADDTO(CFLAGS, -O1)
 
273
        APR_ADDTO(LDFLAGS, -p)
 
274
    fi
 
275
  fi
 
276
)dnl
 
277
 
 
278
AC_ARG_ENABLE(pool-debug,
 
279
  [  --enable-pool-debug[[=yes|no|verbose|verbose-alloc|lifetime|owner|all]]    Turn on pools debugging],
 
280
  [ if test -z "$enableval"; then
 
281
        APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=1)
 
282
    elif test ! "$enableval" = "no"; then
 
283
        apr_pool_debug=1
 
284
    
 
285
        for i in $enableval
 
286
        do
 
287
            flag=0
 
288
        
 
289
            case $i in
 
290
            yes)
 
291
                flag=1
 
292
                ;;
 
293
            verbose)
 
294
                flag=2
 
295
                ;;
 
296
            lifetime)
 
297
                flag=4
 
298
                ;;
 
299
            owner)
 
300
                flag=8
 
301
                ;;
 
302
            verbose-alloc)
 
303
                flag=16
 
304
                ;;
 
305
            all)
 
306
                apr_pool_debug=31
 
307
                ;;
 
308
            *)
 
309
                ;;
 
310
            esac
 
311
 
 
312
            if test $flag -gt 0; then
 
313
                apr_pool_debug=`expr '(' $apr_pool_debug - $apr_pool_debug % \
 
314
                    '(' $flag '*' 2 ')' ')' + $flag + $apr_pool_debug % $flag`
 
315
            fi
 
316
        done
 
317
      
 
318
        APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=$apr_pool_debug)
 
319
    fi
 
320
  ])
 
321
 
 
322
if test "$host" = "i586-pc-beos"; then
 
323
  AC_ARG_ENABLE(malloc-debug,[  --enable-malloc-debug   Switch on malloc_debug for BeOS],
 
324
    APR_REMOVEFROM(CFLAGS, -O2)
 
325
    APR_ADDTO(CPPFLAGS, -fcheck-memory-usage -D_KERNEL_MODE)
 
326
  ) dnl
 
327
fi
 
328
 
 
329
# this is the place to put specific options for platform/compiler
 
330
# combinations
 
331
case "$host:$CC" in
 
332
    *-hp-hpux*:cc )
 
333
        APR_ADDTO(CFLAGS,[-Ae +Z])
 
334
        case $host in
 
335
          ia64-* )
 
336
            ;;
 
337
          * )
 
338
            if echo "$CFLAGS " | grep '+DA' >/dev/null; then :
 
339
            else
 
340
              APR_ADDTO(CFLAGS,[+DAportable])
 
341
            fi 
 
342
            ;;
 
343
        esac
 
344
        ;;
 
345
    powerpc-*-beos:mwcc* )
 
346
        APR_SETVAR(CPP,[mwcc -E])
 
347
        APR_SETVAR(CC,mwcc)
 
348
        APR_SETVAR(AR,ar)
 
349
        ;;
 
350
esac
 
351
 
 
352
dnl Check the depend program we can use
 
353
APR_CHECK_DEPEND
 
354
 
 
355
proc_mutex_is_global=0
 
356
 
 
357
config_subdirs="none"
 
358
INSTALL_SUBDIRS="none"
 
359
OBJECTS_PLATFORM='$(OBJECTS_unix)'
 
360
 
 
361
case $host in
 
362
   i386-ibm-aix* | *-ibm-aix[1-2].* | *-ibm-aix3.* | *-ibm-aix4.1 | *-ibm-aix4.1.* | *-ibm-aix4.2 | *-ibm-aix4.2.*)
 
363
       OSDIR="aix"
 
364
       APR_ADDTO(LDFLAGS,-lld)
 
365
       eolstr="\\n"
 
366
       OBJECTS_PLATFORM='$(OBJECTS_aix)'
 
367
       ;;
 
368
   *-os2*)
 
369
       APR_ADDTO(CPPFLAGS,-DOS2)
 
370
       APR_ADDTO(CFLAGS,-Zmt)
 
371
       AC_CHECK_LIB(bsd, random)
 
372
       OSDIR="os2"
 
373
       enable_threads="system_threads"
 
374
       eolstr="\\r\\n"
 
375
       file_as_socket="0"
 
376
       proc_mutex_is_global=1
 
377
       OBJECTS_PLATFORM='$(OBJECTS_os2)'
 
378
       ;;
 
379
   *beos*)
 
380
       OSDIR="beos"
 
381
       APR_ADDTO(CPPFLAGS,-DBEOS)
 
382
       enable_threads="system_threads"
 
383
       native_mmap_emul="1"
 
384
       APR_CHECK_DEFINE(BONE_VERSION, sys/socket.h)
 
385
       eolstr="\\n"
 
386
       osver=`uname -r`
 
387
       proc_mutex_is_global=1
 
388
       OBJECTS_PLATFORM='$(OBJECTS_beos)'
 
389
       case $osver in
 
390
          5.0.4)
 
391
             file_as_socket="1"
 
392
             ;;
 
393
          *)
 
394
             file_as_socket="0"
 
395
             ;;
 
396
       esac
 
397
       ;;
 
398
   *os390)
 
399
       OSDIR="os390"
 
400
       OBJECTS_PLATFORM='$(OBJECTS_os390)'
 
401
       eolstr="\\n"
 
402
       ;;
 
403
   *os400)
 
404
       OSDIR="as400"
 
405
       eolstr="\\n"
 
406
       ;;
 
407
   *cygwin*)
 
408
       OSDIR="unix"
 
409
       APR_ADDTO(CPPFLAGS,-DCYGWIN)
 
410
       enable_threads="no"
 
411
       eolstr="\\n"
 
412
       ;;
 
413
   *hpux10* ) 
 
414
       enable_threads="no"
 
415
       OSDIR="unix"
 
416
       eolstr="\\n"
 
417
       ;;
 
418
   *)
 
419
       OSDIR="unix"
 
420
       eolstr="\\n"
 
421
       ;;
 
422
esac
 
423
 
 
424
AC_SUBST(OBJECTS_PLATFORM)
 
425
 
 
426
# Check whether LFS has explicitly been disabled
 
427
AC_ARG_ENABLE(lfs,[  --disable-lfs           Disable large file support on 32-bit platforms],
 
428
[apr_lfs_choice=$enableval], [apr_lfs_choice=yes])
 
429
 
 
430
if test "$apr_lfs_choice" = "yes"; then
 
431
   # Check whether the transitional LFS API is sufficient
 
432
   AC_CACHE_CHECK([whether to enable -D_LARGEFILE64_SOURCE], [apr_cv_use_lfs64], [
 
433
   apr_save_CPPFLAGS=$CPPFLAGS
 
434
   CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
 
435
   AC_TRY_RUN([
 
436
#include <sys/types.h>
 
437
#include <sys/stat.h>
 
438
#include <fcntl.h>
 
439
#include <stdlib.h>
 
440
#include <stdio.h>
 
441
#include <unistd.h>
 
442
 
 
443
void main(void)
 
444
{
 
445
    int fd, ret = 0;
 
446
    struct stat64 st;
 
447
    off64_t off = 4242;
 
448
 
 
449
    if (sizeof(off64_t) != 8 || sizeof(off_t) != 4)
 
450
       exit(1);
 
451
    if ((fd = open("conftest.lfs", O_LARGEFILE|O_CREAT|O_WRONLY)) < 0)
 
452
       exit(2);
 
453
    if (ftruncate64(fd, off) != 0)
 
454
       ret = 3;
 
455
    else if (fstat64(fd, &st) != 0 || st.st_size != off)
 
456
       ret = 4;
 
457
    else if (lseek64(fd, off, SEEK_SET) != off)
 
458
       ret = 5;
 
459
    else if (close(fd) != 0)
 
460
       ret = 6;
 
461
    else if (lstat64("conftest.lfs", &st) != 0 || st.st_size != off)
 
462
       ret = 7;
 
463
    else if (stat64("conftest.lfs", &st) != 0 || st.st_size != off)
 
464
       ret = 8;
 
465
    unlink("conftest.lfs");
 
466
 
 
467
    exit(ret);
 
468
}], [apr_cv_use_lfs64=yes], [apr_cv_use_lfs64=no], [apr_cv_use_lfs64=no])
 
469
   CPPFLAGS=$apr_save_CPPFLAGS])
 
470
   if test "$apr_cv_use_lfs64" = "yes"; then
 
471
      APR_ADDTO(CPPFLAGS, [-D_LARGEFILE64_SOURCE])
 
472
   fi
 
473
fi
 
474
 
 
475
AC_ARG_ENABLE(nonportable-atomics,
 
476
[  --enable-nonportable-atomics  Use optimized atomic code which may produce nonportable binaries],
 
477
[if test $enableval = yes; then
 
478
   force_generic_atomics=no
 
479
 else
 
480
   force_generic_atomics=yes
 
481
 fi
 
482
],
 
483
[case $host_cpu in
 
484
   i[[456]]86) force_generic_atomics=yes ;;
 
485
   *) force_generic_atomics=no ;;
 
486
esac
 
487
])
 
488
 
 
489
if test $force_generic_atomics = yes; then
 
490
   AC_DEFINE([USE_GENERIC_ATOMICS], 1,
 
491
             [Define if use of generic atomics is requested])
 
492
fi
 
493
 
 
494
AC_SUBST(proc_mutex_is_global)
 
495
AC_SUBST(eolstr)
 
496
AC_SUBST(INSTALL_SUBDIRS)
 
497
 
 
498
# For some platforms we need a version string which allows easy numeric
 
499
# comparisons.
 
500
case $host in
 
501
    *freebsd*)
 
502
        if test -x /sbin/sysctl; then
 
503
            os_version=`/sbin/sysctl -n kern.osreldate`
 
504
        else
 
505
            os_version=000000
 
506
        fi
 
507
        ;;
 
508
    *linux*)
 
509
        os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'`
 
510
        ;;
 
511
    *darwin*)
 
512
        os_version=`uname -r | sed -e 's/\(.\)\.\(.\).*/\1\2/'`
 
513
        ;;
 
514
    *)
 
515
        os_version=OS_VERSION_IS_NOT_SET
 
516
        ;;
 
517
esac
 
518
 
 
519
echo "${nl}Checking for libraries..."
 
520
 
 
521
dnl ----------------------------- Checks for Any required Libraries
 
522
dnl Note: Autoconf will always append LIBS with an extra " " in AC_CHECK_LIB.
 
523
dnl It should check for LIBS being empty and set LIBS equal to the new value 
 
524
dnl without the extra " " in that case, but they didn't do that.  So, we
 
525
dnl end up LIBS="-lm -lcrypt -lnsl  -ldl" which is an annoyance.
 
526
AC_SEARCH_LIBS(gethostbyname, nsl)
 
527
AC_SEARCH_LIBS(gethostname, nsl)
 
528
AC_SEARCH_LIBS(socket, socket)
 
529
AC_SEARCH_LIBS(crypt, crypt ufc)
 
530
AC_CHECK_LIB(truerand, main)
 
531
AC_SEARCH_LIBS(modf, m)
 
532
 
 
533
dnl ----------------------------- Checking for Threads
 
534
echo "${nl}Checking for Threads..."
 
535
 
 
536
if test -z "$enable_threads"; then
 
537
        AC_ARG_ENABLE(threads,
 
538
        [  --enable-threads        Enable threading support in APR.],
 
539
        [ enable_threads=$enableval] ,
 
540
        [ APR_CHECK_PTHREADS_H([ enable_threads="pthread" ] ,
 
541
                               [ enable_threads="no" ] ) ] )
 
542
fi
 
543
 
 
544
if test "$enable_threads" = "no"; then
 
545
    threads="0"
 
546
    pthreadh="0"
 
547
    pthreadser="0"
 
548
else
 
549
    if test "$enable_threads" = "pthread"; then
 
550
# We have specified pthreads for our threading library, just make sure
 
551
# that we have everything we need
 
552
      APR_PTHREADS_CHECK_SAVE
 
553
      APR_PTHREADS_CHECK
 
554
      APR_CHECK_PTHREADS_H([
 
555
          threads="1"
 
556
          pthreadh="1"
 
557
          pthreadser="1" ], [
 
558
          threads="0"
 
559
          pthreadh="0"
 
560
          pthreadser="0"
 
561
          APR_PTHREADS_CHECK_RESTORE ] )
 
562
    elif test "$enable_threads" = "system_threads"; then
 
563
        threads="1"
 
564
        pthreadh="0"
 
565
        pthreadser="0"
 
566
    else
 
567
# We basically specified that we wanted threads, but not how to implement
 
568
# them.  In this case, just look for pthreads.  In the future, we can check
 
569
# for other threading libraries as well.
 
570
      APR_PTHREADS_CHECK_SAVE
 
571
      APR_PTHREADS_CHECK
 
572
      APR_CHECK_PTHREADS_H([
 
573
          threads="1"
 
574
          pthreadh="1"
 
575
          pthreadser="1" ], [
 
576
          threads="0"
 
577
          pthreadser="0"
 
578
          pthreadh="0"
 
579
          APR_PTHREADS_CHECK_RESTORE ] )
 
580
    fi
 
581
    if test "$pthreadh" = "1"; then
 
582
        APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
 
583
        APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
 
584
        APR_CHECK_PTHREAD_RECURSIVE_MUTEX
 
585
        AC_CHECK_FUNCS([pthread_key_delete pthread_rwlock_init \
 
586
                        pthread_attr_setguardsize])
 
587
 
 
588
        if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
 
589
            dnl ----------------------------- Checking for pthread_rwlock_t
 
590
            AC_CACHE_CHECK([for pthread_rwlock_t], [apr_cv_type_rwlock_t],
 
591
            AC_TRY_COMPILE([#include <sys/types.h>
 
592
#include <pthread.h>], [pthread_rwlock_t *rwlock;],
 
593
              [apr_cv_type_rwlock_t=yes], [apr_cv_type_rwlock_t=no], 
 
594
              [apr_cv_type_rwlock_t=no]))
 
595
            if test "$apr_cv_type_rwlock_t" = "yes"; then
 
596
               AC_DEFINE(HAVE_PTHREAD_RWLOCKS, 1, [Define if pthread rwlocks are available])
 
597
            fi
 
598
        fi
 
599
    fi
 
600
fi
 
601
 
 
602
ac_cv_define_READDIR_IS_THREAD_SAFE=no
 
603
ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no
 
604
ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no
 
605
if test "$threads" = "1"; then
 
606
    echo "APR will use threads"
 
607
    AC_CHECK_LIB(c_r, readdir,
 
608
        AC_DEFINE(READDIR_IS_THREAD_SAFE, 1, 
 
609
                  [Define if readdir is thread safe]))
 
610
    if test "x$apr_gethostbyname_is_thread_safe" = "x"; then
 
611
        AC_CHECK_LIB(c_r, gethostbyname, apr_gethostbyname_is_thread_safe=yes)
 
612
    fi
 
613
    if test "$apr_gethostbyname_is_thread_safe" = "yes"; then
 
614
        AC_DEFINE(GETHOSTBYNAME_IS_THREAD_SAFE, 1,
 
615
                  [Define if gethostbyname is thread safe])
 
616
    fi
 
617
    if test "x$apr_gethostbyaddr_is_thread_safe" = "x"; then
 
618
        AC_CHECK_LIB(c_r, gethostbyaddr, apr_gethostbyaddr_is_thread_safe=yes)
 
619
    fi
 
620
    if test "$apr_gethostbyaddr_is_thread_safe" = "yes"; then
 
621
        AC_DEFINE(GETHOSTBYADDR_IS_THREAD_SAFE, 1, 
 
622
                  [Define if gethostbyaddr is thread safe])
 
623
    fi
 
624
    AC_CHECK_FUNCS(gethostbyname_r gethostbyaddr_r)
 
625
else
 
626
    echo "APR will be non-threaded"
 
627
fi
 
628
 
 
629
dnl Electric Fence malloc checker.
 
630
dnl --with-efence specifies the path to Electric Fence.
 
631
dnl This test should remain after the threads checks since libefence
 
632
dnl may depend on libpthread.
 
633
AC_ARG_WITH(efence, 
 
634
  [  --with-efence[[=DIR]]     path to Electric Fence installation], 
 
635
  [ apr_efence_dir="$withval"
 
636
    if test "$apr_efence_dir" != "yes"; then
 
637
      APR_ADDTO(LDFLAGS,[-L$apr_efence_dir/lib])
 
638
      if test "x$apr_platform_runtime_link_flag" != "x"; then
 
639
          APR_ADDTO(LDFLAGS, 
 
640
                    [$apr_platform_runtime_link_flag$apr_efence_dir/lib])
 
641
      fi
 
642
    fi
 
643
    AC_CHECK_LIB(efence, malloc, 
 
644
                 [ APR_ADDTO(LIBS,-lefence) ],
 
645
                 [ AC_MSG_ERROR(Electric Fence requested but not detected) ])
 
646
  ])
 
647
 
 
648
AC_CHECK_FUNCS(sigsuspend, [ have_sigsuspend="1" ], [ have_sigsuspend="0" ])
 
649
AC_CHECK_FUNCS(sigwait, [ have_sigwait="1" ], [ have_sigwait="0" ]) 
 
650
dnl AC_CHECK_FUNCS doesn't work for this on Tru64 since the function
 
651
dnl is renamed in signal.h.  Todo: Autodetect
 
652
case $host in
 
653
    *alpha*-dec-osf* )
 
654
        have_sigwait="1"
 
655
        ;;
 
656
esac
 
657
 
 
658
AC_SUBST(threads)
 
659
AC_SUBST(have_sigsuspend)
 
660
AC_SUBST(have_sigwait)
 
661
 
 
662
AC_CHECK_FUNCS(poll kqueue port_create)
 
663
 
 
664
# Check for the Linux epoll interface; epoll* may be available in libc
 
665
# but return ENOSYS on a pre-2.6 kernel, so do a run-time check.
 
666
AC_CACHE_CHECK([for epoll support], [apr_cv_epoll],
 
667
[AC_TRY_RUN([
 
668
#include <sys/epoll.h>
 
669
#include <unistd.h>
 
670
 
 
671
int main()
 
672
{
 
673
    return epoll_create(5) == -1;
 
674
}], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])])
 
675
 
 
676
if test "$apr_cv_epoll" = "yes"; then
 
677
   AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported])
 
678
fi
 
679
 
 
680
dnl ----------------------------- Checking for missing POSIX thread functions
 
681
AC_CHECK_FUNCS([getpwnam_r getpwuid_r getgrnam_r getgrgid_r])
 
682
 
 
683
dnl ----------------------------- Checking for Shared Memory Support 
 
684
echo "${nl}Checking for Shared Memory Support..."
 
685
 
 
686
# The real-time POSIX extensions (e.g. shm_*, sem_*) may only
 
687
# be available if linking against librt.
 
688
AC_SEARCH_LIBS(shm_open, rt)
 
689
 
 
690
case $host in
 
691
 *-sysv*)
 
692
   ac_includes_default="$ac_includes_default
 
693
#if HAVE_SYS_MUTEX_H /* needed to define lock_t for sys/shm.h */
 
694
# include <sys/mutex.h>
 
695
#endif";;
 
696
esac
 
697
 
 
698
AC_CHECK_HEADERS([sys/types.h sys/mman.h sys/ipc.h sys/mutex.h sys/shm.h sys/file.h kernel/OS.h os2.h])
 
699
AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
 
700
                create_area])
 
701
APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
 
702
APR_CHECK_FILE(/dev/zero)
 
703
 
 
704
# Not all systems can mmap /dev/zero (such as HP-UX).  Check for that.
 
705
if test "$ac_cv_func_mmap" = "yes" &&
 
706
   test "$ac_cv_file__dev_zero" = "yes"; then
 
707
    AC_MSG_CHECKING(for mmap that can map /dev/zero)
 
708
    AC_TRY_RUN([
 
709
#include <sys/types.h>
 
710
#include <sys/stat.h>
 
711
#include <fcntl.h>
 
712
#ifdef HAVE_SYS_MMAN_H
 
713
#include <sys/mman.h>
 
714
#endif
 
715
    int main()
 
716
    {
 
717
        int fd;
 
718
        void *m;
 
719
        fd = open("/dev/zero", O_RDWR);
 
720
        if (fd < 0) {
 
721
            return 1;
 
722
        }
 
723
        m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
 
724
        if (m == (void *)-1) {  /* aka MAP_FAILED */
 
725
            return 2;
 
726
        }
 
727
        if (munmap(m, sizeof(void*)) < 0) {
 
728
            return 3;
 
729
        }
 
730
        return 0;
 
731
    }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])
 
732
 
 
733
    AC_MSG_RESULT($ac_cv_file__dev_zero)
 
734
fi
 
735
 
 
736
# Now we determine which one is our anonymous shmem preference.
 
737
haveshmgetanon="0"
 
738
havemmapzero="0"
 
739
havemmapanon="0"
 
740
APR_BEGIN_DECISION([anonymous shared memory allocation method])
 
741
APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
 
742
             func:shmget func:shmat func:shmdt func:shmctl,
 
743
             [haveshmgetanon="1"
 
744
              APR_DECIDE(USE_SHMEM_SHMGET_ANON, [SysV IPC shmget()])])
 
745
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap file:/dev/zero,
 
746
             [havemmapzero="1"
 
747
              APR_DECIDE(USE_SHMEM_MMAP_ZERO, 
 
748
                  [SVR4-style mmap() on /dev/zero])])
 
749
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON,
 
750
             [havemmapanon="1"
 
751
              APR_DECIDE(USE_SHMEM_MMAP_ANON, 
 
752
                  [4.4BSD-style mmap() via MAP_ANON])])
 
753
APR_IFALLYES(header:os2.h,
 
754
             [haveos2shm="1"
 
755
              APR_DECIDE(USE_SHMEM_OS2_ANON, [OS/2 DosAllocSharedMem()])])
 
756
APR_IFALLYES(header:kernel/OS.h func:create_area,
 
757
             [havebeosshm="1"
 
758
              APR_DECIDE(USE_SHMEM_BEOS_ANON,
 
759
                         [BeOS areas])])
 
760
case $host in
 
761
    *linux* ) 
 
762
        # Linux has problems with MM_SHMT_MMANON even though it reports
 
763
        # that it has it.
 
764
        # FIXME - find exact 2.3 version that MMANON was fixed in.  It is
 
765
        # confirmed fixed in 2.4 series.
 
766
        if test $os_version -le "240"; then
 
767
            APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_ZERO USE_SHMEM_SHMGET_ANON)
 
768
        fi
 
769
        ;;
 
770
    *hpux11* ) 
 
771
        APR_DECISION_OVERRIDE(USE_SHMEM_SHMGET_ANON)
 
772
        ;;
 
773
esac
 
774
APR_END_DECISION
 
775
AC_DEFINE_UNQUOTED($ac_decision)
 
776
 
 
777
useshmgetanon="0"
 
778
usemmapzero="0"
 
779
usemmapanon="0"
 
780
 
 
781
case $ac_decision in
 
782
    USE_SHMEM_SHMGET_ANON )
 
783
        useshmgetanon="1"
 
784
        ;;
 
785
    USE_SHMEM_MMAP_ZERO )
 
786
        usemmapzero="1"
 
787
        ;;
 
788
    USE_SHMEM_MMAP_ANON )
 
789
        usemmapanon="1"
 
790
        ;;
 
791
esac
 
792
 
 
793
AC_SUBST(useshmgetanon)
 
794
AC_SUBST(usemmapzero)
 
795
AC_SUBST(usemmapanon)
 
796
AC_SUBST(haveshmgetanon)
 
797
AC_SUBST(havemmapzero)
 
798
AC_SUBST(havemmapanon)
 
799
 
 
800
# Now we determine which one is our name-based shmem preference.
 
801
havemmaptmp="0"
 
802
havemmapshm="0"
 
803
haveshmget="0"
 
804
havebeosarea="0"
 
805
haveos2shm="0"
 
806
APR_BEGIN_DECISION([namebased memory allocation method])
 
807
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
 
808
             [havemmaptmp="1"
 
809
              APR_DECIDE(USE_SHMEM_MMAP_TMP, 
 
810
                  [Classical mmap() on temporary file])])
 
811
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open dnl
 
812
             func:shm_unlink,
 
813
             [havemmapshm="1"
 
814
              APR_DECIDE(USE_SHMEM_MMAP_SHM, 
 
815
                  [mmap() via POSIX.1 shm_open() on temporary file])])
 
816
APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
 
817
             func:shmget func:shmat func:shmdt func:shmctl,
 
818
             [haveshmget="1"
 
819
              APR_DECIDE(USE_SHMEM_SHMGET, [SysV IPC shmget()])])
 
820
APR_IFALLYES(header:kernel/OS.h func:create_area,
 
821
             [havebeosshm="1"
 
822
              APR_DECIDE(USE_SHMEM_BEOS, [BeOS areas])])
 
823
APR_IFALLYES(header:os2.h,
 
824
             [haveos2shm="1"
 
825
              APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])])
 
826
case $host in
 
827
    *linux* ) 
 
828
        # Linux has problems with MM_SHMT_MMANON even though it reports
 
829
        # that it has it.
 
830
        # FIXME - find exact 2.3 version that MMANON was fixed in.  It is
 
831
        # confirmed fixed in 2.4 series.
 
832
        if test $os_version -le "240"; then
 
833
            APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_TMP USE_SHMEM_MMAP_SHM dnl
 
834
                                  USE_SHMEM_SHMGET)
 
835
        fi
 
836
        ;;
 
837
esac
 
838
APR_END_DECISION
 
839
AC_DEFINE_UNQUOTED($ac_decision)
 
840
 
 
841
usemmaptmp="0"
 
842
usemmapshm="0"
 
843
useshmget="0"
 
844
usebeosarea="0"
 
845
useos2shm="0"
 
846
 
 
847
case $ac_decision in
 
848
    USE_SHMEM_MMAP_TMP )
 
849
        usemmaptmp="1"
 
850
        ;;
 
851
    USE_SHMEM_MMAP_SHM )
 
852
        usemmapshm="1"
 
853
        ;;
 
854
    USE_SHMEM_SHMGET )
 
855
        useshmget="1"
 
856
        ;;
 
857
    USE_SHMEM_BEOS )
 
858
        usebeosarea="1"
 
859
        ;;
 
860
    USE_SHMEM_OS2 )
 
861
        useos2shm="1"
 
862
        ;;
 
863
esac
 
864
 
 
865
# Do we have any shared memory support?
 
866
if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm" = "0000000"; then
 
867
  sharedmem="0"
 
868
else
 
869
  sharedmem="1"
 
870
fi
 
871
 
 
872
AC_SUBST(usemmaptmp)
 
873
AC_SUBST(usemmapshm)
 
874
AC_SUBST(useshmget)
 
875
AC_SUBST(usebeosarea)
 
876
AC_SUBST(useos2shm)
 
877
AC_SUBST(havemmaptmp)
 
878
AC_SUBST(havemmapshm)
 
879
AC_SUBST(haveshmget)
 
880
AC_SUBST(havebeosarea)
 
881
AC_SUBST(haveos2shm)
 
882
AC_SUBST(sharedmem)
 
883
 
 
884
dnl ----------------------------- Checks for Any required Functions
 
885
dnl Checks for library functions. (N.B. poll is further down)
 
886
AC_CHECK_FUNCS([alloca calloc setsid isinf isnan \
 
887
                getenv putenv setenv unsetenv \
 
888
                writev getifaddrs utime utimes])
 
889
AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ]) 
 
890
AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ]) 
 
891
sendfile="0"
 
892
AC_CHECK_LIB(sendfile, sendfilev)
 
893
AC_CHECK_FUNCS(sendfile send_file sendfilev, [ sendfile="1" ])
 
894
 
 
895
dnl THIS MUST COME AFTER THE THREAD TESTS - FreeBSD doesn't always have a
 
896
dnl threaded poll() and we don't want to use sendfile on early FreeBSD 
 
897
dnl systems if we are also using threads.
 
898
 
 
899
AC_ARG_WITH(sendfile, [  --with-sendfile         Override decision to use sendfile],
 
900
  [ if test "$withval" = "yes"; then
 
901
        sendfile="1"
 
902
    else
 
903
        sendfile="0"
 
904
    fi ], [
 
905
    orig_sendfile=$sendfile
 
906
    case $host in
 
907
        *freebsd*)
 
908
            # FreeBSD < 4.2 has issues with threads+sendfile
 
909
            if test $os_version -le "401999"; then
 
910
                if test "$threads" = "1"; then
 
911
                    sendfile="0"
 
912
                fi
 
913
            fi
 
914
            ;;
 
915
        *alpha*-dec-osf* )
 
916
            sendfile="0"
 
917
            ;;
 
918
        s390-*-linux-gnu)
 
919
            # disable sendfile support for 2.2 on S/390
 
920
            if test $os_version -lt 240; then
 
921
                sendfile="0"
 
922
            fi
 
923
            ;;
 
924
        *aix*)
 
925
            # compiler-independent check for 64-bit build
 
926
            AC_CHECK_SIZEOF(void*, 4)
 
927
            if test "x$ac_cv_sizeof_voidp" = "x8"; then
 
928
                # sendfile not working for 64-bit build
 
929
                sendfile="0"
 
930
            fi
 
931
            ;;
 
932
    esac       
 
933
    if test "$orig_sendfile" != "$sendfile"; then
 
934
      echo "sendfile support disabled to avoid system problem"
 
935
    fi ] )
 
936
AC_SUBST(sendfile)
 
937
 
 
938
AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ]) 
 
939
AC_DECL_SYS_SIGLIST
 
940
 
 
941
AC_CHECK_FUNCS(fork, [ fork="1" ], [ fork="0" ])
 
942
APR_CHECK_INET_ADDR
 
943
APR_CHECK_INET_NETWORK
 
944
AC_SUBST(apr_inaddr_none)
 
945
AC_CHECK_FUNC(_getch)
 
946
AC_CHECK_FUNCS(strerror_r, [ strerror_r="1" ], [ strerror_r="0" ])
 
947
if test "$strerror_r" = "1"; then
 
948
  APR_CHECK_STRERROR_R_RC
 
949
fi
 
950
AC_CHECK_FUNCS(mmap, [ mmap="1" ], [ mmap="0" ])
 
951
if test "$native_mmap_emul" = "1"; then
 
952
    mmap="1"
 
953
fi
 
954
AC_CHECK_FUNCS(memmove, [ have_memmove="1" ], [have_memmove="0" ])
 
955
AC_CHECK_FUNCS([getpass getpassphrase gmtime_r localtime_r mkstemp])
 
956
 
 
957
AC_SUBST(fork)
 
958
AC_SUBST(have_inet_addr)
 
959
AC_SUBST(tcp_nodelay_inherited)
 
960
AC_SUBST(o_nonblock_inherited)
 
961
AC_SUBST(have_inet_network)
 
962
AC_SUBST(have_sigaction)
 
963
AC_SUBST(have_setrlimit)
 
964
AC_SUBST(have_getrlimit)
 
965
AC_SUBST(mmap)
 
966
AC_SUBST(have_memmove)
 
967
 
 
968
APR_CHECK_SIGWAIT_ONE_ARG
 
969
APR_CHECK_DIRENT_INODE
 
970
APR_CHECK_DIRENT_TYPE
 
971
 
 
972
dnl ----------------------------- Checks for Any required Headers
 
973
AC_HEADER_STDC
 
974
 
 
975
APR_FLAG_HEADERS(
 
976
    alloca.h            \
 
977
    ByteOrder.h         \
 
978
    conio.h             \
 
979
    crypt.h             \
 
980
    ctype.h             \
 
981
    dir.h               \
 
982
    dirent.h            \
 
983
    dl.h                \
 
984
    dlfcn.h             \
 
985
    errno.h             \
 
986
    fcntl.h             \
 
987
    grp.h               \
 
988
    io.h                \
 
989
    limits.h            \
 
990
    mach-o/dyld.h       \
 
991
    malloc.h            \
 
992
    memory.h            \
 
993
    netdb.h             \
 
994
    osreldate.h         \
 
995
    poll.h              \
 
996
    process.h           \
 
997
    pwd.h               \
 
998
    semaphore.h         \
 
999
    signal.h            \
 
1000
    stdarg.h            \
 
1001
    stddef.h            \
 
1002
    stdio.h             \
 
1003
    stdlib.h            \
 
1004
    string.h            \
 
1005
    strings.h           \
 
1006
    sysapi.h            \
 
1007
    sysgtime.h          \
 
1008
    termios.h           \
 
1009
    time.h              \
 
1010
    tpfeq.h             \
 
1011
    tpfio.h             \
 
1012
    unistd.h            \
 
1013
    unix.h              \
 
1014
    arpa/inet.h         \
 
1015
    kernel/OS.h         \
 
1016
    net/errno.h         \
 
1017
    netinet/in.h        \
 
1018
    netinet/sctp.h      \
 
1019
    netinet/sctp_uio.h  \
 
1020
    sys/file.h          \
 
1021
    sys/ioctl.h         \
 
1022
    sys/mman.h          \
 
1023
    sys/poll.h          \
 
1024
    sys/resource.h      \
 
1025
    sys/select.h        \
 
1026
    sys/sem.h           \
 
1027
    sys/sendfile.h      \
 
1028
    sys/signal.h        \
 
1029
    sys/socket.h        \
 
1030
    sys/sockio.h        \
 
1031
    sys/stat.h          \
 
1032
    sys/sysctl.h        \
 
1033
    sys/syslimits.h     \
 
1034
    sys/time.h          \
 
1035
    sys/types.h         \
 
1036
    sys/uio.h           \
 
1037
    sys/un.h            \
 
1038
    sys/wait.h)
 
1039
 
 
1040
# IRIX 6.5 has a problem in <netinet/tcp.h> which prevents it from
 
1041
# being included by itself.  Check for <netinet/tcp.h> manually,
 
1042
# including another header file first.
 
1043
AC_CACHE_CHECK([for netinet/tcp.h], [apr_cv_hdr_netinet_tcp_h],
 
1044
[AC_TRY_CPP(
 
1045
[#ifdef HAVE_NETINET_IN_H
 
1046
#include <netinet/in.h>
 
1047
#endif
 
1048
#include <netinet/tcp.h>
 
1049
], [apr_cv_hdr_netinet_tcp_h=yes], [apr_cv_hdr_netinet_tcp_h=no])])
 
1050
if test "$apr_cv_hdr_netinet_tcp_h" = "yes"; then
 
1051
   netinet_tcph=1
 
1052
   AC_DEFINE([HAVE_NETINET_TCP_H], 1, [Defined if netinet/tcp.h is present])
 
1053
else
 
1054
   netinet_tcph=0
 
1055
fi
 
1056
 
 
1057
AC_SUBST(arpa_ineth)
 
1058
AC_SUBST(conioh)
 
1059
AC_SUBST(ctypeh)
 
1060
AC_SUBST(crypth)
 
1061
AC_SUBST(errnoh)
 
1062
AC_SUBST(direnth)
 
1063
AC_SUBST(fcntlh)
 
1064
AC_SUBST(ioh)
 
1065
AC_SUBST(limitsh)
 
1066
AC_SUBST(netdbh)
 
1067
AC_SUBST(sys_syslimitsh)
 
1068
AC_SUBST(netinet_inh)
 
1069
AC_SUBST(netinet_sctph)
 
1070
AC_SUBST(netinet_sctp_uioh)
 
1071
AC_SUBST(netinet_tcph)
 
1072
AC_SUBST(stdargh)
 
1073
AC_SUBST(stdioh)
 
1074
AC_SUBST(stdlibh)
 
1075
AC_SUBST(stringh)
 
1076
AC_SUBST(stringsh)
 
1077
AC_SUBST(sys_ioctlh)
 
1078
AC_SUBST(sys_sendfileh)
 
1079
AC_SUBST(sys_signalh)
 
1080
AC_SUBST(sys_socketh)
 
1081
AC_SUBST(sys_sockioh)
 
1082
AC_SUBST(sys_typesh)
 
1083
AC_SUBST(sys_timeh)
 
1084
AC_SUBST(sys_uioh)
 
1085
AC_SUBST(sys_unh)
 
1086
AC_SUBST(timeh)
 
1087
AC_SUBST(unistdh)
 
1088
AC_SUBST(signalh)
 
1089
AC_SUBST(sys_waith)
 
1090
AC_SUBST(pthreadh)
 
1091
AC_SUBST(semaphoreh)
 
1092
 
 
1093
# Checking for h_errno in <netdb.h>
 
1094
if test "$netdbh" = "1"; then
 
1095
  APR_CHECK_H_ERRNO_FLAG
 
1096
  if test "$ac_cv_h_errno_cflags" = "no"; then
 
1097
    AC_MSG_ERROR([can not find h_errno in netdb.h])
 
1098
  fi
 
1099
fi
 
1100
 
 
1101
dnl ----------------------------- Checks for standard typedefs
 
1102
AC_TYPE_OFF_T
 
1103
AC_TYPE_PID_T
 
1104
AC_TYPE_SIZE_T
 
1105
AC_TYPE_UID_T
 
1106
AC_CHECK_TYPE(ssize_t, int)
 
1107
AC_C_INLINE
 
1108
AC_C_CONST
 
1109
AC_FUNC_SETPGRP
 
1110
 
 
1111
APR_CHECK_SOCKLEN_T
 
1112
 
 
1113
dnl Checks for pointer size
 
1114
AC_CHECK_SIZEOF(void*, 4)
 
1115
 
 
1116
if test "x$ac_cv_sizeof_voidp" != "x"; then
 
1117
    voidp_size=$ac_cv_sizeof_voidp
 
1118
else
 
1119
    AC_ERROR([Cannot determine size of void*])
 
1120
fi
 
1121
 
 
1122
dnl Checks for integer size
 
1123
AC_CHECK_SIZEOF(char, 1)
 
1124
AC_CHECK_SIZEOF(int, 4)
 
1125
AC_CHECK_SIZEOF(long, 4)
 
1126
AC_CHECK_SIZEOF(short, 2)
 
1127
AC_CHECK_SIZEOF(long long, 8)
 
1128
 
 
1129
if test "$ac_cv_sizeof_short" = "2"; then
 
1130
    short_value=short
 
1131
fi
 
1132
if test "$ac_cv_sizeof_int" = "4"; then
 
1133
    int_value=int
 
1134
fi
 
1135
# Now we need to find what apr_int64_t (sizeof == 8) will be.
 
1136
# The first match is our preference.
 
1137
if test "$ac_cv_sizeof_int" = "8"; then
 
1138
    int64_literal='#define APR_INT64_C(val) (val)'
 
1139
    uint64_literal='#define APR_UINT64_C(val) (val##U)'
 
1140
    int64_t_fmt='#define APR_INT64_T_FMT "d"'
 
1141
    uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
 
1142
    uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
 
1143
    int64_value="int"
 
1144
    long_value=int
 
1145
    int64_strfn="strtoi"
 
1146
elif test "$ac_cv_sizeof_long" = "8"; then
 
1147
    int64_literal='#define APR_INT64_C(val) (val##L)'
 
1148
    uint64_literal='#define APR_UINT64_C(val) (val##UL)'
 
1149
    int64_t_fmt='#define APR_INT64_T_FMT "ld"'
 
1150
    uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
 
1151
    uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
 
1152
    int64_value="long"
 
1153
    long_value=long
 
1154
    int64_strfn="strtol"
 
1155
elif test "$ac_cv_sizeof_long_long" = "8"; then
 
1156
    int64_literal='#define APR_INT64_C(val) (val##LL)'
 
1157
    uint64_literal='#define APR_UINT64_C(val) (val##ULL)'
 
1158
    # Linux, Solaris, FreeBSD all support ll with printf.
 
1159
    # BSD 4.4 originated 'q'.  Solaris is more popular and 
 
1160
    # doesn't support 'q'.  Solaris wins.  Exceptions can
 
1161
    # go to the OS-dependent section.
 
1162
    int64_t_fmt='#define APR_INT64_T_FMT "lld"'
 
1163
    uint64_t_fmt='#define APR_UINT64_T_FMT "llu"'
 
1164
    uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"'
 
1165
    int64_value="long long"
 
1166
    long_value="long long"
 
1167
    int64_strfn="strtoll"
 
1168
elif test "$ac_cv_sizeof_longlong" = "8"; then
 
1169
    int64_literal='#define APR_INT64_C(val) (val##LL)'
 
1170
    uint64_literal='#define APR_UINT64_C(val) (val##ULL)'
 
1171
    int64_t_fmt='#define APR_INT64_T_FMT "qd"'
 
1172
    uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
 
1173
    uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
 
1174
    int64_value="__int64"
 
1175
    long_value="__int64"
 
1176
    int64_strfn="strtoll"
 
1177
else
 
1178
    # int64_literal may be overriden if your compiler thinks you have
 
1179
    # a 64-bit value but APR does not agree.
 
1180
    AC_ERROR([could not detect a 64-bit integer type])
 
1181
fi
 
1182
 
 
1183
# If present, allow the C99 macro INT64_C to override our conversion.
 
1184
#
 
1185
# HP-UX's ANSI C compiler provides this without any includes, so we
 
1186
# will first look for INT64_C without adding stdint.h
 
1187
AC_CACHE_CHECK([for INT64_C], [apr_cv_define_INT64_C], [
 
1188
AC_EGREP_CPP(YES_IS_DEFINED,
 
1189
[#ifdef INT64_C
 
1190
YES_IS_DEFINED
 
1191
#endif], [apr_cv_define_INT64_C=yes], [
 
1192
    # Now check for INT64_C in stdint.h
 
1193
    AC_EGREP_CPP(YES_IS_DEFINED, [#include <stdint.h>
 
1194
#ifdef INT64_C
 
1195
YES_IS_DEFINED
 
1196
#endif], [apr_cv_define_INT64_C=yes], [apr_cv_define_INT64_C=no])])])
 
1197
 
 
1198
if test "$apr_cv_define_INT64_C" = "yes"; then
 
1199
    int64_literal='#define APR_INT64_C(val) INT64_C(val)'
 
1200
    uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)'
 
1201
    stdint=1
 
1202
else
 
1203
    stdint=0
 
1204
fi
 
1205
 
 
1206
if test "$ac_cv_type_size_t" = "yes"; then
 
1207
    size_t_value="size_t"
 
1208
else
 
1209
    size_t_value="apr_int32_t"
 
1210
fi
 
1211
if test "$ac_cv_type_ssize_t" = "yes"; then
 
1212
    ssize_t_value="ssize_t"
 
1213
else
 
1214
    ssize_t_value="apr_int32_t"
 
1215
fi
 
1216
if test "$ac_cv_socklen_t" = "yes"; then
 
1217
    socklen_t_value="socklen_t"
 
1218
    case $host in
 
1219
        *-hp-hpux*)
 
1220
            if test "$ac_cv_sizeof_long" = "8"; then
 
1221
                # 64-bit HP-UX requires 32-bit socklens in
 
1222
                # kernel, but user-space declarations say
 
1223
                # 64-bit (socklen_t == size_t == long).
 
1224
                # This will result in many compile warnings,
 
1225
                # but we're functionally busted otherwise.
 
1226
                socklen_t_value="int"
 
1227
            fi
 
1228
            ;;
 
1229
    esac
 
1230
else
 
1231
    socklen_t_value="int"
 
1232
fi
 
1233
 
 
1234
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
 
1235
 
 
1236
if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
 
1237
    ssize_t_fmt='#define APR_SSIZE_T_FMT "d"'
 
1238
elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
 
1239
    ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
 
1240
else
 
1241
    ssize_t_fmt='#error Can not determine the proper size for ssize_t'
 
1242
fi
 
1243
 
 
1244
APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
 
1245
 
 
1246
if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
 
1247
    size_t_fmt='#define APR_SIZE_T_FMT "d"'
 
1248
elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
 
1249
    size_t_fmt='#define APR_SIZE_T_FMT "ld"'
 
1250
else
 
1251
    size_t_fmt='#error Can not determine the proper size for size_t'
 
1252
fi
 
1253
 
 
1254
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
 
1255
 
 
1256
if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
 
1257
    # Enable LFS
 
1258
    aprlfs=1
 
1259
    AC_CHECK_FUNCS([mmap64 sendfile64 sendfilev64 mkstemp64])
 
1260
else
 
1261
    aprlfs=0     
 
1262
fi
 
1263
 
 
1264
AC_MSG_CHECKING([which type to use for apr_off_t])
 
1265
if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
 
1266
    # LFS is go!
 
1267
    off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
 
1268
    off_t_value='off64_t'
 
1269
    off_t_strfn='apr_strtoi64'
 
1270
elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then
 
1271
    # Special case: off_t may change size with _FILE_OFFSET_BITS
 
1272
    # on 32-bit systems with LFS support.  To avoid compatibility
 
1273
    # issues when other packages do define _FILE_OFFSET_BITS,
 
1274
    # hard-code apr_off_t to long.
 
1275
    off_t_value=long
 
1276
    off_t_fmt='#define APR_OFF_T_FMT "ld"'
 
1277
    off_t_strfn='strtol'
 
1278
elif test "$ac_cv_type_off_t" = "yes"; then
 
1279
    off_t_value=off_t
 
1280
    # off_t is more commonly a long than an int; prefer that case
 
1281
    # where int and long are the same size.
 
1282
    if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
 
1283
        off_t_fmt='#define APR_OFF_T_FMT "ld"'
 
1284
        off_t_strfn='strtol'
 
1285
    elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then
 
1286
        off_t_fmt='#define APR_OFF_T_FMT "d"'
 
1287
        off_t_strfn='strtoi'
 
1288
    elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
 
1289
        off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
 
1290
        off_t_strfn='apr_strtoi64'
 
1291
    else
 
1292
        AC_ERROR([could not determine the size of off_t])
 
1293
    fi
 
1294
else
 
1295
   # Fallback on int
 
1296
   off_t_value=apr_int32_t
 
1297
   off_t_fmt=d
 
1298
   off_t_strfn='strtoi'
 
1299
fi
 
1300
AC_MSG_RESULT($off_t_value)
 
1301
 
 
1302
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
 
1303
 
 
1304
if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
 
1305
    pid_t_fmt='#define APR_PID_T_FMT "hd"'
 
1306
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then
 
1307
    pid_t_fmt='#define APR_PID_T_FMT "d"'
 
1308
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then
 
1309
    pid_t_fmt='#define APR_PID_T_FMT "ld"'
 
1310
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then
 
1311
    pid_t_fmt='#define APR_PID_T_FMT APR_INT64_T_FMT'
 
1312
else
 
1313
    pid_t_fmt='#error Can not determine the proper size for pid_t'
 
1314
fi
 
1315
 
 
1316
# Checks for endianness
 
1317
AC_C_BIGENDIAN
 
1318
if test $ac_cv_c_bigendian = yes; then
 
1319
    bigendian=1
 
1320
else
 
1321
    bigendian=0
 
1322
fi
 
1323
 
 
1324
# Basically, we have tried to figure out the correct format strings
 
1325
# for APR types which vary between platforms, but we don't always get 
 
1326
# it right.  If you find that we don't get it right for your platform, 
 
1327
# you can override our decision below.
 
1328
case $host in
 
1329
   s390*linux*)
 
1330
       # uniquely, the 31-bit Linux/s390 uses "unsigned long int"
 
1331
       # for size_t rather than "unsigned int":
 
1332
       size_t_fmt='#define APR_SIZE_T_FMT "lu"'
 
1333
       ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
 
1334
       ;;
 
1335
   *-os2*)
 
1336
       size_t_fmt='#define APR_SIZE_T_FMT "lu"'
 
1337
       ;;
 
1338
   *-solaris*)
 
1339
       pid_t_fmt='#define APR_PID_T_FMT "ld"'
 
1340
       ;;
 
1341
   *aix4*|*aix5*)
 
1342
       ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
 
1343
       size_t_fmt='#define APR_SIZE_T_FMT "ld"'
 
1344
       ;;
 
1345
    *beos*)
 
1346
        ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
 
1347
        size_t_fmt='#define APR_SIZE_T_FMT "ld"'
 
1348
        ;;
 
1349
    *apple-darwin*)
 
1350
        ssize_t_fmt='#define APR_SSIZE_T_FMT "d"'
 
1351
        size_t_fmt='#define APR_SIZE_T_FMT "lu"'
 
1352
        ;;
 
1353
esac
 
1354
 
 
1355
AC_SUBST(voidp_size)
 
1356
AC_SUBST(short_value)
 
1357
AC_SUBST(int_value)
 
1358
AC_SUBST(long_value)
 
1359
AC_SUBST(int64_value)
 
1360
AC_SUBST(off_t_value)
 
1361
AC_SUBST(size_t_value)
 
1362
AC_SUBST(ssize_t_value)
 
1363
AC_SUBST(socklen_t_value)
 
1364
AC_SUBST(int64_t_fmt) 
 
1365
AC_SUBST(uint64_t_fmt) 
 
1366
AC_SUBST(uint64_t_hex_fmt) 
 
1367
AC_SUBST(ssize_t_fmt) 
 
1368
AC_SUBST(size_t_fmt)
 
1369
AC_SUBST(off_t_fmt) 
 
1370
AC_SUBST(pid_t_fmt)
 
1371
AC_SUBST(int64_literal) 
 
1372
AC_SUBST(uint64_literal) 
 
1373
AC_SUBST(stdint) 
 
1374
AC_SUBST(bigendian)
 
1375
AC_SUBST(aprlfs)
 
1376
 
 
1377
dnl ----------------------------- Checking for string functions
 
1378
AC_CHECK_FUNCS(strnicmp, have_strnicmp="1", have_strnicmp="0")
 
1379
AC_CHECK_FUNCS(strncasecmp, have_strncasecmp="1", have_strncasecmp="0")
 
1380
AC_CHECK_FUNCS(stricmp, have_stricmp="1", have_stricmp="0")
 
1381
AC_CHECK_FUNCS(strcasecmp, have_strcasecmp="1", have_strcasecmp="0")
 
1382
AC_CHECK_FUNCS(strdup, have_strdup="1", have_strdup="0")
 
1383
AC_CHECK_FUNCS(strstr, have_strstr="1", have_strstr="0")
 
1384
AC_CHECK_FUNCS(memchr, have_memchr="1", have_memchr="0")
 
1385
AC_CHECK_FUNC($int64_strfn, have_int64_strfn="1", have_int64_strfn="0")
 
1386
 
 
1387
dnl ----------------------------- We have a fallback position
 
1388
if test "$have_int64_strfn" = "0" && test "$int64_strfn" = "strtoll"; then
 
1389
    int64_strfn="strtoq"
 
1390
    AC_CHECK_FUNC(strtoq, [have_int64_strfn=1], [have_int64_strfn=0])
 
1391
fi
 
1392
 
 
1393
if test "$have_int64_strfn" = "1"; then
 
1394
  AC_DEFINE_UNQUOTED(APR_INT64_STRFN, [$int64_strfn],
 
1395
      [Define as function which can be used for conversion of strings to apr_int64_t])
 
1396
fi
 
1397
 
 
1398
AC_SUBST(have_strnicmp)
 
1399
AC_SUBST(have_strncasecmp)
 
1400
AC_SUBST(have_stricmp)
 
1401
AC_SUBST(have_strcasecmp)
 
1402
AC_SUBST(have_strdup)
 
1403
AC_SUBST(have_strstr)
 
1404
AC_SUBST(have_memchr)
 
1405
 
 
1406
if test "$off_t_strfn" = "apr_strtoi64" && test "$have_int64_strfn" = "1"; then
 
1407
    off_t_strfn=$int64_strfn
 
1408
fi
 
1409
AC_DEFINE_UNQUOTED(APR_OFF_T_STRFN, [$off_t_strfn],
 
1410
          [Define as function used for conversion of strings to apr_off_t])
 
1411
 
 
1412
dnl ----------------------------- Checking for DSO support
 
1413
echo "${nl}Checking for DSO..."
 
1414
AC_ARG_ENABLE(dso,
 
1415
  [  --disable-dso           Disable DSO support ],
 
1416
  [if test "x$enableval" = "xyes"; then
 
1417
      dsotype=any
 
1418
   else
 
1419
      dsotype=$enableval
 
1420
   fi
 
1421
  ], [dsotype=any])
 
1422
 
 
1423
if test "$dsotype" = "any"; then
 
1424
    # Darwin:
 
1425
    AC_CHECK_FUNC(NSLinkModule, [dsotype=dyld])
 
1426
    if test "$dsotype" = "any"; then
 
1427
      # Original HP-UX:
 
1428
      AC_CHECK_LIB(dld, shl_load, [dsotype=shl; APR_ADDTO(LIBS,-ldld)])
 
1429
    fi
 
1430
    # Normal POSIX:
 
1431
    if test "$dsotype" = "any"; then
 
1432
      AC_CHECK_FUNC(dlopen, [dsotype=dlfcn])
 
1433
    fi
 
1434
    if test "$dsotype" = "any"; then
 
1435
      AC_CHECK_LIB(dl, dlopen, [dsotype=dlfcn; APR_ADDTO(LIBS,-ldl)])
 
1436
    fi
 
1437
    if test "$dsotype" = "dlfcn"; then
 
1438
        # ReliantUnix has dlopen() in libc but dlsym() in libdl :(
 
1439
        AC_CHECK_FUNC(dlsym, [], 
 
1440
          [AC_CHECK_LIB(dl, dlsym, 
 
1441
             [APR_ADDTO(LIBS, -ldl)],
 
1442
             [dsotype=any
 
1443
              echo "Weird: dlopen() was found but dlsym() was not found!"])])
 
1444
    fi
 
1445
    if test "$dsotype" = "any"; then
 
1446
      # BeOS:
 
1447
      AC_CHECK_LIB(root, load_image, [dsotype=other])
 
1448
    fi
 
1449
    # Everything else:
 
1450
    if test "$dsotype" = "any"; then
 
1451
        case $host in
 
1452
        *os390|*-os2*|*os400|*-aix*) dsotype=other ;;
 
1453
        esac
 
1454
    fi
 
1455
fi
 
1456
 
 
1457
if test "$dsotype" = "any"; then
 
1458
    AC_MSG_ERROR([Could not detect suitable DSO implementation])
 
1459
elif test "$dsotype" = "no"; then
 
1460
    aprdso="0"
 
1461
else
 
1462
    case "$dsotype" in
 
1463
    dlfcn) AC_DEFINE(DSO_USE_DLFCN, 1, [Define if DSO support uses dlfcn.h]);;
 
1464
    shl)   AC_DEFINE(DSO_USE_SHL, 1, [Define if DSO support uses shl_load]);;
 
1465
    dyld)  AC_DEFINE(DSO_USE_DYLD, 1, [Define if DSO support uses dyld.h]);;
 
1466
    other) ;; # Use whatever is in dso/OSDIR
 
1467
    *) AC_MSG_ERROR([Unknown DSO implementation "$dsotype"]);;
 
1468
    esac
 
1469
    aprdso="1"
 
1470
    apr_modules="$apr_modules dso"
 
1471
fi
 
1472
 
 
1473
AC_SUBST(aprdso)
 
1474
 
 
1475
dnl ----------------------------- Checking for Processes
 
1476
echo "${nl}Checking for Processes..."
 
1477
 
 
1478
AC_CHECK_FUNCS(waitpid)
 
1479
 
 
1480
AC_ARG_ENABLE(other-child,
 
1481
  [  --enable-other-child    Enable reliable child processes ],
 
1482
  [ if test "$enableval" = "yes"; then
 
1483
        oc="1"
 
1484
    else
 
1485
        oc="0"
 
1486
    fi ],
 
1487
  [ oc=1 ] ) 
 
1488
  
 
1489
AC_SUBST(oc) 
 
1490
 
 
1491
AC_MSG_CHECKING(for Variable Length Arrays)
 
1492
APR_TRY_COMPILE_NO_WARNING([],
 
1493
[
 
1494
    int foo[argc];
 
1495
    foo[0] = 0;
 
1496
], vla_msg=yes, vla_msg=no )
 
1497
AC_MSG_RESULT([$vla_msg])
 
1498
if test "$vla_msg" = "yes"; then
 
1499
    AC_DEFINE(HAVE_VLA, 1, [Define if C compiler supports VLA])
 
1500
fi
 
1501
 
 
1502
AC_CACHE_CHECK(struct rlimit,ac_cv_struct_rlimit,[
 
1503
AC_TRY_RUN([
 
1504
#include <sys/types.h>
 
1505
#include <sys/time.h>
 
1506
#include <sys/resource.h>
 
1507
main()
 
1508
{
 
1509
    struct rlimit limit;
 
1510
    limit.rlim_cur = 0;
 
1511
    limit.rlim_max = 0;
 
1512
    exit(0);
 
1513
}], [
 
1514
    ac_cv_struct_rlimit=yes ], [
 
1515
    ac_cv_struct_rlimit=no ], [
 
1516
    ac_cv_struct_rlimit=no ] ) ] )
 
1517
struct_rlimit=0
 
1518
test "x$ac_cv_struct_rlimit" = xyes && struct_rlimit=1
 
1519
AC_SUBST(struct_rlimit)
 
1520
 
 
1521
dnl ----------------------------- Checking for Locking Characteristics 
 
1522
echo "${nl}Checking for Locking..."
 
1523
 
 
1524
AC_CHECK_FUNCS(semget semctl flock)
 
1525
AC_CHECK_HEADERS(semaphore.h OS.h)
 
1526
AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait create_sem)
 
1527
 
 
1528
# Some systems return ENOSYS from sem_open.
 
1529
AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[
 
1530
AC_TRY_RUN([
 
1531
#include <errno.h>
 
1532
#include <stdlib.h>
 
1533
#include <fcntl.h>
 
1534
#include <semaphore.h>
 
1535
main()
 
1536
{
 
1537
    sem_t *psem;
 
1538
    const char *sem_name = "/apr_autoconf";
 
1539
 
 
1540
    psem = sem_open(sem_name, O_CREAT, 0644, 1);
 
1541
    if (psem == (sem_t *)SEM_FAILED) {
 
1542
        exit(1);
 
1543
    }
 
1544
    sem_close(psem);
 
1545
    sem_unlink(sem_name);
 
1546
    exit(0);
 
1547
}], [ac_cv_func_sem_open=yes], [ac_cv_func_sem_open=no],
 
1548
[ac_cv_func_sem_open=no])])
 
1549
 
 
1550
# It's stupid, but not all platforms have union semun, even those that need it.
 
1551
AC_MSG_CHECKING(for union semun in sys/sem.h)
 
1552
AC_TRY_COMPILE([
 
1553
#include <sys/types.h>
 
1554
#include <sys/ipc.h>
 
1555
#include <sys/sem.h>
 
1556
],[
 
1557
union semun arg;
 
1558
semctl(0, 0, 0, arg);
 
1559
], [have_union_semun="1" union_semun=yes ]
 
1560
msg=yes, [
 
1561
have_union_semun="0"
 
1562
msg=no ] )
 
1563
AC_MSG_RESULT([$msg])
 
1564
AC_SUBST(have_union_semun)
 
1565
 
 
1566
dnl Checks for libraries.
 
1567
APR_CHECK_DEFINE(LOCK_EX, sys/file.h)
 
1568
APR_CHECK_DEFINE(F_SETLK, fcntl.h)
 
1569
APR_CHECK_DEFINE(SEM_UNDO, sys/sem.h)
 
1570
 
 
1571
# We are assuming that if the platform doesn't have POLLIN, it doesn't have
 
1572
# any POLL definitions.
 
1573
APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h)
 
1574
 
 
1575
if test "$threads" = "1"; then
 
1576
    APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
 
1577
    AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
 
1578
    # Some systems have setpshared and define PROCESS_SHARED, but don't 
 
1579
    # really support PROCESS_SHARED locks.  So, we must validate that we 
 
1580
    # can go through the steps without receiving some sort of system error.
 
1581
    # Linux and older versions of AIX have this problem.
 
1582
    APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED func:pthread_mutexattr_setpshared, [
 
1583
      AC_CACHE_CHECK([for working PROCESS_SHARED locks], apr_cv_process_shared_works, [
 
1584
      AC_TRY_RUN([
 
1585
#include <sys/types.h>
 
1586
#include <pthread.h>
 
1587
        int main()
 
1588
        {
 
1589
            pthread_mutex_t mutex;
 
1590
            pthread_mutexattr_t attr;
 
1591
            if (pthread_mutexattr_init(&attr))
 
1592
                exit(1);
 
1593
            if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
 
1594
                exit(2);
 
1595
            if (pthread_mutex_init(&mutex, &attr))
 
1596
                exit(3);
 
1597
            if (pthread_mutexattr_destroy(&attr))
 
1598
                exit(4);
 
1599
            if (pthread_mutex_destroy(&mutex))
 
1600
                exit(5);
 
1601
            exit(0);
 
1602
        }], [apr_cv_process_shared_works=yes], [apr_cv_process_shared_works=no])])
 
1603
      # Override detection of pthread_mutexattr_setpshared
 
1604
      ac_cv_func_pthread_mutexattr_setpshared=$apr_cv_process_shared_works])
 
1605
 
 
1606
    if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then
 
1607
        APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX
 
1608
    fi
 
1609
fi
 
1610
 
 
1611
# See which lock mechanisms we can support on this system.
 
1612
APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
 
1613
             func:sem_unlink func:sem_post func:sem_wait,
 
1614
             hasposixser="1", hasposixser="0")
 
1615
APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1", 
 
1616
             hassysvser="0")
 
1617
APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
 
1618
APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0")
 
1619
# note: the current APR use of shared mutex requires /dev/zero
 
1620
APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
 
1621
             func:pthread_mutexattr_setpshared dnl
 
1622
             file:/dev/zero,
 
1623
             hasprocpthreadser="1", hasprocpthreadser="0")
 
1624
APR_IFALLYES(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="0")
 
1625
 
 
1626
# See which lock mechanism we'll select by default on this system.
 
1627
# The last APR_DECIDE to execute sets the default.
 
1628
# At this stage, we match the ordering in Apache 1.3
 
1629
# which is (highest to lowest): sysvsem -> fcntl -> flock.
 
1630
# POSIX semaphores and cross-process pthread mutexes are not
 
1631
# used by default since they have less desirable behaviour when
 
1632
# e.g. a process holding the mutex segfaults.
 
1633
# The BEOSSEM decision doesn't require any substitutions but is
 
1634
# included here to prevent the fcntl() branch being selected
 
1635
# from the decision making.
 
1636
APR_BEGIN_DECISION([apr_lock implementation method])
 
1637
APR_IFALLYES(func:flock define:LOCK_EX,
 
1638
            APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
 
1639
APR_IFALLYES(header:fcntl.h define:F_SETLK,
 
1640
            APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
 
1641
APR_IFALLYES(func:semget func:semctl define:SEM_UNDO,
 
1642
            APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
 
1643
APR_IFALLYES(header:OS.h func:create_sem, 
 
1644
            APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores])) 
 
1645
if test "x$apr_lock_method" != "x"; then
 
1646
    APR_DECISION_FORCE($apr_lock_method)
 
1647
fi
 
1648
APR_END_DECISION
 
1649
AC_DEFINE_UNQUOTED($ac_decision)
 
1650
 
 
1651
flockser="0"
 
1652
sysvser="0"
 
1653
posixser="0"
 
1654
procpthreadser="0"
 
1655
fcntlser="0"
 
1656
case $ac_decision in
 
1657
    USE_FLOCK_SERIALIZE )
 
1658
        flockser="1"
 
1659
        ;;
 
1660
    USE_FCNTL_SERIALIZE )
 
1661
        fcntlser="1"
 
1662
        ;;
 
1663
    USE_SYSVSEM_SERIALIZE )
 
1664
        sysvser="1"
 
1665
        ;;
 
1666
    USE_POSIXSEM_SERIALIZE )
 
1667
        posixser="1"
 
1668
        ;;
 
1669
    USE_PROC_PTHREAD_SERIALIZE )
 
1670
        procpthreadser="1"
 
1671
        ;;
 
1672
    USE_BEOSSEM )
 
1673
        beossem="1"
 
1674
        ;;
 
1675
esac
 
1676
 
 
1677
AC_SUBST(hasflockser)
 
1678
AC_SUBST(hassysvser)
 
1679
AC_SUBST(hasposixser)
 
1680
AC_SUBST(hasfcntlser)
 
1681
AC_SUBST(hasprocpthreadser)
 
1682
AC_SUBST(flockser)
 
1683
AC_SUBST(sysvser)
 
1684
AC_SUBST(posixser)
 
1685
AC_SUBST(fcntlser)
 
1686
AC_SUBST(procpthreadser)
 
1687
AC_SUBST(pthreadser)
 
1688
 
 
1689
AC_MSG_CHECKING(if all interprocess locks affect threads)
 
1690
if test "x$apr_process_lock_is_global" = "xyes"; then
 
1691
    proclockglobal="1"
 
1692
    AC_MSG_RESULT(yes)
 
1693
else
 
1694
    proclockglobal="0"
 
1695
    AC_MSG_RESULT(no)
 
1696
fi
 
1697
 
 
1698
AC_SUBST(proclockglobal)
 
1699
 
 
1700
AC_MSG_CHECKING(if POSIX sems affect threads in the same process)
 
1701
if test "x$apr_posixsem_is_global" = "xyes"; then
 
1702
  AC_DEFINE(POSIXSEM_IS_GLOBAL, 1, 
 
1703
            [Define if POSIX semaphores affect threads within the process])
 
1704
  AC_MSG_RESULT(yes)
 
1705
else
 
1706
  AC_MSG_RESULT(no)
 
1707
fi
 
1708
 
 
1709
AC_MSG_CHECKING(if SysV sems affect threads in the same process)
 
1710
if test "x$apr_sysvsem_is_global" = "xyes"; then
 
1711
  AC_DEFINE(SYSVSEM_IS_GLOBAL, 1,
 
1712
            [Define if SysV semaphores affect threads within the process])
 
1713
  AC_MSG_RESULT(yes)
 
1714
else
 
1715
  AC_MSG_RESULT(no)
 
1716
fi
 
1717
 
 
1718
AC_MSG_CHECKING(if fcntl locks affect threads in the same process)
 
1719
if test "x$apr_fcntl_is_global" = "xyes"; then
 
1720
  AC_DEFINE(FCNTL_IS_GLOBAL, 1,
 
1721
            [Define if fcntl locks affect threads within the process])
 
1722
  AC_MSG_RESULT(yes)
 
1723
else
 
1724
  AC_MSG_RESULT(no)
 
1725
fi
 
1726
 
 
1727
AC_MSG_CHECKING(if flock locks affect threads in the same process)
 
1728
if test "x$apr_flock_is_global" = "xyes"; then
 
1729
  AC_DEFINE(FLOCK_IS_GLOBAL, 1,
 
1730
            [Define if flock locks affect threads within the process])
 
1731
  AC_MSG_RESULT(yes)
 
1732
else
 
1733
  AC_MSG_RESULT(no)
 
1734
fi
 
1735
 
 
1736
dnl ----------------------------- Checking for /dev/random 
 
1737
AC_MSG_CHECKING(for entropy source)
 
1738
 
 
1739
AC_ARG_WITH(egd, 
 
1740
  [  --with-egd[[=DIR]]        use EGD-compatible socket],
 
1741
  [ AC_DEFINE(HAVE_EGD, 1, [Define if EGD is supported])
 
1742
    if test "$withval" = "yes"; then
 
1743
        AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy"], 
 
1744
         [Define to list of paths to EGD sockets])
 
1745
    else
 
1746
        AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["$withval"])
 
1747
    fi
 
1748
    AC_MSG_RESULT(EGD-compatible daemon)
 
1749
    rand="1"
 
1750
  ])
 
1751
 
 
1752
if test "$rand" != "1"; then
 
1753
  AC_ARG_WITH(devrandom,
 
1754
    [  --with-devrandom[[=DEV]]  use /dev/random or compatible [[searches by default]]],
 
1755
    [ apr_devrandom="$withval" ], [ apr_devrandom="yes" ])
 
1756
 
 
1757
  if test "$apr_devrandom" = "yes"; then
 
1758
    # /dev/random on OpenBSD doesn't provide random data, so
 
1759
    # prefer /dev/arandom, which does; see random(4).
 
1760
    for f in /dev/arandom /dev/random /dev/urandom; do
 
1761
      if test -r $f; then
 
1762
        apr_devrandom=$f
 
1763
        rand=1
 
1764
        break
 
1765
      fi
 
1766
    done
 
1767
  elif test "$apr_devrandom" != "no"; then
 
1768
    if test -r "$apr_devrandom"; then
 
1769
      rand="1"
 
1770
    else
 
1771
      AC_ERROR([$apr_devrandom not found or unreadable.])
 
1772
    fi
 
1773
  fi
 
1774
 
 
1775
  if test "$rand" = "1"; then
 
1776
    AC_DEFINE_UNQUOTED(DEV_RANDOM, ["$apr_devrandom"], [Define to path of random device])
 
1777
    AC_MSG_RESULT([$apr_devrandom])
 
1778
  fi
 
1779
fi
 
1780
 
 
1781
if test "$rand" != "1"; then
 
1782
    case $host in
 
1783
        # we have built in support for OS/2
 
1784
        *-os2*)
 
1785
            AC_MSG_RESULT([Using OS/2 builtin random])
 
1786
            rand="1"
 
1787
            ;;
 
1788
        *)
 
1789
            if test "$rand" != "1"; then
 
1790
              if test "$ac_cv_lib_truerand_main" = "yes"; then
 
1791
                AC_DEFINE(HAVE_TRUERAND, 1, [Define if truerand is supported])
 
1792
                AC_MSG_RESULT(truerand)
 
1793
                rand="1"
 
1794
              else
 
1795
                AC_MSG_RESULT(not found)
 
1796
                rand="0"
 
1797
              fi
 
1798
            fi
 
1799
            ;;
 
1800
    esac
 
1801
fi
 
1802
 
 
1803
AC_SUBST(rand)
 
1804
 
 
1805
dnl ----------------------------- Checking for UUID Support 
 
1806
echo "${nl}Checking for OS UUID Support..."
 
1807
 
 
1808
AC_CHECK_HEADERS(uuid.h uuid/uuid.h sys/uuid.h, break)
 
1809
 
 
1810
apr_revert_save_LIBS=$LIBS
 
1811
 
 
1812
# Prefer the flavor(s) that live in libc;
 
1813
AC_SEARCH_LIBS(uuid_create, uuid)
 
1814
AC_SEARCH_LIBS(uuid_generate, uuid)
 
1815
if test "$ac_cv_search_uuid_create" = "none required" -o \
 
1816
        "$ac_cv_search_uuid_generate" = "none required"; then
 
1817
 LIBS=$apr_revert_save_LIBS
 
1818
fi
 
1819
 
 
1820
AC_CHECK_FUNCS(uuid_create uuid_generate)
 
1821
 
 
1822
AC_CACHE_CHECK([for os uuid usability], [apr_cv_osuuid], [
 
1823
# Ensure this test closely mirrors misc/unix/rand.c!
 
1824
uuid_includes="
 
1825
#if defined(HAVE_SYS_TYPES_H)
 
1826
#include <sys/types.h>
 
1827
#endif
 
1828
#if defined(HAVE_UNISTD_H)
 
1829
#include <unistd.h>
 
1830
#endif
 
1831
#if defined(HAVE_UUID_H)
 
1832
#include <uuid.h>
 
1833
#elif defined(HAVE_UUID_UUID_H)
 
1834
#include <uuid/uuid.h>
 
1835
#elif defined(HAVE_SYS_UUID_H)
 
1836
#include <sys/uuid.h>
 
1837
#endif
 
1838
"
 
1839
 apr_cv_osuuid=no
 
1840
 if test $ac_cv_func_uuid_create = yes; then
 
1841
  AC_TRY_LINK([$uuid_includes], [
 
1842
    uuid_t g;
 
1843
    uint32_t s;
 
1844
    uuid_create(&g, &s);
 
1845
    if (s == uuid_s_ok) s = 0;
 
1846
  ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_create=no])
 
1847
 fi
 
1848
 if test $ac_cv_func_uuid_generate = yes; then
 
1849
  AC_TRY_LINK([$uuid_includes], [
 
1850
    uuid_t g;
 
1851
    uuid_generate(g);
 
1852
  ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_generate=no])
 
1853
 fi 
 
1854
])
 
1855
 
 
1856
if test $apr_cv_osuuid = yes; then
 
1857
  osuuid="1"
 
1858
else
 
1859
  osuuid="0"
 
1860
  LIBS=$apr_revert_save_LIBS
 
1861
fi
 
1862
AC_SUBST(osuuid)
 
1863
 
 
1864
 
 
1865
dnl ----------------------------- Checking for Time Support 
 
1866
echo "${nl}Checking for Time Support..."
 
1867
 
 
1868
AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[
 
1869
#include <sys/types.h>
 
1870
#include <time.h>])
 
1871
 
 
1872
dnl ----------------------------- Checking for Networking Support 
 
1873
echo "${nl}Checking for Networking support..."
 
1874
AC_MSG_CHECKING(for in_addr in netinet/in.h)
 
1875
AC_TRY_COMPILE([
 
1876
#include <sys/types.h>
 
1877
#include <netinet/in.h>
 
1878
],[
 
1879
struct in_addr arg;
 
1880
arg.s_addr = htonl(INADDR_ANY);
 
1881
], [ have_in_addr="1" 
 
1882
msg=yes ] , [ have_in_addr="0"
 
1883
msg=no ])
 
1884
AC_MSG_RESULT([$msg])
 
1885
 
 
1886
AC_MSG_CHECKING([if fd == socket on this platform])
 
1887
if test "x$file_as_socket" != "x0" ; then
 
1888
    file_as_socket="1";
 
1889
    echo "yes"
 
1890
else
 
1891
    echo "no"
 
1892
fi
 
1893
 
 
1894
AC_SUBST(have_in_addr)
 
1895
AC_SUBST(file_as_socket)
 
1896
 
 
1897
if test "$ac_cv_func_poll $file_as_socket" = "yes 1"; then
 
1898
    AC_DEFINE(WAITIO_USES_POLL, 1,
 
1899
              [Define if apr_wait_for_io_or_timeout() uses poll(2)])
 
1900
fi
 
1901
 
 
1902
# Check the types only if we have gethostbyname_r
 
1903
if test "$ac_cv_func_gethostbyname_r" = "yes"; then
 
1904
    APR_CHECK_GETHOSTBYNAME_R_STYLE
 
1905
fi
 
1906
 
 
1907
APR_CHECK_TCP_NODELAY_INHERITED
 
1908
APR_CHECK_O_NONBLOCK_INHERITED
 
1909
APR_CHECK_TCP_NODELAY_WITH_CORK
 
1910
 
 
1911
# Look for a way of corking TCP...
 
1912
APR_CHECK_DEFINE(TCP_CORK, netinet/tcp.h)
 
1913
APR_CHECK_DEFINE(TCP_NOPUSH, netinet/tcp.h)
 
1914
apr_tcp_nopush_flag="0"
 
1915
have_corkable_tcp="0"
 
1916
if test "x$ac_cv_define_TCP_CORK" = "xyes"; then
 
1917
    apr_tcp_nopush_flag="TCP_CORK"
 
1918
    have_corkable_tcp="1"
 
1919
else
 
1920
    case $host in
 
1921
        *linux*)
 
1922
            AC_EGREP_CPP(yes,[
 
1923
#include <linux/socket.h>
 
1924
#ifdef TCP_CORK
 
1925
yes
 
1926
#endif
 
1927
            ],[
 
1928
                apr_tcp_nopush_flag="3"
 
1929
                have_corkable_tcp="1"
 
1930
            ])
 
1931
            ;;
 
1932
        *)
 
1933
            ;;
 
1934
    esac
 
1935
fi
 
1936
if test "x$ac_cv_define_TCP_NOPUSH" = "xyes"; then
 
1937
    apr_tcp_nopush_flag="TCP_NOPUSH"
 
1938
    have_corkable_tcp="1"
 
1939
fi
 
1940
 
 
1941
APR_CHECK_DEFINE(SO_ACCEPTFILTER, sys/socket.h)
 
1942
if test "x$ac_cv_define_SO_ACCEPTFILTER" = "xyes"; then
 
1943
    acceptfilter="1"
 
1944
else
 
1945
    acceptfilter="0"
 
1946
fi
 
1947
 
 
1948
APR_CHECK_SCTP
 
1949
APR_CHECK_MCAST
 
1950
 
 
1951
AC_SUBST(apr_tcp_nopush_flag)
 
1952
AC_SUBST(have_corkable_tcp)
 
1953
AC_SUBST(acceptfilter)
 
1954
AC_SUBST(have_sctp)
 
1955
 
 
1956
AC_CHECK_FUNCS(set_h_errno)
 
1957
 
 
1958
echo "${nl}Checking for IPv6 Networking support..."
 
1959
dnl Start of checking for IPv6 support...
 
1960
 
 
1961
AC_ARG_ENABLE(ipv6,
 
1962
  [  --disable-ipv6          Disable IPv6 support in APR.],
 
1963
  [ if test "$enableval" = "no"; then
 
1964
        user_disabled_ipv6=1
 
1965
    fi ],
 
1966
  [ user_disabled_ipv6=0 ] )
 
1967
 
 
1968
case $host in
 
1969
  *)
 
1970
    broken_ipv6=0
 
1971
esac
 
1972
 
 
1973
AC_SEARCH_LIBS(getaddrinfo, socket inet6)
 
1974
AC_SEARCH_LIBS(gai_strerror, socket inet6)
 
1975
AC_SEARCH_LIBS(getnameinfo, socket inet6)
 
1976
AC_CHECK_FUNCS(gai_strerror)
 
1977
APR_CHECK_WORKING_GETADDRINFO
 
1978
APR_CHECK_NEGATIVE_EAI
 
1979
APR_CHECK_WORKING_GETNAMEINFO
 
1980
APR_CHECK_SOCKADDR_IN6
 
1981
APR_CHECK_SOCKADDR_STORAGE
 
1982
 
 
1983
have_ipv6="0"
 
1984
if test "$user_disabled_ipv6" = 1; then
 
1985
    ipv6_result="no -- disabled by user"
 
1986
else
 
1987
    if test "x$broken_ipv6" = "x0"; then
 
1988
        if test "x$have_sockaddr_in6" = "x1"; then
 
1989
            if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
 
1990
                if test "x$ac_cv_working_getnameinfo" = "xyes"; then
 
1991
                    APR_CHECK_GETADDRINFO_ADDRCONFIG
 
1992
                    have_ipv6="1"
 
1993
                    ipv6_result="yes"
 
1994
                else
 
1995
                    ipv6_result="no -- no getnameinfo"
 
1996
                fi
 
1997
            else
 
1998
                ipv6_result="no -- no working getaddrinfo"
 
1999
            fi
 
2000
        else
 
2001
            ipv6_result="no -- no sockaddr_in6"
 
2002
        fi
 
2003
    else
 
2004
        ipv6_result="no -- the platform has known problems supporting IPv6"
 
2005
    fi
 
2006
fi
 
2007
 
 
2008
AC_MSG_CHECKING(if APR supports IPv6)
 
2009
AC_MSG_RESULT($ipv6_result)
 
2010
 
 
2011
AC_SUBST(have_ipv6)
 
2012
 
 
2013
# hstrerror is only needed if IPv6 is not enabled,
 
2014
# so getaddrinfo/gai_strerror are not used.
 
2015
if test $have_ipv6 = 0; then
 
2016
  AC_SEARCH_LIBS(hstrerror, resolv,
 
2017
    [AC_DEFINE(HAVE_HSTRERROR, 1, [Define if hstrerror is present])])
 
2018
fi
 
2019
 
 
2020
dnl Check for langinfo support
 
2021
 
 
2022
AC_CHECK_HEADERS(langinfo.h)
 
2023
AC_CHECK_FUNCS(nl_langinfo)
 
2024
 
 
2025
dnl ----------------------------- Finalize the variables
 
2026
 
 
2027
echo "${nl}Restore user-defined environment settings..."
 
2028
 
 
2029
APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
 
2030
APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_)
 
2031
APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
 
2032
APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_)
 
2033
APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_)
 
2034
AC_SUBST(NOTEST_CPPFLAGS)
 
2035
AC_SUBST(NOTEST_CFLAGS)
 
2036
AC_SUBST(NOTEST_LDFLAGS)
 
2037
AC_SUBST(NOTEST_LIBS)
 
2038
AC_SUBST(NOTEST_INCLUDES)
 
2039
 
 
2040
dnl ----------------------------- Construct the files
 
2041
 
 
2042
AC_SUBST(LDLIBS)
 
2043
AC_SUBST(INCLUDES)
 
2044
AC_SUBST(AR)
 
2045
AC_SUBST(RM)
 
2046
AC_SUBST(OSDIR)
 
2047
AC_SUBST(DEFAULT_OSDIR)
 
2048
AC_SUBST(EXEEXT)
 
2049
AC_SUBST(LIBTOOL_LIBS)
 
2050
 
 
2051
# Use -no-install to link the test programs on all platforms
 
2052
# but Darwin, where it would cause the programs to be linked
 
2053
# against installed versions of libapr instead of those just
 
2054
# built.
 
2055
case $host in
 
2056
*-apple-darwin*) LT_NO_INSTALL="" ;;
 
2057
*) LT_NO_INSTALL="-no-install" ;;
 
2058
esac
 
2059
AC_SUBST(LT_NO_INSTALL)
 
2060
 
 
2061
#
 
2062
# BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
 
2063
#
 
2064
case $host in
 
2065
*bsdi*)
 
2066
    # Check whether they've installed GNU make
 
2067
    if make --version > /dev/null 2>&1; then 
 
2068
        INCLUDE_RULES="include $apr_buildout/apr_rules.mk"
 
2069
        INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk"
 
2070
    else
 
2071
        # BSDi make
 
2072
        INCLUDE_RULES=".include \"$apr_buildout/apr_rules.mk\""
 
2073
        INCLUDE_OUTPUTS=".include \"$apr_srcdir/build-outputs.mk\""
 
2074
    fi
 
2075
    ;;
 
2076
*)
 
2077
    INCLUDE_RULES="include $apr_buildout/apr_rules.mk"
 
2078
    INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk"
 
2079
    ;;
 
2080
esac
 
2081
AC_SUBST(INCLUDE_RULES)
 
2082
AC_SUBST(INCLUDE_OUTPUTS)
 
2083
 
 
2084
AC_CONFIG_FILES([Makefile
 
2085
                 include/apr.h
 
2086
                 build/apr_rules.mk
 
2087
                 build/pkg/pkginfo
 
2088
                 apr-$APR_MAJOR_VERSION-config:apr-config.in
 
2089
                 apr.pc])
 
2090
 
 
2091
if test -d $srcdir/test; then
 
2092
   AC_CONFIG_FILES([test/Makefile test/internal/Makefile])
 
2093
fi
 
2094
 
 
2095
dir=include/arch/unix
 
2096
test -d $dir || $MKDIR $dir
 
2097
 
 
2098
AC_CONFIG_COMMANDS([default], [
 
2099
# Commands run at the end of config.status:
 
2100
for i in $APR_SAVE_HEADERS; do
 
2101
  if cmp -s $i $i.save 2>/dev/null; then
 
2102
    mv $i.save $i
 
2103
    AC_MSG_NOTICE([$i is unchanged])
 
2104
  fi
 
2105
  rm -f $i.save
 
2106
done
 
2107
chmod +x apr-$APR_MAJOR_VERSION-config
 
2108
],[
 
2109
dnl This section is expanded by configure UNQUOTED so variable 
 
2110
dnl references must be backslash-escaped as necessary.
 
2111
 
 
2112
# Commands run at the beginning of config.status:
 
2113
APR_SAVE_HEADERS="include/apr.h include/arch/unix/apr_private.h"
 
2114
APR_MAJOR_VERSION=$APR_MAJOR_VERSION
 
2115
 
 
2116
for apri in \${APR_SAVE_HEADERS}; do
 
2117
  test -r \${apri} && mv \${apri} \${apri}.save
 
2118
done
 
2119
])
 
2120
 
 
2121
AC_OUTPUT