Install msysDTK-1.0.1
[msysgit.git] / share / autoconf / autoconf / specific.m4
blobc4aff8dae8d8172bbfa174752b91b2205aeef7a1
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 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 2, or (at your option)
10 # 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, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, USA.
22 # As a special exception, the Free Software Foundation gives unlimited
23 # permission to copy, distribute and modify the configure scripts that
24 # are the output of Autoconf.  You need not follow the terms of the GNU
25 # General Public License when using or distributing such scripts, even
26 # though portions of the text of Autoconf appear in them.  The GNU
27 # General Public License (GPL) does govern all other use of the material
28 # that constitutes the Autoconf program.
30 # Certain portions of the Autoconf source text are designed to be copied
31 # (in certain cases, depending on the input) into the output of
32 # Autoconf.  We call these the "data" portions.  The rest of the Autoconf
33 # source text consists of comments plus executable code that decides which
34 # of the data portions to output in any given case.  We call these
35 # comments and executable code the "non-data" portions.  Autoconf never
36 # copies any of the non-data portions into its output.
38 # This special exception to the GPL applies to versions of Autoconf
39 # released by the Free Software Foundation.  When you make and
40 # distribute a modified version of Autoconf, you may extend this special
41 # exception to the GPL to apply to your modified version as well, *unless*
42 # your modified version has the potential to copy into its output some
43 # of the text that was the non-data portion of the version that you started
44 # with.  (In other words, unless your change moves or copies text from
45 # the non-data portions to the data portions.)  If your modification has
46 # such potential, you must delete any notice of this special exception
47 # to the GPL from your modified version.
49 # Written by David MacKenzie, with help from
50 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
51 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
54 ## ------------------------- ##
55 ## Checks for declarations.  ##
56 ## ------------------------- ##
59 # AC_DECL_SYS_SIGLIST
60 # -------------------
61 AN_IDENTIFIER([sys_siglist],     [AC_CHECK_DECLS([sys_siglist])])
62 AU_DEFUN([AC_DECL_SYS_SIGLIST],
63 [AC_CHECK_DECLS([sys_siglist])
64 ])# AC_DECL_SYS_SIGLIST
69 ## -------------------------------------- ##
70 ## Checks for operating system services.  ##
71 ## -------------------------------------- ##
74 # AC_SYS_INTERPRETER
75 # ------------------
76 AC_DEFUN([AC_SYS_INTERPRETER],
77 [AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter,
78 [echo '#! /bin/cat
79 exit 69
80 ' >conftest
81 chmod u+x conftest
82 (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
83 if test $? -ne 69; then
84    ac_cv_sys_interpreter=yes
85 else
86    ac_cv_sys_interpreter=no
88 rm -f conftest])
89 interpval=$ac_cv_sys_interpreter
93 AU_DEFUN([AC_HAVE_POUNDBANG],
94 [AC_SYS_INTERPRETER
95 AC_DIAGNOSE([obsolete],
96 [$0: Remove this warning when you adjust your code to use
97       `AC_SYS_INTERPRETER'.])])
100 AU_DEFUN([AC_ARG_ARRAY],
101 [AC_DIAGNOSE([obsolete],
102 [$0: no longer implemented: don't do unportable things
103 with arguments. Remove this warning when you adjust your code.])])
106 # _AC_SYS_LARGEFILE_TEST_INCLUDES
107 # -------------------------------
108 m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
109 [@%:@include <sys/types.h>
110  /* Check that off_t can represent 2**63 - 1 correctly.
111     We can't simply define LARGE_OFF_T to be 9223372036854775807,
112     since some C++ compilers masquerading as C compilers
113     incorrectly reject 9223372036854775807.  */
114 @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
115   int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
116                        && LARGE_OFF_T % 2147483647 == 1)
117                       ? 1 : -1]];[]dnl
121 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
122 #                               CACHE-VAR,
123 #                               DESCRIPTION,
124 #                               [INCLUDES], [FUNCTION-BODY])
125 # ----------------------------------------------------------
126 m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
127 [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
128 [while :; do
129   $3=no
130   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$5], [$6])],
131                     [break])
132   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@define $1 $2
133 $5], [$6])],
134                     [$3=$2; break])
135   break
136 done])
137 if test "$$3" != no; then
138   AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
140 rm -f conftest*[]dnl
141 ])# _AC_SYS_LARGEFILE_MACRO_VALUE
144 # AC_SYS_LARGEFILE
145 # ----------------
146 # By default, many hosts won't let programs access large files;
147 # one must use special compiler options to get large-file access to work.
148 # For more details about this brain damage please see:
149 # http://www.sas.com/standards/large.file/x_open.20Mar96.html
150 AC_DEFUN([AC_SYS_LARGEFILE],
151 [AC_ARG_ENABLE(largefile,
152                [  --disable-largefile     omit support for large files])
153 if test "$enable_largefile" != no; then
155   AC_CACHE_CHECK([for special C compiler options needed for large files],
156     ac_cv_sys_largefile_CC,
157     [ac_cv_sys_largefile_CC=no
158      if test "$GCC" != yes; then
159        ac_save_CC=$CC
160        while :; do
161          # IRIX 6.2 and later do not support large files by default,
162          # so use the C compiler's -n32 option if that helps.
163          AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
164          AC_COMPILE_IFELSE([], [break])
165          CC="$CC -n32"
166          AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
167          break
168        done
169        CC=$ac_save_CC
170        rm -f conftest.$ac_ext
171     fi])
172   if test "$ac_cv_sys_largefile_CC" != no; then
173     CC=$CC$ac_cv_sys_largefile_CC
174   fi
176   _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
177     ac_cv_sys_file_offset_bits,
178     [Number of bits in a file offset, on hosts where this is settable.],
179     [_AC_SYS_LARGEFILE_TEST_INCLUDES])
180   _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
181     ac_cv_sys_large_files,
182     [Define for large files, on AIX-style hosts.],
183     [_AC_SYS_LARGEFILE_TEST_INCLUDES])
185 ])# AC_SYS_LARGEFILE
188 # AC_SYS_LONG_FILE_NAMES
189 # ----------------------
190 # Security: use a temporary directory as the most portable way of
191 # creating files in /tmp securely.  Removing them leaves a race
192 # condition, set -C is not portably guaranteed to use O_EXCL, so still
193 # leaves a race, and not all systems have the `mktemp' utility.  We
194 # still test for existence first in case of broken systems where the
195 # mkdir succeeds even when the directory exists.  Broken systems may
196 # retain a race, but they probably have other security problems
197 # anyway; this should be secure on well-behaved systems.  In any case,
198 # use of `mktemp' is probably inappropriate here since it would fail in
199 # attempting to create different file names differing after the 14th
200 # character on file systems without long file names.
201 AC_DEFUN([AC_SYS_LONG_FILE_NAMES],
202 [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
203 [ac_cv_sys_long_file_names=yes
204 # Test for long file names in all the places we know might matter:
205 #      .                the current directory, where building will happen
206 #      $prefix/lib      where we will be installing things
207 #      $exec_prefix/lib likewise
208 # eval it to expand exec_prefix.
209 #      $TMPDIR          if set, where it might want to write temporary files
210 # if $TMPDIR is not set:
211 #      /tmp             where it might want to write temporary files
212 #      /var/tmp         likewise
213 #      /usr/tmp         likewise
214 if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
215   ac_tmpdirs=$TMPDIR
216 else
217   ac_tmpdirs='/tmp /var/tmp /usr/tmp'
219 for ac_dir in  . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
220   test -d $ac_dir || continue
221   test -w $ac_dir || continue # It is less confusing to not echo anything here.
222   ac_xdir=$ac_dir/cf$$
223   (umask 077 && mkdir $ac_xdir 2>/dev/null) || continue
224   ac_tf1=$ac_xdir/conftest9012345
225   ac_tf2=$ac_xdir/conftest9012346
226   (echo 1 >$ac_tf1) 2>/dev/null
227   (echo 2 >$ac_tf2) 2>/dev/null
228   ac_val=`cat $ac_tf1 2>/dev/null`
229   if test ! -f $ac_tf1 || test "$ac_val" != 1; then
230     ac_cv_sys_long_file_names=no
231     rm -rf $ac_xdir 2>/dev/null
232     break
233   fi
234   rm -rf $ac_xdir 2>/dev/null
235 done])
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: System call restartability is now typically set at runtime.
250 Remove this `AC_SYS_RESTARTABLE_SYSCALLS'
251 and adjust your code to use `sigaction' with `SA_RESTART' instead.])dnl
252 AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
253 AC_CHECK_HEADERS(unistd.h)
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.  */
260 #include <sys/types.h>
261 #include <signal.h>
262 #if HAVE_UNISTD_H
263 # include <unistd.h>
264 #endif
265 #if HAVE_SYS_WAIT_H
266 # include <sys/wait.h>
267 #endif
269 /* Some platforms explicitly require an extern "C" signal handler
270    when using C++. */
271 #ifdef __cplusplus
272 extern "C" void ucatch (int dummy) { }
273 #else
274 void ucatch (dummy) int dummy; { }
275 #endif
278 main ()
280   int i = fork (), status;
282   if (i == 0)
283     {
284       sleep (3);
285       kill (getppid (), SIGINT);
286       sleep (3);
287       exit (0);
288     }
290   signal (SIGINT, ucatch);
292   status = wait (&i);
293   if (status == -1)
294     wait (&i);
296   exit (status == -1);
297 }])],
298                [ac_cv_sys_restartable_syscalls=yes],
299                [ac_cv_sys_restartable_syscalls=no])])
300 if test $ac_cv_sys_restartable_syscalls = yes; then
301   AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS, 1,
302             [Define to 1 if system calls automatically restart after
303              interruption by a signal.])
305 ])# AC_SYS_RESTARTABLE_SYSCALLS
308 # AC_SYS_POSIX_TERMIOS
309 # --------------------
310 AC_DEFUN([AC_SYS_POSIX_TERMIOS],
311 [AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
312 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
313 #include <unistd.h>
314 #include <termios.h>
316              [/* SunOS 4.0.3 has termios.h but not the library calls.  */
317    tcgetattr(0, 0);])],
318              ac_cv_sys_posix_termios=yes,
319              ac_cv_sys_posix_termios=no)])
320 ])# AC_SYS_POSIX_TERMIOS
325 ## ------------------------------------ ##
326 ## Checks for not-quite-Unix variants.  ##
327 ## ------------------------------------ ##
330 # AC_GNU_SOURCE
331 # --------------
332 AC_DEFUN([AC_GNU_SOURCE],
333 [AH_VERBATIM([_GNU_SOURCE],
334 [/* Enable GNU extensions on systems that have them.  */
335 #ifndef _GNU_SOURCE
336 # undef _GNU_SOURCE
337 #endif])dnl
338 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
339 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
340 AC_DEFINE([_GNU_SOURCE])
344 # AC_CYGWIN
345 # ---------
346 # Check for Cygwin.  This is a way to set the right value for
347 # EXEEXT.
348 AU_DEFUN([AC_CYGWIN],
349 [AC_CANONICAL_HOST
350 AC_DIAGNOSE([obsolete],
351             [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
352 case $host_os in
353   *cygwin* ) CYGWIN=yes;;
354          * ) CYGWIN=no;;
355 esac
356 ])# AC_CYGWIN
359 # AC_EMXOS2
360 # ---------
361 # Check for EMX on OS/2.  This is another way to set the right value
362 # for EXEEXT.
363 AU_DEFUN([AC_EMXOS2],
364 [AC_CANONICAL_HOST
365 AC_DIAGNOSE([obsolete],
366             [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
367 case $host_os in
368   *emx* ) EMXOS2=yes;;
369       * ) EMXOS2=no;;
370 esac
371 ])# AC_EMXOS2
374 # AC_MINGW32
375 # ----------
376 # Check for mingw32.  This is another way to set the right value for
377 # EXEEXT.
378 AU_DEFUN([AC_MINGW32],
379 [AC_CANONICAL_HOST
380 AC_DIAGNOSE([obsolete],
381             [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
382 case $host_os in
383   *mingw32* ) MINGW32=yes;;
384           * ) MINGW32=no;;
385 esac
386 ])# AC_MINGW32
391 ## -------------------------- ##
392 ## Checks for UNIX variants.  ##
393 ## -------------------------- ##
396 # These are kludges which should be replaced by a single POSIX check.
397 # They aren't cached, to discourage their use.
399 # AC_AIX
400 # ------
401 AC_DEFUN([AC_AIX],
402 [AH_VERBATIM([_ALL_SOURCE],
403 [/* Define to 1 if on AIX 3.
404    System headers sometimes define this.
405    We just want to avoid a redefinition error message.  */
406 @%:@ifndef _ALL_SOURCE
407 @%:@ undef _ALL_SOURCE
408 @%:@endif])dnl
409 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
410 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
411 AC_MSG_CHECKING([for AIX])
412 AC_EGREP_CPP(yes,
413 [#ifdef _AIX
414   yes
415 #endif
417 [AC_MSG_RESULT([yes])
418 AC_DEFINE(_ALL_SOURCE)],
419 [AC_MSG_RESULT([no])])
420 ])# AC_AIX
423 # AC_MINIX
424 # --------
425 AC_DEFUN([AC_MINIX],
426 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
427 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
428 AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
429 if test "$MINIX" = yes; then
430   AC_DEFINE(_POSIX_SOURCE, 1,
431             [Define to 1 if you need to in order for `stat' and other things to
432              work.])
433   AC_DEFINE(_POSIX_1_SOURCE, 2,
434             [Define to 2 if the system does not provide POSIX.1 features except
435              with this defined.])
436   AC_DEFINE(_MINIX, 1,
437             [Define to 1 if on MINIX.])
439 ])# AC_MINIX
442 # AC_ISC_POSIX
443 # ------------
444 AC_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
447 # AC_XENIX_DIR
448 # ------------
449 AU_DEFUN(AC_XENIX_DIR,
450 [# You shouldn't need to depend upon XENIX.  Remove this test if useless.
451 AC_MSG_CHECKING([for Xenix])
452 AC_EGREP_CPP(yes,
453 [#if defined(M_XENIX) && !defined(M_UNIX)
454   yes
455 @%:@endif],
456              [AC_MSG_RESULT([yes]); XENIX=yes],
457              [AC_MSG_RESULT([no]); XENIX=])
459 AC_HEADER_DIRENT[]dnl
463 # AC_DYNIX_SEQ
464 # ------------
465 AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT])
468 # AC_IRIX_SUN
469 # -----------
470 AU_DEFUN([AC_IRIX_SUN],
471 [AC_FUNC_GETMNTENT
472 AC_CHECK_LIB(sun, getpwnam)])
475 # AC_SCO_INTL
476 # -----------
477 AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME])