source: trunk/aclocal.m4 @ 153

Last change on this file since 153 was 153, checked in by katerina, 14 years ago

Use -D_FORTIFY_SOURCE=1 -fstack-protector-all if supported. Compiler warnings fixed.

File size: 56.4 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([#include <stdlib.h>
253    #include <sys/types.h>], [
254    #undef $1
255    int a = sizeof($1);
256    ], sh_cv_typedef=yes, sh_cv_typedef=no )])
257    AC_MSG_RESULT($sh_cv_typedef)
258    if test "$sh_cv_typedef" = yes; then
259        AC_DEFINE($2)
260        sh_$2=yes
261    else
262        sh_$2=no
263    fi
264  ])
265
266
267
268dnl **********************
269dnl *** va_copy checks ***
270dnl **********************
271AC_DEFUN([SL_CHECK_VA_COPY],
272[AC_MSG_CHECKING(for va_copy())
273AC_CACHE_VAL(sh_cv_va_copy,[
274        AC_TRY_RUN([
275        #include <stdarg.h>
276        void f (int i, ...) {
277        va_list args1, args2;
278        va_start (args1, i);
279        va_copy (args2, args1);
280        if (va_arg (args2, int) != 42)
281          exit (1);
282        if (va_arg (args1, int) != 42)
283          exit (1);
284        va_end (args1); va_end (args2);
285        }
286        int main() {
287          f (0, 42);
288          return 0;
289        }],
290        sh_cv_va_copy=yes
291        ,
292        sh_cv_va_copy=no
293        ,
294        sh_cv_va_copy=no)
295])
296AC_MSG_RESULT($sh_cv_va_copy)
297AC_MSG_CHECKING(for __va_copy())
298AC_CACHE_VAL(sh_cv___va_copy,[
299        AC_TRY_RUN([
300        #include <stdarg.h>
301        void f (int i, ...) {
302        va_list args1, args2;
303        va_start (args1, i);
304        __va_copy (args2, args1);
305        if (va_arg (args2, int) != 42)
306          exit (1);
307        if (va_arg (args1, int) != 42)
308          exit (1);
309        va_end (args1); va_end (args2);
310        }
311        int main() {
312          f (0, 42);
313          return 0;
314        }],
315        sh_cv___va_copy=yes
316        ,
317        sh_cv___va_copy=no
318        ,
319        sh_cv___va_copy=no)
320])
321AC_MSG_RESULT($sh_cv___va_copy)
322AC_MSG_CHECKING(whether va_lists can be copied by value)
323AC_CACHE_VAL(sh_cv_va_val_copy,[
324        AC_TRY_RUN([
325        #include <stdarg.h>
326        void f (int i, ...) {
327        va_list args1, args2;
328        va_start (args1, i);
329        args2 = args1;
330        if (va_arg (args2, int) != 42)
331          exit (1);
332        if (va_arg (args1, int) != 42)
333          exit (1);
334        va_end (args1); va_end (args2);
335        }
336        int main() {
337          f (0, 42);
338          return 0;
339        }],
340        sh_cv_va_val_copy=yes
341        ,
342        sh_cv_va_val_copy=no
343        ,
344        sh_cv_va_val_copy=no)
345])
346if test "x$sh_cv_va_copy" = "xyes"; then
347  AC_DEFINE(VA_COPY, va_copy)
348else if test "x$sh_cv___va_copy" = "xyes"; then
349  AC_DEFINE(VA_COPY, __va_copy)
350fi
351fi
352if test "x$sh_cv_va_val_copy" = "xno"; then
353  AC_DEFINE(VA_COPY_AS_ARRAY)
354fi
355AC_MSG_RESULT($sh_cv_va_val_copy)
356])
357
358
359dnl SH_INIT_PARSE_ARGS()
360m4_define([SH_INIT_PARSE_ARGS],
361[
362m4_divert_push([PARSE_ARGS])dnl
363
364as_cr_letters='abcdefghijklmnopqrstuvwxyz'
365as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
366as_cr_Letters=$as_cr_letters$as_cr_LETTERS
367as_cr_digits='0123456789'
368as_cr_alnum=$as_cr_Letters$as_cr_digits
369
370# Sed expression to map a string onto a valid CPP name.
371as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g"
372
373as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
374# IFS
375# We need space, tab and new line, in precisely that order.
376as_nl='
377'
378IFS="   $as_nl"
379
380# CDPATH.
381$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
382
383
384# Initialize some variables set by options.
385ac_init_help=
386ac_init_version=false
387# The variables have the same names as the options, with
388# dashes changed to underlines.
389cache_file=/dev/null
390AC_SUBST(exec_prefix, NONE)dnl
391no_create=
392no_recursion=
393AC_SUBST(prefix, NONE)dnl
394program_prefix=NONE
395program_suffix=NONE
396AC_SUBST(program_transform_name, [s,x,x,])dnl
397silent=
398site=
399srcdir=
400verbose=
401x_includes=NONE
402x_libraries=NONE
403DESTDIR=
404SH_ENABLE_OPTS="db-reload xml-log message-queue login-watch process-check port-check mounts-check userfiles debug ptrace static network udp nocl stealth micro-stealth install-name identity khide suidcheck base largefile mail external-scripts encrypt srp"
405SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
406
407# Installation directory options.
408# These are left unexpanded so users can "make install exec_prefix=/foo"
409# and all the variables that are supposed to be based on exec_prefix
410# by default will actually change.
411dnl Use braces instead of parens because sh, perl, etc. also accept them.
412sbindir='${exec_prefix}/sbin'
413sysconfdir='${prefix}/etc'
414localstatedir='${prefix}/var'
415mandir='${prefix}/share/man'
416
417AC_SUBST([sbindir],        ['${exec_prefix}/sbin'])dnl
418AC_SUBST([sysconfdir],     ['${prefix}/etc'])dnl
419AC_SUBST([localstatedir],  ['${prefix}/var'])dnl
420AC_SUBST([mandir],         ['${prefix}/share/man'])dnl
421
422
423# Initialize some other variables.
424subdirs=
425MFLAGS= MAKEFLAGS=
426SHELL=${CONFIG_SHELL-/bin/sh}
427# Maximum number of lines to put in a shell here document.
428ac_max_here_lines=12
429
430ac_prev=
431for ac_option
432do
433
434  # If the previous option needs an argument, assign it.
435  if test -n "$ac_prev"; then
436    eval "$ac_prev=\$ac_option"
437    ac_prev=
438    continue
439  fi
440
441  case "$ac_option" in
442changequote(, )dnl
443  *=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
444changequote([, ])dnl
445  *) ac_optarg= ;;
446  esac
447
448  # Accept the important Cygnus configure options, so we can diagnose typos.
449
450  case "$ac_option" in
451
452  -build | --build | --buil | --bui | --bu)
453    ac_prev=build_alias ;;
454  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
455    build_alias="$ac_optarg" ;;
456
457  -cache-file | --cache-file | --cache-fil | --cache-fi \
458  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
459    ac_prev=cache_file ;;
460  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
461  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
462    cache_file="$ac_optarg" ;;
463
464  --config-cache | -C)
465    cache_file=config.cache ;;
466
467  -disable-* | --disable-*)
468    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
469    # Reject names that are not valid shell variable names.
470    expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
471      AC_MSG_ERROR([invalid feature name: $ac_feature])
472    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
473    ac_enable_check_opt=no
474    for f in ${SH_ENABLE_OPTS}
475    do
476        f=`echo $f | sed 's/-/_/g'`
477        if test x${f} = x"${ac_feature}"
478        then
479                ac_enable_check_opt=yes
480        fi
481    done
482    if test x${ac_enable_check_opt} = xno
483    then
484        AC_MSG_ERROR([unrecognized option: $ac_option
485Try `$[0] --help' for more information.])
486    fi
487    eval "enable_$ac_feature=no" ;;
488
489  -enable-* | --enable-*)
490    ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'`
491    # Reject names that are not valid shell variable names.
492    expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
493      AC_MSG_ERROR([invalid feature name: $ac_feature])
494    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
495    case $ac_option in
496      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
497      *) ac_optarg=yes ;;
498    esac
499    ac_enable_check_opt=no
500    for f in ${SH_ENABLE_OPTS}
501    do
502        f=`echo $f | sed 's/-/_/g'`
503        if test x${f} = x"${ac_feature}"
504        then
505                ac_enable_check_opt=yes
506        fi
507    done
508    if test x${ac_enable_check_opt} = xno
509    then
510        AC_MSG_ERROR([unrecognized option: $ac_option
511Try `$[0] --help' for more information.])
512    fi
513    eval "enable_$ac_feature='$ac_optarg'" ;;
514
515  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
516  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
517  | --exec | --exe | --ex)
518    ac_prev=exec_prefix
519    ac_exec_prefix_set="yes"
520    ;;
521  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
522  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
523  | --exec=* | --exe=* | --ex=*)
524    exec_prefix="$ac_optarg"
525    ac_exec_prefix_set="yes"
526    ;;
527
528  -gas | --gas | --ga | --g)
529    # Obsolete; use --with-gas.
530    with_gas=yes ;;
531
532  -help | --help | --hel | --he | -h)
533    ac_init_help=long ;;
534  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
535    ac_init_help=recursive ;;
536  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
537    ac_init_help=short ;;
538
539  -host | --host | --hos | --ho)
540    ac_prev=host_alias ;;
541  -host=* | --host=* | --hos=* | --ho=*)
542    host_alias="$ac_optarg" ;;
543
544  -localstatedir | --localstatedir | --localstatedi | --localstated \
545  | --localstate | --localstat | --localsta | --localst \
546  | --locals | --local | --loca | --loc | --lo)
547    ac_prev=localstatedir
548    ac_localstatedir_set="yes"
549    ;;
550  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
551  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
552  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
553    localstatedir="$ac_optarg"
554    ac_localstatedir_set="yes"
555    ;;
556
557  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
558    ac_prev=mandir
559    ac_mandir_set="yes"
560    ;;
561  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
562    mandir="$ac_optarg"
563    ac_mandir_set="yes"
564    ;;
565
566  -nfp | --nfp | --nf)
567    # Obsolete; use --without-fp.
568    with_fp=no ;;
569
570  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
571  | --no-cr | --no-c | -n)
572    no_create=yes ;;
573
574  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
575  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
576    no_recursion=yes ;;
577
578  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
579    ac_prev=prefix
580    ac_prefix_set="yes"
581    ;;
582  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
583    prefix="$ac_optarg"
584    ac_prefix_set="yes"
585    ;;
586
587  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
588  | -silent | --silent | --silen | --sile | --sil)
589    silent=yes ;;
590
591  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
592    ac_prev=sbindir
593    ac_sbindir_set="yes"
594    ;;
595  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
596  | --sbi=* | --sb=*)
597    sbindir="$ac_optarg"
598    ac_sbindir_set="yes"
599    ;;
600
601  -bindir | --bindir | --bindi | --bind | --bin | --bi | --b)
602    echo "WARNING: bindir will be ignored, use sbindir"
603    ;;
604  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* \
605  | --bi=* | --b=*)
606    echo "WARNING: bindir will be ignored, use sbindir"
607    ;;
608
609  -datadir | --datadir)
610    echo "WARNING: datadir will be ignored"
611   ;;
612  -datadir=* | --datadir=*)
613    echo "WARNING: datadir will be ignored"
614   ;;
615 
616  -includedir | --includedir)
617    echo "WARNING: includedir will be ignored"
618   ;;
619  -includedir=* | --includedir=*)
620    echo "WARNING: includedir will be ignored"
621   ;;
622
623  -infodir | --infodir)
624    echo "WARNING: infodir will be ignored"
625   ;;
626  -infodir=* | --infodir=*)
627    echo "WARNING: infodir will be ignored"
628   ;;
629 
630  -libdir | --libdir)
631    echo "WARNING: libdir will be ignored"
632   ;;
633  -libdir=* | --libdir=*)
634    echo "WARNING: libdir will be ignored"
635   ;;
636 
637  -libexecdir | --libexecdir)
638    echo "WARNING: libexecdir will be ignored"
639   ;;
640  -libexecdir=* | --libexecdir=*)
641    echo "WARNING: libexecdir will be ignored"
642   ;;
643
644  -sharedstatedir | --sharedstatedir)
645    echo "WARNING: sharedstatedir will be ignored"
646   ;;
647  -sharedstatedir=* | --sharedstatedir=*)
648    echo "WARNING: sharedstatedir will be ignored"
649   ;;
650 
651  -site | --site | --sit)
652    ac_prev=site ;;
653  -site=* | --site=* | --sit=*)
654    site="$ac_optarg" ;;
655
656  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
657    ac_prev=srcdir ;;
658  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
659    srcdir="$ac_optarg" ;;
660
661  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
662  | --syscon | --sysco | --sysc | --sys | --sy)
663    ac_prev=sysconfdir
664    ac_sysconfdir_set="yes"
665    ;;
666  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
667  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
668    sysconfdir="$ac_optarg"
669    ac_sysconfdir_set="yes"
670    ;;
671
672  -target | --target | --targe | --targ | --tar | --ta | --t)
673    ac_prev=target_alias ;;
674  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
675    target_alias="$ac_optarg" ;;
676
677  -v | -verbose | --verbose | --verbos | --verbo | --verb)
678    verbose=yes ;;
679
680  -version | --version | --versio | --versi | --vers)
681    ac_init_version=: ;;
682
683
684  -with-* | --with-*)
685    ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'`
686    # Reject names that are not valid shell variable names.
687    expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
688      AC_MSG_ERROR([invalid package name: $ac_package])
689    ac_package=`echo $ac_package| sed 's/-/_/g'`
690    case $ac_option in
691      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
692      *) ac_optarg=yes ;;
693    esac
694    ac_with_check_opt=no
695    for f in ${SH_WITH_OPTS}
696    do
697        f=`echo $f | sed 's/-/_/g'`
698        if test x${f} = x"${ac_package}"
699        then
700                ac_with_check_opt=yes
701        fi
702    done
703    if test x${ac_with_check_opt} = xno
704    then
705        AC_MSG_ERROR([unrecognized option: $ac_option
706Try `$[0] --help' for more information.])
707    fi
708    eval "with_$ac_package='$ac_optarg'" ;;
709
710  -without-* | --without-*)
711    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
712    # Reject names that are not valid shell variable names.
713    expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
714      AC_MSG_ERROR([invalid package name: $ac_package])
715    ac_package=`echo $ac_package | sed 's/-/_/g'`
716    ac_with_check_opt=no
717    for f in ${SH_WITH_OPTS}
718    do
719        f=`echo $f | sed 's/-/_/g'`
720        if test x${f} = x"${ac_package}"
721        then
722                ac_with_check_opt=yes
723        fi
724    done
725    if test x${ac_with_check_opt} = xno
726    then
727        AC_MSG_ERROR([unrecognized option: $ac_option
728Try `$[0] --help' for more information.])
729    fi
730    eval "with_$ac_package=no" ;;
731
732
733  -*) AC_MSG_ERROR([unrecognized option: $ac_option
734Try `$[0] --help' for more information.])
735    ;;
736
737  *=*)
738    ac_envvar=`expr "x$ac_option" : 'x\([[^=]]*\)='`
739    # Reject names that are not valid shell variable names.
740    expr "x$ac_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
741      AC_MSG_ERROR([invalid variable name: $ac_envvar])
742    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
743    eval "$ac_envvar='$ac_optarg'"
744    export $ac_envvar ;;
745
746  *)
747    # FIXME: should be removed in autoconf 3.0.
748    AC_MSG_WARN([you should use --build, --host, --target])
749    expr "x$ac_option" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
750      AC_MSG_WARN([invalid host type: $ac_option])
751    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
752    ;;
753
754
755  esac
756done
757
758if test -n "$ac_prev"; then
759  AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`)
760fi
761
762# Be sure to have absolute paths.
763for ac_var in prefix exec_prefix
764do
765  eval ac_val=$`echo $ac_var`
766  case $ac_val in
767    [[\\/$]]* | ?:[[\\/]]* | NONE | '' | OPT | USR ) ;;
768    *)  AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]);;
769  esac
770done
771
772# Be sure to have absolute paths.
773for ac_var in sbindir sysconfdir localstatedir mandir
774do
775  eval ac_val=$`echo $ac_var`
776  case $ac_val in
777    [[\\/$]]* | ?:[[\\/]]* ) ;;
778    *)  AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val]);;
779  esac
780done
781
782# There might be people who depend on the old broken behavior: `$host'
783# used to hold the argument of --host etc.
784# FIXME: To remove some day.
785build=$build_alias
786host=$host_alias
787target=$target_alias
788
789# FIXME: To remove some day.
790if test "x$host_alias" != x; then
791  if test "x$build_alias" = x; then
792    cross_compiling=maybe
793    AC_MSG_WARN([If you wanted to set the --build type, don't use --host.
794    If a cross compiler is detected then cross compile mode will be used.])
795  elif test "x$build_alias" != "x$host_alias"; then
796    cross_compiling=yes
797  fi
798fi
799
800ac_tool_prefix=
801test -n "$host_alias" && ac_tool_prefix=$host_alias-
802
803test "$silent" = yes && exec AS_MESSAGE_FD>/dev/null
804
805m4_divert_pop([PARSE_ARGS])dnl
806])# SH_INIT_PARSE_ARGS
807
808m4_define([SH_INIT_HELP],
809[m4_divert_push([HELP_BEGIN])dnl
810
811#
812# Report the --help message.
813#
814if test "$ac_init_help" = "long"; then
815  # Omit some internal or obsolete options to make the list less imposing.
816  # This message is too long to be a string in the A/UX 3.1 sh.
817  cat <<_ACEOF
818\`configure' configures m4_ifset([AC_PACKAGE_STRING],
819                        [AC_PACKAGE_STRING],
820                        [this package]) to adapt to many kinds of systems.
821
822Usage: $[0] [[OPTION]]... [[VAR=VALUE]]...
823
824[To assign environment variables (e.g., CC, CFLAGS...), specify them as
825VAR=VALUE.  See below for descriptions of some of the useful variables.
826
827Defaults for the options are specified in brackets.
828
829Configuration:
830  -h, --help              display this help and exit
831      --help=short        display options specific to this package
832      --help=recursive    display the short help of all the included packages
833  -V, --version           display version information and exit
834  -q, --quiet, --silent   do not print \`checking...' messages
835      --cache-file=FILE   cache test results in FILE [disabled]
836  -C, --config-cache      alias for \`--cache-file=config.cache'
837  -n, --no-create         do not create output files
838      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
839
840_ACEOF
841
842  cat <<_ACEOF
843Installation directories:
844  --prefix=PREFIX         install architecture-independent files in PREFIX
845                          [$ac_default_prefix]
846  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
847                          [PREFIX]
848
849By default, \`make install' will install binaries in \`/usr/local/sbin',
850the config file in \`/etc', manpage in \`/usr/local/share/man', and state
851data in \`/var/lib/INSTALL_NAME' (FSH layout).  You can specify other
852FSH compliant layouts with \`--prefix=OPT' or \`--prefix=USR', or you
853can specify a directory with \`--prefix=DIR' to install in \`DIR/sbin',
854\`DIR/etc', etc.
855
856For better control, use the options below.
857
858Fine tuning of the installation directories:
859  --sbindir=DIR          system admin executables [EPREFIX/sbin]
860  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
861  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
862  --mandir=DIR           man documentation [PREFIX/man]
863
864For even finer tuning, paths can be specified for individual files (see below)
865
866_ACEOF
867
868  cat <<\_ACEOF]
869m4_divert_pop([HELP_BEGIN])dnl
870dnl The order of the diversions here is
871dnl - HELP_BEGIN
872dnl   which may be prolongated by extra generic options such as with X or
873dnl   AC_ARG_PROGRAM.  Displayed only in long --help.
874dnl
875dnl - HELP_CANON
876dnl   Support for cross compilation (--build, --host and --target).
877dnl   Display only in long --help.
878dnl
879dnl - HELP_ENABLE
880dnl   which starts with the trailer of the HELP_BEGIN, HELP_CANON section,
881dnl   then implements the header of the non generic options.
882dnl
883dnl - HELP_WITH
884dnl
885dnl - HELP_VAR
886dnl
887dnl - HELP_VAR_END
888dnl
889dnl - HELP_END
890dnl   initialized below, in which we dump the trailer (handling of the
891dnl   recursion for instance).
892m4_divert_push([HELP_ENABLE])dnl
893_ACEOF
894fi
895
896if test -n "$ac_init_help"; then
897m4_ifset([AC_PACKAGE_STRING],
898[  case $ac_init_help in
899     short | recursive ) echo "Configuration of AC_PACKAGE_STRING:";;
900   esac])
901  cat <<\_ACEOF
902m4_divert_pop([HELP_ENABLE])dnl
903m4_divert_push([HELP_END])dnl
904m4_ifset([AC_PACKAGE_BUGREPORT], [
905Report bugs to <AC_PACKAGE_BUGREPORT>.])
906_ACEOF
907fi
908
909if test "$ac_init_help" = "recursive"; then
910  # If there are subdirs, report their specific --help.
911  ac_popdir=`pwd`
912  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
913    test -d $ac_dir || continue
914    _AC_SRCPATHS(["$ac_dir"])
915    cd $ac_dir
916    # Check for guested configure; otherwise get Cygnus style configure.
917    if test -f $ac_srcdir/configure.gnu; then
918      echo
919      $SHELL $ac_srcdir/configure.gnu  --help=recursive
920    elif test -f $ac_srcdir/configure; then
921      echo
922      $SHELL $ac_srcdir/configure  --help=recursive
923    elif test -f $ac_srcdir/configure.ac ||
924           test -f $ac_srcdir/configure.in; then
925      echo
926      $ac_configure --help
927    else
928      AC_MSG_WARN([no configuration information is in $ac_dir])
929    fi
930    cd $ac_popdir
931  done
932fi
933
934test -n "$ac_init_help" && exit 0
935m4_divert_pop([HELP_END])dnl
936])# SH_INIT_HELP
937
938
939
940
941
942
943
944
945# Check whether sa_sigaction works.
946# Rainer Wichmann <support@la-samhna.de>, 2003.
947#
948# This file can be copied and used freely without restrictions.  It can
949# be used in projects which are not available under the GNU Public License.
950
951# serial 1
952
953AC_DEFUN([AM_SA_SIGACTION_WORKS],
954  [
955   am_cv_val_SA_SIGACTION=no
956   AC_CHECK_HEADER(signal.h,
957     [
958      AM_SI_USER
959      AM_SA_SIGINFO
960      if test $am_cv_val_SI_USER = yes && test $am_cv_val_SA_SIGINFO = yes
961      then
962        AC_TRY_RUN([
963#include <signal.h>
964#include <setjmp.h>
965#include <stdio.h>
966#include <stdlib.h>
967
968volatile int xnum  = 0;
969volatile int xcode = 0;
970jmp_buf      Buf;
971int          xsig  = SIGSEGV;
972
973void sighandler (int xsignam, siginfo_t * xsiginfo, void * xsigadd)
974{
975  static sigset_t x;
976
977  if (xsiginfo == NULL)
978    exit(__LINE__);
979  if (xsiginfo->si_signo != xsignam)
980    exit(__LINE__);
981  ++xnum;
982  xcode   = xsiginfo->si_code;
983  sigemptyset (&x);
984  sigprocmask(SIG_SETMASK, &x, NULL);
985  longjmp ( Buf, 1);
986}
987
988int main ()
989{
990  struct sigaction newact;
991
992  newact.sa_sigaction = sighandler;
993  sigemptyset (&newact.sa_mask);
994  newact.sa_flags = SA_SIGINFO;
995  if (0 != sigaction (xsig, &newact, NULL))
996    exit (__LINE__);
997  if(setjmp ( Buf)) {
998      if (xnum > 1)
999        goto Third;
1000      goto Second;
1001  }
1002  memcpy((void *) 0x0, "test", 5);
1003 Second:
1004  if (xcode == SI_USER)
1005    exit (__LINE__);
1006  raise(xsig);
1007 Third:
1008  if (xcode != SI_USER)
1009    exit (__LINE__);
1010  if (xnum != 2)
1011    exit (__LINE__);
1012  return (0);
1013}], am_cv_val_SA_SIGACTION=yes, am_cv_val_SA_SIGACTION=no, am_cv_val_SA_SIGACTION=no)
1014   fi
1015      ])
1016     AC_MSG_CHECKING([whether sa_sigaction is supported])
1017     if test $am_cv_val_SA_SIGACTION = yes
1018     then
1019       AC_MSG_RESULT(yes)
1020       AC_DEFINE([SA_SIGACTION_WORKS], 1, [Define if sa_sigaction works])
1021     else
1022        AC_MSG_RESULT(no)
1023     fi
1024     ])
1025
1026# Check whether SI_USER is available in <signal.h>.
1027# Rainer Wichmann <support@la-samhna.de>, 2003.
1028#
1029# This file can be copied and used freely without restrictions.  It can
1030# be used in projects which are not available under the GNU Public License.
1031
1032# serial 1
1033
1034
1035AC_DEFUN([AM_SI_USER],
1036  [if test $ac_cv_header_signal_h = yes; then
1037    AC_CACHE_CHECK([for SI_USER in signal.h], am_cv_val_SI_USER,
1038      [AC_TRY_LINK([#include <signal.h>], [return SI_USER],
1039       am_cv_val_SI_USER=yes, am_cv_val_SI_USER=no)])
1040    if test $am_cv_val_SI_USER = yes; then
1041      AC_DEFINE([HAVE_SI_USER], 1, [Define if you have SI_USER])
1042    fi
1043  fi])
1044
1045# Check whether SA_SIGINFO is available in <signal.h>.
1046# Rainer Wichmann <support@la-samhna.de>, 2003.
1047#
1048# This file can be copied and used freely without restrictions.  It can
1049# be used in projects which are not available under the GNU Public License.
1050
1051# serial 1
1052
1053
1054AC_DEFUN([AM_SA_SIGINFO],
1055  [if test $ac_cv_header_signal_h = yes; then
1056    AC_CACHE_CHECK([for SA_SIGINFO in signal.h], am_cv_val_SA_SIGINFO,
1057      [AC_TRY_LINK([#include <signal.h>], [return SA_SIGINFO],
1058       am_cv_val_SA_SIGINFO=yes, am_cv_val_SA_SIGINFO=no)])
1059    if test $am_cv_val_SA_SIGINFO = yes; then
1060      AC_DEFINE([HAVE_SA_SIGINFO], 1, [Define if you have SA_SIGINFO])
1061    fi
1062  fi])
1063
1064dnl
1065dnl Useful macros for autoconf to check for ssp-patched gcc
1066dnl 1.0 - September 2003 - Tiago Sousa <mirage@kaotik.org>
1067dnl 1.1 - August 2006 - Ted Percival <ted@midg3t.net>
1068dnl     * Stricter language checking (C or C++)
1069dnl     * Adds GCC_STACK_PROTECT_LIB to add -lssp to LDFLAGS as necessary
1070dnl     * Caches all results
1071dnl     * Uses macros to ensure correct ouput in quiet/silent mode
1072dnl 1.2 - April 2007 - Ted Percival <ted@midg3t.net>
1073dnl     * Added GCC_STACK_PROTECTOR macro for simpler (one-line) invocation
1074dnl     * GCC_STACK_PROTECT_LIB now adds -lssp to LIBS rather than LDFLAGS
1075dnl
1076dnl About ssp:
1077dnl GCC extension for protecting applications from stack-smashing attacks
1078dnl http://www.research.ibm.com/trl/projects/security/ssp/
1079dnl
1080dnl Usage:
1081dnl Most people will simply call GCC_STACK_PROTECTOR.
1082dnl If you only use one of C or C++, you can save time by only calling the
1083dnl macro appropriate for that language. In that case you should also call
1084dnl GCC_STACK_PROTECT_LIB first.
1085dnl
1086dnl GCC_STACK_PROTECTOR
1087dnl Tries to turn on stack protection for C and C++ by calling the following
1088dnl three macros with the right languages.
1089dnl
1090dnl GCC_STACK_PROTECT_CC
1091dnl checks -fstack-protector with the C compiler, if it exists then updates
1092dnl CFLAGS and defines ENABLE_SSP_CC
1093dnl
1094dnl GCC_STACK_PROTECT_CXX
1095dnl checks -fstack-protector with the C++ compiler, if it exists then updates
1096dnl CXXFLAGS and defines ENABLE_SSP_CXX
1097dnl
1098dnl GCC_STACK_PROTECT_LIB
1099dnl adds -lssp to LIBS if it is available
1100dnl ssp is usually provided as part of libc, but was previously a separate lib
1101dnl It does not hurt to add -lssp even if libc provides SSP - in that case
1102dnl libssp will simply be ignored.
1103dnl
1104
1105AC_DEFUN([GCC_STACK_PROTECT_LIB],[
1106  AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib,
1107    [ssp_old_libs="$LIBS"
1108     LIBS="$LIBS -lssp"
1109     AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no)
1110     LIBS="$ssp_old_libs"
1111    ])
1112  if test $ssp_cv_lib = yes; then
1113    LIBS="$LIBS -lssp"
1114  fi
1115])
1116
1117AC_DEFUN([GCC_STACK_PROTECT_CC],[
1118  AC_LANG_ASSERT(C)
1119  if test "X$CC" != "X"; then
1120    AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector],
1121      ssp_cv_cc,
1122      [ssp_old_cflags="$CFLAGS"
1123       CFLAGS="$CFLAGS -fstack-protector-all"
1124       AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
1125       CFLAGS="$ssp_old_cflags"
1126      ])
1127    if test $ssp_cv_cc = no; then
1128      AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector],
1129        ssp_cv_cc,
1130        [ssp_old_cflags="$CFLAGS"
1131         CFLAGS="$CFLAGS -fstack-protector-all"
1132         AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
1133         CFLAGS="$ssp_old_cflags"
1134        ])
1135      if test $ssp_cv_cc = yes; then
1136        CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1 -fstack-protector-all"
1137        AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
1138      fi
1139    else
1140      if test $ssp_cv_cc = yes; then
1141        CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1 -fstack-protector"
1142        AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
1143      fi
1144    fi
1145  fi
1146])
1147
1148AC_DEFUN([GCC_STACK_PROTECT_CXX],[
1149  AC_LANG_ASSERT(C++)
1150  if test "X$CXX" != "X"; then
1151    AC_CACHE_CHECK([whether ${CXX} accepts -fstack-protector],
1152      ssp_cv_cxx,
1153      [ssp_old_cxxflags="$CXXFLAGS"
1154       CXXFLAGS="$CXXFLAGS -fstack-protector"
1155       AC_TRY_COMPILE(,, ssp_cv_cxx=yes, ssp_cv_cxx=no)
1156       CXXFLAGS="$ssp_old_cxxflags"
1157      ])
1158    if test $ssp_cv_cxx = yes; then
1159      CXXFLAGS="$CXXFLAGS -fstack-protector"
1160      AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.])
1161    fi
1162  fi
1163])
1164
1165AC_DEFUN([GCC_STACK_PROTECTOR],[
1166  GCC_STACK_PROTECT_LIB
1167
1168  AC_LANG_PUSH([C])
1169  GCC_STACK_PROTECT_CC
1170  AC_LANG_POP([C])
1171
1172  AC_LANG_PUSH([C++])
1173  GCC_STACK_PROTECT_CXX
1174  AC_LANG_POP([C++])
1175])
1176
1177
1178
1179AC_DEFUN([SAMHAIN_POSIX],[
1180        AC_MSG_CHECKING([whether _POSIX_SOURCE is necessary])
1181        AC_TRY_COMPILE([#include <stdio.h>
1182void fileno(int);int fdopen(int, char *); ],,
1183        [
1184        AC_MSG_RESULT(yes)
1185        AC_DEFINE([_POSIX_SOURCE],1,[Define if POSIX functions are required])
1186        ],
1187        [AC_MSG_RESULT(no)])
1188])dnl
1189
1190dnl checks for a known 64 bit programming environment
1191dnl AC_RUN_IFELSE(PROGRAM,
1192dnl               [ACTION-IF-TRUE], [ACTION-IF-FALSE],
1193dnl               [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
1194dnl
1195AC_DEFUN([SAMHAIN_PRG_ENV],[
1196    AC_MSG_CHECKING([for a known 64 bit programming environment])
1197    # Compile and run a program that determines the programming environment
1198    AC_RUN_IFELSE([
1199      AC_LANG_SOURCE([[
1200#include <stdio.h>
1201int main(int argc,char **argv)
1202{
1203  if (argc > 1) {
1204#if defined(__arch64__)
1205  printf("__arch64__\n");
1206#elif defined(__ia64__)
1207  printf("__ia64__\n");
1208#elif defined(__x86_64__)
1209  printf("__x86_64__\n");
1210#elif defined(__LP64__)
1211  printf("__LP64__\n");
1212#elif defined(__64BIT__)
1213  printf("__64BIT__\n");
1214#elif defined(_LP64)
1215  printf("_LP64\n");
1216#elif defined(_M_IA64)
1217  printf("_M_IA64\n");
1218#elif defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64)
1219  printf("_MIPS_64\n");
1220#else
1221choke me
1222#endif
1223  }
1224  return 0;
1225}
1226      ]])
1227    ],[
1228      # Program compiled and ran, so get version by adding argument.
1229      samhain_prg_ENV=`./conftest$ac_exeext x`
1230      samhain_64=yes
1231      AC_MSG_RESULT([$samhain_prg_ENV])
1232    ],[
1233      AC_MSG_RESULT([none])
1234        ],[
1235      AC_MSG_RESULT([none])
1236        ])
1237])dnl
1238
1239AC_DEFUN([SAMHAIN_X86_64],[
1240        AC_MSG_CHECKING([for x86_64])
1241        AC_TRY_RUN([
1242int main() {
1243__asm__ volatile (
1244"movq %rax, %rax"
1245);
1246return 0;
1247}
1248        ],
1249        [
1250        AC_MSG_RESULT(yes)
1251        samhain_64=yes
1252        tiger_src=sh_tiger1_64.c
1253        AC_DEFINE([TIGER_OPT_ASM],1,[Define to use tiger x86_64 optimized assembly])
1254        ],
1255        [
1256        AC_MSG_RESULT([no])
1257        ],[
1258        AC_MSG_RESULT([no])
1259        ])
1260])dnl
1261
1262
1263AC_DEFUN([SAMHAIN_64],[
1264samhain_64=no
1265tiger_src=sh_tiger1.c
1266#
1267# if sizeof(unsigned long) = 4, try compiler macros for 64bit
1268#
1269if test "x$ac_cv_sizeof_unsigned_long" = x4; then
1270  if test "x$ac_cv_sizeof_unsigned_long_long" = x8; then
1271        SAMHAIN_PRG_ENV
1272        if test "x$samhain_64" = xyes; then
1273          tiger_src=sh_tiger1_64.c
1274        fi
1275        #
1276        # if GCC and __i386__, use precompiled assembler
1277        #
1278        if test "x$GCC" = xyes; then
1279          AC_MSG_CHECKING([for non-apple non-cygwin i386])
1280          samhain_i386=no
1281          $CC -E -dM - < /dev/null | egrep '__i386__' >/dev/null 2>&1
1282          if test $? = 0; then
1283            # apples gcc does not understand the assembly we provide
1284            $CC -E -dM - < /dev/null | egrep '(__sun__|__APPLE__|__CYGWIN__)' >/dev/null 2>&1 || samhain_i386=yes
1285          fi
1286          if test "x$samhain_i386" = xyes; then
1287            tiger_src=sh_tiger1.s
1288            AC_DEFINE([TIGER_32_BIT_S],1,[Define to use tiger 32 bit i386 assembler])
1289          fi
1290          AC_MSG_RESULT([$samhain_i386])
1291        fi
1292        #
1293        #
1294        #
1295  else
1296        samhain_64=no
1297        tiger_src=sh_tiger1.c
1298  fi
1299else
1300  #
1301  # sizeof(unsigned long) = 8
1302  #
1303  tiger_src=sh_tiger1_64.c
1304  samhain_64=yes
1305  #
1306  # check for x86_64 (enables assembly optimizations)
1307  #
1308  if test "x$GCC" = xyes; then
1309    SAMHAIN_X86_64
1310  fi
1311fi
1312if test "x$samhain_64" = xyes; then
1313        AC_DEFINE([TIGER_64_BIT],1,[Define to use tiger 64 bit implementation])
1314fi
1315AC_MSG_CHECKING([for 64 bit environment])
1316AC_MSG_RESULT([$samhain_64])
1317AC_MSG_CHECKING([for tiger source to use])
1318AC_MSG_RESULT([$tiger_src])
1319AC_SUBST(tiger_src)
1320])dnl
1321
1322AC_DEFUN([sh_CHECK_POSIX_ACL],
1323[
1324  AC_CHECK_HEADERS(sys/acl.h)
1325  if test $ac_cv_header_sys_acl_h = yes; then
1326
1327        AC_CHECK_LIB([acl], [acl_get_file], sh_lacl=yes, sh_lacl=no)
1328        if test x"$sh_lacl" = xyes; then
1329                LIBACL=-lacl
1330        else
1331                LIBACL=
1332        fi
1333
1334        OLDLIBS="$LIBS"
1335        LIBS="$LIBS $LIBACL"
1336        AC_CHECK_FUNCS([acl_free acl_get_file acl_get_fd],
1337                       [sh_facl=yes],[sh_facl=no])
1338        LIBS="$OLDLIBS"
1339
1340        if test x"$sh_facl" = xyes; then
1341          AC_DEFINE(USE_ACL, 1, [Define if you want ACL support.])
1342          LIBS="$LIBS $LIBACL"
1343        fi
1344  fi
1345])
1346
1347AC_DEFUN([sh_CHECK_XATTR],
1348[
1349  AC_CHECK_HEADERS(attr/xattr.h)
1350  if test $ac_cv_header_attr_xattr_h = yes; then
1351
1352        AC_CHECK_LIB([attr], [getxattr], sh_lattr=yes, sh_lattr=no)
1353        if test x"$sh_lattr" = xyes; then
1354                LIBATTR=-lattr
1355        else
1356                LIBATTR=
1357        fi
1358 
1359        OLDLIBS="$LIBS"
1360        LIBS="$LIBS $LIBATTR"
1361        AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr],
1362                       [sh_fattr=yes],[sh_fattr=no])
1363        LIBS="$OLDLIBS"
1364
1365        if test x"$sh_fattr" = xyes; then
1366          AC_DEFINE(USE_XATTR, 1, [Define if you want extended attributes support.])
1367          LIBS="$LIBS $LIBATTR"
1368        fi
1369  fi
1370])
1371
1372dnl Autoconf macros for libprelude
1373dnl $id$
1374
1375# Modified for LIBPRELUDE -- Yoann Vandoorselaere
1376# Modified for LIBGNUTLS -- nmav
1377# Configure paths for LIBGCRYPT
1378# Shamelessly stolen from the one of XDELTA by Owen Taylor
1379# Werner Koch   99-12-09
1380
1381dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
1382dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
1383dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
1384dnl
1385AC_DEFUN([AM_PATH_LIBPRELUDE],
1386[dnl
1387dnl Get the cflags and libraries from the libprelude-config script
1388dnl
1389dnl AC_ARG_WITH(libprelude-prefix,
1390dnl          [  --with-libprelude-prefix=PFX   Prefix where libprelude is installed (optional)],
1391dnl          libprelude_config_prefix="$withval", libprelude_config_prefix="")
1392dnl
1393dnl  if test x$libprelude_config_prefix != x ; then
1394dnl     if test x${LIBPRELUDE_CONFIG+set} != xset ; then
1395dnl        LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
1396dnl     fi
1397dnl  fi
1398dnl
1399dnl  AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
1400  min_libprelude_version=ifelse([$1], ,0.1.0,$1)
1401  AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
1402  no_libprelude=""
1403  if test "$LIBPRELUDE_CONFIG" = "no" ; then
1404    no_libprelude=yes
1405  else
1406    LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
1407    LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
1408    LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
1409    LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
1410    LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
1411    LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
1412    libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
1413
1414
1415      ac_save_CFLAGS="$CFLAGS"
1416      ac_save_LDFLAGS="$LDFLAGS"
1417      ac_save_LIBS="$LIBS"
1418      CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
1419      LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1420      LIBS="$LIBS $LIBPRELUDE_LIBS"
1421dnl
1422dnl Now check if the installed libprelude is sufficiently new. Also sanity
1423dnl checks the results of libprelude-config to some extent
1424dnl
1425      rm -f conf.libpreludetest
1426      AC_TRY_RUN([
1427#include <stdio.h>
1428#include <stdlib.h>
1429#include <string.h>
1430#include <libprelude/prelude.h>
1431
1432int
1433main ()
1434{
1435    system ("touch conf.libpreludetest");
1436
1437    if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
1438    {
1439      printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
1440             "$libprelude_config_version", prelude_check_version(NULL) );
1441      printf("*** was found! If libprelude-config was correct, then it is best\n");
1442      printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
1443      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1444      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1445      printf("*** required on your system.\n");
1446      printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
1447      printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
1448      printf("*** before re-running configure\n");
1449    }
1450    else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
1451    {
1452      printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
1453      printf("*** library (version %s)\n", prelude_check_version(NULL) );
1454    }
1455    else
1456    {
1457      if ( prelude_check_version( "$min_libprelude_version" ) )
1458      {
1459        return 0;
1460      }
1461     else
1462      {
1463        printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
1464                prelude_check_version(NULL) );
1465        printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
1466               "$min_libprelude_version" );
1467        printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
1468        printf("*** \n");
1469        printf("*** If you have already installed a sufficiently new version, this error\n");
1470        printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
1471        printf("*** being found. The easiest way to fix this is to remove the old version\n");
1472        printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
1473        printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
1474        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1475        printf("*** so that the correct libraries are found at run-time))\n");
1476      }
1477    }
1478  return 1;
1479}
1480],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1481       CFLAGS="$ac_save_CFLAGS"
1482       LIBS="$ac_save_LIBS"
1483       LDFLAGS="$ac_save_LDFLAGS"
1484  fi
1485
1486  if test "x$no_libprelude" = x ; then
1487     AC_MSG_RESULT(yes)
1488     ifelse([$2], , :, [$2])
1489  else
1490     if test -f conf.libpreludetest ; then
1491        :
1492     else
1493        AC_MSG_RESULT(no)
1494     fi
1495     if test "$LIBPRELUDE_CONFIG" = "no" ; then
1496       echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
1497       echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
1498       echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
1499       echo "*** full path to libprelude-config."
1500     else
1501       if test -f conf.libpreludetest ; then
1502        :
1503       else
1504          echo "*** Could not run libprelude test program, checking why..."
1505          CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
1506          LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1507          LIBS="$LIBS $LIBPRELUDE_LIBS"
1508          AC_TRY_LINK([
1509#include <stdio.h>
1510#include <stdlib.h>
1511#include <string.h>
1512#include <libprelude/prelude.h>
1513],      [ return !!prelude_check_version(NULL); ],
1514        [ echo "*** The test program compiled, but did not run. This usually means"
1515          echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
1516          echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
1517          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1518          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1519          echo "*** is required on your system"
1520          echo "***"
1521          echo "*** If you have an old version installed, it is best to remove it, although"
1522          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1523          echo "***" ],
1524        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1525          echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
1526          echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
1527          echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
1528          CFLAGS="$ac_save_CFLAGS"
1529          LDFLAGS="$ac_save_LDFLAGS"
1530          LIBS="$ac_save_LIBS"
1531       fi
1532     fi
1533     LIBPRELUDE_CFLAGS=""
1534     LIBPRELUDE_LDFLAGS=""
1535     LIBPRELUDE_LIBS=""
1536     ifelse([$3], , :, [$3])
1537  fi
1538  rm -f conf.libpreludetest
1539  AC_SUBST(LIBPRELUDE_CFLAGS)
1540  AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
1541  AC_SUBST(LIBPRELUDE_LDFLAGS)
1542  AC_SUBST(LIBPRELUDE_LIBS)
1543  AC_SUBST(LIBPRELUDE_PREFIX)
1544  AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
1545])
1546
1547
1548##### http://autoconf-archive.cryp.to/acx_pthread.html
1549#
1550# SYNOPSIS
1551#
1552#   ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
1553#
1554# DESCRIPTION
1555#
1556#   This macro figures out how to build C programs using POSIX threads.
1557#   It sets the PTHREAD_LIBS output variable to the threads library and
1558#   linker flags, and the PTHREAD_CFLAGS output variable to any special
1559#   C compiler flags that are needed. (The user can also force certain
1560#   compiler flags/libs to be tested by setting these environment
1561#   variables.)
1562#
1563#   Also sets PTHREAD_CC to any special C compiler that is needed for
1564#   multi-threaded programs (defaults to the value of CC otherwise).
1565#   (This is necessary on AIX to use the special cc_r compiler alias.)
1566#
1567#   NOTE: You are assumed to not only compile your program with these
1568#   flags, but also link it with them as well. e.g. you should link
1569#   with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
1570#   $LIBS
1571#
1572#   If you are only building threads programs, you may wish to use
1573#   these variables in your default LIBS, CFLAGS, and CC:
1574#
1575#          LIBS="$PTHREAD_LIBS $LIBS"
1576#          CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1577#          CC="$PTHREAD_CC"
1578#
1579#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
1580#   constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
1581#   that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
1582#
1583#   ACTION-IF-FOUND is a list of shell commands to run if a threads
1584#   library is found, and ACTION-IF-NOT-FOUND is a list of commands to
1585#   run it if it is not found. If ACTION-IF-FOUND is not specified, the
1586#   default action will define HAVE_PTHREAD.
1587#
1588#   Please let the authors know if this macro fails on any platform, or
1589#   if you have any other suggestions or comments. This macro was based
1590#   on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
1591#   (with help from M. Frigo), as well as ac_pthread and hb_pthread
1592#   macros posted by Alejandro Forero Cuervo to the autoconf macro
1593#   repository. We are also grateful for the helpful feedback of
1594#   numerous users.
1595#
1596# LAST MODIFICATION
1597#
1598#   2007-07-29
1599#
1600# COPYLEFT
1601#
1602#   Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
1603#
1604#   This program is free software: you can redistribute it and/or
1605#   modify it under the terms of the GNU General Public License as
1606#   published by the Free Software Foundation, either version 3 of the
1607#   License, or (at your option) any later version.
1608#
1609#   This program is distributed in the hope that it will be useful, but
1610#   WITHOUT ANY WARRANTY; without even the implied warranty of
1611#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1612#   General Public License for more details.
1613#
1614#   You should have received a copy of the GNU General Public License
1615#   along with this program. If not, see
1616#   <http://www.gnu.org/licenses/>.
1617#
1618#   As a special exception, the respective Autoconf Macro's copyright
1619#   owner gives unlimited permission to copy, distribute and modify the
1620#   configure scripts that are the output of Autoconf when processing
1621#   the Macro. You need not follow the terms of the GNU General Public
1622#   License when using or distributing such scripts, even though
1623#   portions of the text of the Macro appear in them. The GNU General
1624#   Public License (GPL) does govern all other use of the material that
1625#   constitutes the Autoconf Macro.
1626#
1627#   This special exception to the GPL applies to versions of the
1628#   Autoconf Macro released by the Autoconf Macro Archive. When you
1629#   make and distribute a modified version of the Autoconf Macro, you
1630#   may extend this special exception to the GPL to apply to your
1631#   modified version as well.
1632
1633AC_DEFUN([ACX_PTHREAD], [
1634AC_REQUIRE([AC_CANONICAL_HOST])
1635AC_LANG_SAVE
1636AC_LANG_C
1637acx_pthread_ok=no
1638
1639# We used to check for pthread.h first, but this fails if pthread.h
1640# requires special compiler flags (e.g. on True64 or Sequent).
1641# It gets checked for in the link test anyway.
1642
1643# First of all, check if the user has set any of the PTHREAD_LIBS,
1644# etcetera environment variables, and if threads linking works using
1645# them:
1646if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
1647        save_CFLAGS="$CFLAGS"
1648        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1649        save_LIBS="$LIBS"
1650        LIBS="$PTHREAD_LIBS $LIBS"
1651        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
1652        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
1653        AC_MSG_RESULT($acx_pthread_ok)
1654        if test x"$acx_pthread_ok" = xno; then
1655                PTHREAD_LIBS=""
1656                PTHREAD_CFLAGS=""
1657        fi
1658        LIBS="$save_LIBS"
1659        CFLAGS="$save_CFLAGS"
1660fi
1661
1662# We must check for the threads library under a number of different
1663# names; the ordering is very important because some systems
1664# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
1665# libraries is broken (non-POSIX).
1666
1667# Create a list of thread flags to try.  Items starting with a "-" are
1668# C compiler flags, and other items are library names, except for "none"
1669# which indicates that we try without any flags at all, and "pthread-config"
1670# which is a program returning the flags for the Pth emulation library.
1671
1672acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
1673
1674# The ordering *is* (sometimes) important.  Some notes on the
1675# individual items follow:
1676
1677# pthreads: AIX (must check this before -lpthread)
1678# none: in case threads are in libc; should be tried before -Kthread and
1679#       other compiler flags to prevent continual compiler warnings
1680# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
1681# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
1682# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
1683# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
1684# -pthreads: Solaris/gcc
1685# -mthreads: Mingw32/gcc, Lynx/gcc
1686# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
1687#      doesn't hurt to check since this sometimes defines pthreads too;
1688#      also defines -D_REENTRANT)
1689#      ... -mt is also the pthreads flag for HP/aCC
1690# pthread: Linux, etcetera
1691# --thread-safe: KAI C++
1692# pthread-config: use pthread-config program (for GNU Pth library)
1693
1694case "${host_cpu}-${host_os}" in
1695        *solaris*)
1696
1697        # On Solaris (at least, for some versions), libc contains stubbed
1698        # (non-functional) versions of the pthreads routines, so link-based
1699        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
1700        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
1701        # a function called by this macro, so we could check for that, but
1702        # who knows whether they'll stub that too in a future libc.)  So,
1703        # we'll just look for -pthreads and -lpthread first:
1704
1705        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
1706        ;;
1707esac
1708
1709if test x"$acx_pthread_ok" = xno; then
1710for flag in $acx_pthread_flags; do
1711
1712        case $flag in
1713                none)
1714                AC_MSG_CHECKING([whether pthreads work without any flags])
1715                ;;
1716
1717                -pthread)
1718                AC_MSG_CHECKING([whether pthreads work with $flag])
1719                PTHREAD_CFLAGS="$flag"
1720                ;;
1721
1722                -*)
1723                AC_MSG_CHECKING([whether pthreads work with $flag])
1724                PTHREAD_CFLAGS="$flag"
1725                ;;
1726
1727                pthread-config)
1728                AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
1729                if test x"$acx_pthread_config" = xno; then continue; fi
1730                PTHREAD_CFLAGS="`pthread-config --cflags`"
1731                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
1732                ;;
1733
1734                *)
1735                AC_MSG_CHECKING([for the pthreads library -l$flag])
1736                PTHREAD_LIBS="-l$flag"
1737                ;;
1738        esac
1739
1740        save_LIBS="$LIBS"
1741        save_CFLAGS="$CFLAGS"
1742        save_LDFLAGS="$LDFLAGS"
1743        LIBS="$PTHREAD_LIBS $LIBS"
1744        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1745        LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
1746
1747        # Check for various functions.  We must include pthread.h,
1748        # since some functions may be macros.  (On the Sequent, we
1749        # need a special flag -Kthread to make this header compile.)
1750        # We check for pthread_join because it is in -lpthread on IRIX
1751        # while pthread_create is in libc.  We check for pthread_attr_init
1752        # due to DEC craziness with -lpthreads.  We check for
1753        # pthread_cleanup_push because it is one of the few pthread
1754        # functions on Solaris that doesn't have a non-functional libc stub.
1755        # We try pthread_create on general principles.
1756        AC_TRY_LINK([#include <pthread.h>],
1757                    [pthread_t th; pthread_join(th, 0);
1758                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
1759                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
1760                    [acx_pthread_ok=yes])
1761
1762        LIBS="$save_LIBS"
1763        LDFLAGS="$save_LDFLAGS"
1764        CFLAGS="$save_CFLAGS"
1765
1766        AC_MSG_RESULT($acx_pthread_ok)
1767        if test "x$acx_pthread_ok" = xyes; then
1768                break;
1769        fi
1770
1771        PTHREAD_LIBS=""
1772        PTHREAD_CFLAGS=""
1773done
1774fi
1775
1776# Various other checks:
1777if test "x$acx_pthread_ok" = xyes; then
1778        save_LIBS="$LIBS"
1779        LIBS="$PTHREAD_LIBS $LIBS"
1780        save_CFLAGS="$CFLAGS"
1781        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1782
1783        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
1784        AC_MSG_CHECKING([for joinable pthread attribute])
1785        attr_name=unknown
1786        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
1787            AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
1788                        [attr_name=$attr; break])
1789        done
1790        AC_MSG_RESULT($attr_name)
1791        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
1792            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
1793                               [Define to necessary symbol if this constant
1794                                uses a non-standard name on your system.])
1795        fi
1796
1797        # Solaris lossage: default is obsolete semantics for getpwnam_r,
1798        # getpwuid_r, getgrgid_r, unless _POSIX_PTHREAD_SEMANTICS is defined
1799        AC_MSG_CHECKING([if more special flags are required for pthreads])
1800        flag=no
1801        case "${host_cpu}-${host_os}" in
1802            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
1803            *-osf* | *-hpux*) flag="-D_REENTRANT";;
1804            *solaris*) flag="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
1805        esac
1806        AC_MSG_RESULT(${flag})
1807        if test "x$flag" != xno; then
1808            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
1809        fi
1810
1811        # Detect PTHREAD_MUTEX_RECURSIVE
1812        AC_MSG_CHECKING([for recursive mutexes])
1813        mutex_recursive=no
1814        AC_TRY_LINK([
1815#define _XOPEN_SOURCE 500
1816#include <pthread.h>], [
1817pthread_mutexattr_t   mta;
1818pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);
1819return 0;],[mutex_recursive=yes])
1820        if test "x$mutex_recursive" = "xyes"
1821        then
1822          AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE,1,[Define if you have recursive mutexes.])
1823        fi
1824        AC_MSG_RESULT($mutex_recursive)
1825
1826        LIBS="$save_LIBS"
1827        CFLAGS="$save_CFLAGS"
1828
1829        # More AIX lossage: must compile with xlc_r or cc_r
1830        if test x"$GCC" != xyes; then
1831          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
1832        else
1833          PTHREAD_CC=$CC
1834        fi
1835else
1836        PTHREAD_CC="$CC"
1837fi
1838
1839AC_SUBST(PTHREAD_LIBS)
1840AC_SUBST(PTHREAD_CFLAGS)
1841AC_SUBST(PTHREAD_LDFLAGS)
1842AC_SUBST(PTHREAD_CC)
1843
1844# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
1845if test x"$acx_pthread_ok" = xyes; then
1846        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
1847        :
1848else
1849        acx_pthread_ok=no
1850        $2
1851fi
1852AC_LANG_RESTORE
1853])dnl ACX_PTHREAD
1854
1855dnl *-*wedit:notab*-*  Please keep this as the last line.
1856
Note: See TracBrowser for help on using the repository browser.