File: configure.ac

package info (click to toggle)
inn2 2.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,720 kB
  • ctags: 8,983
  • sloc: ansic: 92,499; sh: 13,509; perl: 12,921; makefile: 2,985; yacc: 842; python: 342; lex: 255
file content (595 lines) | stat: -rw-r--r-- 21,055 bytes parent folder | download
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
dnl Process this file with Autoconf to produce a configure script.
dnl $Id: configure.ac 9587 2013-12-14 20:10:48Z iulius $
dnl
dnl Please try to follow GNU conventions and Autoconf manual conventions as
dnl much as possible in this file so that any macros we develop can be easily
dnl contributed to the macro archive and possibly rolled into future versions
dnl of Autoconf so that we can stop supporting them.  This means, for example,
dnl that code excerpts should probably follow the GNU coding standards rather
dnl than INN's.
dnl
dnl If a check is any way non-trivial, please package it up in a macro with
dnl AC_DEFUN and put that macro into a separate file under m4.  Please also
dnl put any long code blocks into a separate macro rather than in-line in the
dnl test macro; this will make quoting issues much easier.  See the existing
dnl tests for details on how to do this.
dnl
dnl Try to do as much with AC_DEFINE and as little with AC_SUBST as is
dnl reasonable; obviously, makefile things like library paths and so forth and
dnl paths to programs have to use AC_SUBST, but any compile-time parameters
dnl are easier to handle with AC_DEFINE.  (And AC_SUBST is slower.)
dnl
dnl And remember:  If you don't have any alternative available if your check
dnl for something fails, and there's no purpose served in aborting configure
dnl instead of the compile if what you're checking for is missing, don't
dnl bother checking for it.  Compile-time errors often produce a lot more
dnl useful information for someone debugging a problem than configure-time
dnl errors.

AC_INIT([INN], [2.5.4], [inn-workers@lists.isc.org])
AC_PREREQ(2.61)
AC_REVISION($Revision: 9587 $)
AC_CONFIG_AUX_DIR([support])

dnl Lots of our macros are stored in separate files for ease of maintenance.
m4_include([m4/aux-libs.m4])
m4_include([m4/berkeleydb.m4])
m4_include([m4/cc-c-o.m4])
m4_include([m4/cc-flags.m4])
m4_include([m4/compress.m4])
m4_include([m4/inet-ntoa.m4])
m4_include([m4/iov-max.m4])
m4_include([m4/krb5.m4])
m4_include([m4/large-fpos.m4])
m4_include([m4/libtool.m4])
m4_include([m4/lt~obsolete.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/mmap.m4])
m4_include([m4/modes.m4])
m4_include([m4/openssl.m4])
m4_include([m4/paths.m4])
m4_include([m4/perl.m4])
m4_include([m4/prog-ensure.m4])
m4_include([m4/python.m4])
m4_include([m4/sasl.m4])
m4_include([m4/sendfd.m4])
m4_include([m4/sendmail.m4])
m4_include([m4/snprintf.m4])
m4_include([m4/socket.m4])
m4_include([m4/syslog.m4])
m4_include([m4/users.m4])
m4_include([m4/vamacros.m4])
m4_include([m4/zlib.m4])

dnl By default, INN installs into its own independent tree.  Support for FHS
dnl is not yet implemented; once it is, this will need to become conditional
dnl on that support being disabled.
AC_PREFIX_DEFAULT([/usr/local/news])

dnl Make sure $prefix is set so that we can use it internally.
test x"$prefix" = xNONE && prefix="$ac_default_prefix"

dnl A few tests need to happen before any of the libtool tests in order to
dnl avoid error messages.  We therefore lift them up to the top of the file.
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_SEARCH_LIBS([strerror], [cposix])
INN_PROG_CC_C_O
AC_CANONICAL_HOST
_LT_DECL_SED

dnl Check to see if the user wants to use libtool.  We only invoke the libtool
dnl setup macros if they do.  Keep this call together with the libtool setup
dnl so that the arguments to configure will be together in configure --help.
inn_use_libtool=no
AC_ARG_ENABLE([libtool],
    [AS_HELP_STRING([--enable-libtool],
        [Use libtool for lib generation @<:@default=no@:>@])],
    [if test x"$enableval" = xyes ; then
        inn_use_libtool=yes
    fi])
