1
# This file is part of Autoconf. -*- Autoconf -*-
2
# Macros that test for specific, unclassified, features.
3
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
4
# Free Software Foundation, Inc.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2, or (at your option)
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
# As a special exception, the Free Software Foundation gives unlimited
22
# permission to copy, distribute and modify the configure scripts that
23
# are the output of Autoconf. You need not follow the terms of the GNU
24
# General Public License when using or distributing such scripts, even
25
# though portions of the text of Autoconf appear in them. The GNU
26
# General Public License (GPL) does govern all other use of the material
27
# that constitutes the Autoconf program.
29
# Certain portions of the Autoconf source text are designed to be copied
30
# (in certain cases, depending on the input) into the output of
31
# Autoconf. We call these the "data" portions. The rest of the Autoconf
32
# source text consists of comments plus executable code that decides which
33
# of the data portions to output in any given case. We call these
34
# comments and executable code the "non-data" portions. Autoconf never
35
# copies any of the non-data portions into its output.
37
# This special exception to the GPL applies to versions of Autoconf
38
# released by the Free Software Foundation. When you make and
39
# distribute a modified version of Autoconf, you may extend this special
40
# exception to the GPL to apply to your modified version as well, *unless*
41
# your modified version has the potential to copy into its output some
42
# of the text that was the non-data portion of the version that you started
43
# with. (In other words, unless your change moves or copies text from
44
# the non-data portions to the data portions.) If your modification has
45
# such potential, you must delete any notice of this special exception
46
# to the GPL from your modified version.
48
# Written by David MacKenzie, with help from
49
# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
50
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
53
## ------------------------- ##
54
## Checks for declarations. ##
55
## ------------------------- ##
60
AC_DEFUN([AC_DECL_SYS_SIGLIST],
61
[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
62
ac_cv_decl_sys_siglist,
64
[AC_LANG_PROGRAM([#include <sys/types.h>
66
/* NetBSD declares sys_siglist in unistd.h. */
70
], [char *msg = *(sys_siglist + 1);])],
71
[ac_cv_decl_sys_siglist=yes],
72
[ac_cv_decl_sys_siglist=no])])
73
if test $ac_cv_decl_sys_siglist = yes; then
74
AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
75
[Define to 1 if `sys_siglist' is declared by <signal.h>
78
])# AC_DECL_SYS_SIGLIST
83
## -------------------------------------- ##
84
## Checks for operating system services. ##
85
## -------------------------------------- ##
90
AC_DEFUN([AC_SYS_INTERPRETER],
91
[AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter,
96
(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
97
if test $? -ne 69; then
98
ac_cv_sys_interpreter=yes
100
ac_cv_sys_interpreter=no
103
interpval=$ac_cv_sys_interpreter
107
AU_DEFUN([AC_HAVE_POUNDBANG],
109
AC_DIAGNOSE([obsolete],
110
[$0: Remove this warning when you adjust your code to use
111
`AC_SYS_INTERPRETER'.])])
114
AU_DEFUN([AC_ARG_ARRAY],
115
[AC_DIAGNOSE([obsolete],
116
[$0: no longer implemented: don't do unportable things
117
with arguments. Remove this warning when you adjust your code.])])
120
# _AC_SYS_LARGEFILE_TEST_INCLUDES
121
# -------------------------------
122
m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
123
[@%:@include <sys/types.h>
124
/* Check that off_t can represent 2**63 - 1 correctly.
125
We can't simply define LARGE_OFF_T to be 9223372036854775807,
126
since some C++ compilers masquerading as C compilers
127
incorrectly reject 9223372036854775807. */
128
@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
129
int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
130
&& LARGE_OFF_T % 2147483647 == 1)
135
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
138
# [INCLUDES], [FUNCTION-BODY])
139
# ----------------------------------------------------------
140
m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
141
[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
144
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$5], [$6])],
146
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@define $1 $2
151
if test "$$3" != no; then
152
AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
155
])# _AC_SYS_LARGEFILE_MACRO_VALUE
160
# By default, many hosts won't let programs access large files;
161
# one must use special compiler options to get large-file access to work.
162
# For more details about this brain damage please see:
163
# http://www.sas.com/standards/large.file/x_open.20Mar96.html
164
AC_DEFUN([AC_SYS_LARGEFILE],
165
[AC_ARG_ENABLE(largefile,
166
[ --disable-largefile omit support for large files])
167
if test "$enable_largefile" != no; then
169
AC_CACHE_CHECK([for special C compiler options needed for large files],
170
ac_cv_sys_largefile_CC,
171
[ac_cv_sys_largefile_CC=no
172
if test "$GCC" != yes; then
175
# IRIX 6.2 and later do not support large files by default,
176
# so use the C compiler's -n32 option if that helps.
177
AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
178
AC_COMPILE_IFELSE([], [break])
180
AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
184
rm -f conftest.$ac_ext
186
if test "$ac_cv_sys_largefile_CC" != no; then
187
CC=$CC$ac_cv_sys_largefile_CC
190
_AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
191
ac_cv_sys_file_offset_bits,
192
[Number of bits in a file offset, on hosts where this is settable.],
193
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
194
_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
195
ac_cv_sys_large_files,
196
[Define for large files, on AIX-style hosts.],
197
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
202
# AC_SYS_LONG_FILE_NAMES
203
# ----------------------
204
# Security: use a temporary directory as the most portable way of
205
# creating files in /tmp securely. Removing them leaves a race
206
# condition, set -C is not portably guaranteed to use O_EXCL, so still
207
# leaves a race, and not all systems have the `mktemp' utility. We
208
# still test for existence first in case of broken systems where the
209
# mkdir succeeds even when the directory exists. Broken systems may
210
# retain a race, but they probably have other security problems
211
# anyway; this should be secure on well-behaved systems. In any case,
212
# use of `mktemp' is probably inappropriate here since it would fail in
213
# attempting to create different file names differing after the 14th
214
# character on file systems without long file names.
215
AC_DEFUN([AC_SYS_LONG_FILE_NAMES],
216
[AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
217
[ac_cv_sys_long_file_names=yes
218
# Test for long file names in all the places we know might matter:
219
# . the current directory, where building will happen
220
# $prefix/lib where we will be installing things
221
# $exec_prefix/lib likewise
222
# eval it to expand exec_prefix.
223
# $TMPDIR if set, where it might want to write temporary files
224
# if $TMPDIR is not set:
225
# /tmp where it might want to write temporary files
228
if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
231
ac_tmpdirs='/tmp /var/tmp /usr/tmp'
233
for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
234
test -d $ac_dir || continue
235
test -w $ac_dir || continue # It is less confusing to not echo anything here.
237
(umask 077 && mkdir $ac_xdir 2>/dev/null) || continue
238
ac_tf1=$ac_xdir/conftest9012345
239
ac_tf2=$ac_xdir/conftest9012346
240
(echo 1 >$ac_tf1) 2>/dev/null
241
(echo 2 >$ac_tf2) 2>/dev/null
242
ac_val=`cat $ac_tf1 2>/dev/null`
243
if test ! -f $ac_tf1 || test "$ac_val" != 1; then
244
ac_cv_sys_long_file_names=no
245
rm -rf $ac_xdir 2>/dev/null
248
rm -rf $ac_xdir 2>/dev/null
250
if test $ac_cv_sys_long_file_names = yes; then
251
AC_DEFINE(HAVE_LONG_FILE_NAMES, 1,
252
[Define to 1 if you support file names longer than 14 characters.])
257
# AC_SYS_RESTARTABLE_SYSCALLS
258
# ---------------------------
259
# If the system automatically restarts a system call that is
260
# interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
261
AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS],
262
[AC_DIAGNOSE([obsolete],
263
[$0: System call restartability is now typically set at runtime.
264
Remove this `AC_SYS_RESTARTABLE_SYSCALLS'
265
and adjust your code to use `sigaction' with `SA_RESTART' instead.])dnl
266
AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
267
AC_CHECK_HEADERS(unistd.h)
268
AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
269
[AC_RUN_IFELSE([AC_LANG_SOURCE(
270
[/* Exit 0 (true) if wait returns something other than -1,
271
i.e. the pid of the child, which means that wait was restarted
272
after getting the signal. */
274
#include <sys/types.h>
280
# include <sys/wait.h>
283
/* Some platforms explicitly require an extern "C" signal handler
286
extern "C" void ucatch (int dummy) { }
288
void ucatch (dummy) int dummy; { }
294
int i = fork (), status;
299
kill (getppid (), SIGINT);
304
signal (SIGINT, ucatch);
312
[ac_cv_sys_restartable_syscalls=yes],
313
[ac_cv_sys_restartable_syscalls=no])])
314
if test $ac_cv_sys_restartable_syscalls = yes; then
315
AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS, 1,
316
[Define to 1 if system calls automatically restart after
317
interruption by a signal.])
319
])# AC_SYS_RESTARTABLE_SYSCALLS
322
# AC_SYS_POSIX_TERMIOS
323
# --------------------
324
AC_DEFUN([AC_SYS_POSIX_TERMIOS],
325
[AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
326
[AC_TRY_LINK([#include <sys/types.h>
328
@%:@include <termios.h>],
329
[/* SunOS 4.0.3 has termios.h but not the library calls. */
331
ac_cv_sys_posix_termios=yes,
332
ac_cv_sys_posix_termios=no)])
333
])# AC_SYS_POSIX_TERMIOS
338
## ------------------------------------ ##
339
## Checks for not-quite-Unix variants. ##
340
## ------------------------------------ ##
345
# Check for Cygwin. This is a way to set the right value for
347
AU_DEFUN([AC_CYGWIN],
348
[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
349
AC_DIAGNOSE([obsolete],
350
[$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
352
*cygwin* ) CYGWIN=yes;;
360
# Check for EMX on OS/2. This is another way to set the right value
362
AU_DEFUN([AC_EMXOS2],
363
[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
364
AC_DIAGNOSE([obsolete],
365
[$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
375
# Check for mingw32. This is another way to set the right value for
377
AU_DEFUN([AC_MINGW32],
378
[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
379
AC_DIAGNOSE([obsolete],
380
[$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
382
*mingw32* ) MINGW32=yes;;
390
## -------------------------- ##
391
## Checks for UNIX variants. ##
392
## -------------------------- ##
395
# These are kludges which should be replaced by a single POSIX check.
396
# They aren't cached, to discourage their use.
401
[AH_VERBATIM([_ALL_SOURCE],
402
[/* Define to 1 if on AIX 3.
403
System headers sometimes define this.
404
We just want to avoid a redefinition error message. */
405
@%:@ifndef _ALL_SOURCE
406
@%:@ undef _ALL_SOURCE
408
AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
409
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
410
AC_MSG_CHECKING([for AIX])
416
[AC_MSG_RESULT([yes])
417
AC_DEFINE(_ALL_SOURCE)],
418
[AC_MSG_RESULT([no])])
425
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
426
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
427
AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
428
if test "$MINIX" = yes; then
429
AC_DEFINE(_POSIX_SOURCE, 1,
430
[Define to 1 if you need to in order for `stat' and other things to
432
AC_DEFINE(_POSIX_1_SOURCE, 2,
433
[Define to 2 if the system does not provide POSIX.1 features except
436
[Define to 1 if on MINIX.])
443
AC_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
448
AU_DEFUN(AC_XENIX_DIR,
449
[# You shouldn't need to depend upon XENIX. Remove this test if useless.
450
AC_MSG_CHECKING([for Xenix])
452
[#if defined(M_XENIX) && !defined(M_UNIX)
455
[AC_MSG_RESULT([yes]); XENIX=yes],
456
[AC_MSG_RESULT([no]); XENIX=])
458
AC_HEADER_DIRENT[]dnl
464
AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT])
469
AU_DEFUN([AC_IRIX_SUN],
471
AC_CHECK_LIB(sun, getpwnam)])
476
AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME])