[Top][All Lists]
[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: |
Sat, 13 Mar 2010 17:33:05 +0100 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> Which begs the question - why is gnulib-tool making C-only projects to
> import C++ test files? It seems like C++ files should be excluded
> unless the developer explicitly requests that both C and C++ be supported.
Simon Josefsson wrote:
> > So, the fix is to add an LT_LANG([CXX]) invocation to your configure.ac.
> > This fixes it for libunistring.
>
> That doesn't make a lot of sense to me because
>
> 1) It violates the modularity of gnulib. Gnulib is adding the C++
> code to my project, so I believe gnulib should be responsible for
> making sure the files build.
>
> 2) LT_LANG([CXX]) doesn't exist in libtool 1.5.x which is still
> supported by gnulib.
>
> The fix you applied is just for --create-testdir (right?) so that patch
> by itself doesn't modify anything for libidn or libunistring as far as I
> can tell.
> ...
> Alternatively, some solution that detected that C++ code isn't relevant
> for the particular project, and didn't try to build those files.
Actually, there are quite a number of tests that not every project may
want to carry in its testsuite, but that should be packageable via
--create-testdir:
- The C++ tests of the modules 'string', 'stdlib', etc.
- The tests that ask for the superuser password ('idpriv-drop',
'idpriv-droptemp').
- The long-running tests of the 'havelib' module (currently still in
gettext).
The solution I would propose is to put them into a module '*-extratests'.
It is like '*-tests', except that it is not included by default in
--with-tests.
Additionally, the user who installs a package might want to disable the C++
part even if it is packaged as part of the tarball. I'm applying this.
2010-03-13 Bruno Haible <address@hidden>
Allow the user to disable C++ code and tests.
* m4/ansi-c++.m4 (gl_CXX_CHOICE): New macro.
(gl_PROG_ANSI_CXX): Require it.
--- m4/ansi-c++.m4.orig Sat Mar 13 17:30:01 2010
+++ m4/ansi-c++.m4 Sat Mar 13 17:28:22 2010
@@ -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"
- C++ libtool build error?, Simon Josefsson, 2010/03/08
- Re: C++ libtool build error?, Ludovic Courtès, 2010/03/11
- Re: C++ libtool build error?, Bruno Haible, 2010/03/12
- Re: [bug-libunistring] Re: C++ libtool build error?, Simon Josefsson, 2010/03/12
- Re: C++ libtool build error?, Bruno Haible, 2010/03/13
- Re: C++ libtool build error?,
Bruno Haible <=
- Re: C++ libtool build error?, Jim Meyering, 2010/03/13
- Re: C++ libtool build error?, Bruno Haible, 2010/03/13
- extra test module categories, Bruno Haible, 2010/03/28
- Re: extra test module categories, Bruno Haible, 2010/03/28
- Re: C++ libtool build error?, Simon Josefsson, 2010/03/17
- Re: C++ libtool build error?, Bruno Haible, 2010/03/28
- Re: C++ libtool build error?, Eric Blake, 2010/03/17
- Re: C++ libtool build error?, Bruno Haible, 2010/03/28
- Re: C++ libtool build error?, Ralf Wildenhues, 2010/03/13
- Re: C++ libtool build error?, Bruno Haible, 2010/03/13