if test x"$inn_use_libtool" = xyes ; then
    LT_INIT
    EXTLIB='la'
    EXTOBJ='lo'
    LIBTOOL='$(top)/libtool'
    LIBTOOLCC='$(top)/libtool --mode=compile'
    LIBTOOLINST='$(top)/libtool --mode=install'
    LIBTOOLLD='$(top)/libtool --mode=link'
    CCOUTPUT='-c -o $@ $<'
else
    EXTLIB='a'
    EXTOBJ='o'
    LIBTOOL=''
    LIBTOOLCC=''
    LIBTOOLINST=''
    LIBTOOLLD=''
    if test x"$compiler_c_o" = xyes ; then
        CCOUTPUT='-c -o $@ $<'
    else
        CCOUTPUT='-c $< && if test x"$(@F)" != x"$@" ; then mv $(@F) $@ ; fi'
    fi
    AC_SUBST(LIBTOOL)
fi
AC_SUBST(EXTLIB)
AC_SUBST(EXTOBJ)
AC_SUBST(LIBTOOLCC)
AC_SUBST(LIBTOOLINST)
AC_SUBST(LIBTOOLLD)
AC_SUBST(CCOUTPUT)

dnl Command-line options.  Many of these macros just do the command-line
dnl component of a set of macros that have additional parts called later.
INN_ARG_PATHS
INN_ARG_SYSLOG
INN_ARG_USERS
INN_ARG_MODES
INN_ARG_COMPRESS
INN_ARG_SENDMAIL

dnl innbind by default only allows ports 119, 433 and 563 below 1024; if the user
dnl wants to use some other port as well, they must use this option.
AC_ARG_WITH([innd-port],
    [AS_HELP_STRING([--with-innd-port=PORT],
        [Additional low-numbered port for innbind])],
    [AC_DEFINE_UNQUOTED([INND_PORT], [$with_innd_port],
        [Additional permitted low-numbered port for innbind.])])

dnl Whether IPv6 support should be enabled (disabled by default).  Eventually
dnl this will be automatically detected and always turned on, but it's not
dnl quite mature enough yet.
AC_ARG_ENABLE([ipv6],
    [AS_HELP_STRING([--enable-ipv6], [Enable IPv6 support])],
    [if test "x$enableval" = xyes ; then
        AC_DEFINE([HAVE_INET6], 1, [Define to enable IPv6 support.])
    fi])

dnl Whether to use a different (less tested) history algorithm.  This will
dnl eventually be a runtime option rather than a compile-time option as soon
dnl as the #ifdefs can be untangled and put into the history API.  The output
dnl variable is needed for now to support news.daily.
DO_DBZ_TAGGED_HASH=DONT
inn_enable_tagged_hash=no
AC_ARG_ENABLE([tagged-hash],
    [AS_HELP_STRING([--enable-tagged-hash],
        [Use tagged hash table for history])],
    [if test "x$enableval" = xyes ; then
        DO_DBZ_TAGGED_HASH=DO
        inn_enable_tagged_hash=yes
        AC_DEFINE([DO_TAGGED_HASH], 1,
            [Define to use tagged hash for the history file.])
    fi])
AC_SUBST([DO_DBZ_TAGGED_HASH])

dnl Whether to enable the keyword generation code in innd.  Use of this code
dnl requires a regular expression library, which is checked for later on.
inn_enable_keywords=0
AC_ARG_ENABLE([keywords],
    [AS_HELP_STRING([--enable-keywords],
        [Automatic innd keyword generation support])],
    if test x"$enableval" = xyes ; then
        inn_enable_keywords=1
    fi)
AC_DEFINE_UNQUOTED([DO_KEYWORDS], [$inn_enable_keywords],
    [Define to 1 to compile in support for keyword generation code.])

dnl Whether to use the OS flags to enable large file support.  Ideally this
dnl should just always be turned on if possible and the various parts of INN
dnl that read off_t's from disk should adjust somehow to the size, but INN
dnl isn't there yet.  Currently tagged hash doesn't work with large file
dnl support due to assumptions about the size of off_t.
inn_enable_largefiles=no
AC_ARG_ENABLE([largefiles],
    [AS_HELP_STRING([--enable-largefiles],
        [Support for files larger than 2GB [default=no]])],
    if test x"$enableval" = xyes ; then
        inn_enable_largefiles=yes
    fi)
if test x"$inn_enable_tagged_hash" = xyes \
   && test x"$inn_enable_largefiles" = xyes ; then
    AC_MSG_ERROR([--enable-tagged-hash conflicts with --enable-largefiles.])
fi

dnl Checks for embedded interpreters.
INN_ARG_PERL
INN_ARG_PYTHON

dnl Set some configuration file defaults from the machine hostname.
HOSTNAME=`hostname 2> /dev/null || uname -n`
AC_SUBST(HOSTNAME)

dnl Checks for programs.
AC_PROG_GCC_TRADITIONAL
AC_PROG_LEX
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_RANLIB
AC_PROG_YACC

dnl On MacOS X Server, -traditional-cpp is needed for gcc for compiling as
dnl well as preprocessing according to Miro Jurisic <meeroh@meeroh.org>.
case "$CPP" in
*-traditional-cpp*)
    CFLAGS="-traditional-cpp $CFLAGS"
    ;;
esac

case "$host" in

dnl When building on Linux, we need to compile with _GNU_SOURCE to get the
dnl right definitions of pread and pwrite and to get some other functions
dnl (like asprintf) that we use.
*linux*)
    AC_DEFINE([_GNU_SOURCE], 1,
        [Define if compiling on Linux to get prototypes for some functions.])
    ;;

dnl HP-UX's native compiler needs a special flag to turn on ANSI, and needs
dnl -g on link as well as compile for debugging to work.
*hpux*)
    if test x"$GCC" != xyes ; then
        CFLAGS="$CFLAGS -Ae"
        case "$CFLAGS" in
        *-g*) LDFLAGS="$LDFLAGS -g" ;;
        esac
    fi
    ;;

dnl OSX needs -multiply_defined suppress.
*darwin*)
    LDFLAGS="$LDFLAGS -multiply_defined suppress"
    ;;

dnl From Boyd Gerber <gerberb@zenez.com>, needed in some cases to compile
dnl the bison-generated parser for innfeed.conf.
*UnixWare*|*unixware*|*-sco3*)
    if test x"$GCC" != xyes ; then
        CFLAGS="$CFLAGS -Kalloca"
    fi
esac
  
dnl Checks for pathnames.  If AC_PROG_* does not manage to find a working
dnl program, INN_PATH_PROG_ENSURE will output an error.
AC_ARG_VAR([AWK], [Location of awk])
AC_ARG_VAR([EGREP], [Location of egrep])
AC_ARG_VAR([SED], [Location of sed])
AC_ARG_VAR([SORT], [Location of sort])
AC_ARG_VAR([SSLBIN], [Location of openssl])
AC_ARG_VAR([UUSTAT], [Location of uustat])
AC_ARG_VAR([UUX], [Location of uux])
AC_PROG_AWK
AC_PROG_EGREP
AC_PROG_SED
INN_PATH_PROG_ENSURE([AWK], [awk])
INN_PATH_PROG_ENSURE([EGREP], [egrep])
INN_PATH_PROG_ENSURE([SED], [sed])
INN_PATH_PROG_ENSURE([SORT], [sort])
AC_PATH_PROGS([SSLBIN], [openssl], [openssl])
AC_PATH_PROGS([UUSTAT], [uustat])
AC_PATH_PROGS([UUX], [uux], [uux])
INN_PATH_COMPRESS
INN_PATH_SENDMAIL

dnl Look for PGP 5.0's pgpv, then pgp, then pgpgpg (not sure why anyone would
dnl have pgpgpg and not gpgv, but it doesn't hurt).  Separately look for
dnl GnuPG (which we prefer).
DO_PGPVERIFY=true
AC_ARG_VAR([GPGV], [Location of GnuPG gpgv program])
AC_ARG_VAR([PGP], [Location of PGP verification program])
AC_PATH_PROGS([GPGV], [gpgv2 gpgv])
AC_PATH_PROGS([PGP], [pgpv pgp pgpgpg])
if test -z "$PGP" && test -z "$GPGV" ; then
    DO_PGPVERIFY=false
