source: trunk/aclocal.m4 @ 139

Last change on this file since 139 was 139, checked in by rainer, 12 years ago

Detect availability of recursive mutexes on Linux.

File size: 55.8 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"
1124       AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
1125       CFLAGS="$ssp_old_cflags"
1126      ])
1127    if test $ssp_cv_cc = yes; then
1128      CFLAGS="$CFLAGS -fstack-protector"
1129      AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
1130    fi
1131  fi
1132])
1133
1134AC_DEFUN([GCC_STACK_PROTECT_CXX],[
1135  AC_LANG_ASSERT(C++)
1136  if test "X$CXX" != "X"; then
1137    AC_CACHE_CHECK([whether ${CXX} accepts -fstack-protector],
1138      ssp_cv_cxx,
1139      [ssp_old_cxxflags="$CXXFLAGS"
1140       CXXFLAGS="$CXXFLAGS -fstack-protector"
1141       AC_TRY_COMPILE(,, ssp_cv_cxx=yes, ssp_cv_cxx=no)
1142       CXXFLAGS="$ssp_old_cxxflags"
1143      ])
1144    if test $ssp_cv_cxx = yes; then
1145      CXXFLAGS="$CXXFLAGS -fstack-protector"
1146      AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.])
1147    fi
1148  fi
1149])
1150
1151AC_DEFUN([GCC_STACK_PROTECTOR],[
1152  GCC_STACK_PROTECT_LIB
1153
1154  AC_LANG_PUSH([C])
1155  GCC_STACK_PROTECT_CC
1156  AC_LANG_POP([C])
1157
1158  AC_LANG_PUSH([C++])
1159  GCC_STACK_PROTECT_CXX
1160  AC_LANG_POP([C++])
1161])
1162
1163
1164
1165AC_DEFUN([SAMHAIN_POSIX],[
1166        AC_MSG_CHECKING([whether _POSIX_SOURCE is necessary])
1167        AC_TRY_COMPILE([#include <stdio.h>
1168void fileno(int);int fdopen(int, char *); ],,
1169        [
1170        AC_MSG_RESULT(yes)
1171        AC_DEFINE([_POSIX_SOURCE],1,[Define if POSIX functions are required])
1172        ],
1173        [AC_MSG_RESULT(no)])
1174])dnl
1175
1176dnl checks for a known 64 bit programming environment
1177dnl AC_RUN_IFELSE(PROGRAM,
1178dnl               [ACTION-IF-TRUE], [ACTION-IF-FALSE],
1179dnl               [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
1180dnl
1181AC_DEFUN([SAMHAIN_PRG_ENV],[
1182    AC_MSG_CHECKING([for a known 64 bit programming environment])
1183    # Compile and run a program that determines the programming environment
1184    AC_RUN_IFELSE([
1185      AC_LANG_SOURCE([[
1186#include <stdio.h>
1187int main(int argc,char **argv)
1188{
1189  if (argc > 1) {
1190#if defined(__arch64__)
1191  printf("__arch64__\n");
1192#elif defined(__ia64__)
1193  printf("__ia64__\n");
1194#elif defined(__x86_64__)
1195  printf("__x86_64__\n");
1196#elif defined(__LP64__)
1197  printf("__LP64__\n");
1198#elif defined(__64BIT__)
1199  printf("__64BIT__\n");
1200#elif defined(_LP64)
1201  printf("_LP64\n");
1202#elif defined(_M_IA64)
1203  printf("_M_IA64\n");
1204#elif defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64)
1205  printf("_MIPS_64\n");
1206#else
1207choke me
1208#endif
1209  }
1210  return 0;
1211}
1212      ]])
1213    ],[
1214      # Program compiled and ran, so get version by adding argument.
1215      samhain_prg_ENV=`./conftest$ac_exeext x`
1216      samhain_64=yes
1217      AC_MSG_RESULT([$samhain_prg_ENV])
1218    ],[
1219      AC_MSG_RESULT([none])
1220        ],[
1221      AC_MSG_RESULT([none])
1222        ])
1223])dnl
1224
1225AC_DEFUN([SAMHAIN_X86_64],[
1226        AC_MSG_CHECKING([for x86_64])
1227        AC_TRY_RUN([
1228int main() {
1229__asm__ volatile (
1230"movq %rax, %rax"
1231);
1232return 0;
1233}
1234        ],
1235        [
1236        AC_MSG_RESULT(yes)
1237        samhain_64=yes
1238        tiger_src=sh_tiger1_64.c
1239        AC_DEFINE([TIGER_OPT_ASM],1,[Define to use tiger x86_64 optimized assembly])
1240        ],
1241        [
1242        AC_MSG_RESULT([no])
1243        ],[
1244        AC_MSG_RESULT([no])
1245        ])
1246])dnl
1247
1248
1249AC_DEFUN([SAMHAIN_64],[
1250samhain_64=no
1251tiger_src=sh_tiger1.c
1252#
1253# if sizeof(unsigned long) = 4, try compiler macros for 64bit
1254#
1255if test "x$ac_cv_sizeof_unsigned_long" = x4; then
1256  if test "x$ac_cv_sizeof_unsigned_long_long" = x8; then
1257        SAMHAIN_PRG_ENV
1258        if test "x$samhain_64" = xyes; then
1259          tiger_src=sh_tiger1_64.c
1260        fi
1261        #
1262        # if GCC and __i386__, use precompiled assembler
1263        #
1264        if test "x$GCC" = xyes; then
1265          AC_MSG_CHECKING([for non-apple non-cygwin i386])
1266          samhain_i386=no
1267          $CC -E -dM - < /dev/null | egrep '__i386__' >/dev/null 2>&1
1268          if test $? = 0; then
1269            # apples gcc does not understand the assembly we provide
1270            $CC -E -dM - < /dev/null | egrep '(__sun__|__APPLE__|__CYGWIN__)' >/dev/null 2>&1 || samhain_i386=yes
1271          fi
1272          if test "x$samhain_i386" = xyes; then
1273            tiger_src=sh_tiger1.s
1274            AC_DEFINE([TIGER_32_BIT_S],1,[Define to use tiger 32 bit i386 assembler])
1275          fi
1276          AC_MSG_RESULT([$samhain_i386])
1277        fi
1278        #
1279        #
1280        #
1281  else
1282        samhain_64=no
1283        tiger_src=sh_tiger1.c
1284  fi
1285else
1286  #
1287  # sizeof(unsigned long) = 8
1288  #
1289  tiger_src=sh_tiger1_64.c
1290  samhain_64=yes
1291  #
1292  # check for x86_64 (enables assembly optimizations)
1293  #
1294  if test "x$GCC" = xyes; then
1295    SAMHAIN_X86_64
1296  fi
1297fi
1298if test "x$samhain_64" = xyes; then
1299        AC_DEFINE([TIGER_64_BIT],1,[Define to use tiger 64 bit implementation])
1300fi
1301AC_MSG_CHECKING([for 64 bit environment])
1302AC_MSG_RESULT([$samhain_64])
1303AC_MSG_CHECKING([for tiger source to use])
1304AC_MSG_RESULT([$tiger_src])
1305AC_SUBST(tiger_src)
1306])dnl
1307
1308AC_DEFUN([sh_CHECK_POSIX_ACL],
1309[
1310  AC_CHECK_HEADERS(sys/acl.h)
1311  if test $ac_cv_header_sys_acl_h = yes; then
1312
1313        AC_CHECK_LIB([acl], [acl_get_file], sh_lacl=yes, sh_lacl=no)
1314        if test x"$sh_lacl" = xyes; then
1315                LIBACL=-lacl
1316        else
1317                LIBACL=
1318        fi
1319
1320        OLDLIBS="$LIBS"
1321        LIBS="$LIBS $LIBACL"
1322        AC_CHECK_FUNCS([acl_free acl_get_file acl_get_fd],
1323                       [sh_facl=yes],[sh_facl=no])
1324        LIBS="$OLDLIBS"
1325
1326        if test x"$sh_facl" = xyes; then
1327          AC_DEFINE(USE_ACL, 1, [Define if you want ACL support.])
1328          LIBS="$LIBS $LIBACL"
1329        fi
1330  fi
1331])
1332
1333AC_DEFUN([sh_CHECK_XATTR],
1334[
1335  AC_CHECK_HEADERS(attr/xattr.h)
1336  if test $ac_cv_header_attr_xattr_h = yes; then
1337
1338        AC_CHECK_LIB([attr], [getxattr], sh_lattr=yes, sh_lattr=no)
1339        if test x"$sh_lattr" = xyes; then
1340                LIBATTR=-lattr
1341        else
1342                LIBATTR=
1343        fi
1344 
1345        OLDLIBS="$LIBS"
1346        LIBS="$LIBS $LIBATTR"
1347        AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr],
1348                       [sh_fattr=yes],[sh_fattr=no])
1349        LIBS="$OLDLIBS"
1350
1351        if test x"$sh_fattr" = xyes; then
1352          AC_DEFINE(USE_XATTR, 1, [Define if you want extended attributes support.])
1353          LIBS="$LIBS $LIBATTR"
1354        fi
1355  fi
1356])
1357
1358dnl Autoconf macros for libprelude
1359dnl $id$
1360
1361# Modified for LIBPRELUDE -- Yoann Vandoorselaere
1362# Modified for LIBGNUTLS -- nmav
1363# Configure paths for LIBGCRYPT
1364# Shamelessly stolen from the one of XDELTA by Owen Taylor
1365# Werner Koch   99-12-09
1366
1367dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
1368dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
1369dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
1370dnl
1371AC_DEFUN([AM_PATH_LIBPRELUDE],
1372[dnl
1373dnl Get the cflags and libraries from the libprelude-config script
1374dnl
1375dnl AC_ARG_WITH(libprelude-prefix,
1376dnl          [  --with-libprelude-prefix=PFX   Prefix where libprelude is installed (optional)],
1377dnl          libprelude_config_prefix="$withval", libprelude_config_prefix="")
1378dnl
1379dnl  if test x$libprelude_config_prefix != x ; then
1380dnl     if test x${LIBPRELUDE_CONFIG+set} != xset ; then
1381dnl        LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
1382dnl     fi
1383dnl  fi
1384dnl
1385dnl  AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
1386  min_libprelude_version=ifelse([$1], ,0.1.0,$1)
1387  AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
1388  no_libprelude=""
1389  if test "$LIBPRELUDE_CONFIG" = "no" ; then
1390    no_libprelude=yes
1391  else
1392    LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
1393    LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
1394    LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
1395    LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
1396    LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
1397    LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
1398    libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
1399
1400
1401      ac_save_CFLAGS="$CFLAGS"
1402      ac_save_LDFLAGS="$LDFLAGS"
1403      ac_save_LIBS="$LIBS"
1404      CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
1405      LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1406      LIBS="$LIBS $LIBPRELUDE_LIBS"
1407dnl
1408dnl Now check if the installed libprelude is sufficiently new. Also sanity
1409dnl checks the results of libprelude-config to some extent
1410dnl
1411      rm -f conf.libpreludetest
1412      AC_TRY_RUN([
1413#include <stdio.h>
1414#include <stdlib.h>
1415#include <string.h>
1416#include <libprelude/prelude.h>
1417
1418int
1419main ()
1420{
1421    system ("touch conf.libpreludetest");
1422
1423    if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
1424    {
1425      printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
1426             "$libprelude_config_version", prelude_check_version(NULL) );
1427      printf("*** was found! If libprelude-config was correct, then it is best\n");
1428      printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
1429      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1430      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1431      printf("*** required on your system.\n");
1432      printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
1433      printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
1434      printf("*** before re-running configure\n");
1435    }
1436    else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
1437    {
1438      printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
1439      printf("*** library (version %s)\n", prelude_check_version(NULL) );
1440    }
1441    else
1442    {
1443      if ( prelude_check_version( "$min_libprelude_version" ) )
1444      {
1445        return 0;
1446      }
1447     else
1448      {
1449        printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
1450                prelude_check_version(NULL) );
1451        printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
1452               "$min_libprelude_version" );
1453        printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
1454        printf("*** \n");
1455        printf("*** If you have already installed a sufficiently new version, this error\n");
1456        printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
1457        printf("*** being found. The easiest way to fix this is to remove the old version\n");
1458        printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
1459        printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
1460        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1461        printf("*** so that the correct libraries are found at run-time))\n");
1462      }
1463    }
1464  return 1;
1465}
1466],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1467       CFLAGS="$ac_save_CFLAGS"
1468       LIBS="$ac_save_LIBS"
1469       LDFLAGS="$ac_save_LDFLAGS"
1470  fi
1471
1472  if test "x$no_libprelude" = x ; then
1473     AC_MSG_RESULT(yes)
1474     ifelse([$2], , :, [$2])
1475  else
1476     if test -f conf.libpreludetest ; then
1477        :
1478     else
1479        AC_MSG_RESULT(no)
1480     fi
1481     if test "$LIBPRELUDE_CONFIG" = "no" ; then
1482       echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
1483       echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
1484       echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
1485       echo "*** full path to libprelude-config."
1486     else
1487       if test -f conf.libpreludetest ; then
1488        :
1489       else
1490          echo "*** Could not run libprelude test program, checking why..."
1491          CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
1492          LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1493          LIBS="$LIBS $LIBPRELUDE_LIBS"
1494          AC_TRY_LINK([
1495#include <stdio.h>
1496#include <stdlib.h>
1497#include <string.h>
1498#include <libprelude/prelude.h>
1499],      [ return !!prelude_check_version(NULL); ],
1500        [ echo "*** The test program compiled, but did not run. This usually means"
1501          echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
1502          echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
1503          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1504          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1505          echo "*** is required on your system"
1506          echo "***"
1507          echo "*** If you have an old version installed, it is best to remove it, although"
1508          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1509          echo "***" ],
1510        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1511          echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
1512          echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
1513          echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
1514          CFLAGS="$ac_save_CFLAGS"
1515          LDFLAGS="$ac_save_LDFLAGS"
1516          LIBS="$ac_save_LIBS"
1517       fi
1518     fi
1519     LIBPRELUDE_CFLAGS=""
1520     LIBPRELUDE_LDFLAGS=""
1521     LIBPRELUDE_LIBS=""
1522     ifelse([$3], , :, [$3])
1523  fi
1524  rm -f conf.libpreludetest
1525  AC_SUBST(LIBPRELUDE_CFLAGS)
1526  AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
1527  AC_SUBST(LIBPRELUDE_LDFLAGS)
1528  AC_SUBST(LIBPRELUDE_LIBS)
1529  AC_SUBST(LIBPRELUDE_PREFIX)
1530  AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
1531])
1532
1533
1534##### http://autoconf-archive.cryp.to/acx_pthread.html
1535#
1536# SYNOPSIS
1537#
1538#   ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
1539#
1540# DESCRIPTION
1541#
1542#   This macro figures out how to build C programs using POSIX threads.
1543#   It sets the PTHREAD_LIBS output variable to the threads library and
1544#   linker flags, and the PTHREAD_CFLAGS output variable to any special
1545#   C compiler flags that are needed. (The user can also force certain
1546#   compiler flags/libs to be tested by setting these environment
1547#   variables.)
1548#
1549#   Also sets PTHREAD_CC to any special C compiler that is needed for
1550#   multi-threaded programs (defaults to the value of CC otherwise).
1551#   (This is necessary on AIX to use the special cc_r compiler alias.)
1552#
1553#   NOTE: You are assumed to not only compile your program with these
1554#   flags, but also link it with them as well. e.g. you should link
1555#   with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
1556#   $LIBS
1557#
1558#   If you are only building threads programs, you may wish to use
1559#   these variables in your default LIBS, CFLAGS, and CC:
1560#
1561#          LIBS="$PTHREAD_LIBS $LIBS"
1562#          CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1563#          CC="$PTHREAD_CC"
1564#
1565#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
1566#   constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
1567#   that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
1568#
1569#   ACTION-IF-FOUND is a list of shell commands to run if a threads
1570#   library is found, and ACTION-IF-NOT-FOUND is a list of commands to
1571#   run it if it is not found. If ACTION-IF-FOUND is not specified, the
1572#   default action will define HAVE_PTHREAD.
1573#
1574#   Please let the authors know if this macro fails on any platform, or
1575#   if you have any other suggestions or comments. This macro was based
1576#   on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
1577#   (with help from M. Frigo), as well as ac_pthread and hb_pthread
1578#   macros posted by Alejandro Forero Cuervo to the autoconf macro
1579#   repository. We are also grateful for the helpful feedback of
1580#   numerous users.
1581#
1582# LAST MODIFICATION
1583#
1584#   2007-07-29
1585#
1586# COPYLEFT
1587#
1588#   Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
1589#
1590#   This program is free software: you can redistribute it and/or
1591#   modify it under the terms of the GNU General Public License as
1592#   published by the Free Software Foundation, either version 3 of the
1593#   License, or (at your option) any later version.
1594#
1595#   This program is distributed in the hope that it will be useful, but
1596#   WITHOUT ANY WARRANTY; without even the implied warranty of
1597#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1598#   General Public License for more details.
1599#
1600#   You should have received a copy of the GNU General Public License
1601#   along with this program. If not, see
1602#   <http://www.gnu.org/licenses/>.
1603#
1604#   As a special exception, the respective Autoconf Macro's copyright
1605#   owner gives unlimited permission to copy, distribute and modify the
1606#   configure scripts that are the output of Autoconf when processing
1607#   the Macro. You need not follow the terms of the GNU General Public
1608#   License when using or distributing such scripts, even though
1609#   portions of the text of the Macro appear in them. The GNU General
1610#   Public License (GPL) does govern all other use of the material that
1611#   constitutes the Autoconf Macro.
1612#
1613#   This special exception to the GPL applies to versions of the
1614#   Autoconf Macro released by the Autoconf Macro Archive. When you
1615#   make and distribute a modified version of the Autoconf Macro, you
1616#   may extend this special exception to the GPL to apply to your
1617#   modified version as well.
1618
1619AC_DEFUN([ACX_PTHREAD], [
1620AC_REQUIRE([AC_CANONICAL_HOST])
1621AC_LANG_SAVE
1622AC_LANG_C
1623acx_pthread_ok=no
1624
1625# We used to check for pthread.h first, but this fails if pthread.h
1626# requires special compiler flags (e.g. on True64 or Sequent).
1627# It gets checked for in the link test anyway.
1628
1629# First of all, check if the user has set any of the PTHREAD_LIBS,
1630# etcetera environment variables, and if threads linking works using
1631# them:
1632if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
1633        save_CFLAGS="$CFLAGS"
1634        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1635        save_LIBS="$LIBS"
1636        LIBS="$PTHREAD_LIBS $LIBS"
1637        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
1638        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
1639        AC_MSG_RESULT($acx_pthread_ok)
1640        if test x"$acx_pthread_ok" = xno; then
1641                PTHREAD_LIBS=""
1642                PTHREAD_CFLAGS=""
1643        fi
1644        LIBS="$save_LIBS"
1645        CFLAGS="$save_CFLAGS"
1646fi
1647
1648# We must check for the threads library under a number of different
1649# names; the ordering is very important because some systems
1650# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
1651# libraries is broken (non-POSIX).
1652
1653# Create a list of thread flags to try.  Items starting with a "-" are
1654# C compiler flags, and other items are library names, except for "none"
1655# which indicates that we try without any flags at all, and "pthread-config"
1656# which is a program returning the flags for the Pth emulation library.
1657
1658acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
1659
1660# The ordering *is* (sometimes) important.  Some notes on the
1661# individual items follow:
1662
1663# pthreads: AIX (must check this before -lpthread)
1664# none: in case threads are in libc; should be tried before -Kthread and
1665#       other compiler flags to prevent continual compiler warnings
1666# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
1667# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
1668# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
1669# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
1670# -pthreads: Solaris/gcc
1671# -mthreads: Mingw32/gcc, Lynx/gcc
1672# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
1673#      doesn't hurt to check since this sometimes defines pthreads too;
1674#      also defines -D_REENTRANT)
1675#      ... -mt is also the pthreads flag for HP/aCC
1676# pthread: Linux, etcetera
1677# --thread-safe: KAI C++
1678# pthread-config: use pthread-config program (for GNU Pth library)
1679
1680case "${host_cpu}-${host_os}" in
1681        *solaris*)
1682
1683        # On Solaris (at least, for some versions), libc contains stubbed
1684        # (non-functional) versions of the pthreads routines, so link-based
1685        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
1686        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
1687        # a function called by this macro, so we could check for that, but
1688        # who knows whether they'll stub that too in a future libc.)  So,
1689        # we'll just look for -pthreads and -lpthread first:
1690
1691        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
1692        ;;
1693esac
1694
1695if test x"$acx_pthread_ok" = xno; then
1696for flag in $acx_pthread_flags; do
1697
1698        case $flag in
1699                none)
1700                AC_MSG_CHECKING([whether pthreads work without any flags])
1701                ;;
1702
1703                -pthread)
1704                AC_MSG_CHECKING([whether pthreads work with $flag])
1705                PTHREAD_CFLAGS="$flag"
1706                PTHREAD_LDFLAGS="$flag"
1707                ;;
1708
1709                -*)
1710                AC_MSG_CHECKING([whether pthreads work with $flag])
1711                PTHREAD_CFLAGS="$flag"
1712                ;;
1713
1714                pthread-config)
1715                AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
1716                if test x"$acx_pthread_config" = xno; then continue; fi
1717                PTHREAD_CFLAGS="`pthread-config --cflags`"
1718                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
1719                ;;
1720
1721                *)
1722                AC_MSG_CHECKING([for the pthreads library -l$flag])
1723                PTHREAD_LIBS="-l$flag"
1724                ;;
1725        esac
1726
1727        save_LIBS="$LIBS"
1728        save_CFLAGS="$CFLAGS"
1729        save_LDFLAGS="$LDFLAGS"
1730        LIBS="$PTHREAD_LIBS $LIBS"
1731        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1732        LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
1733
1734        # Check for various functions.  We must include pthread.h,
1735        # since some functions may be macros.  (On the Sequent, we
1736        # need a special flag -Kthread to make this header compile.)
1737        # We check for pthread_join because it is in -lpthread on IRIX
1738        # while pthread_create is in libc.  We check for pthread_attr_init
1739        # due to DEC craziness with -lpthreads.  We check for
1740        # pthread_cleanup_push because it is one of the few pthread
1741        # functions on Solaris that doesn't have a non-functional libc stub.
1742        # We try pthread_create on general principles.
1743        AC_TRY_LINK([#include <pthread.h>],
1744                    [pthread_t th; pthread_join(th, 0);
1745                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
1746                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
1747                    [acx_pthread_ok=yes])
1748
1749        LIBS="$save_LIBS"
1750        LDFLAGS="$save_LDFLAGS"
1751        CFLAGS="$save_CFLAGS"
1752
1753        AC_MSG_RESULT($acx_pthread_ok)
1754        if test "x$acx_pthread_ok" = xyes; then
1755                break;
1756        fi
1757
1758        PTHREAD_LIBS=""
1759        PTHREAD_CFLAGS=""
1760        PTHREAD_LDFLAGS=""
1761done
1762fi
1763
1764# Various other checks:
1765if test "x$acx_pthread_ok" = xyes; then
1766        save_LIBS="$LIBS"
1767        LIBS="$PTHREAD_LIBS $LIBS"
1768        save_CFLAGS="$CFLAGS"
1769        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1770
1771        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
1772        AC_MSG_CHECKING([for joinable pthread attribute])
1773        attr_name=unknown
1774        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
1775            AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
1776                        [attr_name=$attr; break])
1777        done
1778        AC_MSG_RESULT($attr_name)
1779        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
1780            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
1781                               [Define to necessary symbol if this constant
1782                                uses a non-standard name on your system.])
1783        fi
1784
1785        AC_MSG_CHECKING([if more special flags are required for pthreads])
1786        flag=no
1787        case "${host_cpu}-${host_os}" in
1788            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
1789            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
1790        esac
1791        AC_MSG_RESULT(${flag})
1792        if test "x$flag" != xno; then
1793            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
1794        fi
1795
1796        # Detect PTHREAD_MUTEX_RECURSIVE
1797        AC_MSG_CHECKING([for recursive mutexes])
1798        mutex_recursive=no
1799        AC_TRY_LINK([
1800#define _XOPEN_SOURCE 500
1801#include <pthread.h>], [
1802pthread_mutexattr_t   mta;
1803pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);
1804return 0;],[mutex_recursive=yes])
1805        if test "x$mutex_recursive" = "xyes"
1806        then
1807          AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE,1,[Define if you have recursive mutexes.])
1808        fi
1809        AC_MSG_RESULT($mutex_recursive)
1810
1811        LIBS="$save_LIBS"
1812        CFLAGS="$save_CFLAGS"
1813
1814        # More AIX lossage: must compile with xlc_r or cc_r
1815        if test x"$GCC" != xyes; then
1816          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
1817        else
1818          PTHREAD_CC=$CC
1819        fi
1820else
1821        PTHREAD_CC="$CC"
1822fi
1823
1824AC_SUBST(PTHREAD_LIBS)
1825AC_SUBST(PTHREAD_CFLAGS)
1826AC_SUBST(PTHREAD_LDFLAGS)
1827AC_SUBST(PTHREAD_CC)
1828
1829# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
1830if test x"$acx_pthread_ok" = xyes; then
1831        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
1832        :
1833else
1834        acx_pthread_ok=no
1835        $2
1836fi
1837AC_LANG_RESTORE
1838])dnl ACX_PTHREAD
1839
1840dnl *-*wedit:notab*-*  Please keep this as the last line.
1841
Note: See TracBrowser for help on using the repository browser.