1# =========================================================================== 2# http://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# Copyright (c) 2008-2017 The strace developers. 30# 31# Copying and distribution of this file, with or without modification, are 32# permitted in any medium without royalty provided the copyright notice 33# and this notice are preserved. This file is offered as-is, without any 34# warranty. 35 36#serial 8 37#modified for strace project 38 39AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) 40AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl 41AC_REQUIRE([AC_PROG_CC])dnl 42AC_REQUIRE([AC_PROG_CPP])dnl 43AC_REQUIRE([AC_EXEEXT])dnl 44AC_REQUIRE([AC_CANONICAL_HOST])dnl 45 46dnl Use the standard macros, but make them use other variable names 47dnl 48pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)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_prog_cc_stdc], ac_cv_build_prog_cc_stdc)dnl 54pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl 55pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl 56pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl 57pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl 58pushdef([ac_cv_objext], ac_cv_build_objext)dnl 59pushdef([ac_exeext], ac_build_exeext)dnl 60pushdef([ac_objext], ac_build_objext)dnl 61pushdef([CC], CC_FOR_BUILD)dnl 62pushdef([CPP], CPP_FOR_BUILD)dnl 63pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl 64pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl 65pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl 66pushdef([WARN_CFLAGS], WARN_CFLAGS_FOR_BUILD)dnl 67pushdef([host], build)dnl 68pushdef([host_alias], build_alias)dnl 69pushdef([host_cpu], build_cpu)dnl 70pushdef([host_vendor], build_vendor)dnl 71pushdef([host_os], build_os)dnl 72pushdef([ac_cv_host], ac_cv_build)dnl 73pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl 74pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl 75pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl 76pushdef([ac_cv_host_os], ac_cv_build_os)dnl 77pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl 78pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl 79pushdef([gl_unknown_warnings_are_errors], gl_build_unknown_warnings_are_errors)dnl 80 81st_SAVE_VAR([ac_c_decl_warn_flag]) 82st_SAVE_VAR([ac_c_preproc_warn_flag]) 83st_SAVE_VAR([ac_c_werror_flag]) 84st_SAVE_VAR([ac_compile]) 85st_SAVE_VAR([ac_compiler_gnu]) 86st_SAVE_VAR([ac_cpp]) 87st_SAVE_VAR([ac_cv_c_compiler_gnu]) 88st_SAVE_VAR([ac_cv_c_decl_report]) 89st_SAVE_VAR([ac_link]) 90st_SAVE_VAR([ac_tool_prefix]) 91st_SAVE_VAR([cross_compiling]) 92cross_compiling=no 93 94AC_MSG_NOTICE([looking for a C compiler that generates native executables]) 95AC_PROG_CC 96AC_PROG_CPP 97AC_EXEEXT 98 99st_WARN_CFLAGS 100 101st_RESTORE_VAR([cross_compiling]) 102st_RESTORE_VAR([ac_tool_prefix]) 103st_RESTORE_VAR([ac_link]) 104st_RESTORE_VAR([ac_cv_c_decl_report]) 105st_RESTORE_VAR([ac_cv_c_compiler_gnu]) 106st_RESTORE_VAR([ac_cpp]) 107st_RESTORE_VAR([ac_compiler_gnu]) 108st_RESTORE_VAR([ac_compile]) 109st_RESTORE_VAR([ac_c_werror_flag]) 110st_RESTORE_VAR([ac_c_preproc_warn_flag]) 111st_RESTORE_VAR([ac_c_decl_warn_flag]) 112 113dnl Restore the old definitions 114dnl 115popdef([gl_unknown_warnings_are_errors])dnl 116popdef([am_cv_CC_dependencies_compiler_type])dnl 117popdef([am_cv_prog_cc_c_o])dnl 118popdef([ac_cv_host_os])dnl 119popdef([ac_cv_host_vendor])dnl 120popdef([ac_cv_host_cpu])dnl 121popdef([ac_cv_host_alias])dnl 122popdef([ac_cv_host])dnl 123popdef([host_os])dnl 124popdef([host_vendor])dnl 125popdef([host_cpu])dnl 126popdef([host_alias])dnl 127popdef([host])dnl 128popdef([WARN_CFLAGS])dnl 129popdef([LDFLAGS])dnl 130popdef([CPPFLAGS])dnl 131popdef([CFLAGS])dnl 132popdef([CPP])dnl 133popdef([CC])dnl 134popdef([ac_objext])dnl 135popdef([ac_exeext])dnl 136popdef([ac_cv_objext])dnl 137popdef([ac_cv_exeext])dnl 138popdef([ac_cv_prog_cc_c89])dnl 139popdef([ac_cv_prog_cc_c99])dnl 140popdef([ac_cv_prog_cc_c11])dnl 141popdef([ac_cv_prog_cc_stdc])dnl 142popdef([ac_cv_prog_cc_g])dnl 143popdef([ac_cv_prog_cc_cross])dnl 144popdef([ac_cv_prog_cc_works])dnl 145popdef([ac_cv_prog_gcc])dnl 146popdef([ac_cv_prog_CPP])dnl 147 148dnl Finally, set Makefile variables 149dnl 150BUILD_EXEEXT=$ac_build_exeext 151BUILD_OBJEXT=$ac_build_objext 152AC_SUBST(BUILD_EXEEXT)dnl 153AC_SUBST(BUILD_OBJEXT)dnl 154AC_SUBST([CFLAGS_FOR_BUILD])dnl 155AC_SUBST([CPPFLAGS_FOR_BUILD])dnl 156AC_SUBST([LDFLAGS_FOR_BUILD])dnl 157AC_SUBST([WARN_CFLAGS_FOR_BUILD])dnl 158]) 159