ax_prog_cxx_for_build.m4 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #serial 2
  34. AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD])
  35. AC_DEFUN([AX_PROG_CXX_FOR_BUILD], [dnl
  36. AC_REQUIRE([AX_PROG_CC_FOR_BUILD])dnl
  37. AC_REQUIRE([AC_PROG_CXX])dnl
  38. AC_REQUIRE([AC_PROG_CXXCPP])dnl
  39. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  40. dnl Use the standard macros, but make them use other variable names
  41. dnl
  42. pushdef([ac_cv_prog_CXXCPP], ac_cv_build_prog_CXXCPP)dnl
  43. pushdef([ac_cv_prog_gxx], ac_cv_build_prog_gxx)dnl
  44. pushdef([ac_cv_prog_cxx_works], ac_cv_build_prog_cxx_works)dnl
  45. pushdef([ac_cv_prog_cxx_cross], ac_cv_build_prog_cxx_cross)dnl
  46. pushdef([ac_cv_prog_cxx_g], ac_cv_build_prog_cxx_g)dnl
  47. pushdef([CXX], CXX_FOR_BUILD)dnl
  48. pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl
  49. pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl
  50. pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
  51. pushdef([CXXCPPFLAGS], CXXCPPFLAGS_FOR_BUILD)dnl
  52. pushdef([host], build)dnl
  53. pushdef([host_alias], build_alias)dnl
  54. pushdef([host_cpu], build_cpu)dnl
  55. pushdef([host_vendor], build_vendor)dnl
  56. pushdef([host_os], build_os)dnl
  57. pushdef([ac_cv_host], ac_cv_build)dnl
  58. pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
  59. pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
  60. pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
  61. pushdef([ac_cv_host_os], ac_cv_build_os)dnl
  62. pushdef([ac_cxxcpp], ac_build_cxxcpp)dnl
  63. pushdef([ac_compile], ac_build_compile)dnl
  64. pushdef([ac_link], ac_build_link)dnl
  65. save_cross_compiling=$cross_compiling
  66. save_ac_tool_prefix=$ac_tool_prefix
  67. cross_compiling=no
  68. ac_tool_prefix=
  69. AC_PROG_CXX
  70. AC_PROG_CXXCPP
  71. ac_tool_prefix=$save_ac_tool_prefix
  72. cross_compiling=$save_cross_compiling
  73. dnl Restore the old definitions
  74. dnl
  75. popdef([ac_link])dnl
  76. popdef([ac_compile])dnl
  77. popdef([ac_cxxcpp])dnl
  78. popdef([ac_cv_host_os])dnl
  79. popdef([ac_cv_host_vendor])dnl
  80. popdef([ac_cv_host_cpu])dnl
  81. popdef([ac_cv_host_alias])dnl
  82. popdef([ac_cv_host])dnl
  83. popdef([host_os])dnl
  84. popdef([host_vendor])dnl
  85. popdef([host_cpu])dnl
  86. popdef([host_alias])dnl
  87. popdef([host])dnl
  88. popdef([CXXCPPFLAGS])dnl
  89. popdef([CPPFLAGS])dnl
  90. popdef([CXXFLAGS])dnl
  91. popdef([CXXCPP])dnl
  92. popdef([CXX])dnl
  93. popdef([ac_cv_prog_cxx_g])dnl
  94. popdef([ac_cv_prog_cxx_cross])dnl
  95. popdef([ac_cv_prog_cxx_works])dnl
  96. popdef([ac_cv_prog_gxx])dnl
  97. popdef([ac_cv_prog_CXXCPP])dnl
  98. dnl Finally, set Makefile variables
  99. dnl
  100. AC_SUBST([CXXFLAGS_FOR_BUILD])dnl
  101. AC_SUBST([CXXCPPFLAGS_FOR_BUILD])dnl
  102. ])