isl_map_coalesce: avoid ignoring constraints redundant wrt implicit equalities
[isl.git] / m4 / ax_prog_cc_for_build.m4
blobd80efdfc75372de80e5602a50e9da5ae72728e8f
1 # ===========================================================================
2 #   https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
3 # ===========================================================================
5 # SYNOPSIS
7 #   AX_PROG_CC_FOR_BUILD
9 # DESCRIPTION
11 #   This macro searches for a C compiler that generates native executables,
12 #   that is a C compiler that surely is not a cross-compiler. This can be
13 #   useful if you have to generate source code at compile-time like for
14 #   example GCC does.
16 #   The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
17 #   needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
18 #   The value of these variables can be overridden by the user by specifying
19 #   a compiler with an environment variable (like you do for standard CC).
21 #   It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
22 #   file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
23 #   the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
24 #   substituted in the Makefile.
26 # LICENSE
28 #   Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
30 #   Copying and distribution of this file, with or without modification, are
31 #   permitted in any medium without royalty provided the copyright notice
32 #   and this notice are preserved. This file is offered as-is, without any
33 #   warranty.
35 #serial 21
37 AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
38 AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
39 AC_REQUIRE([AC_PROG_CC])dnl
40 AC_REQUIRE([AC_PROG_CPP])dnl
41 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
43 dnl Use the standard macros, but make them use other variable names
44 dnl
45 pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
46 pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
47 pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
48 pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
49 pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
50 pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
51 pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
52 pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
53 pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl
54 pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
55 pushdef([ac_cv_objext], ac_cv_build_objext)dnl
56 pushdef([ac_exeext], ac_build_exeext)dnl
57 pushdef([ac_objext], ac_build_objext)dnl
58 pushdef([CC], CC_FOR_BUILD)dnl
59 pushdef([CCDEPMODE], CCDEPMODE_FOR_BUILD)dnl
60 pushdef([CPP], CPP_FOR_BUILD)dnl
61 pushdef([GCC], GCC_FOR_BUILD)dnl
62 pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
63 pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
64 pushdef([EXEEXT], BUILD_EXEEXT)dnl
65 pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
66 pushdef([OBJEXT], BUILD_OBJEXT)dnl
67 pushdef([host], build)dnl
68 pushdef([host_alias], build_alias)dnl
69 pushdef([host_cpu], build_cpu)dnl
70 pushdef([host_vendor], build_vendor)dnl
71 pushdef([host_os], build_os)dnl
72 pushdef([ac_cv_host], ac_cv_build)dnl
73 pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
74 pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
75 pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
76 pushdef([ac_cv_host_os], ac_cv_build_os)dnl
77 pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
78 pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
79 pushdef([am__fastdepCC_FALSE], am__fastdepCC_build_FALSE)dnl
80 pushdef([am__fastdepCC_TRUE], am__fastdepCC_build_TRUE)dnl
81 pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
82 pushdef([cross_compiling], cross_compiling_build)dnl
84 cross_compiling_build=no
86 ac_build_tool_prefix=
87 AS_IF([test -n "$build"],      [ac_build_tool_prefix="$build-"],
88       [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"])
90 AC_LANG_PUSH([C])
92 dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover
93 dnl the use of this variable in _AC_LANG_COMPILER_GNU called by
94 dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround.
95 was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y}
96 AS_IF([test ${was_set_c_compiler_gnu}],
97     [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu]
98     AS_UNSET([[ac_cv_c_compiler_gnu]])])
100 AC_PROG_CC
102 dnl Restore ac_cv_c_compiler_gnu
103 AS_IF([test ${was_set_c_compiler_gnu}],
104   [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]])
106 _AC_COMPILER_EXEEXT
107 _AC_COMPILER_OBJEXT
108 AC_PROG_CPP
110 dnl Restore the old definitions
112 popdef([cross_compiling])dnl
113 popdef([am_cv_prog_cc_c_o])dnl
114 popdef([am__fastdepCC_TRUE])dnl
115 popdef([am__fastdepCC_FALSE])dnl
116 popdef([am_cv_CC_dependencies_compiler_type])dnl
117 popdef([ac_tool_prefix])dnl
118 popdef([ac_cv_host_os])dnl
119 popdef([ac_cv_host_vendor])dnl
120 popdef([ac_cv_host_cpu])dnl
121 popdef([ac_cv_host_alias])dnl
122 popdef([ac_cv_host])dnl
123 popdef([host_os])dnl
124 popdef([host_vendor])dnl
125 popdef([host_cpu])dnl
126 popdef([host_alias])dnl
127 popdef([host])dnl
128 popdef([OBJEXT])dnl
129 popdef([LDFLAGS])dnl
130 popdef([EXEEXT])dnl
131 popdef([CPPFLAGS])dnl
132 popdef([CFLAGS])dnl
133 popdef([GCC])dnl
134 popdef([CPP])dnl
135 popdef([CCDEPMODE])dnl
136 popdef([CC])dnl
137 popdef([ac_objext])dnl
138 popdef([ac_exeext])dnl
139 popdef([ac_cv_objext])dnl
140 popdef([ac_cv_exeext])dnl
141 popdef([ac_cv_c_compiler_gnu])dnl
142 popdef([ac_cv_prog_cc_g])dnl
143 popdef([ac_cv_prog_cc_cross])dnl
144 popdef([ac_cv_prog_cc_works])dnl
145 popdef([ac_cv_prog_cc_c89])dnl
146 popdef([ac_cv_prog_gcc])dnl
147 popdef([ac_cv_prog_CPP])dnl
149 dnl restore global variables ac_ext, ac_cpp, ac_compile,
150 dnl ac_link, ac_compiler_gnu (dependant on the current
151 dnl language after popping):
152 AC_LANG_POP([C])
154 dnl Finally, set Makefile variables using the ac_cv_build_* variables
156 AC_SUBST(BUILD_EXEEXT)dnl
157 AC_SUBST(BUILD_OBJEXT)dnl
158 dnl Since autoconf 2.70, the call to AC_SUBST in the following lines
159 dnl of _AC_COMPILER_EXEEXT
160 dnl     AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
161 dnl     ac_exeext=$EXEEXT
162 dnl no longer sets BUILD_EXEEXT, but EXEEXT instead.
163 dnl This means not only that BUILD_EXEEXT is not getting set,
164 dnl but also that the original EXEEXT is overwritten
165 dnl by a possibly different value.  Furthermore, ac_build_exeext
166 dnl is assigned an undefined value.
167 dnl Restore EXEEXT to the original value and
168 dnl set BUILD_EXEEXT and ac_build_exeext.
169 dnl Similarly for _AC_COMPILER_OBJEXT and OBJEXT.
170 m4_version_prereq([2.70],[dnl
171 EXEEXT=$ac_cv_exeext
172 BUILD_EXEEXT=$ac_cv_build_exeext; ac_build_exeext=$ac_cv_build_exeext
173 OBJEXT=$ac_cv_objext
174 BUILD_OBJEXT=$ac_cv_build_objext; ac_build_objext=$ac_cv_build_objext],[[]])
175 dnl Similarly to _AC_COMPILER_EXEEXT and _AC_COMPILER_OBJEXT,
176 dnl the line
177 dnl     AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
178 dnl of _AM_DEPENDENCIES no longer sets CCDEPMODE_FOR_BUILD,
179 dnl but overrides CCDEPMODE.
180 dnl Restore CCDEPMODE and set CCDEPMODE_FOR_BUILD.
181 AC_SUBST(CCDEPMODE_FOR_BUILD)dnl
182 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
183 CCDEPMODE_FOR_BUILD=depmode=$am_cv_build_CC_dependencies_compiler_type
184 AC_SUBST([CFLAGS_FOR_BUILD])dnl
185 AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
186 AC_SUBST([LDFLAGS_FOR_BUILD])dnl