source: branches/samhain_3_1/aclocal.m4@ 538

Last change on this file since 538 was 476, checked in by katerina, 9 years ago

Fix for ticket #373 (better autoconf macro for va_copy).

File size: 65.2 KB
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.3
2
3dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4dnl This Makefile.in is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13#
14# Check to make sure that the build environment is sane.
15#
16AC_DEFUN([AM_INIT_AUTOMAKE],
17[
18AC_REQUIRE([AC_PROG_INSTALL])
19PACKAGE=[$1]
20AC_SUBST(PACKAGE)
21VERSION=[$2]
22AC_SUBST(VERSION)
23dnl test to see if srcdir already configured
24if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
25 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
26fi
27ifelse([$3],,
28AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
29AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
30AC_REQUIRE([AC_PROG_MAKE_SET])])
31
32
33# Define a conditional.
34
35AC_DEFUN([AM_CONDITIONAL],
36[AC_SUBST($1_TRUE)
37AC_SUBST($1_FALSE)
38if $2; then
39 $1_TRUE=
40 $1_FALSE='#'
41else
42 $1_TRUE='#'
43 $1_FALSE=
44fi])
45
46
47AC_DEFUN([sh_run_prog],
48[if test "$cross_compiling" = "yes"; then
49 AC_MSG_ERROR([Can not probe non-portable values when cross compiling])
50fi
51cat > conftest.$ac_ext <<EOF
52[#]line __oline__ "configure"
53#include "confdefs.h"
54ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
55extern "C" void exit(int);
56#endif
57])
58[$1]
59EOF
60if AC_TRY_EVAL(ac_link) && test -s conftest && $2=`(./conftest 2>/dev/null)`
61then
62dnl Don't remove the temporary files here, so they can be examined.
63ifelse([$3], , :, [$3])
64else
65echo "configure: failed program was:" >&AC_FD_CC
66cat conftest.$ac_ext >&AC_FD_CC
67ifelse([$4], , , [ rm -fr conftest*
68 $4
69])
70fi
71rm -fr conftest* ])
72
73dnl fs type number of the proc filing system
74AC_DEFUN([sh_procfs_id],
75[AC_MSG_CHECKING([f_type of /proc])
76AC_CACHE_VAL([sh_cv_proc_fstype],
77[sh_run_prog(
78changequote(<<, >>)dnl
79<<#include <stdio.h>
80#ifdef HAVE_STDLIB_H
81#include <stdlib.h>
82#endif /* HAVE_STDLIB_H */
83#ifdef HAVE_UNISTD_H
84#include <unistd.h>
85#endif /* HAVE_UNISTD_H */
86#ifdef HAVE_SYS_VFS_H
87#include <sys/vfs.h>
88#endif
89#ifndef Q
90#define __Q(x) #x
91#define Q(x) __Q(x)
92#endif
93int main(void)
94{
95struct statfs fsbuf;
96long ft;
97if (statfs("/", &fsbuf)!=0)
98 exit(1);
99ft=fsbuf.f_type;
100if (statfs("/proc/1", &fsbuf)!=0)
101 exit(1);
102if (ft!=fsbuf.f_type)
103 printf("0x%08lx", fsbuf.f_type);
104else
105 puts("statfs useless");
106exit(0);
107} >>
108changequote([, ]), sh_cv_proc_fstype,, sh_cv_proc_fstype="a fatal error occured")])
109AC_MSG_RESULT($sh_cv_proc_fstype)
110if test "${sh_cv_proc_fstype}" = "a fatal error occured"; then
111 $1=$2
112 $4
113else if test "${sh_cv_proc_fstype}" = "statfs useless"; then
114 $1=$2
115 $4
116else
117 $1=$sh_cv_proc_fstype
118 $3
119fi; fi ])
120
121# Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock
122# is not called from uid 0 (not tested whether uid 0 works)
123dnl AC_CHECK_MLOCK
124dnl
125define([AC_CHECK_MLOCK],
126 [ AC_CHECK_FUNCS(mlock)
127 if test "$ac_cv_func_mlock" = "yes"; then
128 AC_MSG_CHECKING(whether mlock is broken)
129 AC_CACHE_VAL(ac_cv_have_broken_mlock,
130 AC_TRY_RUN([
131 #include <stdlib.h>
132 #include <unistd.h>
133 #include <errno.h>
134 #include <sys/mman.h>
135 #include <sys/types.h>
136 #include <fcntl.h>
137
138 int main()
139 {
140 char *pool;
141 int err;
142 long int pgsize = getpagesize();
143
144 pool = malloc( 4096 + pgsize );
145 if( !pool )
146 return 2;
147 pool += (pgsize - ((long int)pool % pgsize));
148
149 err = mlock( pool, 4096 );
150 if( !err || errno == EPERM )
151 return 0; /* okay */
152
153 return 1; /* hmmm */
154 }
155
156 ],
157 ac_cv_have_broken_mlock="no",
158 ac_cv_have_broken_mlock="yes",
159 ac_cv_have_broken_mlock="assume-no"
160 )
161 )
162 if test "$ac_cv_have_broken_mlock" = "yes"; then
163 AC_DEFINE(HAVE_BROKEN_MLOCK)
164 AC_MSG_RESULT(yes)
165 else
166 if test "$ac_cv_have_broken_mlock" = "no"; then
167 AC_MSG_RESULT(no)
168 else
169 AC_MSG_RESULT(assuming no)
170 fi
171 fi
172 fi
173 ])
174
175dnl @synopsis AC_FUNC_VSNPRINTF
176dnl
177dnl Check whether there is a reasonably sane vsnprintf() function installed.
178dnl "Reasonably sane" in this context means never clobbering memory beyond
179dnl the buffer supplied, and having a sensible return value. It is
180dnl explicitly allowed not to NUL-terminate the return value, however.
181dnl
182dnl @version $Id: ac_func_vsnprintf.m4,v 1.1 2001/07/26 02:00:21 guidod Exp $
183dnl @author Gaute Strokkenes <gs234@cam.ac.uk>
184dnl
185AC_DEFUN([SL_CHECK_VSNPRINTF],
186[AC_CACHE_CHECK(for working vsnprintf,
187 ac_cv_func_vsnprintf,
188[AC_TRY_RUN(
189[#include <stdio.h>
190#include <stdarg.h>
191
192int
193doit(char * s, ...)
194{
195 char buffer[32];
196 va_list args;
197 int r;
198
199 buffer[5] = 'X';
200
201 va_start(args, s);
202 r = vsnprintf(buffer, 5, s, args);
203 va_end(args);
204
205 /* -1 is pre-C99, 7 is C99. R.W. 17.01.2003 disallow -1 */
206
207 if (r != 7)
208 exit(1);
209
210 /* We deliberately do not care if the result is NUL-terminated or
211 not, since this is easy to work around like this. */
212
213 buffer[4] = 0;
214
215 /* Simple sanity check. */
216
217 if (strcmp(buffer, "1234"))
218 exit(1);
219
220 if (buffer[5] != 'X')
221 exit(1);
222
223 exit(0);
224}
225
226int
227main(void)
228{
229 doit("1234567");
230 exit(1);
231}], ac_cv_func_vsnprintf=yes, ac_cv_func_vsnprintf=no, ac_cv_func_vsnprintf=no)])
232dnl Note that the default is to be pessimistic in the case
233dnl of cross compilation.
234dnl If you know that the target has a sensible vsnprintf(),
235dnl you can get around this
236dnl by setting ac_func_vsnprintf to yes, as described in the Autoconf manual.
237if test $ac_cv_func_vsnprintf = yes; then
238 :
239else
240 AC_DEFINE(HAVE_BROKEN_VSNPRINTF, 1,
241 [Define if you have a broken version of the `vsnprintf' function.])
242fi
243])# AC_FUNC_VSNPRINTF
244
245dnl SH_CHECK_TYPEDEF(TYPE, HAVE_NAME)
246dnl Check whether a typedef exists and create a #define $2 if it exists
247dnl
248AC_DEFUN([SH_CHECK_TYPEDEF],
249 [ AC_MSG_CHECKING(for $1 typedef)
250 sh_cv_typedef_foo=`echo sh_cv_typedef_$1 | sed -e 's% %_%g'`
251 AC_CACHE_VAL( $sh_cv_typedef_foo,
252 [AC_TRY_COMPILE([
253#include <stdlib.h>
254#include <sys/types.h>
255#ifdef HAVE_STDINT_H
256#include <stdint.h>
257#endif
258#ifdef HAVE_INTTYPES_H
259#include <inttypes.h>
260#endif], [
261 #undef $1
262 int a = sizeof($1);
263 ], sh_cv_typedef=yes, sh_cv_typedef=no )])
264 AC_MSG_RESULT($sh_cv_typedef)
265 if test "$sh_cv_typedef" = yes; then
266 AC_DEFINE($2)
267 sh_$2=yes
268 else
269 sh_$2=no
270 fi
271 ])
272
273
274
275dnl **********************
276dnl *** va_copy checks ***
277dnl **********************
278# va_copy.m4 serial 1 (js-1.6.20070208)
279
280dnl ## From the OpenWrt Project (http://openwrt.org)
281dnl ## Project is GPL v2
282dnl ##
283dnl ##
284dnl ## Check for C99 va_copy() implementation
285dnl ## (and provide fallback implementation if neccessary)
286dnl ##
287dnl ## configure.in:
288dnl ## AC_CHECK_VA_COPY
289dnl ## foo.c:
290dnl ## #include "config.h"
291dnl ## [...]
292dnl ## va_copy(d,s)
293dnl ##
294dnl ## This check is rather complex: first because we really have to
295dnl ## try various possible implementations in sequence and second, we
296dnl ## cannot define a macro in config.h with parameters directly.
297dnl ##
298
299dnl # test program for va_copy() implementation
300changequote(<<,>>)
301m4_define(__va_copy_test, <<[
302#include <stdlib.h>
303#include <stdarg.h>
304#include <string.h>
305#define DO_VA_COPY(d, s) $1
306void test(char *str, ...)
307{
308 va_list ap, ap2;
309 int i;
310 va_start(ap, str);
311 DO_VA_COPY(ap2, ap);
312 for (i = 1; i <= 9; i++) {
313 int k = (int)va_arg(ap, int);
314 if (k != i)
315 abort();
316 }
317 DO_VA_COPY(ap, ap2);
318 for (i = 1; i <= 9; i++) {
319 int k = (int)va_arg(ap, int);
320 if (k != i)
321 abort();
322 }
323 va_end(ap);
324}
325int main(int argc, char *argv[])
326{
327 test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
328 exit(0);
329}
330]>>)
331changequote([,])
332
333dnl # test driver for va_copy() implementation
334m4_define(__va_copy_check, [
335 AH_VERBATIM($1,
336[/* Predefined possible va_copy() implementation (id: $1) */
337#define __VA_COPY_USE_$1(d, s) $2])
338 if test ".$ac_cv_va_copy" = .; then
339 AC_TRY_RUN(__va_copy_test($2), [ac_cv_va_copy="$1"])
340 fi
341])
342
343dnl # Autoconf check for va_copy() implementation checking
344AC_DEFUN([AC_CHECK_VA_COPY],[
345 dnl # provide Autoconf display check message
346 AC_MSG_CHECKING(for va_copy() function)
347 dnl # check for various implementations in priorized sequence
348 AC_CACHE_VAL(ac_cv_va_copy, [
349 ac_cv_va_copy=""
350 dnl # 1. check for standardized C99 macro
351 __va_copy_check(C99, [va_copy((d), (s))])
352 dnl # 2. check for alternative/deprecated GCC macro
353 __va_copy_check(GCM, [VA_COPY((d), (s))])
354 dnl # 3. check for internal GCC macro (high-level define)
355 __va_copy_check(GCH, [__va_copy((d), (s))])
356 dnl # 4. check for internal GCC macro (built-in function)
357 __va_copy_check(GCB, [__builtin_va_copy((d), (s))])
358 dnl # 5. check for assignment approach (assuming va_list is a struct)
359 __va_copy_check(ASS, [do { (d) = (s); } while (0)])
360 dnl # 6. check for assignment approach (assuming va_list is a pointer)
361 __va_copy_check(ASP, [do { *(d) = *(s); } while (0)])
362 dnl # 7. check for memory copying approach (assuming va_list is a struct)
363 __va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))])
364 dnl # 8. check for memory copying approach (assuming va_list is a pointer)
365 __va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))])
366 if test ".$ac_cv_va_copy" = .; then
367 AC_ERROR([no working implementation found])
368 fi
369 ])
370 dnl # optionally activate the fallback implementation
371 if test ".$ac_cv_va_copy" = ".C99"; then
372 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)])
373 fi
374 dnl # declare which fallback implementation to actually use
375 AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy],
376 [Define to id of used va_copy() implementation])
377 dnl # provide activation hook for fallback implementation
378 AH_VERBATIM([__VA_COPY_ACTIVATION],
379[/* Optional va_copy() implementation activation */
380#ifndef HAVE_VA_COPY
381#define va_copy(d, s) __VA_COPY_USE(d, s)
382#endif
383])
384 dnl # provide Autoconf display result message
385 if test ".$ac_cv_va_copy" = ".C99"; then
386 AC_MSG_RESULT([yes])
387 else
388 AC_MSG_RESULT([no (using fallback implementation)])
389 fi
390])
391
392
393dnl SH_INIT_PARSE_ARGS()
394m4_define([SH_INIT_PARSE_ARGS],
395[
396m4_divert_push([PARSE_ARGS])dnl
397
398as_cr_letters='abcdefghijklmnopqrstuvwxyz'
399as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
400as_cr_Letters=$as_cr_letters$as_cr_LETTERS
401as_cr_digits='0123456789'
402as_cr_alnum=$as_cr_Letters$as_cr_digits
403
404# Sed expression to map a string onto a valid CPP name.
405as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g"
406
407as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
408# IFS
409# We need space, tab and new line, in precisely that order.
410as_nl='
411'
412IFS=" $as_nl"
413
414# CDPATH.
415$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
416
417
418# Initialize some variables set by options.
419ac_init_help=
420ac_init_version=false
421# The variables have the same names as the options, with
422# dashes changed to underlines.
423cache_file=/dev/null
424AC_SUBST(exec_prefix, NONE)dnl
425no_create=
426no_recursion=
427AC_SUBST(prefix, NONE)dnl
428program_prefix=NONE
429program_suffix=NONE
430AC_SUBST(program_transform_name, [s,x,x,])dnl
431silent=
432site=
433srcdir=
434verbose=
435x_includes=NONE
436x_libraries=NONE
437DESTDIR=
438SH_ENABLE_OPTS="asm ssp db-reload xml-log message-queue login-watch process-check port-check mounts-check logfile-monitor userfiles debug ptrace static network udp nocl stealth micro-stealth install-name identity khide suidcheck base largefile mail external-scripts encrypt srp dnmalloc ipv6 shellexpand suid"
439SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
440
441# Installation directory options.
442# These are left unexpanded so users can "make install exec_prefix=/foo"
443# and all the variables that are supposed to be based on exec_prefix
444# by default will actually change.
445dnl Use braces instead of parens because sh, perl, etc. also accept them.
446sbindir='${exec_prefix}/sbin'
447sysconfdir='${prefix}/etc'
448localstatedir='${prefix}/var'
449mandir='${prefix}/share/man'
450
451AC_SUBST([sbindir], ['${exec_prefix}/sbin'])dnl
452AC_SUBST([sysconfdir], ['${prefix}/etc'])dnl
453AC_SUBST([localstatedir], ['${prefix}/var'])dnl
454AC_SUBST([mandir], ['${prefix}/share/man'])dnl
455
456
457# Initialize some other variables.
458subdirs=
459MFLAGS= MAKEFLAGS=
460SHELL=${CONFIG_SHELL-/bin/sh}
461# Maximum number of lines to put in a shell here document.
462ac_max_here_lines=12
463
464ac_prev=
465for ac_option
466do
467
468 # If the previous option needs an argument, assign it.
469 if test -n "$ac_prev"; then
470 eval "$ac_prev=\$ac_option"
471 ac_prev=
472 continue
473 fi
474
475 case "$ac_option" in
476changequote(, )dnl
477 *=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
478changequote([, ])dnl
479 *) ac_optarg= ;;
480 esac
481
482 # Accept the important Cygnus configure options, so we can diagnose typos.
483
484 case "$ac_option" in
485
486 -build | --build | --buil | --bui | --bu)
487 ac_prev=build_alias ;;
488 -build=* | --build=* | --buil=* | --bui=* | --bu=*)
489 build_alias="$ac_optarg" ;;
490
491 -cache-file | --cache-file | --cache-fil | --cache-fi \
492 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
493 ac_prev=cache_file ;;
494 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
495 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
496 cache_file="$ac_optarg" ;;
497
498 --config-cache | -C)
499 cache_file=config.cache ;;
500
501 -disable-* | --disable-*)
502 ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
503 # Reject names that are not valid shell variable names.
504 expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
505 AC_MSG_ERROR([invalid feature name: $ac_feature])
506 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
507 ac_enable_check_opt=no
508 for f in ${SH_ENABLE_OPTS}
509 do
510 f=`echo $f | sed 's/-/_/g'`
511 if test x${f} = x"${ac_feature}"
512 then
513 ac_enable_check_opt=yes
514 fi
515 done
516 if test x${ac_enable_check_opt} = xno
517 then
518 AC_MSG_ERROR([unrecognized option: $ac_option
519Try `$[0] --help' for more information.])
520 fi
521 eval "enable_$ac_feature=no" ;;
522
523 -enable-* | --enable-*)
524 ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'`
525 # Reject names that are not valid shell variable names.
526 expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
527 AC_MSG_ERROR([invalid feature name: $ac_feature])
528 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
529 case $ac_option in
530 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
531 *) ac_optarg=yes ;;
532 esac
533 ac_enable_check_opt=no
534 for f in ${SH_ENABLE_OPTS}
535 do
536 f=`echo $f | sed 's/-/_/g'`
537 if test x${f} = x"${ac_feature}"
538 then
539 ac_enable_check_opt=yes
540 fi
541 done
542 if test x${ac_enable_check_opt} = xno
543 then
544 AC_MSG_ERROR([unrecognized option: $ac_option
545Try `$[0] --help' for more information.])
546 fi
547 eval "enable_$ac_feature='$ac_optarg'" ;;
548
549 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
550 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
551 | --exec | --exe | --ex)
552 ac_prev=exec_prefix
553 ac_exec_prefix_set="yes"
554 ;;
555 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
556 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
557 | --exec=* | --exe=* | --ex=*)
558 exec_prefix="$ac_optarg"
559 ac_exec_prefix_set="yes"
560 ;;
561
562 -gas | --gas | --ga | --g)
563 # Obsolete; use --with-gas.
564 with_gas=yes ;;
565
566 -help | --help | --hel | --he | -h)
567 ac_init_help=long ;;
568 -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
569 ac_init_help=recursive ;;
570 -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
571 ac_init_help=short ;;
572
573 -host | --host | --hos | --ho)
574 ac_prev=host_alias ;;
575 -host=* | --host=* | --hos=* | --ho=*)
576 host_alias="$ac_optarg" ;;
577
578 -localstatedir | --localstatedir | --localstatedi | --localstated \
579 | --localstate | --localstat | --localsta | --localst \
580 | --locals | --local | --loca | --loc | --lo)
581 ac_prev=localstatedir
582 ac_localstatedir_set="yes"
583 ;;
584 -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
585 | --localstate=* | --localstat=* | --localsta=* | --localst=* \
586 | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
587 localstatedir="$ac_optarg"
588 ac_localstatedir_set="yes"
589 ;;
590
591 -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
592 ac_prev=mandir
593 ac_mandir_set="yes"
594 ;;
595 -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
596 mandir="$ac_optarg"
597 ac_mandir_set="yes"
598 ;;
599
600 -nfp | --nfp | --nf)
601 # Obsolete; use --without-fp.
602 with_fp=no ;;
603
604 -no-create | --no-create | --no-creat | --no-crea | --no-cre \
605 | --no-cr | --no-c | -n)
606 no_create=yes ;;
607
608 -no-recursion | --no-recursion | --no-recursio | --no-recursi \
609 | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
610 no_recursion=yes ;;
611
612 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
613 ac_prev=prefix
614 ac_prefix_set="yes"
615 ;;
616 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
617 prefix="$ac_optarg"
618 ac_prefix_set="yes"
619 ;;
620
621 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
622 | -silent | --silent | --silen | --sile | --sil)
623 silent=yes ;;
624
625 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
626 ac_prev=sbindir
627 ac_sbindir_set="yes"
628 ;;
629 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
630 | --sbi=* | --sb=*)
631 sbindir="$ac_optarg"
632 ac_sbindir_set="yes"
633 ;;
634
635 -bindir | --bindir | --bindi | --bind | --bin | --bi | --b)
636 echo "WARNING: bindir will be ignored, use sbindir"
637 ;;
638 -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* \
639 | --bi=* | --b=*)
640 echo "WARNING: bindir will be ignored, use sbindir"
641 ;;
642
643 -datadir | --datadir)
644 echo "WARNING: datadir will be ignored"
645 ;;
646 -datadir=* | --datadir=*)
647 echo "WARNING: datadir will be ignored"
648 ;;
649
650 -includedir | --includedir)
651 echo "WARNING: includedir will be ignored"
652 ;;
653 -includedir=* | --includedir=*)
654 echo "WARNING: includedir will be ignored"
655 ;;
656
657 -infodir | --infodir)
658 echo "WARNING: infodir will be ignored"
659 ;;
660 -infodir=* | --infodir=*)
661 echo "WARNING: infodir will be ignored"
662 ;;
663
664 -libdir | --libdir)
665 echo "WARNING: libdir will be ignored"
666 ;;
667 -libdir=* | --libdir=*)
668 echo "WARNING: libdir will be ignored"
669 ;;
670
671 -libexecdir | --libexecdir)
672 echo "WARNING: libexecdir will be ignored"
673 ;;
674 -libexecdir=* | --libexecdir=*)
675 echo "WARNING: libexecdir will be ignored"
676 ;;
677
678 -sharedstatedir | --sharedstatedir)
679 echo "WARNING: sharedstatedir will be ignored"
680 ;;
681 -sharedstatedir=* | --sharedstatedir=*)
682 echo "WARNING: sharedstatedir will be ignored"
683 ;;
684
685 -site | --site | --sit)
686 ac_prev=site ;;
687 -site=* | --site=* | --sit=*)
688 site="$ac_optarg" ;;
689
690 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
691 ac_prev=srcdir ;;
692 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
693 srcdir="$ac_optarg" ;;
694
695 -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
696 | --syscon | --sysco | --sysc | --sys | --sy)
697 ac_prev=sysconfdir
698 ac_sysconfdir_set="yes"
699 ;;
700 -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
701 | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
702 sysconfdir="$ac_optarg"
703 ac_sysconfdir_set="yes"
704 ;;
705
706 -target | --target | --targe | --targ | --tar | --ta | --t)
707 ac_prev=target_alias ;;
708 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
709 target_alias="$ac_optarg" ;;
710
711 -v | -verbose | --verbose | --verbos | --verbo | --verb)
712 verbose=yes ;;
713
714 -version | --version | --versio | --versi | --vers)
715 ac_init_version=: ;;
716
717
718 -with-* | --with-*)
719 ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'`
720 # Reject names that are not valid shell variable names.
721 expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
722 AC_MSG_ERROR([invalid package name: $ac_package])
723 ac_package=`echo $ac_package| sed 's/-/_/g'`
724 case $ac_option in
725 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
726 *) ac_optarg=yes ;;
727 esac
728 ac_with_check_opt=no
729 for f in ${SH_WITH_OPTS}
730 do
731 f=`echo $f | sed 's/-/_/g'`
732 if test x${f} = x"${ac_package}"
733 then
734 ac_with_check_opt=yes
735 fi
736 done
737 if test x${ac_with_check_opt} = xno
738 then
739 AC_MSG_ERROR([unrecognized option: $ac_option
740Try `$[0] --help' for more information.])
741 fi
742 eval "with_$ac_package='$ac_optarg'" ;;
743
744 -without-* | --without-*)
745 ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
746 # Reject names that are not valid shell variable names.
747 expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
748 AC_MSG_ERROR([invalid package name: $ac_package])
749 ac_package=`echo $ac_package | sed 's/-/_/g'`
750 ac_with_check_opt=no
751 for f in ${SH_WITH_OPTS}
752 do
753 f=`echo $f | sed 's/-/_/g'`
754 if test x${f} = x"${ac_package}"
755 then
756 ac_with_check_opt=yes
757 fi
758 done
759 if test x${ac_with_check_opt} = xno
760 then
761 AC_MSG_ERROR([unrecognized option: $ac_option
762Try `$[0] --help' for more information.])
763 fi
764 eval "with_$ac_package=no" ;;
765
766
767 -*) AC_MSG_ERROR([unrecognized option: $ac_option
768Try `$[0] --help' for more information.])
769 ;;
770
771 *=*)
772 ac_envvar=`expr "x$ac_option" : 'x\([[^=]]*\)='`
773 # Reject names that are not valid shell variable names.
774 expr "x$ac_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
775 AC_MSG_ERROR([invalid variable name: $ac_envvar])
776 ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
777 eval "$ac_envvar='$ac_optarg'"
778 export $ac_envvar ;;
779
780 *)
781 # FIXME: should be removed in autoconf 3.0.
782 AC_MSG_WARN([you should use --build, --host, --target])
783 expr "x$ac_option" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
784 AC_MSG_WARN([invalid host type: $ac_option])
785 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
786 ;;
787
788
789 esac
790done
791
792if test -n "$ac_prev"; then
793 AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`)
794fi
795
796# Be sure to have absolute paths.
797for ac_var in prefix exec_prefix
798do
799 eval ac_val=$`echo $ac_var`
800 case $ac_val in
801 [[\\/$]]* | ?:[[\\/]]* | NONE | '' | OPT | USR ) ;;
802 *) AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]);;
803 esac
804done
805
806# Be sure to have absolute paths.
807for ac_var in sbindir sysconfdir localstatedir mandir
808do
809 eval ac_val=$`echo $ac_var`
810 case $ac_val in
811 [[\\/$]]* | ?:[[\\/]]* ) ;;
812 *) AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]);;
813 esac
814done
815
816# There might be people who depend on the old broken behavior: `$host'
817# used to hold the argument of --host etc.
818# FIXME: To remove some day.
819build=$build_alias
820host=$host_alias
821target=$target_alias
822
823# FIXME: To remove some day.
824if test "x$host_alias" != x; then
825 if test "x$build_alias" = x; then
826 cross_compiling=maybe
827 AC_MSG_WARN([If you wanted to set the --build type, don't use --host.
828 If a cross compiler is detected then cross compile mode will be used.])
829 elif test "x$build_alias" != "x$host_alias"; then
830 cross_compiling=yes
831 fi
832fi
833
834ac_tool_prefix=
835test -n "$host_alias" && ac_tool_prefix=$host_alias-
836
837test "$silent" = yes && exec AS_MESSAGE_FD>/dev/null
838
839m4_divert_pop([PARSE_ARGS])dnl
840])# SH_INIT_PARSE_ARGS
841
842m4_define([SH_INIT_HELP],
843[m4_divert_push([HELP_BEGIN])dnl
844
845#
846# Report the --help message.
847#
848if test "$ac_init_help" = "long"; then
849 # Omit some internal or obsolete options to make the list less imposing.
850 # This message is too long to be a string in the A/UX 3.1 sh.
851 cat <<_ACEOF
852\`configure' configures m4_ifset([AC_PACKAGE_STRING],
853 [AC_PACKAGE_STRING],
854 [this package]) to adapt to many kinds of systems.
855
856Usage: $[0] [[OPTION]]... [[VAR=VALUE]]...
857
858[To assign environment variables (e.g., CC, CFLAGS...), specify them as
859VAR=VALUE. See below for descriptions of some of the useful variables.
860
861Defaults for the options are specified in brackets.
862
863Configuration:
864 -h, --help display this help and exit
865 --help=short display options specific to this package
866 --help=recursive display the short help of all the included packages
867 -V, --version display version information and exit
868 -q, --quiet, --silent do not print \`checking...' messages
869 --cache-file=FILE cache test results in FILE [disabled]
870 -C, --config-cache alias for \`--cache-file=config.cache'
871 -n, --no-create do not create output files
872 --srcdir=DIR find the sources in DIR [configure dir or \`..']
873
874_ACEOF
875
876 cat <<_ACEOF
877Installation directories:
878 --prefix=PREFIX install architecture-independent files in PREFIX
879 [$ac_default_prefix]
880 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
881 [PREFIX]
882
883By default, \`make install' will install binaries in \`/usr/local/sbin',
884the config file in \`/etc', manpage in \`/usr/local/share/man', and state
885data in \`/var/lib/INSTALL_NAME' (FSH layout). You can specify other
886FSH compliant layouts with \`--prefix=OPT' or \`--prefix=USR', or you
887can specify a directory with \`--prefix=DIR' to install in \`DIR/sbin',
888\`DIR/etc', etc.
889
890For better control, use the options below.
891
892Fine tuning of the installation directories:
893 --sbindir=DIR system admin executables [EPREFIX/sbin]
894 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
895 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
896 --mandir=DIR man documentation [PREFIX/man]
897
898For even finer tuning, paths can be specified for individual files (see below)
899
900_ACEOF
901
902 cat <<\_ACEOF]
903m4_divert_pop([HELP_BEGIN])dnl
904dnl The order of the diversions here is
905dnl - HELP_BEGIN
906dnl which may be prolongated by extra generic options such as with X or
907dnl AC_ARG_PROGRAM. Displayed only in long --help.
908dnl
909dnl - HELP_CANON
910dnl Support for cross compilation (--build, --host and --target).
911dnl Display only in long --help.
912dnl
913dnl - HELP_ENABLE
914dnl which starts with the trailer of the HELP_BEGIN, HELP_CANON section,
915dnl then implements the header of the non generic options.
916dnl
917dnl - HELP_WITH
918dnl
919dnl - HELP_VAR
920dnl
921dnl - HELP_VAR_END
922dnl
923dnl - HELP_END
924dnl initialized below, in which we dump the trailer (handling of the
925dnl recursion for instance).
926m4_divert_push([HELP_ENABLE])dnl
927_ACEOF
928fi
929
930if test -n "$ac_init_help"; then
931m4_ifset([AC_PACKAGE_STRING],
932[ case $ac_init_help in
933 short | recursive ) echo "Configuration of AC_PACKAGE_STRING:";;
934 esac])
935 cat <<\_ACEOF
936m4_divert_pop([HELP_ENABLE])dnl
937m4_divert_push([HELP_END])dnl
938m4_ifset([AC_PACKAGE_BUGREPORT], [
939Report bugs to <AC_PACKAGE_BUGREPORT>.])
940_ACEOF
941fi
942
943if test "$ac_init_help" = "recursive"; then
944 # If there are subdirs, report their specific --help.
945 ac_popdir=`pwd`
946 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
947 test -d $ac_dir || continue
948 _AC_SRCPATHS(["$ac_dir"])
949 cd $ac_dir
950 # Check for guested configure; otherwise get Cygnus style configure.
951 if test -f $ac_srcdir/configure.gnu; then
952 echo
953 $SHELL $ac_srcdir/configure.gnu --help=recursive
954 elif test -f $ac_srcdir/configure; then
955 echo
956 $SHELL $ac_srcdir/configure --help=recursive
957 elif test -f $ac_srcdir/configure.ac ||
958 test -f $ac_srcdir/configure.in; then
959 echo
960 $ac_configure --help
961 else
962 AC_MSG_WARN([no configuration information is in $ac_dir])
963 fi
964 cd $ac_popdir
965 done
966fi
967
968test -n "$ac_init_help" && exit 0
969m4_divert_pop([HELP_END])dnl
970])# SH_INIT_HELP
971
972
973
974
975
976
977
978
979# Check whether sa_sigaction works.
980# Rainer Wichmann <support@la-samhna.de>, 2003.
981#
982# This file can be copied and used freely without restrictions. It can
983# be used in projects which are not available under the GNU Public License.
984
985# serial 1
986
987AC_DEFUN([AM_SA_SIGACTION_WORKS],
988 [
989 am_cv_val_SA_SIGACTION=no
990 AC_CHECK_HEADER(signal.h,
991 [
992 AM_SI_USER
993 AM_SA_SIGINFO
994 if test $am_cv_val_SI_USER = yes && test $am_cv_val_SA_SIGINFO = yes
995 then
996 AC_TRY_RUN([
997#include <signal.h>
998#include <setjmp.h>
999#include <stdio.h>
1000#include <stdlib.h>
1001
1002volatile int xnum = 0;
1003volatile int xcode = 0;
1004jmp_buf Buf;
1005int xsig = SIGSEGV;
1006
1007void sighandler (int xsignam, siginfo_t * xsiginfo, void * xsigadd)
1008{
1009 static sigset_t x;
1010
1011 if (xsiginfo == NULL)
1012 exit(__LINE__);
1013 if (xsiginfo->si_signo != xsignam)
1014 exit(__LINE__);
1015 ++xnum;
1016 xcode = xsiginfo->si_code;
1017 sigemptyset (&x);
1018 sigprocmask(SIG_SETMASK, &x, NULL);
1019 longjmp ( Buf, 1);
1020}
1021
1022int main ()
1023{
1024 struct sigaction newact;
1025
1026 newact.sa_sigaction = sighandler;
1027 sigemptyset (&newact.sa_mask);
1028 newact.sa_flags = SA_SIGINFO;
1029 if (0 != sigaction (xsig, &newact, NULL))
1030 exit (__LINE__);
1031 if(setjmp ( Buf)) {
1032 if (xnum > 1)
1033 goto Third;
1034 goto Second;
1035 }
1036 memcpy((void *) 0x0, "test", 5);
1037 Second:
1038 if (xcode == SI_USER)
1039 exit (__LINE__);
1040 raise(xsig);
1041 Third:
1042 if (xcode != SI_USER)
1043 exit (__LINE__);
1044 if (xnum != 2)
1045 exit (__LINE__);
1046 return (0);
1047}], am_cv_val_SA_SIGACTION=yes, am_cv_val_SA_SIGACTION=no, am_cv_val_SA_SIGACTION=no)
1048 fi
1049 ])
1050 AC_MSG_CHECKING([whether sa_sigaction is supported])
1051 if test $am_cv_val_SA_SIGACTION = yes
1052 then
1053 AC_MSG_RESULT(yes)
1054 AC_DEFINE([SA_SIGACTION_WORKS], 1, [Define if sa_sigaction works])
1055 else
1056 AC_MSG_RESULT(no)
1057 fi
1058 ])
1059
1060# Check whether SI_USER is available in <signal.h>.
1061# Rainer Wichmann <support@la-samhna.de>, 2003.
1062#
1063# This file can be copied and used freely without restrictions. It can
1064# be used in projects which are not available under the GNU Public License.
1065
1066# serial 1
1067
1068
1069AC_DEFUN([AM_SI_USER],
1070 [if test $ac_cv_header_signal_h = yes; then
1071 AC_CACHE_CHECK([for SI_USER in signal.h], am_cv_val_SI_USER,
1072 [AC_TRY_LINK([#include <signal.h>], [return SI_USER],
1073 am_cv_val_SI_USER=yes, am_cv_val_SI_USER=no)])
1074 if test $am_cv_val_SI_USER = yes; then
1075 AC_DEFINE([HAVE_SI_USER], 1, [Define if you have SI_USER])
1076 fi
1077 fi])
1078
1079# Check whether SA_SIGINFO is available in <signal.h>.
1080# Rainer Wichmann <support@la-samhna.de>, 2003.
1081#
1082# This file can be copied and used freely without restrictions. It can
1083# be used in projects which are not available under the GNU Public License.
1084
1085# serial 1
1086
1087
1088AC_DEFUN([AM_SA_SIGINFO],
1089 [if test $ac_cv_header_signal_h = yes; then
1090 AC_CACHE_CHECK([for SA_SIGINFO in signal.h], am_cv_val_SA_SIGINFO,
1091 [AC_TRY_LINK([#include <signal.h>], [return SA_SIGINFO],
1092 am_cv_val_SA_SIGINFO=yes, am_cv_val_SA_SIGINFO=no)])
1093 if test $am_cv_val_SA_SIGINFO = yes; then
1094 AC_DEFINE([HAVE_SA_SIGINFO], 1, [Define if you have SA_SIGINFO])
1095 fi
1096 fi])
1097
1098dnl
1099dnl Useful macros for autoconf to check for ssp-patched gcc
1100dnl 1.0 - September 2003 - Tiago Sousa <mirage@kaotik.org>
1101dnl 1.1 - August 2006 - Ted Percival <ted@midg3t.net>
1102dnl * Stricter language checking (C or C++)
1103dnl * Adds GCC_STACK_PROTECT_LIB to add -lssp to LDFLAGS as necessary
1104dnl * Caches all results
1105dnl * Uses macros to ensure correct ouput in quiet/silent mode
1106dnl 1.2 - April 2007 - Ted Percival <ted@midg3t.net>
1107dnl * Added GCC_STACK_PROTECTOR macro for simpler (one-line) invocation
1108dnl * GCC_STACK_PROTECT_LIB now adds -lssp to LIBS rather than LDFLAGS
1109dnl
1110dnl About ssp:
1111dnl GCC extension for protecting applications from stack-smashing attacks
1112dnl http://www.research.ibm.com/trl/projects/security/ssp/
1113dnl
1114dnl Usage:
1115dnl Most people will simply call GCC_STACK_PROTECTOR.
1116dnl If you only use one of C or C++, you can save time by only calling the
1117dnl macro appropriate for that language. In that case you should also call
1118dnl GCC_STACK_PROTECT_LIB first.
1119dnl
1120dnl GCC_STACK_PROTECTOR
1121dnl Tries to turn on stack protection for C and C++ by calling the following
1122dnl three macros with the right languages.
1123dnl
1124dnl GCC_STACK_PROTECT_CC
1125dnl checks -fstack-protector with the C compiler, if it exists then updates
1126dnl CFLAGS and defines ENABLE_SSP_CC
1127dnl
1128dnl GCC_STACK_PROTECT_CXX
1129dnl checks -fstack-protector with the C++ compiler, if it exists then updates
1130dnl CXXFLAGS and defines ENABLE_SSP_CXX
1131dnl
1132dnl GCC_STACK_PROTECT_LIB
1133dnl adds -lssp to LIBS if it is available
1134dnl ssp is usually provided as part of libc, but was previously a separate lib
1135dnl It does not hurt to add -lssp even if libc provides SSP - in that case
1136dnl libssp will simply be ignored.
1137dnl
1138
1139AC_DEFUN([GCC_STACK_PROTECT_LIB],[
1140 AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib,
1141 [ssp_old_libs="$LIBS"
1142 LIBS="$LIBS -lssp"
1143 AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no)
1144 LIBS="$ssp_old_libs"
1145 ])
1146 if test $ssp_cv_lib = yes; then
1147 LIBS="$LIBS -lssp"
1148 fi
1149])
1150
1151AC_DEFUN([GCC_STACK_PROTECT_CC],[
1152 AC_LANG_ASSERT(C)
1153 if test "X$CC" != "X"; then
1154 AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector-all],
1155 ssp_cv_cc,
1156 [ssp_old_cflags="$CFLAGS"
1157 CFLAGS="$CFLAGS -fstack-protector-all"
1158 AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
1159 CFLAGS="$ssp_old_cflags"
1160 ])
1161 if test $ssp_cv_cc = no; then
1162 AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector],
1163 ssp_cv_cc,
1164 [ssp_old_cflags="$CFLAGS"
1165 CFLAGS="$CFLAGS -fstack-protector"
1166 AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
1167 CFLAGS="$ssp_old_cflags"
1168 ])
1169 if test $ssp_cv_cc = yes; then
1170 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector"
1171 LDFLAGS="$LDFLAGS -fstack-protector"
1172 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
1173 fi
1174 else
1175 if test $ssp_cv_cc = yes; then
1176 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all"
1177 LDFLAGS="$LDFLAGS -fstack-protector-all"
1178 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
1179 fi
1180 fi
1181 fi
1182])
1183
1184AC_DEFUN([GCC_STACK_PROTECT_CXX],[
1185 AC_LANG_ASSERT(C++)
1186 if test "X$CXX" != "X"; then
1187 AC_CACHE_CHECK([whether ${CXX} accepts -fstack-protector],
1188 ssp_cv_cxx,
1189 [ssp_old_cxxflags="$CXXFLAGS"
1190 CXXFLAGS="$CXXFLAGS -fstack-protector"
1191 AC_TRY_COMPILE(,, ssp_cv_cxx=yes, ssp_cv_cxx=no)
1192 CXXFLAGS="$ssp_old_cxxflags"
1193 ])
1194 if test $ssp_cv_cxx = yes; then
1195 CXXFLAGS="$CXXFLAGS -fstack-protector"
1196 AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.])
1197 fi
1198 fi
1199])
1200
1201AC_DEFUN([GCC_STACK_PROTECTOR],[
1202 GCC_STACK_PROTECT_LIB
1203
1204 AC_LANG_PUSH([C])
1205 GCC_STACK_PROTECT_CC
1206 AC_LANG_POP([C])
1207
1208 AC_LANG_PUSH([C++])
1209 GCC_STACK_PROTECT_CXX
1210 AC_LANG_POP([C++])
1211])
1212
1213
1214AC_DEFUN([GCC_PIE_CC],[
1215 AC_LANG_ASSERT(C)
1216 if test "X$CC" != "X"; then
1217 AC_CACHE_CHECK([whether ${CC} accepts -pie -fPIE],
1218 pie_cv_cc,
1219 [pie_old_cflags="$CFLAGS"
1220 CFLAGS="$CFLAGS -pie -fPIE"
1221 AC_TRY_COMPILE(,, pie_cv_cc=yes, pie_cv_cc=no)
1222 CFLAGS="$pie_old_cflags"
1223 ])
1224 if test $pie_cv_cc = yes; then
1225 case "$host_os" in
1226 *cygwin*)
1227 ;;
1228 *)
1229 PIE_CFLAGS="-fPIE"
1230 PIE_LDFLAGS="-pie"
1231 ;;
1232 esac
1233 fi
1234 fi
1235])
1236
1237AC_DEFUN([GCC_STACK_CHECK_CC],[
1238 AC_LANG_ASSERT(C)
1239 if test "X$CC" != "X"; then
1240 AC_CACHE_CHECK([whether ${CC} accepts -fstack-check],
1241 stackcheck_cv_cc,
1242 [stackcheck_old_cflags="$CFLAGS"
1243 CFLAGS="$CFLAGS -fstack-check"
1244 AC_TRY_COMPILE(,, stackcheck_cv_cc=yes, stackcheck_cv_cc=no)
1245 CFLAGS="$stackcheck_old_cflags"
1246 ])
1247 if test $stackcheck_cv_cc = yes; then
1248 CFLAGS="$CFLAGS -fstack-check"
1249 fi
1250 fi
1251])
1252
1253AC_DEFUN([GCC_FLAG_CHECK],[
1254 AC_LANG_ASSERT(C)
1255 if test "X$CC" != "X"; then
1256 AC_MSG_CHECKING([whether ${CC} accepts $1])
1257 saved_cflags="$CFLAGS"
1258 CFLAGS="$CFLAGS -Werror $1"
1259 AC_TRY_COMPILE(,, flag_check_cv=yes, flag_check_cv=no)
1260 CFLAGS="$saved_cflags"
1261
1262 if test $flag_check_cv = yes; then
1263 CFLAGS="$CFLAGS $1"
1264 AC_MSG_RESULT([yes])
1265 else
1266 AC_MSG_RESULT([no])
1267 fi
1268 fi
1269])
1270
1271AC_DEFUN([SAMHAIN_POSIX],[
1272 AC_MSG_CHECKING([whether _POSIX_SOURCE is necessary])
1273 AC_TRY_COMPILE([#include <stdio.h>
1274void fileno(int);int fdopen(int, char *); ],,
1275 [
1276 AC_MSG_RESULT(yes)
1277 AC_DEFINE([_POSIX_SOURCE],1,[Define if POSIX functions are required])
1278 ],
1279 [AC_MSG_RESULT(no)])
1280])dnl
1281
1282dnl checks for a known 64 bit programming environment
1283dnl AC_RUN_IFELSE(PROGRAM,
1284dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE],
1285dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
1286dnl
1287AC_DEFUN([SAMHAIN_PRG_ENV],[
1288 AC_MSG_CHECKING([for a known 64 bit programming environment])
1289 # Compile and run a program that determines the programming environment
1290 AC_RUN_IFELSE([
1291 AC_LANG_SOURCE([[
1292#include <stdio.h>
1293int main(int argc,char **argv)
1294{
1295 if (argc > 1) {
1296#if defined(__arch64__)
1297 printf("__arch64__\n");
1298#elif defined(__ia64__)
1299 printf("__ia64__\n");
1300#elif defined(__x86_64__)
1301 printf("__x86_64__\n");
1302#elif defined(__LP64__)
1303 printf("__LP64__\n");
1304#elif defined(__64BIT__)
1305 printf("__64BIT__\n");
1306#elif defined(_LP64)
1307 printf("_LP64\n");
1308#elif defined(_M_IA64)
1309 printf("_M_IA64\n");
1310#elif defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64)
1311 printf("_MIPS_64\n");
1312#else
1313choke me
1314#endif
1315 }
1316 return 0;
1317}
1318 ]])
1319 ],[
1320 # Program compiled and ran, so get version by adding argument.
1321 samhain_prg_ENV=`./conftest$ac_exeext x`
1322 samhain_64=yes
1323 AC_MSG_RESULT([$samhain_prg_ENV])
1324 ],[
1325 AC_MSG_RESULT([none])
1326 ],[
1327 AC_MSG_RESULT([none])
1328 ])
1329])dnl
1330
1331AC_DEFUN([SAMHAIN_X86_64],[
1332 AC_MSG_CHECKING([for x86_64])
1333 AC_TRY_RUN([
1334int main() {
1335__asm__ volatile (
1336"movq %rax, %rax"
1337);
1338return 0;
1339}
1340 ],
1341 [
1342 AC_MSG_RESULT(yes)
1343 samhain_64=yes
1344 tiger_src=sh_tiger1_64.c
1345 samhain_64_asm=yes
1346 ],
1347 [
1348 AC_MSG_RESULT([no])
1349 ],[
1350 AC_MSG_RESULT([no])
1351 ])
1352])dnl
1353
1354
1355AC_DEFUN([SAMHAIN_64],[
1356samhain_64=no
1357tiger_src=sh_tiger1.c
1358samhain_64_asm=no
1359#
1360# if sizeof(unsigned long) = 4, try compiler macros for 64bit
1361#
1362if test "x$ac_cv_sizeof_unsigned_long" = x4; then
1363 if test "x$ac_cv_sizeof_unsigned_long_long" = x8; then
1364 SAMHAIN_PRG_ENV
1365 if test "x$samhain_64" = xyes; then
1366 tiger_src=sh_tiger1_64.c
1367 fi
1368 #
1369 # if GCC and __i386__, use precompiled assembler
1370 #
1371 if test "x$GCC" = xyes; then
1372 AC_MSG_CHECKING([for non-apple non-cygwin i386])
1373 samhain_i386=no
1374 $CC -E -dM - < /dev/null | egrep '__i386__' >/dev/null 2>&1
1375 if test $? = 0; then
1376 case "$host_os" in
1377 *linux*)
1378 # apples gcc does not understand the assembly we provide
1379 $CC -E -dM - < /dev/null | egrep '(__sun__|__APPLE__|__CYGWIN__)' >/dev/null 2>&1 || samhain_i386=yes
1380 ;;
1381 *)
1382 ;;
1383 esac
1384 fi
1385 AC_MSG_RESULT([$samhain_i386])
1386 if test "x$samhain_i386" = xyes; then
1387 GCC_PIE_CC
1388 if test $pie_cv_cc = yes; then
1389 tiger_src=sh_tiger1.s
1390 AC_DEFINE([TIGER_32_BIT_S],1,[Define to use tiger 32 bit i386 assembler])
1391 fi
1392 fi
1393 fi
1394 #
1395 #
1396 #
1397 else
1398 samhain_64=no
1399 tiger_src=sh_tiger1.c
1400 fi
1401else
1402 #
1403 # sizeof(unsigned long) = 8
1404 #
1405 tiger_src=sh_tiger1_64.c
1406 samhain_64=yes
1407 #
1408 # check for x86_64 (enables assembly optimizations)
1409 #
1410 if test "x$GCC" = xyes; then
1411 $CC -E -dM - < /dev/null | egrep '__clang__' >/dev/null 2>&1
1412 if ! test $? = 0; then
1413 case "$host_os" in
1414 *linux*)
1415 SAMHAIN_X86_64
1416 ;;
1417 *bsd*)
1418 SAMHAIN_X86_64
1419 ;;
1420 *)
1421 SAMHAIN_X86_64
1422 ;;
1423 esac
1424 fi
1425 fi
1426fi
1427if test "x$samhain_64" = xyes; then
1428 AC_DEFINE([TIGER_64_BIT],1,[Define to use tiger 64 bit implementation])
1429fi
1430AC_MSG_CHECKING([for 64 bit environment])
1431AC_MSG_RESULT([$samhain_64])
1432AC_MSG_CHECKING([for tiger source to use])
1433AC_MSG_RESULT([$tiger_src])
1434AC_SUBST(tiger_src)
1435])dnl
1436
1437AC_DEFUN([sh_CHECK_POSIX_ACL],
1438[
1439 AC_CHECK_HEADERS(sys/acl.h)
1440 if test $ac_cv_header_sys_acl_h = yes; then
1441
1442 AC_CHECK_LIB([acl], [acl_get_file], sh_lacl=yes, sh_lacl=no)
1443 if test x"$sh_lacl" = xyes; then
1444 LIBACL=-lacl
1445 else
1446 LIBACL=
1447 fi
1448
1449 OLDLIBS="$LIBS"
1450 LIBS="$LIBS $LIBACL"
1451 AC_CHECK_FUNCS([acl_free acl_get_file acl_get_fd],
1452 [sh_facl=yes],[sh_facl=no])
1453 LIBS="$OLDLIBS"
1454
1455 if test x"$sh_facl" = xyes; then
1456 AC_DEFINE(USE_ACL, 1, [Define if you want ACL support.])
1457 LIBS="$LIBS $LIBACL"
1458 fi
1459 fi
1460])
1461
1462AC_DEFUN([sh_CHECK_XATTR],
1463[
1464 AC_CHECK_HEADERS(attr/xattr.h)
1465 if test $ac_cv_header_attr_xattr_h = yes; then
1466
1467 AC_CHECK_LIB([attr], [getxattr], sh_lattr=yes, sh_lattr=no)
1468 if test x"$sh_lattr" = xyes; then
1469 LIBATTR=-lattr
1470 else
1471 LIBATTR=
1472 fi
1473
1474 OLDLIBS="$LIBS"
1475 LIBS="$LIBS $LIBATTR"
1476 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr],
1477 [sh_fattr=yes],[sh_fattr=no])
1478 LIBS="$OLDLIBS"
1479
1480 if test x"$sh_fattr" = xyes; then
1481 AC_DEFINE(USE_XATTR, 1, [Define if you want extended attributes support.])
1482 LIBS="$LIBS $LIBATTR"
1483 fi
1484 fi
1485])
1486
1487dnl Autoconf macros for libprelude
1488dnl $id$
1489
1490# Modified for LIBPRELUDE -- Yoann Vandoorselaere
1491# Modified for LIBGNUTLS -- nmav
1492# Configure paths for LIBGCRYPT
1493# Shamelessly stolen from the one of XDELTA by Owen Taylor
1494# Werner Koch 99-12-09
1495
1496dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
1497dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
1498dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
1499dnl
1500AC_DEFUN([AM_PATH_LIBPRELUDE],
1501[dnl
1502dnl Get the cflags and libraries from the libprelude-config script
1503dnl
1504dnl AC_ARG_WITH(libprelude-prefix,
1505dnl [ --with-libprelude-prefix=PFX Prefix where libprelude is installed (optional)],
1506dnl libprelude_config_prefix="$withval", libprelude_config_prefix="")
1507dnl
1508dnl if test x$libprelude_config_prefix != x ; then
1509dnl if test x${LIBPRELUDE_CONFIG+set} != xset ; then
1510dnl LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
1511dnl fi
1512dnl fi
1513dnl
1514dnl AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
1515 min_libprelude_version=ifelse([$1], ,0.1.0,$1)
1516 AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
1517 no_libprelude=""
1518 if test "$LIBPRELUDE_CONFIG" = "no" ; then
1519 no_libprelude=yes
1520 else
1521 LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
1522 LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
1523 LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
1524 LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
1525 LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
1526 LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
1527 libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
1528
1529
1530 ac_save_CFLAGS="$CFLAGS"
1531 ac_save_LDFLAGS="$LDFLAGS"
1532 ac_save_LIBS="$LIBS"
1533 CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
1534 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1535 LIBS="$LIBS $LIBPRELUDE_LIBS"
1536dnl
1537dnl Now check if the installed libprelude is sufficiently new. Also sanity
1538dnl checks the results of libprelude-config to some extent
1539dnl
1540 rm -f conf.libpreludetest
1541 AC_TRY_RUN([
1542#include <stdio.h>
1543#include <stdlib.h>
1544#include <string.h>
1545#include <libprelude/prelude.h>
1546
1547int
1548main ()
1549{
1550 system ("touch conf.libpreludetest");
1551
1552 if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
1553 {
1554 printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
1555 "$libprelude_config_version", prelude_check_version(NULL) );
1556 printf("*** was found! If libprelude-config was correct, then it is best\n");
1557 printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
1558 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1559 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1560 printf("*** required on your system.\n");
1561 printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
1562 printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
1563 printf("*** before re-running configure\n");
1564 }
1565 else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
1566 {
1567 printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
1568 printf("*** library (version %s)\n", prelude_check_version(NULL) );
1569 }
1570 else
1571 {
1572 if ( prelude_check_version( "$min_libprelude_version" ) )
1573 {
1574 return 0;
1575 }
1576 else
1577 {
1578 printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
1579 prelude_check_version(NULL) );
1580 printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
1581 "$min_libprelude_version" );
1582 printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
1583 printf("*** \n");
1584 printf("*** If you have already installed a sufficiently new version, this error\n");
1585 printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
1586 printf("*** being found. The easiest way to fix this is to remove the old version\n");
1587 printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
1588 printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
1589 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1590 printf("*** so that the correct libraries are found at run-time))\n");
1591 }
1592 }
1593 return 1;
1594}
1595],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1596 CFLAGS="$ac_save_CFLAGS"
1597 LIBS="$ac_save_LIBS"
1598 LDFLAGS="$ac_save_LDFLAGS"
1599 fi
1600
1601 if test "x$no_libprelude" = x ; then
1602 AC_MSG_RESULT(yes)
1603 ifelse([$2], , :, [$2])
1604 else
1605 if test -f conf.libpreludetest ; then
1606 :
1607 else
1608 AC_MSG_RESULT(no)
1609 fi
1610 if test "$LIBPRELUDE_CONFIG" = "no" ; then
1611 echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
1612 echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
1613 echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
1614 echo "*** full path to libprelude-config."
1615 else
1616 if test -f conf.libpreludetest ; then
1617 :
1618 else
1619 echo "*** Could not run libprelude test program, checking why..."
1620 CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
1621 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1622 LIBS="$LIBS $LIBPRELUDE_LIBS"
1623 AC_TRY_LINK([
1624#include <stdio.h>
1625#include <stdlib.h>
1626#include <string.h>
1627#include <libprelude/prelude.h>
1628], [ return !!prelude_check_version(NULL); ],
1629 [ echo "*** The test program compiled, but did not run. This usually means"
1630 echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
1631 echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
1632 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1633 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1634 echo "*** is required on your system"
1635 echo "***"
1636 echo "*** If you have an old version installed, it is best to remove it, although"
1637 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1638 echo "***" ],
1639 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1640 echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
1641 echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
1642 echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
1643 CFLAGS="$ac_save_CFLAGS"
1644 LDFLAGS="$ac_save_LDFLAGS"
1645 LIBS="$ac_save_LIBS"
1646 fi
1647 fi
1648 LIBPRELUDE_CFLAGS=""
1649 LIBPRELUDE_LDFLAGS=""
1650 LIBPRELUDE_LIBS=""
1651 ifelse([$3], , :, [$3])
1652 fi
1653 rm -f conf.libpreludetest
1654 AC_SUBST(LIBPRELUDE_CFLAGS)
1655 AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
1656 AC_SUBST(LIBPRELUDE_LDFLAGS)
1657 AC_SUBST(LIBPRELUDE_LIBS)
1658 AC_SUBST(LIBPRELUDE_PREFIX)
1659 AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
1660])
1661
1662
1663##### http://autoconf-archive.cryp.to/acx_pthread.html
1664#
1665# SYNOPSIS
1666#
1667# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
1668#
1669# DESCRIPTION
1670#
1671# This macro figures out how to build C programs using POSIX threads.
1672# It sets the PTHREAD_LIBS output variable to the threads library and
1673# linker flags, and the PTHREAD_CFLAGS output variable to any special
1674# C compiler flags that are needed. (The user can also force certain
1675# compiler flags/libs to be tested by setting these environment
1676# variables.)
1677#
1678# Also sets PTHREAD_CC to any special C compiler that is needed for
1679# multi-threaded programs (defaults to the value of CC otherwise).
1680# (This is necessary on AIX to use the special cc_r compiler alias.)
1681#
1682# NOTE: You are assumed to not only compile your program with these
1683# flags, but also link it with them as well. e.g. you should link
1684# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
1685# $LIBS
1686#
1687# If you are only building threads programs, you may wish to use
1688# these variables in your default LIBS, CFLAGS, and CC:
1689#
1690# LIBS="$PTHREAD_LIBS $LIBS"
1691# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1692# CC="$PTHREAD_CC"
1693#
1694# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
1695# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
1696# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
1697#
1698# ACTION-IF-FOUND is a list of shell commands to run if a threads
1699# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
1700# run it if it is not found. If ACTION-IF-FOUND is not specified, the
1701# default action will define HAVE_PTHREAD.
1702#
1703# Please let the authors know if this macro fails on any platform, or
1704# if you have any other suggestions or comments. This macro was based
1705# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
1706# (with help from M. Frigo), as well as ac_pthread and hb_pthread
1707# macros posted by Alejandro Forero Cuervo to the autoconf macro
1708# repository. We are also grateful for the helpful feedback of
1709# numerous users.
1710#
1711# LAST MODIFICATION
1712#
1713# 2007-07-29
1714#
1715# COPYLEFT
1716#
1717# Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
1718#
1719# This program is free software: you can redistribute it and/or
1720# modify it under the terms of the GNU General Public License as
1721# published by the Free Software Foundation, either version 3 of the
1722# License, or (at your option) any later version.
1723#
1724# This program is distributed in the hope that it will be useful, but
1725# WITHOUT ANY WARRANTY; without even the implied warranty of
1726# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1727# General Public License for more details.
1728#
1729# You should have received a copy of the GNU General Public License
1730# along with this program. If not, see
1731# <http://www.gnu.org/licenses/>.
1732#
1733# As a special exception, the respective Autoconf Macro's copyright
1734# owner gives unlimited permission to copy, distribute and modify the
1735# configure scripts that are the output of Autoconf when processing
1736# the Macro. You need not follow the terms of the GNU General Public
1737# License when using or distributing such scripts, even though
1738# portions of the text of the Macro appear in them. The GNU General
1739# Public License (GPL) does govern all other use of the material that
1740# constitutes the Autoconf Macro.
1741#
1742# This special exception to the GPL applies to versions of the
1743# Autoconf Macro released by the Autoconf Macro Archive. When you
1744# make and distribute a modified version of the Autoconf Macro, you
1745# may extend this special exception to the GPL to apply to your
1746# modified version as well.
1747
1748AC_DEFUN([ACX_PTHREAD], [
1749AC_REQUIRE([AC_CANONICAL_HOST])
1750AC_LANG_SAVE
1751AC_LANG_C
1752acx_pthread_ok=no
1753
1754# We used to check for pthread.h first, but this fails if pthread.h
1755# requires special compiler flags (e.g. on True64 or Sequent).
1756# It gets checked for in the link test anyway.
1757
1758# First of all, check if the user has set any of the PTHREAD_LIBS,
1759# etcetera environment variables, and if threads linking works using
1760# them:
1761if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
1762 save_CFLAGS="$CFLAGS"
1763 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1764 save_LIBS="$LIBS"
1765 LIBS="$PTHREAD_LIBS $LIBS"
1766 AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
1767 AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
1768 AC_MSG_RESULT($acx_pthread_ok)
1769 if test x"$acx_pthread_ok" = xno; then
1770 PTHREAD_LIBS=""
1771 PTHREAD_CFLAGS=""
1772 fi
1773 LIBS="$save_LIBS"
1774 CFLAGS="$save_CFLAGS"
1775fi
1776
1777# We must check for the threads library under a number of different
1778# names; the ordering is very important because some systems
1779# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
1780# libraries is broken (non-POSIX).
1781
1782# Create a list of thread flags to try. Items starting with a "-" are
1783# C compiler flags, and other items are library names, except for "none"
1784# which indicates that we try without any flags at all, and "pthread-config"
1785# which is a program returning the flags for the Pth emulation library.
1786
1787acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
1788
1789# The ordering *is* (sometimes) important. Some notes on the
1790# individual items follow:
1791
1792# pthreads: AIX (must check this before -lpthread)
1793# none: in case threads are in libc; should be tried before -Kthread and
1794# other compiler flags to prevent continual compiler warnings
1795# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
1796# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
1797# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
1798# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
1799# -pthreads: Solaris/gcc
1800# -mthreads: Mingw32/gcc, Lynx/gcc
1801# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
1802# doesn't hurt to check since this sometimes defines pthreads too;
1803# also defines -D_REENTRANT)
1804# ... -mt is also the pthreads flag for HP/aCC
1805# pthread: Linux, etcetera
1806# --thread-safe: KAI C++
1807# pthread-config: use pthread-config program (for GNU Pth library)
1808
1809case "${host_cpu}-${host_os}" in
1810 *solaris*)
1811
1812 # On Solaris (at least, for some versions), libc contains stubbed
1813 # (non-functional) versions of the pthreads routines, so link-based
1814 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
1815 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
1816 # a function called by this macro, so we could check for that, but
1817 # who knows whether they'll stub that too in a future libc.) So,
1818 # we'll just look for -pthreads and -lpthread first:
1819
1820 acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
1821 ;;
1822esac
1823
1824if test x"$acx_pthread_ok" = xno; then
1825for flag in $acx_pthread_flags; do
1826
1827 case $flag in
1828 none)
1829 AC_MSG_CHECKING([whether pthreads work without any flags])
1830 ;;
1831
1832 -pthread)
1833 AC_MSG_CHECKING([whether pthreads work with $flag])
1834 PTHREAD_CFLAGS="$flag"
1835 ;;
1836
1837 -*)
1838 AC_MSG_CHECKING([whether pthreads work with $flag])
1839 PTHREAD_CFLAGS="$flag"
1840 ;;
1841
1842 pthread-config)
1843 AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
1844 if test x"$acx_pthread_config" = xno; then continue; fi
1845 PTHREAD_CFLAGS="`pthread-config --cflags`"
1846 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
1847 ;;
1848
1849 *)
1850 AC_MSG_CHECKING([for the pthreads library -l$flag])
1851 PTHREAD_LIBS="-l$flag"
1852 ;;
1853 esac
1854
1855 save_LIBS="$LIBS"
1856 save_CFLAGS="$CFLAGS"
1857 save_LDFLAGS="$LDFLAGS"
1858 LIBS="$PTHREAD_LIBS $LIBS"
1859 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1860 LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
1861
1862 # Check for various functions. We must include pthread.h,
1863 # since some functions may be macros. (On the Sequent, we
1864 # need a special flag -Kthread to make this header compile.)
1865 # We check for pthread_join because it is in -lpthread on IRIX
1866 # while pthread_create is in libc. We check for pthread_attr_init
1867 # due to DEC craziness with -lpthreads. We check for
1868 # pthread_cleanup_push because it is one of the few pthread
1869 # functions on Solaris that doesn't have a non-functional libc stub.
1870 # We try pthread_create on general principles.
1871 AC_TRY_LINK([#include <pthread.h>],
1872 [pthread_t th; pthread_join(th, 0);
1873 pthread_attr_init(0); pthread_cleanup_push(0, 0);
1874 pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
1875 [acx_pthread_ok=yes])
1876
1877 LIBS="$save_LIBS"
1878 LDFLAGS="$save_LDFLAGS"
1879 CFLAGS="$save_CFLAGS"
1880
1881 AC_MSG_RESULT($acx_pthread_ok)
1882 if test "x$acx_pthread_ok" = xyes; then
1883 break;
1884 fi
1885
1886 PTHREAD_LIBS=""
1887 PTHREAD_CFLAGS=""
1888done
1889fi
1890
1891# Various other checks:
1892if test "x$acx_pthread_ok" = xyes; then
1893 save_LIBS="$LIBS"
1894 LIBS="$PTHREAD_LIBS $LIBS"
1895 save_CFLAGS="$CFLAGS"
1896 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1897
1898 # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
1899 AC_MSG_CHECKING([for joinable pthread attribute])
1900 attr_name=unknown
1901 for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
1902 AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
1903 [attr_name=$attr; break])
1904 done
1905 AC_MSG_RESULT($attr_name)
1906 if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
1907 AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
1908 [Define to necessary symbol if this constant
1909 uses a non-standard name on your system.])
1910 fi
1911
1912 # Solaris lossage: default is obsolete semantics for getpwnam_r,
1913 # getpwuid_r, getgrgid_r, unless _POSIX_PTHREAD_SEMANTICS is defined
1914 AC_MSG_CHECKING([if more special flags are required for pthreads])
1915 flag=no
1916 case "${host_cpu}-${host_os}" in
1917 *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
1918 *-osf* | *-hpux*) flag="-D_REENTRANT";;
1919 *solaris*) flag="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
1920 esac
1921 AC_MSG_RESULT(${flag})
1922 if test "x$flag" != xno; then
1923 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
1924 fi
1925
1926 # Detect PTHREAD_MUTEX_RECURSIVE
1927 AC_MSG_CHECKING([for recursive mutexes])
1928 mutex_recursive=no
1929 AC_TRY_LINK([
1930#define _XOPEN_SOURCE 500
1931#include <pthread.h>], [
1932pthread_mutexattr_t mta;
1933pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);
1934return 0;],[mutex_recursive=yes])
1935 if test "x$mutex_recursive" = "xyes"
1936 then
1937 AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE,1,[Define if you have recursive mutexes.])
1938 fi
1939 AC_MSG_RESULT($mutex_recursive)
1940
1941 LIBS="$save_LIBS"
1942 CFLAGS="$save_CFLAGS"
1943
1944 # More AIX lossage: must compile with xlc_r or cc_r
1945 if test x"$GCC" != xyes; then
1946 AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
1947 else
1948 PTHREAD_CC=$CC
1949 fi
1950else
1951 PTHREAD_CC="$CC"
1952fi
1953
1954if test x"$acx_pthread_ok" = xyes; then
1955 PTHREAD_CFLAGS="${PTHREAD_CFLAGS} -DUSE_MALLOC_LOCK=1"
1956fi
1957
1958AC_SUBST(PTHREAD_LIBS)
1959AC_SUBST(PTHREAD_CFLAGS)
1960AC_SUBST(PTHREAD_LDFLAGS)
1961AC_SUBST(PTHREAD_CC)
1962
1963# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
1964if test x"$acx_pthread_ok" = xyes; then
1965 ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
1966 :
1967else
1968 acx_pthread_ok=no
1969 $2
1970fi
1971AC_LANG_RESTORE
1972])dnl ACX_PTHREAD
1973
1974
1975
1976
1977dnl Copyright © 2004 Loic Dachary <loic@senga.org>
1978dnl
1979dnl This program is free software; you can redistribute it and/or modify
1980dnl it under the terms of the GNU General Public License as published by
1981dnl the Free Software Foundation; either version 2 of the License, or (at
1982dnl your option) any later version.
1983dnl
1984dnl Use ZLIB_HOME instead of option
1985
1986AC_DEFUN([CHECK_ZLIB],[
1987
1988if test "x${ZLIB_HOME}" = "x"; then
1989 ZLIB_HOME=/usr/local
1990 if test ! -f "${ZLIB_HOME}/include/zlib.h"
1991 then
1992 ZLIB_HOME=/usr
1993 fi
1994fi
1995
1996zlib_found=no
1997
1998ZLIB_OLD_LDFLAGS=$LDFLAGS
1999ZLIB_OLD_CPPFLAGS=$LDFLAGS
2000if test "x${ZLIB_HOME}" = "x/usr"; then
2001 :
2002else
2003 LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
2004 CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
2005fi
2006AC_LANG_SAVE
2007AC_LANG_C
2008AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
2009AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
2010AC_LANG_RESTORE
2011if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
2012then
2013 #
2014 # If both library and header were found, use them
2015 #
2016 AC_CHECK_LIB(z, inflateEnd)
2017 AC_MSG_CHECKING([zlib in ${ZLIB_HOME}])
2018 AC_MSG_RESULT(ok)
2019 AC_CHECK_FUNCS([compressBound])
2020 zlib_found=yes
2021else
2022 #
2023 # If either header or library was not found, revert and bomb
2024 #
2025 AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
2026 LDFLAGS="$ZLIB_OLD_LDFLAGS"
2027 CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
2028 AC_MSG_RESULT(failed)
2029 AC_MSG_WARN([zlib not found in ZLIB_HOME, /usr/local, or /usr])
2030fi
2031
2032])
2033
2034# SH_PROG_LD
2035# ----------
2036# find the pathname to the GNU or non-GNU linker
2037AC_DEFUN([SH_PROG_LD],
2038[
2039AC_REQUIRE([AC_PROG_CC])dnl
2040AC_REQUIRE([AC_CANONICAL_HOST])dnl
2041AC_REQUIRE([AC_CANONICAL_BUILD])dnl
2042ac_prog=ld
2043if test "$GCC" = yes; then
2044 # Check if gcc -print-prog-name=ld gives a path.
2045 AC_MSG_CHECKING([for ld used by $CC])
2046 case $host in
2047 *-*-mingw*)
2048 # gcc leaves a trailing carriage return which upsets mingw
2049 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2050 *)
2051 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2052 esac
2053 case $ac_prog in
2054 # Accept absolute paths.
2055 [[\\/]]* | ?:[[\\/]]*)
2056 re_direlt='/[[^/]][[^/]]*/\.\./'
2057 # Canonicalize the pathname of ld
2058 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2059 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2060 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2061 done
2062 test -z "$LD" && LD="$ac_prog"
2063 ;;
2064 "")
2065 # If it fails, then pretend we aren't using GCC.
2066 ac_prog=ld
2067 ;;
2068 *)
2069 # If it is relative, then search for the first ld in PATH.
2070 with_gnu_ld=unknown
2071 ;;
2072 esac
2073else
2074 AC_MSG_CHECKING([for ld])
2075fi
2076AC_CACHE_VAL(lt_cv_path_LD,
2077[if test -z "$LD"; then
2078 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
2079 for ac_dir in $PATH; do
2080 IFS="$lt_save_ifs"
2081 test -z "$ac_dir" && ac_dir=.
2082 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2083 lt_cv_path_LD="$ac_dir/$ac_prog"
2084 # Check to see if the program is GNU ld. I'd rather use --version,
2085 # but apparently some variants of GNU ld only accept -v.
2086 # Break only if it was the GNU/non-GNU ld that we prefer.
2087 case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
2088 *GNU* | *'with BFD'*)
2089 with_gnu_ld=yes
2090 ;;
2091 *)
2092 with_gnu_ld=no
2093 ;;
2094 esac
2095 fi
2096 done
2097 IFS="$lt_save_ifs"
2098else
2099 lt_cv_path_LD="$LD" # Let the user override the test with a path.
2100fi])
2101LD="$lt_cv_path_LD"
2102if test -n "$LD"; then
2103 AC_MSG_RESULT($LD)
2104else
2105 AC_MSG_RESULT(no)
2106fi
2107test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2108AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
2109[# I'd rather use --version here, but apparently some GNU lds only accept -v.
2110case `$LD -v 2>&1 </dev/null` in
2111*GNU* | *'with BFD'*)
2112 lt_cv_prog_gnu_ld=yes
2113 ;;
2114*)
2115 lt_cv_prog_gnu_ld=no
2116 ;;
2117esac])
2118with_gnu_ld=$lt_cv_prog_gnu_ld
2119])# AC_PROG_LD_GNU
2120
2121# SH_STRFTIME_Z
2122# -------------
2123# check whether strftime supports %z
2124AC_DEFUN([SH_STRFTIME_Z],
2125[
2126AC_MSG_CHECKING([whether strftime supports %z])
2127AC_TRY_RUN([
2128#include <time.h>
2129#include <string.h>
2130int main()
2131{
2132 struct tm tm;
2133 char tt[64];
2134 memset(&tm, 0, sizeof(tm));
2135 strftime(tt, sizeof(tt), "%z", &tm);
2136
2137 if (strlen(tt) != 5) return 1;
2138 return 0;
2139}
2140],
2141[
2142AC_MSG_RESULT([yes])
2143AC_DEFINE(HAVE_STRFTIME_Z, 1, [strftime supports %z])
2144],
2145[
2146AC_MSG_RESULT([no])
2147],[
2148AC_MSG_RESULT([no])
2149])])
2150
2151AC_DEFUN([SH_GCC_VERSION], [
2152 GCC_VERSION=""
2153 gcc_VERSION_MAJOR=0
2154 gcc_VERSION_MINOR=0
2155 AC_MSG_CHECKING([for gcc version])
2156 if test "x$GCC" = "xyes"
2157 then
2158 $CC -dumpversion >/dev/null 2>&1
2159 if test $? -eq 0
2160 then
2161 GCC_VERSION=`$CC -dumpversion`
2162 gcc_VERSION_MAJOR=`echo $GCC_VERSION | cut -d'.' -f1`
2163 gcc_VERSION_MINOR=`echo $GCC_VERSION | cut -d'.' -f2`
2164 AC_DEFINE_UNQUOTED(GCC_VERSION_MAJOR, [${gcc_VERSION_MAJOR}], [gcc version major])
2165 AC_DEFINE_UNQUOTED(GCC_VERSION_MINOR, [${gcc_VERSION_MINOR}], [gcc version minor])
2166 AC_MSG_RESULT([$GCC_VERSION])
2167 else
2168 AC_MSG_RESULT([$CC -dumpversion working])
2169 fi
2170 else
2171 AC_MSG_RESULT([compiler is not gcc])
2172 fi
2173])
2174
2175
2176
2177dnl *-*wedit:notab*-* Please keep this as the last line.
2178
Note: See TracBrowser for help on using the repository browser.