Search
lxdream.org :: lxdream/m4/ccforbuild.m4
lxdream 0.9.1
released Jun 29
Download Now
filename m4/ccforbuild.m4
changeset 1293:36123decfb24
prev1211:eecdeb37934a
author nkeynes
date Sat Aug 25 14:09:07 2012 +1000 (7 years ago)
permissions -rw-r--r--
last change Subst LDFLAGS_FOR_BUILD in configure
file annotate diff log raw
nkeynes@1211
     1
AC_DEFUN([AC_PUSH_CC_FOR_BUILD], [dnl
nkeynes@1211
     2
pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
nkeynes@1211
     3
pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
nkeynes@1211
     4
pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
nkeynes@1211
     5
pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
nkeynes@1211
     6
pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
nkeynes@1211
     7
pushdef([ac_cv_prog_cc_stdc], ac_cv_build_prog_cc_stdc)dnl
nkeynes@1211
     8
pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_stdc)dnl
nkeynes@1211
     9
pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_stdc)dnl
nkeynes@1211
    10
dnl pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl
nkeynes@1211
    11
pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
nkeynes@1211
    12
pushdef([ac_cv_objext], ac_cv_build_objext)dnl
nkeynes@1211
    13
pushdef([ac_exeext], ac_build_exeext)dnl
nkeynes@1211
    14
pushdef([ac_objext], ac_build_objext)dnl
nkeynes@1211
    15
pushdef([CC], CC_FOR_BUILD)dnl
nkeynes@1211
    16
pushdef([CPP], CPP_FOR_BUILD)dnl
nkeynes@1211
    17
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
nkeynes@1211
    18
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
nkeynes@1211
    19
pushdef([host], build)dnl
nkeynes@1211
    20
pushdef([host_alias], build_alias)dnl
nkeynes@1211
    21
pushdef([host_cpu], build_cpu)dnl
nkeynes@1211
    22
pushdef([host_vendor], build_vendor)dnl
nkeynes@1211
    23
pushdef([host_os], build_os)dnl
nkeynes@1211
    24
pushdef([ac_compiler_gnu], ac_build_compiler_gnu)dnl
nkeynes@1211
    25
pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
nkeynes@1211
    26
pushdef([ac_cv_host], ac_cv_build)dnl
nkeynes@1211
    27
pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
nkeynes@1211
    28
pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
nkeynes@1211
    29
pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
nkeynes@1211
    30
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
nkeynes@1211
    31
pushdef([ac_cpp], ac_build_cpp)dnl
nkeynes@1211
    32
pushdef([ac_compile], ac_build_compile)dnl
nkeynes@1211
    33
pushdef([ac_link], ac_build_link)dnl
nkeynes@1211
    34
])
nkeynes@1211
    35
nkeynes@1211
    36
