1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
3 # ===========================================================================
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
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.
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
36 #modified for strace project
38 AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
39 AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
40 AC_REQUIRE([AC_PROG_CC])dnl
41 AC_REQUIRE([AC_PROG_CPP])dnl
42 AC_REQUIRE([AC_EXEEXT])dnl
43 AC_REQUIRE([AC_CANONICAL_HOST])dnl
45 dnl Use the standard macros, but make them use other variable names
47 pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
48 pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
49 pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
50 pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
51 pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
52 pushdef([ac_cv_prog_cc_stdc], ac_cv_build_prog_cc_stdc)dnl
53 pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
54 pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
55 pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
56 pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
57 pushdef([ac_cv_objext], ac_cv_build_objext)dnl
58 pushdef([ac_exeext], ac_build_exeext)dnl
59 pushdef([ac_objext], ac_build_objext)dnl
60 pushdef([CC], CC_FOR_BUILD)dnl
61 pushdef([CPP], CPP_FOR_BUILD)dnl
62 pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
63 pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
64 pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
65 pushdef([WARN_CFLAGS], WARN_CFLAGS_FOR_BUILD)dnl
66 pushdef([host], build)dnl
67 pushdef([host_alias], build_alias)dnl
68 pushdef([host_cpu], build_cpu)dnl
69 pushdef([host_vendor], build_vendor)dnl
70 pushdef([host_os], build_os)dnl
71 pushdef([ac_cv_host], ac_cv_build)dnl
72 pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
73 pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
74 pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
75 pushdef([ac_cv_host_os], ac_cv_build_os)dnl
76 pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
77 pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
78 pushdef([gl_unknown_warnings_are_errors], gl_build_unknown_warnings_are_errors)dnl
80 st_SAVE_VAR([ac_c_decl_warn_flag])
81 st_SAVE_VAR([ac_c_preproc_warn_flag])
82 st_SAVE_VAR([ac_c_werror_flag])
83 st_SAVE_VAR([ac_compile])
84 st_SAVE_VAR([ac_compiler_gnu])
86 st_SAVE_VAR([ac_cv_c_compiler_gnu])
87 st_SAVE_VAR([ac_cv_c_decl_report])
88 st_SAVE_VAR([ac_link])
89 st_SAVE_VAR([ac_tool_prefix])
90 st_SAVE_VAR([cross_compiling])
93 AC_MSG_NOTICE([looking for a C compiler that generates native executables])
100 st_RESTORE_VAR([cross_compiling])
101 st_RESTORE_VAR([ac_tool_prefix])
102 st_RESTORE_VAR([ac_link])
103 st_RESTORE_VAR([ac_cv_c_decl_report])
104 st_RESTORE_VAR([ac_cv_c_compiler_gnu])
105 st_RESTORE_VAR([ac_cpp])
106 st_RESTORE_VAR([ac_compiler_gnu])
107 st_RESTORE_VAR([ac_compile])
108 st_RESTORE_VAR([ac_c_werror_flag])
109 st_RESTORE_VAR([ac_c_preproc_warn_flag])
110 st_RESTORE_VAR([ac_c_decl_warn_flag])
112 dnl Restore the old definitions
114 popdef([gl_unknown_warnings_are_errors])dnl
115 popdef([am_cv_CC_dependencies_compiler_type])dnl
116 popdef([am_cv_prog_cc_c_o])dnl
117 popdef([ac_cv_host_os])dnl
118 popdef([ac_cv_host_vendor])dnl
119 popdef([ac_cv_host_cpu])dnl
120 popdef([ac_cv_host_alias])dnl
121 popdef([ac_cv_host])dnl
123 popdef([host_vendor])dnl
124 popdef([host_cpu])dnl
125 popdef([host_alias])dnl
127 popdef([WARN_CFLAGS])dnl
129 popdef([CPPFLAGS])dnl
133 popdef([ac_objext])dnl
134 popdef([ac_exeext])dnl
135 popdef([ac_cv_objext])dnl
136 popdef([ac_cv_exeext])dnl
137 popdef([ac_cv_prog_cc_c89])dnl
138 popdef([ac_cv_prog_cc_c99])dnl
139 popdef([ac_cv_prog_cc_c11])dnl
140 popdef([ac_cv_prog_cc_stdc])dnl
141 popdef([ac_cv_prog_cc_g])dnl
142 popdef([ac_cv_prog_cc_cross])dnl
143 popdef([ac_cv_prog_cc_works])dnl
144 popdef([ac_cv_prog_gcc])dnl
145 popdef([ac_cv_prog_CPP])dnl
147 dnl Finally, set Makefile variables
149 BUILD_EXEEXT=$ac_build_exeext
150 BUILD_OBJEXT=$ac_build_objext
151 AC_SUBST(BUILD_EXEEXT)dnl
152 AC_SUBST(BUILD_OBJEXT)dnl
153 AC_SUBST([CFLAGS_FOR_BUILD])dnl
154 AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
155 AC_SUBST([LDFLAGS_FOR_BUILD])dnl
156 AC_SUBST([WARN_CFLAGS_FOR_BUILD])dnl