bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ libtool build error?


From: Bruno Haible
Subject: Re: C++ libtool build error?
Date: Sun, 28 Mar 2010 14:35:20 +0100
User-agent: KMail/1.9.9

Eric Blake wrote on 2010-03-17:
> >     Allow the user to disable C++ code and tests.
> >     * m4/ansi-c++.m4 (gl_CXX_CHOICE): New macro.
> >     (gl_PROG_ANSI_CXX): Require it.
> 
> This is a nice patch, but would it be possible to take it one step
> further, and allow the developer to populate a default state for whether
> C++ code should be enabled/disabled ...
> [1] Oddly enough, this describes m4 :)

Implemented as below. You need to write
  AC_DEFUN([gl_CXX_CHOICE_DEFAULT_NO])

It would also have been possible to let the user write
  gl_CXX_CHOICE_DEFAULT_NO
and have a definition of this macro in a separate .m4 file, relying on
'aclocal' to find out which .m4 files are used and which are not. But
this would mean that gnulib-tool imports .m4 files that are most often
not used. It already does so for the 'gettext' module, and this is an
annoyance.

Bruno


2010-03-28  Bruno Haible  <address@hidden>

        ansi-c++-opt: Allow turning off the C++ build by default.
        * m4/ansi-c++.m4 (gl_CXX_CHOICE): Let CXX_CHOICE default to 'no' if
        gl_CXX_CHOICE_DEFAULT_NO is defined.
        Requested by Eric Blake.

--- m4/ansi-c++.m4.orig Sun Mar 28 15:27:25 2010
+++ m4/ansi-c++.m4      Sun Mar 28 15:26:42 2010
@@ -1,4 +1,4 @@
-# ansi-c++.m4 serial 3
+# ansi-c++.m4 serial 4
 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,
@@ -7,16 +7,25 @@
 dnl From Bruno Haible.
 
 # Sets CXX_CHOICE to 'yes' or 'no', depending on the preferred use of C++.
+# The default is 'yes'. If the configure.ac contains a definition of the
+# macro gl_CXX_CHOICE_DEFAULT_NO, then the default is 'no'. In both cases,
+# the user can change the value by passing the option --disable-cxx or
+# --enable-cxx, respectively.
 
 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])
+  m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO],
+    [AC_ARG_ENABLE([cxx],
+       [  --enable-cxx            also build C++ sources],
+       [CXX_CHOICE="$enableval"],
+       [CXX_CHOICE=no])],
+    [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])
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]