0
|
1 # GCC_NO_EXECUTABLES
|
|
2 # -----------------
|
|
3 # FIXME: The GCC team has specific needs which the current Autoconf
|
|
4 # framework cannot solve elegantly. This macro implements a dirty
|
|
5 # hack until Autoconf is able to provide the services its users
|
|
6 # need.
|
|
7 #
|
|
8 # Several of the support libraries that are often built with GCC can't
|
|
9 # assume the tool-chain is already capable of linking a program: the
|
|
10 # compiler often expects to be able to link with some of such
|
|
11 # libraries.
|
|
12 #
|
|
13 # In several of these libraries, workarounds have been introduced to
|
|
14 # avoid the AC_PROG_CC_WORKS test, that would just abort their
|
|
15 # configuration. The introduction of AC_EXEEXT, enabled either by
|
|
16 # libtool or by CVS autoconf, have just made matters worse.
|
|
17 #
|
|
18 # Unlike the previous AC_NO_EXECUTABLES, this test does not
|
|
19 # disable link tests at autoconf time, but at configure time.
|
|
20 # This allows AC_NO_EXECUTABLES to be invoked conditionally.
|
|
21 AC_DEFUN_ONCE([GCC_NO_EXECUTABLES],
|
|
22 [m4_divert_push([KILL])
|
|
23
|
|
24 AC_BEFORE([$0], [_AC_COMPILER_EXEEXT])
|
|
25 AC_BEFORE([$0], [AC_LINK_IFELSE])
|
|
26
|
|
27 m4_define([_AC_COMPILER_EXEEXT],
|
|
28 AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
|
|
29 # FIXME: Cleanup?
|
|
30 AS_IF([AC_TRY_EVAL(ac_link)], [gcc_no_link=no], [gcc_no_link=yes])
|
|
31 if test x$gcc_no_link = xyes; then
|
|
32 # Setting cross_compile will disable run tests; it will
|
|
33 # also disable AC_CHECK_FILE but that's generally
|
|
34 # correct if we can't link.
|
|
35 cross_compiling=yes
|
|
36 EXEEXT=
|
|
37 else
|
|
38 m4_defn([_AC_COMPILER_EXEEXT])dnl
|
|
39 fi
|
|
40 )
|
|
41
|
|
42 m4_define([AC_LINK_IFELSE],
|
|
43 if test x$gcc_no_link = xyes; then
|
|
44 AC_MSG_ERROR([Link tests are not allowed after [[$0]].])
|
|
45 fi
|
|
46 m4_defn([AC_LINK_IFELSE]))
|
|
47
|
|
48 dnl This is a shame. We have to provide a default for some link tests,
|
|
49 dnl similar to the default for run tests.
|
|
50 m4_define([AC_FUNC_MMAP],
|
|
51 if test x$gcc_no_link = xyes; then
|
|
52 if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
|
|
53 ac_cv_func_mmap_fixed_mapped=no
|
|
54 fi
|
|
55 fi
|
|
56 if test "x${ac_cv_func_mmap_fixed_mapped}" != xno; then
|
|
57 m4_defn([AC_FUNC_MMAP])
|
|
58 fi)
|
|
59
|
|
60 m4_divert_pop()dnl
|
|
61 ])# GCC_NO_EXECUTABLES
|
|
62
|
|
63 # Use the strongest available test out of AC_TRY_COMPILE and AC_TRY_LINK.
|
|
64 AC_DEFUN([GCC_TRY_COMPILE_OR_LINK],
|
|
65 [if test x$gcc_no_link = xyes; then
|
|
66 AC_TRY_COMPILE([$1], [$2], [$3], [$4])
|
|
67 else
|
|
68 AC_TRY_LINK([$1], [$2], [$3], [$4])
|
|
69 fi])
|