AC_DEFUN([AC_POP_CC_FOR_BUILD], [dnl
nkeynes@1211
    37
popdef([ac_link])dnl
nkeynes@1211
    38
popdef([ac_compile])dnl
nkeynes@1211
    39
popdef([ac_cpp])dnl
nkeynes@1211
    40
popdef([ac_cv_host_os])dnl
nkeynes@1211
    41
popdef([ac_cv_host_vendor])dnl
nkeynes@1211
    42
popdef([ac_cv_host_cpu])dnl
nkeynes@1211
    43
popdef([ac_cv_host_alias])dnl
nkeynes@1211
    44
popdef([ac_cv_host])dnl
nkeynes@1211
    45
popdef([ac_tool_prefix])dnl
nkeynes@1211
    46
popdef([ac_compiler_gnu])dnl
nkeynes@1211
    47
popdef([host_os])dnl
nkeynes@1211
    48
popdef([host_vendor])dnl
nkeynes@1211
    49
popdef([host_cpu])dnl
nkeynes@1211
    50
popdef([host_alias])dnl
nkeynes@1211
    51
popdef([host])dnl
nkeynes@1211
    52
popdef([CPPFLAGS])dnl
nkeynes@1211
    53
popdef([CFLAGS])dnl
nkeynes@1211
    54
popdef([CPP])dnl
nkeynes@1211
    55
popdef([CC])dnl
nkeynes@1211
    56
popdef([ac_objext])dnl
nkeynes@1211
    57
popdef([ac_exeext])dnl
nkeynes@1211
    58
popdef([ac_cv_objext])dnl
nkeynes@1211
    59
popdef([ac_cv_exeext])dnl
nkeynes@1211
    60
dnl popdef([ac_cv_c_compiler_gnu])dnl
nkeynes@1211
    61
popdef([ac_cv_prog_cc_c89])dnl
nkeynes@1211
    62
popdef([ac_cv_prog_cc_c99])dnl
nkeynes@1211
    63
popdef([ac_cv_prog_cc_stdc])dnl
nkeynes@1211
    64
popdef([ac_cv_prog_cc_g])dnl
nkeynes@1211
    65
popdef([ac_cv_prog_cc_works])dnl
nkeynes@1211
    66
popdef([ac_cv_prog_cc_cross])dnl
nkeynes@1211
    67
popdef([ac_cv_prog_gcc])dnl
nkeynes@1211
    68
popdef([ac_cv_prog_CPP])dnl
nkeynes@1211
    69
])
nkeynes@1211
    70
nkeynes@1211
    71
nkeynes@1211
    72
AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl
nkeynes@1211
    73
AC_REQUIRE([AC_PROG_CC])dnl
nkeynes@1211
    74
AC_REQUIRE([AC_PROG_CPP])dnl
nkeynes@1211
    75
AC_REQUIRE([AC_EXEEXT])dnl
nkeynes@1211
    76
AC_REQUIRE([AC_CANONICAL_HOST])dnl
nkeynes@1211
    77
dnl
nkeynes@1211
    78
ac_main_cc="$CC"
nkeynes@1211
    79
test -n "$build_alias" && ac_build_tool_prefix=$build_alias-
nkeynes@1211
    80
nkeynes@1211
    81
pushdef([cross_compiling], [#])dnl
nkeynes@1211
    82
dnl If main compiler works and CC_FOR_BUILD is unset, use the main compiler
nkeynes@1211
    83
if test -z "$CC_FOR_BUILD"; then
nkeynes@1211
    84
    AC_RUN_IFELSE([int main(){return 0;}], [CC_FOR_BUILD="$CC"], [],[])
nkeynes@1211
    85
fi
nkeynes@1211
    86
dnl Use the standard macros, but make them use other variable names
nkeynes@1211
    87
dnl
nkeynes@1211
    88
AC_PUSH_CC_FOR_BUILD
nkeynes@1211
    89
nkeynes@1211
    90
AC_PROG_CC
nkeynes@1211
    91
AC_PROG_CC_STDC
nkeynes@1211
    92
AC_PROG_CPP
nkeynes@1211
    93
AC_EXEEXT
nkeynes@1211
    94
nkeynes@1211
    95
dnl Restore the old definitions
nkeynes@1211
    96
dnl
nkeynes@1211
    97
AC_POP_CC_FOR_BUILD
nkeynes@1211
    98
popdef([cross_compiling])dnl
nkeynes@1211
    99
dnl Finally, set Makefile variables
nkeynes@1211
   100
dnl
nkeynes@1211
   101
BUILD_EXEEXT=$ac_build_exeext
nkeynes@1211
   102
BUILD_OBJEXT=$ac_build_objext
nkeynes@1211
   103
AC_SUBST(BUILD_EXEEXT)dnl
nkeynes@1211
   104
AC_SUBST(BUILD_OBJEXT)dnl
nkeynes@1211
   105
AC_SUBST([CFLAGS_FOR_BUILD])dnl
nkeynes@1211
   106
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
nkeynes@1293
   107
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
nkeynes@1211
   108
])
.