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