~ubuntu-branches/ubuntu/lucid/autoconf/lucid

« back to all changes in this revision

Viewing changes to lib/autoconf/specific.m4

  • Committer: Bazaar Package Importer
  • Author(s): Ben Pfaff
  • Date: 2002-03-27 21:52:33 UTC
  • Revision ID: james.westby@ubuntu.com-20020327215233-r3gmxall0x27s306
Tags: upstream-2.53
ImportĀ upstreamĀ versionĀ 2.53

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
5
#
 
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)
 
9
# any later version.
 
10
#
 
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.
 
15
#
 
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
 
19
# 02111-1307, USA.
 
20
#
 
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.
 
28
#
 
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.
 
36
#
 
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.
 
47
#
 
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.
 
51
 
 
52
 
 
53
## ------------------------- ##
 
54
## Checks for declarations.  ##
 
55
## ------------------------- ##
 
56
 
 
57
 
 
58
# AC_DECL_SYS_SIGLIST
 
59
# -------------------
 
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,
 
63
[AC_COMPILE_IFELSE(
 
64
[AC_LANG_PROGRAM([#include <sys/types.h>
 
65
#include <signal.h>
 
66
/* NetBSD declares sys_siglist in unistd.h.  */
 
67
#if HAVE_UNISTD_H
 
68
# include <unistd.h>
 
69
#endif
 
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>
 
76
             or <unistd.h>.])
 
77
fi
 
78
])# AC_DECL_SYS_SIGLIST
 
79
 
 
80
 
 
81
 
 
82
 
 
83
## -------------------------------------- ##
 
84
## Checks for operating system services.  ##
 
85
## -------------------------------------- ##
 
86
 
 
87
 
 
88
# AC_SYS_INTERPRETER
 
89
# ------------------
 
90
AC_DEFUN([AC_SYS_INTERPRETER],
 
91
[AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter,
 
92
[echo '#! /bin/cat
 
93
exit 69
 
94
' >conftest
 
95
chmod u+x conftest
 
96
(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
 
97
if test $? -ne 69; then
 
98
   ac_cv_sys_interpreter=yes
 
99
else
 
100
   ac_cv_sys_interpreter=no
 
101
fi
 
102
rm -f conftest])
 
103
interpval=$ac_cv_sys_interpreter
 
104
])
 
105
 
 
106
 
 
107
AU_DEFUN([AC_HAVE_POUNDBANG],
 
108
[AC_SYS_INTERPRETER
 
109
AC_DIAGNOSE([obsolete],
 
110
[$0: Remove this warning when you adjust your code to use
 
111
      `AC_SYS_INTERPRETER'.])])
 
112
 
 
113
 
 
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.])])
 
118
 
 
119
 
 
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)
 
131
                      ? 1 : -1]];[]dnl
 
132
])
 
133
 
 
134
 
 
135
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
 
136
#                               CACHE-VAR,
 
137
#                               DESCRIPTION,
 
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],
 
142
[while :; do
 
143
  $3=no
 
144
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$5], [$6])],
 
145
                    [break])
 
146
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@define $1 $2
 
147
$5], [$6])],
 
148
                    [$3=$2; break])
 
149
  break
 
150
done])
 
151
if test "$$3" != no; then
 
152
  AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
 
153
fi
 
154
rm -f conftest*[]dnl
 
155
])# _AC_SYS_LARGEFILE_MACRO_VALUE
 
156
 
 
157
 
 
158
# AC_SYS_LARGEFILE
 
159
# ----------------
 
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
 
168
 
 
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
 
173
       ac_save_CC=$CC
 
174
       while :; do
 
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])
 
179
         CC="$CC -n32"
 
180
         AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
 
181
         break
 
182
       done
 
183
       CC=$ac_save_CC
 
184
       rm -f conftest.$ac_ext
 
185
    fi])
 
186
  if test "$ac_cv_sys_largefile_CC" != no; then
 
187
    CC=$CC$ac_cv_sys_largefile_CC
 
188
  fi
 
189
 
 
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])
 
198
fi
 
199
])# AC_SYS_LARGEFILE
 
200
 
 
201
 
 
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
 
226
#      /var/tmp         likewise
 
227
#      /usr/tmp         likewise
 
228
if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
 
229
  ac_tmpdirs=$TMPDIR
 
230
else
 
231
  ac_tmpdirs='/tmp /var/tmp /usr/tmp'
 
232
fi
 
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.
 
236
  ac_xdir=$ac_dir/cf$$
 
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
 
246
    break
 
247
  fi
 
248
  rm -rf $ac_xdir 2>/dev/null
 
249
done])
 
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.])
 
253
fi
 
254
])
 
255
 
 
256
 
 
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.  */
 
273
 
 
274
#include <sys/types.h>
 
275
#include <signal.h>
 
276
#if HAVE_UNISTD_H
 
277
# include <unistd.h>
 
278
#endif
 
279
#if HAVE_SYS_WAIT_H
 
280
# include <sys/wait.h>
 
281
#endif
 
282
 
 
283
/* Some platforms explicitly require an extern "C" signal handler
 
284
   when using C++. */
 
285
#ifdef __cplusplus
 
286
extern "C" void ucatch (int dummy) { }
 
287
#else
 
288
void ucatch (dummy) int dummy; { }
 
289
#endif
 
290
 
 
291
int
 
292
main ()
 
293
{
 
294
  int i = fork (), status;
 
295
 
 
296
  if (i == 0)
 
297
    {
 
298
      sleep (3);
 
299
      kill (getppid (), SIGINT);
 
300
      sleep (3);
 
301
      exit (0);
 
302
    }
 
303
 
 
304
  signal (SIGINT, ucatch);
 
305
 
 
306
  status = wait (&i);
 
307
  if (status == -1)
 
308
    wait (&i);
 
309
 
 
310
  exit (status == -1);
 
311
}])],
 
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.])
 
318
fi
 
319
])# AC_SYS_RESTARTABLE_SYSCALLS
 
320
 
 
321
 
 
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>
 
327
#include <unistd.h>
 
328
@%:@include <termios.h>],
 
329
             [/* SunOS 4.0.3 has termios.h but not the library calls.  */
 
330
   tcgetattr(0, 0);],
 
331
             ac_cv_sys_posix_termios=yes,
 
332
             ac_cv_sys_posix_termios=no)])
 
333
])# AC_SYS_POSIX_TERMIOS
 
334
 
 
335
 
 
336
 
 
337
 
 
338
## ------------------------------------ ##
 
339
## Checks for not-quite-Unix variants.  ##
 
340
## ------------------------------------ ##
 
341
 
 
342
 
 
343
# AC_CYGWIN
 
344
# ---------
 
345
# Check for Cygwin.  This is a way to set the right value for
 
346
# EXEEXT.
 
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
 
351
case $host_os in
 
352
  *cygwin* ) CYGWIN=yes;;
 
353
         * ) CYGWIN=no;;
 
354
esac
 
355
])# AC_CYGWIN
 
356
 
 
357
 
 
358
# AC_EMXOS2
 
359
# ---------
 
360
# Check for EMX on OS/2.  This is another way to set the right value
 
361
# for EXEEXT.
 
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
 
366
case $host_os in
 
367
  *emx* ) EMXOS2=yes;;
 
368
      * ) EMXOS2=no;;
 
369
esac
 
370
])# AC_EMXOS2
 
371
 
 
372
 
 
373
# AC_MINGW32
 
374
# ----------
 
375
# Check for mingw32.  This is another way to set the right value for
 
376
# EXEEXT.
 
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
 
381
case $host_os in
 
382
  *mingw32* ) MINGW32=yes;;
 
383
          * ) MINGW32=no;;
 
384
esac
 
385
])# AC_MINGW32
 
386
 
 
387
 
 
388
 
 
389
 
 
390
## -------------------------- ##
 
391
## Checks for UNIX variants.  ##
 
392
## -------------------------- ##
 
393
 
 
394
 
 
395
# These are kludges which should be replaced by a single POSIX check.
 
396
# They aren't cached, to discourage their use.
 
397
 
 
398
# AC_AIX
 
399
# ------
 
400
AC_DEFUN([AC_AIX],
 
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
 
407
@%:@endif])dnl
 
408
AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
 
409
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 
410
AC_MSG_CHECKING([for AIX])
 
411
AC_EGREP_CPP(yes,
 
412
[#ifdef _AIX
 
413
  yes
 
414
#endif
 
415
],
 
416
[AC_MSG_RESULT([yes])
 
417
AC_DEFINE(_ALL_SOURCE)],
 
418
[AC_MSG_RESULT([no])])
 
419
])# AC_AIX
 
420
 
 
421
 
 
422
# AC_MINIX
 
423
# --------
 
424
AC_DEFUN([AC_MINIX],
 
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
 
431
             work.])
 
432
  AC_DEFINE(_POSIX_1_SOURCE, 2,
 
433
            [Define to 2 if the system does not provide POSIX.1 features except
 
434
             with this defined.])
 
435
  AC_DEFINE(_MINIX, 1,
 
436
            [Define to 1 if on MINIX.])
 
437
fi
 
438
])# AC_MINIX
 
439
 
 
440
 
 
441
# AC_ISC_POSIX
 
442
# ------------
 
443
AC_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
 
444
 
 
445
 
 
446
# AC_XENIX_DIR
 
447
# ------------
 
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])
 
451
AC_EGREP_CPP(yes,
 
452
[#if defined(M_XENIX) && !defined(M_UNIX)
 
453
  yes
 
454
@%:@endif],
 
455
             [AC_MSG_RESULT([yes]); XENIX=yes],
 
456
             [AC_MSG_RESULT([no]); XENIX=])
 
457
 
 
458
AC_HEADER_DIRENT[]dnl
 
459
])
 
460
 
 
461
 
 
462
# AC_DYNIX_SEQ
 
463
# ------------
 
464
AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT])
 
465
 
 
466
 
 
467
# AC_IRIX_SUN
 
468
# -----------
 
469
AU_DEFUN([AC_IRIX_SUN],
 
470
[AC_FUNC_GETMNTENT
 
471
AC_CHECK_LIB(sun, getpwnam)])
 
472
 
 
473
 
 
474
# AC_SCO_INTL
 
475
# -----------
 
476
AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME])