1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Programming languages support.
3 # Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
4 # Free Software Foundation, Inc.
6 # This file is part of Autoconf. This program is free
7 # software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the
9 # 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 # Under Section 7 of GPL version 3, you are granted additional
18 # permissions described in the Autoconf Configure Script Exception,
19 # version 3.0, as published by the Free Software Foundation.
21 # You should have received a copy of the GNU General Public License
22 # and a copy of the Autoconf Configure Script Exception along with
23 # this program; see the files COPYINGv3 and COPYING.EXCEPTION
24 # respectively. If not, see <http://www.gnu.org/licenses/>.
26 # Written by David MacKenzie, with help from
27 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
28 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
33 # 1. Language selection
34 # and routines to produce programs in a given language.
36 # 2. Producing programs in a given language.
38 # 3. Looking for a compiler
39 # And possibly the associated preprocessor.
41 # 3a. Computing EXEEXT and OBJEXT.
43 # 4. Compilers' characteristics.
47 ## ----------------------- ##
48 ## 1. Language selection. ##
49 ## ----------------------- ##
52 # AC_LANG_CASE(LANG1, IF-LANG1, LANG2, IF-LANG2, ..., DEFAULT)
53 # ------------------------------------------------------------
54 # Expand into IF-LANG1 if the current language is LANG1 etc. else
56 m4_define([AC_LANG_CASE],
57 [m4_case(_AC_LANG, $@)])
60 # _AC_LANG_DISPATCH(MACRO, LANG, ARGS)
61 # ------------------------------------
62 # Call the specialization of MACRO for LANG with ARGS. Complain if
64 m4_define([_AC_LANG_DISPATCH],
66 [m4_indir([$1($2)], m4_shift2($@))],
67 [m4_fatal([$1: unknown language: $2])])])
70 # _AC_LANG_SET(OLD, NEW)
71 # ----------------------
72 # Output the shell code needed to switch from OLD language to NEW language.
73 # Do not try to optimize like this:
75 # m4_defun([_AC_LANG_SET],
76 # [m4_if([$1], [$2], [],
77 # [_AC_LANG_DISPATCH([AC_LANG], [$2])])])
79 # as it can introduce differences between the sh-current language and the
80 # m4-current-language when m4_require is used. Something more subtle
81 # might be possible, but at least for the time being, play it safe.
82 m4_defun([_AC_LANG_SET],
83 [_AC_LANG_DISPATCH([AC_LANG], [$2])])
88 # Set the current language to LANG.
90 [_AC_LANG_SET(m4_ifdef([_AC_LANG], [m4_defn([_AC_LANG])]),
92 m4_define([_AC_LANG], [$1])])
97 # Save the current language, and use LANG.
98 m4_defun([AC_LANG_PUSH],
99 [_AC_LANG_SET(m4_ifdef([_AC_LANG], [m4_defn([_AC_LANG])]),
101 m4_pushdef([_AC_LANG], [$1])])
104 # AC_LANG_POP([LANG])
105 # -------------------
106 # If given, check that the current language is LANG, and restore the
108 m4_defun([AC_LANG_POP],
110 [m4_if([$1], m4_defn([_AC_LANG]), [],
111 [m4_fatal([$0($1): unexpected current language: ]m4_defn([_AC_LANG]))])])dnl
112 m4_pushdef([$0 OLD], m4_defn([_AC_LANG]))dnl
113 m4_popdef([_AC_LANG])dnl
114 _AC_LANG_SET(m4_defn([$0 OLD]), m4_defn([_AC_LANG]))dnl
115 m4_popdef([$0 OLD])dnl
121 # Save the current language, but don't change language.
122 AU_DEFUN([AC_LANG_SAVE],
124 [Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
125 you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
126 AC_DEFUN([AC_LANG_SAVE],
127 [m4_pushdef([_AC_LANG], _AC_LANG)dnl
128 AC_DIAGNOSE([obsolete], [The macro `AC_LANG_SAVE' is obsolete.
129 You should run autoupdate.])])
134 # Restore the current language from the stack.
135 AU_DEFUN([AC_LANG_RESTORE], [AC_LANG_POP($@)])
140 # Return a short signature of _AC_LANG which can be used in shell
141 # variable names, or in M4 macro names.
142 m4_defun([_AC_LANG_ABBREV],
143 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
148 # Return a short (upper case) signature of _AC_LANG that is used to
149 # prefix environment variables like FLAGS.
150 m4_defun([_AC_LANG_PREFIX],
151 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
154 # AC_LANG_ASSERT(LANG)
155 # --------------------
156 # Current language must be LANG.
157 m4_defun([AC_LANG_ASSERT],
158 [m4_if(_AC_LANG, $1, [],
159 [m4_fatal([$0: current language is not $1: ] _AC_LANG)])])
163 # AC_LANG_DEFINE(NAME, ABBREV, PREFIX, COMPILER-VAR, COPY-FROM, SHELL-VARS)
164 # -------------------------------------------------------------------------
165 # Define a language referenced by AC_LANG(NAME), with cache variable prefix
166 # ABBREV, Makefile variable prefix PREFIX and compiler variable COMPILER-VAR.
167 # AC_LANG(NAME) is defined to SHELL-VARS, other macros are copied from language
168 # COPY-FROM. Even if COPY-FROM is empty, a default definition is provided for
169 # language-specific macros AC_LANG_SOURCE(NAME) and AC_LANG_CONFTEST(NAME).
170 m4_define([AC_LANG_DEFINE],
171 [m4_define([AC_LANG($1)], [$6])]
172 [m4_define([_AC_LANG_ABBREV($1)], [$2])]
173 [m4_define([_AC_LANG_PREFIX($1)], [$3])]
174 [m4_define([_AC_CC($1)], [$4])]
175 [m4_copy([AC_LANG_CONFTEST($5)], [AC_LANG_CONFTEST($1)])]
176 [m4_copy([AC_LANG_SOURCE($5)], [AC_LANG_SOURCE($1)])]
177 [m4_copy([_AC_LANG_NULL_PROGRAM($5)], [_AC_LANG_NULL_PROGRAM($1)])]
179 [m4_copy([AC_LANG_PROGRAM($5)], [AC_LANG_PROGRAM($1)])]
180 [m4_copy([AC_LANG_CALL($5)], [AC_LANG_CALL($1)])]
181 [m4_copy([AC_LANG_FUNC_LINK_TRY($5)], [AC_LANG_FUNC_LINK_TRY($1)])]
182 [m4_copy([AC_LANG_BOOL_COMPILE_TRY($5)], [AC_LANG_BOOL_COMPILE_TRY($1)])]
183 [m4_copy([AC_LANG_INT_SAVE($5)], [AC_LANG_INT_SAVE($1)])]
184 [m4_copy([_AC_LANG_IO_PROGRAM($5)], [_AC_LANG_IO_PROGRAM($1)])])])
186 ## ----------------------- ##
187 ## 2. Producing programs. ##
188 ## ----------------------- ##
191 # AC_LANG_CONFTEST(BODY)
192 # ----------------------
193 # Save the BODY in `conftest.$ac_ext'. Add a trailing new line.
194 AC_DEFUN([AC_LANG_CONFTEST],
195 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
198 # AC_LANG_CONFTEST()(BODY)
199 # ------------------------
200 # Default implementation of AC_LANG_CONFTEST.
201 m4_define([AC_LANG_CONFTEST()],
202 [cat > conftest.$ac_ext <<_ACEOF
207 # AC_LANG_SOURCE(BODY)
208 # --------------------
209 # Produce a valid source for the current language, which includes the
210 # BODY, and as much as possible `confdefs.h'.
211 AC_DEFUN([AC_LANG_SOURCE],
212 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
215 # AC_LANG_SOURCE()(BODY)
216 # ----------------------
217 # Default implementation of AC_LANG_SOURCE.
218 m4_define([AC_LANG_SOURCE()],
222 # AC_LANG_PROGRAM([PROLOGUE], [BODY])
223 # -----------------------------------
224 # Produce a valid source for the current language. Prepend the
225 # PROLOGUE (typically CPP directives and/or declarations) to an
226 # execution the BODY (typically glued inside the `main' function, or
228 AC_DEFUN([AC_LANG_PROGRAM],
229 [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
232 # _AC_LANG_NULL_PROGRAM()()
233 # -------------------------
234 # Default implementation of AC_LANG_NULL_PROGRAM
235 m4_define([_AC_LANG_NULL_PROGRAM()],
236 [AC_LANG_PROGRAM([], [])])
239 # _AC_LANG_NULL_PROGRAM
240 # ----------------------
241 # Produce valid source for the current language that does
243 AC_DEFUN([_AC_LANG_NULL_PROGRAM],
244 [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
247 # _AC_LANG_IO_PROGRAM
248 # -----------------------------------
249 # Produce valid source for the current language that creates
250 # a file. (This is used when detecting whether executables
251 # work, e.g. to detect cross-compiling.)
252 AC_DEFUN([_AC_LANG_IO_PROGRAM],
253 [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
256 # AC_LANG_CALL(PROLOGUE, FUNCTION)
257 # --------------------------------
259 AC_DEFUN([AC_LANG_CALL],
260 [m4_ifval([$2], [], [m4_warn([syntax], [$0: no function given])])dnl
261 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
264 # AC_LANG_FUNC_LINK_TRY(FUNCTION)
265 # -------------------------------
266 # Produce a source which links correctly iff the FUNCTION exists.
267 AC_DEFUN([AC_LANG_FUNC_LINK_TRY],
268 [m4_ifval([$1], [], [m4_warn([syntax], [$0: no function given])])dnl
269 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
272 # AC_LANG_BOOL_COMPILE_TRY(PROLOGUE, EXPRESSION)
273 # ----------------------------------------------
274 # Produce a program that compiles with success iff the boolean EXPRESSION
275 # evaluates to true at compile time.
276 AC_DEFUN([AC_LANG_BOOL_COMPILE_TRY],
277 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
280 # AC_LANG_INT_SAVE(PROLOGUE, EXPRESSION)
281 # --------------------------------------
282 # Produce a program that saves the runtime evaluation of the integer
283 # EXPRESSION into `conftest.val'.
284 AC_DEFUN([AC_LANG_INT_SAVE],
285 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
290 # The variable name of the compiler.
292 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
295 ## -------------------------------------------- ##
296 ## 3. Looking for Compilers and Preprocessors. ##
297 ## -------------------------------------------- ##
302 # Find a compiler for the current LANG. Be sure to be run before
305 # Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for
306 # instance, the latter must be AC_DEFUN'd, not just define'd.
307 m4_define([AC_LANG_COMPILER],
308 [AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)],
309 [AC_LANG_PREPROC(]_AC_LANG[)])dnl
310 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
313 # AC_LANG_COMPILER_REQUIRE
314 # ------------------------
315 # Ensure we have a compiler for the current LANG.
316 AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
317 [m4_require([AC_LANG_COMPILER(]_AC_LANG[)],
318 [AC_LANG_COMPILER])])
322 # _AC_LANG_COMPILER_GNU
323 # ---------------------
324 # Check whether the compiler for the current language is GNU.
326 # It doesn't seem necessary right now to have a different source
327 # according to the current language, since this works fine. Some day
328 # it might be needed. Nevertheless, pay attention to the fact that
329 # the position of `choke me' on the seventh column is meant: otherwise
330 # some Fortran compilers (e.g., SGI) might consider it's a
331 # continuation line, and warn instead of reporting an error.
332 m4_define([_AC_LANG_COMPILER_GNU],
333 [AC_CACHE_CHECK([whether we are using the GNU _AC_LANG compiler],
334 [ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu],
335 [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __GNUC__
339 [ac_compiler_gnu=yes],
340 [ac_compiler_gnu=no])
341 ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu=$ac_compiler_gnu
342 ])])# _AC_LANG_COMPILER_GNU
347 # Find a preprocessor for the current language. Note that because we
348 # might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must
349 # be AC_DEFUN'd, not just define'd. Since the preprocessor depends
350 # upon the compiler, look for the compiler.
351 m4_define([AC_LANG_PREPROC],
352 [AC_LANG_COMPILER_REQUIRE()dnl
353 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
356 # AC_LANG_PREPROC_REQUIRE
357 # -----------------------
358 # Ensure we have a preprocessor for the current language.
359 AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
360 [m4_require([AC_LANG_PREPROC(]_AC_LANG[)],
366 # Require the preprocessor for the current language.
367 # FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).
368 AC_DEFUN([AC_REQUIRE_CPP],
369 [AC_LANG_PREPROC_REQUIRE])
375 # FIXME: The GCC team has specific needs which the current Autoconf
376 # framework cannot solve elegantly. This macro implements a dirty
377 # hack until Autoconf is able to provide the services its users
380 # Several of the support libraries that are often built with GCC can't
381 # assume the tool-chain is already capable of linking a program: the
382 # compiler often expects to be able to link with some of such
385 # In several of these libraries, workarounds have been introduced to
386 # avoid the AC_PROG_CC_WORKS test, that would just abort their
387 # configuration. The introduction of AC_EXEEXT, enabled either by
388 # libtool or by CVS autoconf, have just made matters worse.
390 # Unlike an earlier version of this macro, using AC_NO_EXECUTABLES does
391 # not disable link tests at autoconf time, but at configure time.
392 # This allows AC_NO_EXECUTABLES to be invoked conditionally.
393 AC_DEFUN_ONCE([AC_NO_EXECUTABLES],
394 [m4_divert_push([KILL])
395 m4_divert_text([DEFAULTS], [ac_no_link=no])
397 AC_BEFORE([$0], [_AC_COMPILER_EXEEXT])
398 AC_BEFORE([$0], [AC_LINK_IFELSE])
400 m4_define([_AC_COMPILER_EXEEXT],
401 [AC_LANG_CONFTEST([_AC_LANG_NULL_PROGRAM])
402 if _AC_DO_VAR(ac_link); then
404 ]m4_defn([_AC_COMPILER_EXEEXT])[
406 rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM
408 # Setting cross_compile will disable run tests; it will
409 # also disable AC_CHECK_FILE but that's generally
410 # correct if we can't link.
413 _AC_COMPILER_EXEEXT_CROSS
417 m4_define([AC_LINK_IFELSE],
418 [if test x$ac_no_link = xyes; then
419 AC_MSG_ERROR([link tests are not allowed after AC@&t@_NO_EXECUTABLES])
421 ]m4_defn([AC_LINK_IFELSE]))
424 ])# AC_NO_EXECUTABLES
428 # --------------------------------- #
429 # 3a. Computing EXEEXT and OBJEXT. #
430 # --------------------------------- #
435 # Ignore .d files produced by CFLAGS=-MD.
437 # On UWIN (which uses a cc wrapper for MSVC), the compiler also generates
440 # When the w32 free Borland C++ command line compiler links a program
441 # (conftest.exe), it also produces a file named `conftest.tds' in
442 # addition to `conftest.obj'.
445 # Created per object by GCC when given -ftest-coverage.
448 # Created on BeOS. Seems to be per executable.
451 # Created by the Green Hills compiler.
454 # Directory created on Mac OS X Leopard.
457 # _AC_COMPILER_OBJEXT_REJECT
458 # --------------------------
459 # Case/esac pattern matching the files to be ignored when looking for
460 # compiled object files.
461 m4_define([_AC_COMPILER_OBJEXT_REJECT],
462 [*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM])
465 # _AC_COMPILER_EXEEXT_REJECT
466 # --------------------------
467 # Case/esac pattern matching the files to be ignored when looking for
468 # compiled executables.
469 m4_define([_AC_COMPILER_EXEEXT_REJECT],
470 [_AC_COMPILER_OBJEXT_REJECT | *.o | *.obj])
473 # We must not AU define them, because autoupdate would then remove
474 # them, which is right, but Automake 1.4 would remove the support for
476 # FIXME: Remove this once Automake fixed.
477 AC_DEFUN([AC_EXEEXT], [])
478 AC_DEFUN([AC_OBJEXT], [])
481 # _AC_COMPILER_EXEEXT_DEFAULT
482 # ---------------------------
483 # Check for the extension used for the default name for executables.
485 # We do this in order to find out what is the extension we must add for
486 # creating executables (see _AC_COMPILER_EXEEXT's comments).
488 # On OpenVMS 7.1 system, the DEC C 5.5 compiler when called through a
489 # GNV (gnv.sourceforge.net) cc wrapper, produces the output file named
491 # b.out is created by i960 compilers.
493 # Start with the most likely output file names, but:
494 # 1) Beware the clever `test -f' on Cygwin, try the DOS-like .exe names
495 # before the counterparts without the extension.
496 # 2) The algorithm is not robust to junk in `.', hence go to wildcards
497 # (conftest.*) only as a last resort.
498 # Beware of `expr' that may return `0' or `'. Since this macro is
499 # the first one in touch with the compiler, it should also check that
500 # it compiles properly.
502 # The IRIX 6 linker writes into existing files which may not be
503 # executable, retaining their permissions. Remove them first so a
504 # subsequent execution test works.
506 m4_define([_AC_COMPILER_EXEEXT_DEFAULT],
507 [# Try to create an executable without -o first, disregard a.out.
508 # It will help us diagnose broken compilers, and finding out an intuition
510 AC_MSG_CHECKING([whether the _AC_LANG compiler works])
511 ac_link_default=`AS_ECHO(["$ac_link"]) | sed ['s/ -o *conftest[^ ]*//']`
513 # The possible output files:
514 ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
517 for ac_file in $ac_files
520 _AC_COMPILER_EXEEXT_REJECT ) ;;
521 * ) ac_rmfiles="$ac_rmfiles $ac_file";;
526 AS_IF([_AC_DO_VAR(ac_link_default)],
527 [# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
528 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
529 # in a Makefile. We should not override ac_cv_exeext if it was cached,
530 # so that the user can short-circuit this test for compilers unknown to
532 for ac_file in $ac_files ''
534 test -f "$ac_file" || continue
536 _AC_COMPILER_EXEEXT_REJECT )
539 # We found the default executable, but exeext='' is most
543 if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
545 ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']`
547 # We set ac_cv_exeext here because the later test for it is not
548 # safe: cross compilers may not add the suffix if given an `-o'
549 # argument, so we may need to know it at that point already.
550 # Even if this section looks crufty: it has the advantage of
557 test "$ac_cv_exeext" = no && ac_cv_exeext=
560 AS_IF([test -z "$ac_file"],
563 AC_MSG_FAILURE([_AC_LANG compiler cannot create executables], 77)],
564 [AC_MSG_RESULT([yes])])
565 AC_MSG_CHECKING([for _AC_LANG compiler default output file name])
566 AC_MSG_RESULT([$ac_file])
567 ac_exeext=$ac_cv_exeext
568 ])# _AC_COMPILER_EXEEXT_DEFAULT
571 # _AC_COMPILER_EXEEXT_CROSS
572 # -------------------------
573 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
575 # It is not sufficient to run a no-op program -- this succeeds and gives
576 # a false negative when cross-compiling for the compute nodes on the
577 # IBM Blue Gene/L. Instead, _AC_COMPILER_EXEEXT calls _AC_LANG_IO_PROGRAM
578 # to create a program that writes to a file, which is sufficient to
579 # detect cross-compiling on Blue Gene. Note also that AC_COMPUTE_INT
580 # requires programs that create files when not cross-compiling, so it
581 # is safe and not a bad idea to check for this capability in general.
582 m4_define([_AC_COMPILER_EXEEXT_CROSS],
583 [# Check that the compiler produces executables we can run. If not, either
584 # the compiler is broken, or we cross compile.
585 AC_MSG_CHECKING([whether we are cross compiling])
586 if test "$cross_compiling" != yes; then
588 if _AC_DO_TOKENS([./conftest$ac_cv_exeext]); then
591 if test "$cross_compiling" = maybe; then
594 AC_MSG_FAILURE([cannot run _AC_LANG compiled programs.
595 If you meant to cross compile, use `--host'.])
599 AC_MSG_RESULT([$cross_compiling])
600 ])# _AC_COMPILER_EXEEXT_CROSS
603 # _AC_COMPILER_EXEEXT_O
604 # ---------------------
605 # Check for the extension used when `-o foo'. Try to see if ac_cv_exeext,
606 # as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK.
607 m4_define([_AC_COMPILER_EXEEXT_O],
608 [AC_MSG_CHECKING([for suffix of executables])
609 AS_IF([_AC_DO_VAR(ac_link)],
610 [# If both `conftest.exe' and `conftest' are `present' (well, observable)
611 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
612 # work properly (i.e., refer to `conftest.exe'), while it won't with
614 for ac_file in conftest.exe conftest conftest.*; do
615 test -f "$ac_file" || continue
617 _AC_COMPILER_EXEEXT_REJECT ) ;;
618 *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']`
623 [AC_MSG_FAILURE([cannot compute suffix of executables: cannot compile and link])])
624 rm -f conftest conftest$ac_cv_exeext
625 AC_MSG_RESULT([$ac_cv_exeext])
626 ])# _AC_COMPILER_EXEEXT_O
629 # _AC_COMPILER_EXEEXT
630 # -------------------
631 # Check for the extension used for executables. It compiles a test
632 # executable. If this is called, the executable extensions will be
633 # automatically used by link commands run by the configure script.
635 # Note that some compilers (cross or not), strictly obey to `-o foo' while
636 # the host requires `foo.exe', so we should not depend upon `-o' to
637 # test EXEEXT. But then, be sure not to destroy user files.
639 # Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT
640 # checks whether the compiler works.
642 # Do not rename this macro; Automake decides whether EXEEXT is used
643 # by checking whether `_AC_COMPILER_EXEEXT' has been expanded.
645 # See _AC_COMPILER_EXEEXT_CROSS for why we need _AC_LANG_IO_PROGRAM.
646 m4_define([_AC_COMPILER_EXEEXT],
647 [AC_LANG_CONFTEST([_AC_LANG_NULL_PROGRAM])
648 ac_clean_files_save=$ac_clean_files
649 ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
650 _AC_COMPILER_EXEEXT_DEFAULT
651 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
652 ac_clean_files=$ac_clean_files_save
653 _AC_COMPILER_EXEEXT_O
654 rm -f conftest.$ac_ext
655 AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
657 AC_LANG_CONFTEST([_AC_LANG_IO_PROGRAM])
658 ac_clean_files="$ac_clean_files conftest.out"
659 _AC_COMPILER_EXEEXT_CROSS
660 rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
661 ac_clean_files=$ac_clean_files_save
662 ])# _AC_COMPILER_EXEEXT
665 # _AC_COMPILER_OBJEXT
666 # -------------------
667 # Check the object extension used by the compiler: typically `.o' or
668 # `.obj'. If this is called, some other behavior will change,
669 # determined by ac_objext.
671 # This macro is called by AC_LANG_COMPILER, the latter being required
672 # by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. And in fact,
673 # don't, since _AC_COMPILE_IFELSE needs to know ac_objext for the `test -s'
674 # it includes. So do it by hand.
675 m4_define([_AC_COMPILER_OBJEXT],
676 [AC_CACHE_CHECK([for suffix of object files], ac_cv_objext,
677 [AC_LANG_CONFTEST([_AC_LANG_NULL_PROGRAM])
678 rm -f conftest.o conftest.obj
679 AS_IF([_AC_DO_VAR(ac_compile)],
680 [for ac_file in conftest.o conftest.obj conftest.*; do
681 test -f "$ac_file" || continue;
683 _AC_COMPILER_OBJEXT_REJECT ) ;;
684 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
688 [_AC_MSG_LOG_CONFTEST
689 AC_MSG_FAILURE([cannot compute suffix of object files: cannot compile])])
690 rm -f conftest.$ac_cv_objext conftest.$ac_ext])
691 AC_SUBST([OBJEXT], [$ac_cv_objext])dnl
693 ])# _AC_COMPILER_OBJEXT
698 ## ------------------------------- ##
699 ## 4. Compilers' characteristics. ##
700 ## ------------------------------- ##
704 # Treat warnings from the current language's preprocessor, compiler, and
705 # linker as fatal errors.
706 AC_DEFUN([AC_LANG_WERROR],
707 [m4_divert_text([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=])
708 ac_[]_AC_LANG_ABBREV[]_werror_flag=yes])# AC_LANG_WERROR