source: trunk/acinclude.m4

Last change on this file was 583, checked in by katerina, 10 days ago

Fix for ticket #471 (autoreconf throws warnings/errors).

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