fi
AC_SUBST([DO_PGPVERIFY])

dnl Look for a program that takes an ftp URL as a command line argument and
dnl retrieves the file to the current directory.  Shame we can't also use
dnl lynx -source; it only writes to stdout.  ncftp as of version 3 doesn't
dnl support this any more (it comes with ncftpget instead), but if someone
dnl has ncftp and not ncftpget they have an earlier version.
AC_PATH_PROGS([PATH_GETFTP], [wget ncftpget ncftp], [$bindir/simpleftp])

dnl Checks for libraries.  Use AC_SEARCH_LIBS where possible to avoid
dnl adding libraries when the function is found in libc, and use
dnl INN_SEARCH_AUX_LIBS for libraries that are only used by particular
dnl subsections of INN.

dnl Check for setproctitle in libc first, then libutil if not found there.
dnl We have a replacement function if we can't find it, and then we also need
dnl to check for pstat.
AC_SEARCH_LIBS([setproctitle], [util],
    [AC_DEFINE([HAVE_SETPROCTITLE], 1,
        [Define if you have the setproctitle function.])],
    [AC_LIBOBJ([setproctitle])
     AC_CHECK_FUNCS([pstat])])

dnl The rat's nest of networking libraries.  The common cases are not to
dnl need any extra libraries, or to need -lsocket -lnsl.  We need to avoid
dnl linking with libnsl unless we need it, though, since on some OSes where
dnl it isn't necessary it will totally break networking.  Unisys also
dnl includes gethostbyname in libsocket but needs libnsl for socket().
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket], ,
    [AC_CHECK_LIB([nsl], [socket], LIBS="$LIBS -lsocket -lnsl", , -lsocket)])

dnl Check for inet_aton.  We have our own, but on Solaris the version in
dnl libresolv is more lenient in ways that Solaris's internal DNS resolution
dnl code requires, so if we use our own *and* link with libresolv (which may
dnl be forced by Perl) DNS resolution fails.
AC_SEARCH_LIBS([inet_aton], [resolv])

dnl Search for various additional libraries used by portions of INN.
INN_SEARCH_AUX_LIBS([crypt], [crypt], [CRYPT_LIBS])
INN_SEARCH_AUX_LIBS([getspnam], [shadow], [SHADOW_LIBS])

dnl IRIX has a PAM library with the right symbols but no header files suitable
dnl for use with it, so we have to check the header files first and then only
dnl if one is found do we check for the library.
inn_check_pam=1
AC_CHECK_HEADERS([pam/pam_appl.h], ,
    [AC_CHECK_HEADER([security/pam_appl.h], , [inn_check_pam=0])])
if test x"$inn_check_pam" = x1; then
    INN_SEARCH_AUX_LIBS([pam_start], [pam], [PAM_LIBS],
        [AC_DEFINE([HAVE_PAM], 1, [Define if you have PAM.])])
fi

dnl If keyword generation support was requested, check for the appropriate
dnl libraries.
if test x"$inn_enable_keywords" = x1 ; then
    INN_SEARCH_AUX_LIBS([regexec], [regex], [REGEX_LIBS], ,
        [AC_MSG_ERROR([no usable regular expression library found])])
fi

dnl Handle optional libraries and probing for their locations and component
dnl libraries if needed.
INN_LIB_BERKELEYDB
INN_LIB_ZLIB
INN_LIB_OPENSSL
INN_LIB_SASL
INN_LIB_KERBEROS

dnl The dbm libraries are a special case.  If we're building with Berkeley DB,
dnl just use the ndbm support provided by it.
if test x"$DB_LIBS" != x ; then
    INN_LIB_BERKELEYDB_NDBM
fi
if test x"$inn_cv_lib_berkeleydb_ndbm_works" != xyes ; then
    INN_SEARCH_AUX_LIBS([dbm_open], [ndbm dbm gdbm "gdbm_compat -lgdbm"], [DBM_LIBS],
        [AC_DEFINE([HAVE_DBM], 1, [Define if you have a dbm library.])])
    DBM_CPPFLAGS=
