Search
lxdream.org :: lxdream/m4/ccforbuild.m4 :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename m4/ccforbuild.m4
changeset 1211:eecdeb37934a
next1293:36123decfb24
author nkeynes
date Fri Feb 10 19:26:10 2012 +1000 (9 years ago)
permissions -rw-r--r--
last change Break tools out into its own Makefile using CC_FOR_BUILD
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/m4/ccforbuild.m4 Fri Feb 10 19:26:10 2012 +1000
1.3 @@ -0,0 +1,107 @@
1.4 +AC_DEFUN([AC_PUSH_CC_FOR_BUILD], [dnl
1.5 +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
1.6 +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
1.7 +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
1.8 +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
1.9 +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
1.10 +pushdef([ac_cv_prog_cc_stdc], ac_cv_build_prog_cc_stdc)dnl
1.11 +pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_stdc)dnl
1.12 +pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_stdc)dnl
1.13 +dnl pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl
1.14 +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
1.15 +pushdef([ac_cv_objext], ac_cv_build_objext)dnl
1.16 +pushdef([ac_exeext], ac_build_exeext)dnl
1.17 +pushdef([ac_objext], ac_build_objext)dnl
1.18 +pushdef([CC], CC_FOR_BUILD)dnl
1.19 +pushdef([CPP], CPP_FOR_BUILD)dnl
1.20 +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
1.21 +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
1.22 +pushdef([host], build)dnl
1.23 +pushdef([host_alias], build_alias)dnl
1.24 +pushdef([host_cpu], build_cpu)dnl
1.25 +pushdef([host_vendor], build_vendor)dnl
1.26 +pushdef([host_os], build_os)dnl
1.27 +pushdef([ac_compiler_gnu], ac_build_compiler_gnu)dnl
1.28 +pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
1.29 +pushdef([ac_cv_host], ac_cv_build)dnl
1.30 +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
1.31 +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
1.32 +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
1.33 +pushdef([ac_cv_host_os], ac_cv_build_os)dnl
1.34 +pushdef([ac_cpp], ac_build_cpp)dnl
1.35 +pushdef([ac_compile], ac_build_compile)dnl
1.36 +pushdef([ac_link], ac_build_link)dnl
1.37 +])
1.38 +
1.39 +AC_DEFUN([AC_POP_CC_FOR_BUILD], [dnl
1.40 +popdef([ac_link])dnl
1.41 +popdef([ac_compile])dnl
1.42 +popdef([ac_cpp])dnl
1.43 +popdef([ac_cv_host_os])dnl
1.44 +popdef([ac_cv_host_vendor])dnl
1.45 +popdef([ac_cv_host_cpu])dnl
1.46 +popdef([ac_cv_host_alias])dnl
1.47 +popdef([ac_cv_host])dnl
1.48 +popdef([ac_tool_prefix])dnl
1.49 +popdef([ac_compiler_gnu])dnl
1.50 +popdef([host_os])dnl
1.51 +popdef([host_vendor])dnl
1.52 +popdef([host_cpu])dnl
1.53 +popdef([host_alias])dnl
1.54 +popdef([host])dnl
1.55 +popdef([CPPFLAGS])dnl
1.56 +popdef([CFLAGS])dnl
1.57 +popdef([CPP])dnl
1.58 +popdef([CC])dnl
1.59 +popdef([ac_objext])dnl
1.60 +popdef([ac_exeext])dnl
1.61 +popdef([ac_cv_objext])dnl
1.62 +popdef([ac_cv_exeext])dnl
1.63 +dnl popdef([ac_cv_c_compiler_gnu])dnl
1.64 +popdef([ac_cv_prog_cc_c89])dnl
1.65 +popdef([ac_cv_prog_cc_c99])dnl
1.66 +popdef([ac_cv_prog_cc_stdc])dnl
1.67 +popdef([ac_cv_prog_cc_g])dnl
1.68 +popdef([ac_cv_prog_cc_works])dnl
1.69 +popdef([ac_cv_prog_cc_cross])dnl
1.70 +popdef([ac_cv_prog_gcc])dnl
1.71 +popdef([ac_cv_prog_CPP])dnl
1.72 +])
1.73 +
1.74 +
1.75 +AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl
1.76 +AC_REQUIRE([AC_PROG_CC])dnl
1.77 +AC_REQUIRE([AC_PROG_CPP])dnl
1.78 +AC_REQUIRE([AC_EXEEXT])dnl
1.79 +AC_REQUIRE([AC_CANONICAL_HOST])dnl
1.80 +dnl
1.81 +ac_main_cc="$CC"
1.82 +test -n "$build_alias" && ac_build_tool_prefix=$build_alias-
1.83 +
1.84 +pushdef([cross_compiling], [#])dnl
1.85 +dnl If main compiler works and CC_FOR_BUILD is unset, use the main compiler
1.86 +if test -z "$CC_FOR_BUILD"; then
1.87 + AC_RUN_IFELSE([int main(){return 0;}], [CC_FOR_BUILD="$CC"], [],[])
1.88 +fi
1.89 +dnl Use the standard macros, but make them use other variable names
1.90 +dnl
1.91 +AC_PUSH_CC_FOR_BUILD
1.92 +
1.93 +AC_PROG_CC
1.94 +AC_PROG_CC_STDC
1.95 +AC_PROG_CPP
1.96 +AC_EXEEXT
1.97 +
1.98 +dnl Restore the old definitions
1.99 +dnl
1.100 +AC_POP_CC_FOR_BUILD
1.101 +popdef([cross_compiling])dnl
1.102 +dnl Finally, set Makefile variables
1.103 +dnl
1.104 +BUILD_EXEEXT=$ac_build_exeext
1.105 +BUILD_OBJEXT=$ac_build_objext
1.106 +AC_SUBST(BUILD_EXEEXT)dnl
1.107 +AC_SUBST(BUILD_OBJEXT)dnl
1.108 +AC_SUBST([CFLAGS_FOR_BUILD])dnl
1.109 +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
1.110 +])
.