1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Macros that test for specific, unclassified, features.
4 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # As a special exception, the Free Software Foundation gives unlimited
21 # permission to copy, distribute and modify the configure scripts that
22 # are the output of Autoconf. You need not follow the terms of the GNU
23 # General Public License when using or distributing such scripts, even
24 # though portions of the text of Autoconf appear in them. The GNU
25 # General Public License (GPL) does govern all other use of the material
26 # that constitutes the Autoconf program.
28 # Certain portions of the Autoconf source text are designed to be copied
29 # (in certain cases, depending on the input) into the output of
30 # Autoconf. We call these the "data" portions. The rest of the Autoconf
31 # source text consists of comments plus executable code that decides which
32 # of the data portions to output in any given case. We call these
33 # comments and executable code the "non-data" portions. Autoconf never
34 # copies any of the non-data portions into its output.
36 # This special exception to the GPL applies to versions of Autoconf
37 # released by the Free Software Foundation. When you make and
38 # distribute a modified version of Autoconf, you may extend this special
39 # exception to the GPL to apply to your modified version as well, *unless*
40 # your modified version has the potential to copy into its output some
41 # of the text that was the non-data portion of the version that you started
42 # with. (In other words, unless your change moves or copies text from
43 # the non-data portions to the data portions.) If your modification has
44 # such potential, you must delete any notice of this special exception
45 # to the GPL from your modified version.
47 # Written by David MacKenzie, with help from
48 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
49 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
52 ## ------------------------- ##
53 ## Checks for declarations. ##
54 ## ------------------------- ##
59 AN_IDENTIFIER([sys_siglist], [AC_CHECK_DECLS([sys_siglist])])
60 AU_DEFUN([AC_DECL_SYS_SIGLIST],
61 [AC_CHECK_DECLS([sys_siglist],,,
63 /* NetBSD declares sys_siglist in unistd.h. */
68 ])# AC_DECL_SYS_SIGLIST
73 ## -------------------------------------- ##
74 ## Checks for operating system services. ##
75 ## -------------------------------------- ##
80 AC_DEFUN([AC_SYS_INTERPRETER],
81 [AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter,
86 (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null 2>&1)
87 if test $? -ne 69; then
88 ac_cv_sys_interpreter=yes
90 ac_cv_sys_interpreter=no
93 interpval=$ac_cv_sys_interpreter
97 AU_DEFUN([AC_HAVE_POUNDBANG],
99 [Remove this warning when you adjust your code to use
100 `AC_SYS_INTERPRETER'.])
103 AU_DEFUN([AC_ARG_ARRAY], [],
104 [$0 is no longer implemented: don't do unportable things
105 with arguments. Remove this warning when you adjust your code.])
108 # _AC_SYS_LARGEFILE_TEST_INCLUDES
109 # -------------------------------
110 m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
111 [@%:@include <sys/types.h>
112 /* Check that off_t can represent 2**63 - 1 correctly.
113 We can't simply define LARGE_OFF_T to be 9223372036854775807,
114 since some C++ compilers masquerading as C compilers
115 incorrectly reject 9223372036854775807. */
116 @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
117 int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
118 && LARGE_OFF_T % 2147483647 == 1)
123 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
126 # PROLOGUE, [FUNCTION-BODY])
127 # ----------------------------------------------------------
128 m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
129 [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
131 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
132 [AC_LANG_PROGRAM([$5], [$6])],
134 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
135 [AC_LANG_PROGRAM([@%:@define $1 $2
143 *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
146 ])# _AC_SYS_LARGEFILE_MACRO_VALUE
151 # By default, many hosts won't let programs access large files;
152 # one must use special compiler options to get large-file access to work.
153 # For more details about this brain damage please see:
154 # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
155 AC_DEFUN([AC_SYS_LARGEFILE],
156 [AC_ARG_ENABLE(largefile,
157 [ --disable-largefile omit support for large files])
158 if test "$enable_largefile" != no; then
160 AC_CACHE_CHECK([for special C compiler options needed for large files],
161 ac_cv_sys_largefile_CC,
162 [ac_cv_sys_largefile_CC=no
163 if test "$GCC" != yes; then
166 # IRIX 6.2 and later do not support large files by default,
167 # so use the C compiler's -n32 option if that helps.
168 AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
169 AC_COMPILE_IFELSE([], [break])
171 AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
175 rm -f conftest.$ac_ext
177 if test "$ac_cv_sys_largefile_CC" != no; then
178 CC=$CC$ac_cv_sys_largefile_CC
181 _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
182 ac_cv_sys_file_offset_bits,
183 [Number of bits in a file offset, on hosts where this is settable.],
184 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
185 if test $ac_cv_sys_file_offset_bits = unknown; then
186 _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
187 ac_cv_sys_large_files,
188 [Define for large files, on AIX-style hosts.],
189 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
195 # AC_SYS_LONG_FILE_NAMES
196 # ----------------------
197 # Security: use a temporary directory as the most portable way of
198 # creating files in /tmp securely. Removing them leaves a race
199 # condition, set -C is not portably guaranteed to use O_EXCL, so still
200 # leaves a race, and not all systems have the `mktemp' utility. We
201 # still test for existence first in case of broken systems where the
202 # mkdir succeeds even when the directory exists. Broken systems may
203 # retain a race, but they probably have other security problems
204 # anyway; this should be secure on well-behaved systems. In any case,
205 # use of `mktemp' is probably inappropriate here since it would fail in
206 # attempting to create different file names differing after the 14th
207 # character on file systems without long file names.
208 AC_DEFUN([AC_SYS_LONG_FILE_NAMES],
209 [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
210 [ac_cv_sys_long_file_names=yes
211 # Test for long file names in all the places we know might matter:
212 # . the current directory, where building will happen
213 # $prefix/lib where we will be installing things
214 # $exec_prefix/lib likewise
215 # $TMPDIR if set, where it might want to write temporary files
216 # /tmp where it might want to write temporary files
219 for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do
220 # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib
221 # in the usual case where exec_prefix is '${prefix}'.
223 . | /* | ?:[[\\/]]*) ;; #(
226 test -w "$ac_dir/." || continue # It is less confusing to not echo anything here.
228 (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue
229 ac_tf1=$ac_xdir/conftest9012345
230 ac_tf2=$ac_xdir/conftest9012346
231 touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" ||
232 ac_cv_sys_long_file_names=no
233 rm -f -r "$ac_xdir" 2>/dev/null
234 test $ac_cv_sys_long_file_names = no && break
236 if test $ac_cv_sys_long_file_names = yes; then
237 AC_DEFINE(HAVE_LONG_FILE_NAMES, 1,
238 [Define to 1 if you support file names longer than 14 characters.])
243 # AC_SYS_RESTARTABLE_SYSCALLS
244 # ---------------------------
245 # If the system automatically restarts a system call that is
246 # interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
247 AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS],
248 [AC_DIAGNOSE([obsolete],
249 [$0: AC_SYS_RESTARTABLE_SYSCALLS is useful only when supporting very
250 old systems that lack `sigaction' and `SA_RESTART'. Don't bother with
251 this macro unless you need to support very old systems like 4.2BSD and
253 AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
254 AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
255 [AC_RUN_IFELSE([AC_LANG_SOURCE(
256 [/* Exit 0 (true) if wait returns something other than -1,
257 i.e. the pid of the child, which means that wait was restarted
258 after getting the signal. */
262 #ifdef HAVE_SYS_WAIT_H
263 # include <sys/wait.h>
266 /* Some platforms explicitly require an extern "C" signal handler
269 extern "C" void ucatch (int dummy) { }
271 void ucatch (dummy) int dummy; { }
277 int i = fork (), status;
282 kill (getppid (), SIGINT);
287 signal (SIGINT, ucatch);
295 [ac_cv_sys_restartable_syscalls=yes],
296 [ac_cv_sys_restartable_syscalls=no])])
297 if test $ac_cv_sys_restartable_syscalls = yes; then
298 AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS, 1,
299 [Define to 1 if system calls automatically restart after
300 interruption by a signal.])
302 ])# AC_SYS_RESTARTABLE_SYSCALLS
305 # AC_SYS_POSIX_TERMIOS
306 # --------------------
307 AC_DEFUN([AC_SYS_POSIX_TERMIOS],
308 [AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
309 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
313 [/* SunOS 4.0.3 has termios.h but not the library calls. */
315 ac_cv_sys_posix_termios=yes,
316 ac_cv_sys_posix_termios=no)])
317 ])# AC_SYS_POSIX_TERMIOS
322 ## ------------------------------------ ##
323 ## Checks for not-quite-Unix variants. ##
324 ## ------------------------------------ ##
329 AC_DEFUN([AC_GNU_SOURCE],
330 [AH_VERBATIM([_GNU_SOURCE],
331 [/* Enable GNU extensions on systems that have them. */
335 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
336 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
337 AC_DEFINE([_GNU_SOURCE])
343 # Check for Cygwin. This is a way to set the right value for
345 AU_DEFUN([AC_CYGWIN],
348 *cygwin* ) CYGWIN=yes;;
351 ], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
352 matches *cygwin*])# AC_CYGWIN
357 # Check for EMX on OS/2. This is another way to set the right value
359 AU_DEFUN([AC_EMXOS2],
365 ], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
366 matches *emx*])# AC_EMXOS2
371 # Check for mingw32. This is another way to set the right value for
373 AU_DEFUN([AC_MINGW32],
376 *mingw32* ) MINGW32=yes;;
379 ], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
380 matches *mingw32*])# AC_MINGW32
383 # AC_USE_SYSTEM_EXTENSIONS
384 # ------------------------
385 # Enable extensions on systems that normally disable them,
386 # typically due to standards-conformance issues.
387 AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
389 AC_BEFORE([$0], [AC_COMPILE_IFELSE])
390 AC_BEFORE([$0], [AC_RUN_IFELSE])
392 AC_REQUIRE([AC_GNU_SOURCE])
394 AC_REQUIRE([AC_MINIX])
396 AH_VERBATIM([__EXTENSIONS__],
397 [/* Enable extensions on Solaris. */
398 #ifndef __EXTENSIONS__
399 # undef __EXTENSIONS__
401 #ifndef _POSIX_PTHREAD_SEMANTICS
402 # undef _POSIX_PTHREAD_SEMANTICS
404 #ifndef _TANDEM_SOURCE
405 # undef _TANDEM_SOURCE
407 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
408 [ac_cv_safe_to_define___extensions__],
411 # define __EXTENSIONS__ 1
412 AC_INCLUDES_DEFAULT])],
413 [ac_cv_safe_to_define___extensions__=yes],
414 [ac_cv_safe_to_define___extensions__=no])])
415 test $ac_cv_safe_to_define___extensions__ = yes &&
416 AC_DEFINE([__EXTENSIONS__])
417 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
418 AC_DEFINE([_TANDEM_SOURCE])
424 ## -------------------------- ##
425 ## Checks for UNIX variants. ##
426 ## -------------------------- ##
429 # These are kludges which should be replaced by a single POSIX check.
430 # They aren't cached, to discourage their use.
435 [AH_VERBATIM([_ALL_SOURCE],
436 [/* Define to 1 if on AIX 3.
437 System headers sometimes define this.
438 We just want to avoid a redefinition error message. */
439 @%:@ifndef _ALL_SOURCE
440 @%:@ undef _ALL_SOURCE
442 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
443 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
444 AC_MSG_CHECKING([for AIX])
450 [AC_MSG_RESULT([yes])
451 AC_DEFINE(_ALL_SOURCE)],
452 [AC_MSG_RESULT([no])])
459 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
460 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
461 AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
462 if test "$MINIX" = yes; then
463 AC_DEFINE(_POSIX_SOURCE, 1,
464 [Define to 1 if you need to in order for `stat' and other things to
466 AC_DEFINE(_POSIX_1_SOURCE, 2,
467 [Define to 2 if the system does not provide POSIX.1 features except
470 [Define to 1 if on MINIX.])
477 AC_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
482 AU_DEFUN([AC_XENIX_DIR],
483 [AC_MSG_CHECKING([for Xenix])
485 [#if defined M_XENIX && ! defined M_UNIX
488 [AC_MSG_RESULT([yes]); XENIX=yes],
489 [AC_MSG_RESULT([no]); XENIX=])
491 AC_HEADER_DIRENT[]dnl
493 [You shouldn't need to depend upon XENIX. Remove the
494 `AC_MSG_CHECKING', `AC_EGREP_CPP', and this warning if this part
495 of the test is useless.])
500 AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT])
505 AU_DEFUN([AC_IRIX_SUN],
507 AC_CHECK_LIB(sun, getpwnam)])
512 AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME])