source: git/m4/ax_prog_cc_for_build.m4

spielwiese
Last change on this file was 47c5e6, checked in by Hans Schoenemann <hannes@…>, 18 months ago
update some m4/*
  • Property mode set to 100644
File size: 5.2 KB
Line 
1# ===========================================================================
2#   https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_PROG_CC_FOR_BUILD
8#
9# DESCRIPTION
10#
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.
15#
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).
20#
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.
25#
26# LICENSE
27#
28#   Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
29#
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.
34
35#serial 21
36
37AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
38AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
39AC_REQUIRE([AC_PROG_CC])dnl
40AC_REQUIRE([AC_PROG_CPP])dnl
41AC_REQUIRE([AC_CANONICAL_BUILD])dnl
42
43dnl Use the standard macros, but make them use other variable names
44dnl
45pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
46pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
47pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
48pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
49pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
50pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
51pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
52pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
53pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl
54pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
55pushdef([ac_cv_objext], ac_cv_build_objext)dnl
56pushdef([ac_exeext], ac_build_exeext)dnl
57pushdef([ac_objext], ac_build_objext)dnl
58pushdef([CC], CC_FOR_BUILD)dnl
59pushdef([CPP], CPP_FOR_BUILD)dnl
60pushdef([GCC], GCC_FOR_BUILD)dnl
61pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
62pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
63pushdef([EXEEXT], BUILD_EXEEXT)dnl
64pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
65pushdef([OBJEXT], BUILD_OBJEXT)dnl
66pushdef([host], build)dnl
67pushdef([host_alias], build_alias)dnl
68pushdef([host_cpu], build_cpu)dnl
69pushdef([host_vendor], build_vendor)dnl
70pushdef([host_os], build_os)dnl
71pushdef([ac_cv_host], ac_cv_build)dnl
72pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
73pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
74pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
75pushdef([ac_cv_host_os], ac_cv_build_os)dnl
76pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
77pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
78pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
79pushdef([cross_compiling], cross_compiling_build)dnl
80
81cross_compiling_build=no
82
83ac_build_tool_prefix=
84AS_IF([test -n "$build"],      [ac_build_tool_prefix="$build-"],
85      [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"])
86
87AC_LANG_PUSH([C])
88
89dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover
90dnl the use of this variable in _AC_LANG_COMPILER_GNU called by
91dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround.
92was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y}
93AS_IF([test ${was_set_c_compiler_gnu}],
94    [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu]
95    AS_UNSET([[ac_cv_c_compiler_gnu]])])
96
97AC_PROG_CC
98
99dnl Restore ac_cv_c_compiler_gnu
100AS_IF([test ${was_set_c_compiler_gnu}],
101  [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]])
102
103_AC_COMPILER_EXEEXT
104_AC_COMPILER_OBJEXT
105AC_PROG_CPP
106
107dnl Restore the old definitions
108dnl
109popdef([cross_compiling])dnl
110popdef([am_cv_prog_cc_c_o])dnl
111popdef([am_cv_CC_dependencies_compiler_type])dnl
112popdef([ac_tool_prefix])dnl
113popdef([ac_cv_host_os])dnl
114popdef([ac_cv_host_vendor])dnl
115popdef([ac_cv_host_cpu])dnl
116popdef([ac_cv_host_alias])dnl
117popdef([ac_cv_host])dnl
118popdef([host_os])dnl
119popdef([host_vendor])dnl
120popdef([host_cpu])dnl
121popdef([host_alias])dnl
122popdef([host])dnl
123popdef([OBJEXT])dnl
124popdef([LDFLAGS])dnl
125popdef([EXEEXT])dnl
126popdef([CPPFLAGS])dnl
127popdef([CFLAGS])dnl
128popdef([GCC])dnl
129popdef([CPP])dnl
130popdef([CC])dnl
131popdef([ac_objext])dnl
132popdef([ac_exeext])dnl
133popdef([ac_cv_objext])dnl
134popdef([ac_cv_exeext])dnl
135popdef([ac_cv_c_compiler_gnu])dnl
136popdef([ac_cv_prog_cc_g])dnl
137popdef([ac_cv_prog_cc_cross])dnl
138popdef([ac_cv_prog_cc_works])dnl
139popdef([ac_cv_prog_cc_c89])dnl
140popdef([ac_cv_prog_gcc])dnl
141popdef([ac_cv_prog_CPP])dnl
142
143dnl restore global variables ac_ext, ac_cpp, ac_compile,
144dnl ac_link, ac_compiler_gnu (dependant on the current
145dnl language after popping):
146AC_LANG_POP([C])
147
148dnl Finally, set Makefile variables
149dnl
150AC_SUBST(BUILD_EXEEXT)dnl
151AC_SUBST(BUILD_OBJEXT)dnl
152AC_SUBST([CFLAGS_FOR_BUILD])dnl
153AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
154AC_SUBST([LDFLAGS_FOR_BUILD])dnl
155])
156
Note: See TracBrowser for help on using the repository browser.