else
    DBM_CPPFLAGS="$DB_CPPFLAGS"
    DBM_LIBS="$DB_LDFLAGS $DB_LIBS"
    AC_SUBST([DBM_LIBS])
fi
AC_SUBST([DBM_CPPFLAGS])

dnl If configuring with large file support, determine the right flags to
dnl use based on the platform.
if test x"$inn_enable_largefiles" = xyes ; then
    AC_SYS_LARGEFILE
    AC_DEFINE([DO_LARGEFILES], [1], [Define to use large files.])
fi

dnl Special checks for header files.
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_HEADER_SYS_WAIT

dnl Generic checks for header files.
AC_CHECK_HEADERS([crypt.h inttypes.h limits.h pam/pam_appl.h stddef.h \
                  stdint.h string.h sys/bitypes.h sys/filio.h sys/loadavg.h \
                  sys/select.h sys/time.h unistd.h])

dnl Some Linux systems have db1/ndbm.h instead of ndbm.h.  Others have
dnl gdbm/ndbm.h or gdbm-ndbm.h.  Detecting the last two ones is not
dnl straight-forward because Autoconf defines the same preprocessor name
dnl and the same shell variable for them; we therefore have to make sure
dnl the cache is not populated, and to define HAVE_GDBM_SLASH_NDBM_H and
dnl HAVE_GDBM_HYPHEN_NDBM_H separately.
AC_CHECK_HEADERS([ndbm.h db1/ndbm.h], [break])
AS_UNSET([ac_cv_header_gdbm_ndbm_h])
AC_CHECK_HEADER([gdbm/ndbm.h])
AS_IF([test x"$ac_cv_header_gdbm_ndbm_h" != xno],
    [AC_DEFINE([HAVE_GDBM_SLASH_NDBM_H], [1],
         [Define if you have the <gdbm/ndbm.h> header file.])],
    [AS_UNSET([ac_cv_header_gdbm_ndbm_h])
     AC_CHECK_HEADER([gdbm-ndbm.h])
     AS_IF([test x"$ac_cv_header_gdbm_ndbm_h" != xno],
         [AC_DEFINE([HAVE_GDBM_HYPHEN_NDBM_H], [1],
              [Define if you have the <gdbm-ndbm.h> header file.])])])

dnl Check for whether various symbols are declared.
AC_CHECK_DECLS([pread, pwrite, snprintf, setproctitle, strlcat,
                strlcpy, vsnprintf])
