egl/wayland: Add invalidate back in eglSwapBuffers()
[mesa.git] / m4 / ax_prog_cc_for_build.m4
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 #
30 # Copying and distribution of this file, with or without modification, are
31 # permitted in any medium without royalty provided the copyright notice
32 # and this notice are preserved. This file is offered as-is, without any
33 # warranty.
34
35 #serial 5
36
37 AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
38 AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
39 AC_REQUIRE([AC_PROG_CC])dnl
40 AC_REQUIRE([AC_PROG_CPP])dnl
41 AC_REQUIRE([AC_EXEEXT])dnl
42 AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl
43 dnl
44 pushdef([AC_TRY_COMPILER], [
45 cat > conftest.$ac_ext << EOF
46 #line __oline__ "configure"
47 #include "confdefs.h"
48 [$1]
49 EOF
50 # If we can't run a trivial program, we are probably using a cross
51 compiler.
52 # Fail miserably.
53 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest;
54 exit) 2>/dev/null; then
55 [$2]=yes
56 else
57 echo "configure: failed program was:" >&AC_FD_CC
58 cat conftest.$ac_ext >&AC_FD_CC
59 [$2]=no
60 fi
61 [$3]=no
62 rm -fr conftest*])dnl
63
64 dnl Use the standard macros, but make them use other variable names
65 dnl
66 pushdef([cross_compiling], [#])dnl
67 pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
68 pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
69 pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
70 pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
71 pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
72 pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
73 pushdef([ac_cv_objext], ac_cv_build_objext)dnl
74 pushdef([ac_exeext], ac_build_exeext)dnl
75 pushdef([ac_objext], ac_build_objext)dnl
76 pushdef([CC], CC_FOR_BUILD)dnl
77 pushdef([CPP], CPP_FOR_BUILD)dnl
78 pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
79 pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
80 pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
81 pushdef([host], build)dnl
82 pushdef([host_alias], build_alias)dnl
83 pushdef([host_cpu], build_cpu)dnl
84 pushdef([host_vendor], build_vendor)dnl
85 pushdef([host_os], build_os)dnl
86 pushdef([ac_cv_host], ac_cv_build)dnl
87 pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
88 pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
89 pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
90 pushdef([ac_cv_host_os], ac_cv_build_os)dnl
91 pushdef([ac_cpp], ac_build_cpp)dnl
92 pushdef([ac_compile], ac_build_compile)dnl
93 pushdef([ac_link], ac_build_link)dnl
94 pushdef([ac_tool_prefix], [#])dnl
95
96 AC_PROG_CC
97 AC_PROG_CPP
98 AC_EXEEXT
99
100 dnl Restore the old definitions
101 dnl
102 popdef([AC_TRY_COMPILER])dnl
103 popdef([ac_tool_prefix])dnl
104 popdef([ac_link])dnl
105 popdef([ac_compile])dnl
106 popdef([ac_cpp])dnl
107 popdef([ac_cv_host_os])dnl
108 popdef([ac_cv_host_vendor])dnl
109 popdef([ac_cv_host_cpu])dnl
110 popdef([ac_cv_host_alias])dnl
111 popdef([ac_cv_host])dnl
112 popdef([host_os])dnl
113 popdef([host_vendor])dnl
114 popdef([host_cpu])dnl
115 popdef([host_alias])dnl
116 popdef([host])dnl
117 popdef([CPPFLAGS])dnl
118 popdef([CFLAGS])dnl
119 popdef([CPP])dnl
120 popdef([CC])dnl
121 popdef([ac_objext])dnl
122 popdef([ac_exeext])dnl
123 popdef([ac_cv_objext])dnl
124 popdef([ac_cv_exeext])dnl
125 popdef([ac_cv_prog_cc_g])dnl
126 popdef([ac_cv_prog_cc_works])dnl
127 popdef([ac_cv_prog_cc_cross])dnl
128 popdef([ac_cv_prog_gcc])dnl
129 popdef([cross_compiling])dnl
130
131 dnl Finally, set Makefile variables
132 dnl
133 BUILD_EXEEXT=$ac_build_exeext
134 BUILD_OBJEXT=$ac_build_objext
135 AC_SUBST(BUILD_EXEEXT)dnl
136 AC_SUBST(BUILD_OBJEXT)dnl
137 AC_SUBST([CFLAGS_FOR_BUILD])dnl
138 AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
139 AC_SUBST([LDFLAGS_FOR_BUILD])dnl
140 ])