]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 63668] Use autoconf to detect the default C++ compiler
authorPaul Smith <psmith@gnu.org>
Sun, 5 Feb 2023 15:22:13 +0000 (10:22 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 5 Feb 2023 15:22:13 +0000 (10:22 -0500)
* configure.ac: Add AC_PROG_CXX to search for a C++ compiler.
(MAKE_CXX): Add the discovered compiler to config.h.
* src/default.c (default_variables): Use MAKE_CXX as the C++ compiler.

configure.ac
src/default.c

index 67793e6ede44e50c536c4055ea450b36838e68c2..8326c0101dc60435d396b3232e2247e94d1ebcd1 100644 (file)
@@ -37,6 +37,8 @@ AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
 # Checks for programs.
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_CC
+AC_PROG_CXX
+AC_DEFINE_UNQUOTED(MAKE_CXX, ["$CXX"], [Default C++ compiler.])
 
 # Configure gnulib
 gl_EARLY
index 1082b41d10e5b820866acfdc4ceb23045a73e4a2..ffb5f98cab8fadea9c31f8043e69c86997f75ec5 100644 (file)
@@ -527,18 +527,24 @@ static const char *default_variables[] =
     "AS", "as",
 #ifdef GCC_IS_NATIVE
     "CC", "gcc",
-# ifdef __MSDOS__
-    "CXX", "gpp",       /* g++ is an invalid name on MSDOS */
-# else
-    "CXX", "gcc",
-# endif /* __MSDOS__ */
     "OBJC", "gcc",
 #else
     "CC", "cc",
-    "CXX", "g++",
     "OBJC", "cc",
 #endif
-
+#ifdef MAKE_CXX
+    "CXX", MAKE_CXX,
+#else
+# ifdef GCC_IS_NATIVE
+#  ifdef __MSDOS__
+    "CXX", "gpp",       /* g++ is an invalid name on MSDOS */
+#  else
+    "CXX", "gcc",
+#  endif /* __MSDOS__ */
+# else
+    "CXX", "g++",
+# endif
+#endif
     /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
        and to the empty string if $@ does exist.  */
     "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",