Search
lxdream.org :: lxdream/acinclude.m4 :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename acinclude.m4
changeset 1200:3b2097efa97d
prev1199:62d0a21fac1c
next1211:eecdeb37934a
author nkeynes
date Wed Dec 21 17:13:08 2011 +1000 (8 years ago)
permissions -rw-r--r--
last change Setup configure to detect/manage CC_FOR_BUILD
file annotate diff log raw
1.1 --- a/acinclude.m4 Wed Dec 21 12:15:06 2011 +1000
1.2 +++ b/acinclude.m4 Wed Dec 21 17:13:08 2011 +1000
1.3 @@ -162,3 +162,94 @@
1.4 $2 ]);
1.5 AC_LANG_POP([Objective C])
1.6 ]);
1.7 +
1.8 +
1.9 +
1.10 +AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl
1.11 +AC_REQUIRE([AC_PROG_CC])dnl
1.12 +AC_REQUIRE([AC_PROG_CPP])dnl
1.13 +AC_REQUIRE([AC_EXEEXT])dnl
1.14 +AC_REQUIRE([AC_CANONICAL_HOST])dnl
1.15 +dnl
1.16 +ac_main_cc="$CC"
1.17 +test -n "$build_alias" && ac_build_tool_prefix=$build_alias-
1.18 +
1.19 +pushdef([cross_compiling], [#])dnl
1.20 +dnl If main compiler works and CC_FOR_BUILD is unset, use the main compiler
1.21 +if test -z "$CC_FOR_BUILD"; then
1.22 + AC_RUN_IFELSE([int main(){return 0;}], [CC_FOR_BUILD="$CC"], [],[])
1.23 +fi
1.24 +dnl Use the standard macros, but make them use other variable names
1.25 +dnl
1.26 +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
1.27 +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
1.28 +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
1.29 +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
1.30 +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
1.31 +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
1.32 +pushdef([ac_cv_objext], ac_cv_build_objext)dnl
1.33 +pushdef([ac_exeext], ac_build_exeext)dnl
1.34 +pushdef([ac_objext], ac_build_objext)dnl
1.35 +pushdef([CC], CC_FOR_BUILD)dnl
1.36 +pushdef([CPP], CPP_FOR_BUILD)dnl
1.37 +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
1.38 +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
1.39 +pushdef([host], build)dnl
1.40 +pushdef([host_alias], build_alias)dnl
1.41 +pushdef([host_cpu], build_cpu)dnl
1.42 +pushdef([host_vendor], build_vendor)dnl
1.43 +pushdef([host_os], build_os)dnl
1.44 +pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
1.45 +pushdef([ac_cv_host], ac_cv_build)dnl
1.46 +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
1.47 +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
1.48 +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
1.49 +pushdef([ac_cv_host_os], ac_cv_build_os)dnl
1.50 +pushdef([ac_cpp], ac_build_cpp)dnl
1.51 +pushdef([ac_compile], ac_build_compile)dnl
1.52 +pushdef([ac_link], ac_build_link)dnl
1.53 +
1.54 +AC_PROG_CC
1.55 +AC_PROG_CPP
1.56 +AC_EXEEXT
1.57 +
1.58 +dnl Restore the old definitions
1.59 +dnl
1.60 +popdef([ac_link])dnl
1.61 +popdef([ac_compile])dnl
1.62 +popdef([ac_cpp])dnl
1.63 +popdef([ac_cv_host_os])dnl
1.64 +popdef([ac_cv_host_vendor])dnl
1.65 +popdef([ac_cv_host_cpu])dnl
1.66 +popdef([ac_cv_host_alias])dnl
1.67 +popdef([ac_cv_host])dnl
1.68 +popdef([ac_tool_prefix])dnl
1.69 +popdef([host_os])dnl
1.70 +popdef([host_vendor])dnl
1.71 +popdef([host_cpu])dnl
1.72 +popdef([host_alias])dnl
1.73 +popdef([host])dnl
1.74 +popdef([CPPFLAGS])dnl
1.75 +popdef([CFLAGS])dnl
1.76 +popdef([CPP])dnl
1.77 +popdef([CC])dnl
1.78 +popdef([ac_objext])dnl
1.79 +popdef([ac_exeext])dnl
1.80 +popdef([ac_cv_objext])dnl
1.81 +popdef([ac_cv_exeext])dnl
1.82 +popdef([ac_cv_prog_cc_g])dnl
1.83 +popdef([ac_cv_prog_cc_works])dnl
1.84 +popdef([ac_cv_prog_cc_cross])dnl
1.85 +popdef([ac_cv_prog_gcc])dnl
1.86 +popdef([ac_cv_prog_CPP])dnl
1.87 +popdef([cross_compiling])dnl
1.88 +
1.89 +dnl Finally, set Makefile variables
1.90 +dnl
1.91 +BUILD_EXEEXT=$ac_build_exeext
1.92 +BUILD_OBJEXT=$ac_build_objext
1.93 +AC_SUBST(BUILD_EXEEXT)dnl
1.94 +AC_SUBST(BUILD_OBJEXT)dnl
1.95 +AC_SUBST([CFLAGS_FOR_BUILD])dnl
1.96 +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
1.97 +])
.