]> git.saurik.com Git - cycript.git/blob - m4/ax_prog_cxx_for_build.m4
Use implicit properties on older, broken runtimes.
[cycript.git] / m4 / ax_prog_cxx_for_build.m4
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_prog_cxx_for_build.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_PROG_CXX_FOR_BUILD
8 #
9 # DESCRIPTION
10 #
11 # This macro searches for a C++ compiler that generates native
12 # executables, that is a C++ compiler that surely is not a cross-compiler.
13 # This can be useful if you have to generate source code at compile-time
14 # like for example GCC does.
15 #
16 # The macro sets the CXX_FOR_BUILD and CXXCPP_FOR_BUILD macros to anything
17 # needed to compile or link (CXX_FOR_BUILD) and preprocess
18 # (CXXCPP_FOR_BUILD). The value of these variables can be overridden by
19 # the user by specifying a compiler with an environment variable (like you
20 # do for standard CXX).
21 #
22 # LICENSE
23 #
24 # Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
25 # Copyright (c) 2012 Avionic Design GmbH
26 #
27 # Based on the AX_PROG_CC_FOR_BUILD macro by Paolo Bonzini.
28 #
29 # Copying and distribution of this file, with or without modification, are
30 # permitted in any medium without royalty provided the copyright notice
31 # and this notice are preserved. This file is offered as-is, without any
32 # warranty.
33
34 #serial 2
35
36 AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD])
37 AC_DEFUN([AX_PROG_CXX_FOR_BUILD], [dnl
38 AC_REQUIRE([AX_PROG_CC_FOR_BUILD])dnl
39 AC_REQUIRE([AC_PROG_CXX])dnl
40 AC_REQUIRE([AC_PROG_CXXCPP])dnl
41 AC_REQUIRE([AC_CANONICAL_HOST])dnl
42
43 dnl Use the standard macros, but make them use other variable names
44 dnl
45 pushdef([ac_cv_prog_CXXCPP], ac_cv_build_prog_CXXCPP)dnl
46 pushdef([ac_cv_prog_gxx], ac_cv_build_prog_gxx)dnl
47 pushdef([ac_cv_prog_cxx_works], ac_cv_build_prog_cxx_works)dnl
48 pushdef([ac_cv_prog_cxx_cross], ac_cv_build_prog_cxx_cross)dnl
49 pushdef([ac_cv_prog_cxx_g], ac_cv_build_prog_cxx_g)dnl
50 pushdef([CXX], CXX_FOR_BUILD)dnl
51 pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl
52 pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl
53 pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
54 pushdef([CXXCPPFLAGS], CXXCPPFLAGS_FOR_BUILD)dnl
55 pushdef([host], build)dnl
56 pushdef([host_alias], build_alias)dnl
57 pushdef([host_cpu], build_cpu)dnl
58 pushdef([host_vendor], build_vendor)dnl
59 pushdef([host_os], build_os)dnl
60 pushdef([ac_cv_host], ac_cv_build)dnl
61 pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
62 pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
63 pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
64 pushdef([ac_cv_host_os], ac_cv_build_os)dnl
65 pushdef([ac_cxxcpp], ac_build_cxxcpp)dnl
66 pushdef([ac_compile], ac_build_compile)dnl
67 pushdef([ac_link], ac_build_link)dnl
68
69 save_cross_compiling=$cross_compiling
70 save_ac_tool_prefix=$ac_tool_prefix
71 cross_compiling=no
72 ac_tool_prefix=
73
74 AC_PROG_CXX
75 AC_PROG_CXXCPP
76
77 ac_tool_prefix=$save_ac_tool_prefix
78 cross_compiling=$save_cross_compiling
79
80 dnl Restore the old definitions
81 dnl
82 popdef([ac_link])dnl
83 popdef([ac_compile])dnl
84 popdef([ac_cxxcpp])dnl
85 popdef([ac_cv_host_os])dnl
86 popdef([ac_cv_host_vendor])dnl
87 popdef([ac_cv_host_cpu])dnl
88 popdef([ac_cv_host_alias])dnl
89 popdef([ac_cv_host])dnl
90 popdef([host_os])dnl
91 popdef([host_vendor])dnl
92 popdef([host_cpu])dnl
93 popdef([host_alias])dnl
94 popdef([host])dnl
95 popdef([CXXCPPFLAGS])dnl
96 popdef([CPPFLAGS])dnl
97 popdef([CXXFLAGS])dnl
98 popdef([CXXCPP])dnl
99 popdef([CXX])dnl
100 popdef([ac_cv_prog_cxx_g])dnl
101 popdef([ac_cv_prog_cxx_cross])dnl
102 popdef([ac_cv_prog_cxx_works])dnl
103 popdef([ac_cv_prog_gxx])dnl
104 popdef([ac_cv_prog_CXXCPP])dnl
105
106 dnl Finally, set Makefile variables
107 dnl
108 AC_SUBST([CXXFLAGS_FOR_BUILD])dnl
109 AC_SUBST([CXXCPPFLAGS_FOR_BUILD])dnl
110 ])