AC_CHECK_DECLS([h_errno], , , [#include <netdb.h>])
AC_CHECK_DECLS([inet_aton, inet_ntoa], , ,
[#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>])
AC_CHECK_DECLS([altzone], , , [#include <time.h>])

dnl Checks for compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
INN_C_C99_VAMACROS
INN_C_GNU_VAMACROS

dnl Checks for structures.
AC_STRUCT_TIMEZONE
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
[#include <sys/types.h>
#include <sys/socket.h>])

dnl Checks for types.
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_LONG_LONG_INT
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_FUNC_GETGROUPS
AC_TYPE_UID_T
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_TYPES([sig_atomic_t], , ,
[#include <sys/types.h>
#include <signal.h>])
AC_CHECK_TYPES([socklen_t], , ,
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_TYPES([union semun], , ,
[#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>])

dnl See if struct sockaddr_storage is available, and if so, how its members
dnl are named.
AC_CHECK_TYPES([struct sockaddr_storage],
    [AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
        [#include <sys/types.h>
        #include <sys/socket.h>])], ,
    [#include <sys/types.h>
    #include <sys/socket.h>])

dnl Checks for macros.
INN_MACRO_IN6_ARE_ADDR_EQUAL
INN_MACRO_IOV_MAX
INN_MACRO_SA_LEN
INN_MACRO_SUN_LEN

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
INN_FUNC_GETADDRINFO_ADDRCONFIG
INN_FUNC_INET_NTOA
INN_FUNC_SNPRINTF

dnl Check for various other functions.
AC_CHECK_FUNCS(atexit getloadavg getrusage getspnam setbuffer sigaction \
               setgroups setrlimit setsid socketpair strncasecmp strtoul \
               sysconf)

dnl Find a way to get the file descriptor limit.
AC_CHECK_FUNCS([getrlimit getdtablesize ulimit], [break])

dnl Probe for the appropriate stat functions.
AC_CHECK_FUNCS([statvfs], ,
    [AC_CHECK_FUNCS([statfs])
     AC_CHECK_HEADERS([sys/vfs.h sys/param.h])
     AC_CHECK_HEADERS(sys/mount.h, [], [],
         [#ifdef HAVE_SYS_PARAM_H
          # include <sys/param.h>
          #endif
         ])
    ])

dnl If we can't find any of the following, we have replacements for them.
AC_REPLACE_FUNCS(asprintf getaddrinfo getnameinfo getpagesize hstrerror \
                 inet_aton inet_ntop mkstemp pread pwrite seteuid strcasecmp \
                 strlcat strlcpy strspn setenv symlink)

dnl Probe for fseeko and ftello, which take off_t instead of int.
if test x"$inn_enable_largefiles" = xyes ; then
    AC_FUNC_FSEEKO
    if test x"$ac_cv_sys_largefile_source" = xunknown ; then
        INN_TYPE_FPOS_T_LARGE
        AC_CHECK_DECLS([fseeko, ftello])
        AC_LIBOBJ([fseeko])
        AC_LIBOBJ([ftello])
    fi
else
    AC_CHECK_DECLS([fseeko])
fi

dnl Probe for mmap properties.
INN_FUNC_MMAP(
    [AC_CHECK_FUNCS([madvise])
     INN_FUNC_MMAP_SEES_WRITES
     INN_FUNC_MMAP_NEEDS_MSYNC
     INN_FUNC_MSYNC_ARGS])

dnl Probes for system characteristics.
INN_SYS_STREAMS_SENDFD
INN_SYS_UNIX_SOCKETS
INN_LOG_FACILITY

dnl Clean up our LIBS, just for grins.
LIBS=`echo "$LIBS" | sed 's/^  *//' | sed 's/   */ /g' | sed 's/  *$//'`

dnl Configure our output files.  Try to keep this as limited as possible,
dnl since it directly affects how long it takes configure to complete.
AC_CONFIG_FILES([Makefile.global include/inn/paths.h])
AC_CONFIG_FILES([scripts/innshellvars scripts/innshellvars.tcl])
AC_CONFIG_FILES([perl/INN/Config.pm scripts/innshellvars.pl])
AC_CONFIG_FILES([support/fixconfig], [chmod +x support/fixconfig])
AC_CONFIG_FILES([support/fixscript], [chmod +x support/fixscript])

dnl Include some additional files at the beginning of config.h.
AH_TOP(
[#include "inn/defines.h"
#include "inn/options.h"])

dnl Most configuration information goes here.
AC_CONFIG_HEADER([include/config.h])

dnl Generate the configure output.
AC_OUTPUT

dnl Print out some additional information on what to check.
cat <<EOM

Please check the following files before running make, to ensure that 
everything was set correctly.

        Makefile.global
        include/config.h
        include/inn/options.h
        include/inn/paths.h
        innfeed/innfeed.h

EOM

dnl Write a warning for missing Perl modules at the end of the output.
dnl $inn_perl_module_warning already has a leading space.
if test x"$inn_perl_module_warning" != x ; then
    echo "Missing Perl modules: $inn_perl_module_warning."
    echo "You should install them for these programs to work fine."
fi

dnl Finally, double-check the configured temporary directory.  Some people
dnl point this at the system temporary directories or at other world-writeable
dnl directories, which can be a local security hole.
if $PERL -e "exit((stat('$PATH_TMP'))[[2]] & 2)" > /dev/null ; then
    :
else
    cat <<EOM

WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

  The temporary directory you have configured is world-writeable.  It is
  currently set to $tmpdir.

  This directory is used by INN for temporary files and should only be
  writeable by the news user.  INN does not go to great lengths to prevent
  symlink attacks and the like because it assumes this directory is not
  world-writeable.  By configuring INN in this fashion, you may be
  introducing a locally exploitable security hole.

  It is STRONGLY recommended that you use a temporary directory reserved for
  INN's exclusive use, one which is not world-writeable.  You can do this
  either with --with-tmp-dir or by setting --prefix to something other than
  /usr or /.

EOM
fi