changeset 12990:bec1f52a7706

Allow the user to disable C++ code and tests.
author Bruno Haible <bruno@clisp.org>
date Sat, 13 Mar 2010 17:31:06 +0100
parents f3c12bbb4e73
children 1276be199c4c
files ChangeLog m4/ansi-c++.m4
diffstat 2 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 13 16:31:43 2010 +0100
+++ b/ChangeLog	Sat Mar 13 17:31:06 2010 +0100
@@ -1,3 +1,9 @@
+2010-03-13  Bruno Haible  <bruno@clisp.org>
+
+	Allow the user to disable C++ code and tests.
+	* m4/ansi-c++.m4 (gl_CXX_CHOICE): New macro.
+	(gl_PROG_ANSI_CXX): Require it.
+
 2010-03-13  Bruno Haible  <bruno@clisp.org>
 
 	* DEPENDENCIES (libtool): Mention libtool 2.2.x requirement in special
--- a/m4/ansi-c++.m4	Sat Mar 13 16:31:43 2010 +0100
+++ b/m4/ansi-c++.m4	Sat Mar 13 17:31:06 2010 +0100
@@ -1,11 +1,26 @@
-# ansi-c++.m4 serial 2
-dnl Copyright (C) 2002-2003, 2010 Free Software Foundation, Inc.
+# ansi-c++.m4 serial 3
+dnl Copyright (C) 2002-2003, 2005, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Bruno Haible.
 
+# Sets CXX_CHOICE to 'yes' or 'no', depending on the preferred use of C++.
+
+AC_DEFUN([gl_CXX_CHOICE],
+[
+  AC_MSG_CHECKING([whether to use C++])
+  dnl It would be so nice if plus signs were supported in AC_ARG_ENABLE.
+  dnl Feature request submitted on 2010-03-13.
+  AC_ARG_ENABLE([cxx],
+    [  --disable-cxx           do not build C++ sources],
+    [CXX_CHOICE="$enableval"],
+    [CXX_CHOICE=yes])
+  AC_MSG_RESULT([$CXX_CHOICE])
+  AC_SUBST([CXX_CHOICE])
+])
+
 # gl_PROG_ANSI_CXX([ANSICXX_VARIABLE], [ANSICXX_CONDITIONAL])
 # Sets ANSICXX_VARIABLE to the name of a sufficiently ANSI C++ compliant
 # compiler, or to ":" if none is found.
@@ -14,8 +29,12 @@
 
 AC_DEFUN([gl_PROG_ANSI_CXX],
 [
+  AC_REQUIRE([gl_CXX_CHOICE])
   m4_if([$1], [CXX], [],
     [gl_save_CXX="$CXX"])
+  if test "$CXX_CHOICE" = no; then
+    CXX=":"
+  fi
   if test -z "$CXX"; then
     if test -n "$CCC"; then
       CXX="$CCC"