[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing compiler flags at configure time
From: |
Eric Blake |
Subject: |
Re: changing compiler flags at configure time |
Date: |
Tue, 13 Jun 2006 11:52:55 +0000 |
Hi Ralf,
[dropping bug-m4, adding libtool-patches]
> > CVS head of m4 currently has a macro, ltdl/m4/debug.m4, that attempts to
> > alter compile-time flags according to whether --enable-debug is passed to
> > ./configure. However, it uses AC_DISABLE_SHARED and AC_ENABLE_SHARED
> > inside a shell if-then-else to enforce this decision, and autoupdate
> > reports that both macors are obsolete and should now be done by LT_INIT.
>
> Yes, we need to un-obsolete these two (at least), or replace them by
> differently-named other macros. Maybe LT_DISABLE_SHARED and
> LT_ENABLE_SHARED. Rationale: LT_INIT([options]) isn't flexible enough
> for some users (such as M4).
>
> > Hmm, AC_ENABLE_SHARED and its replacement of the parameter 'shared' to
> > LT_INIT aren't even mentioned in libtool.texi.
>
> TODO, too. Patches for both gladly accepted.
>
> > Is it safe to call LT_INIT more than once,
>
> No, and it should explicitly flag this error.
How about this?
2006-06-12 Eric Blake <address@hidden>
* libltdl/m4/ltoptions.m4 (_LT_SET_OPTION): Require literal
options.
(LT_ENABLE_SHARED, LT_DISABLE_SHARED): New macros.
(LT_ENABLE_STATIC, LT_DISABLE_STATIC): New macros.
(_LT_OBSOLETE): New helper macro.
* libltdl/m4/libtool.m4 (LT_INIT): Fail on multiple invocations.
* doc/libtool.texi (LT_INIT, LT_DISABLE_SHARED, LT_ENABLE_SHARED),
(LT_DISABLE_STATIC, LT_ENABLE_STATIC): Document these changes.
* NEWS: Document new macros.
--
Eric Blake
? doc/.dirstamp
Index: NEWS
===================================================================
RCS file: /sources/libtool/libtool/NEWS,v
retrieving revision 1.194
diff -u -p -r1.194 NEWS
--- NEWS 15 May 2006 16:40:42 -0000 1.194
+++ NEWS 13 Jun 2006 11:48:07 -0000
@@ -1,6 +1,9 @@
NEWS - list of user-visible changes between releases of GNU Libtool
New in 1.9h: 2005-??-??; CVS version 2.1a, Libtool team:
+* New macros LT_ENABLE_SHARED, LT_DISABLE_SHARED, LT_ENABLE_STATIC,
+ and LT_DISABLE_STATIC work alongside LT_INIT to replace obsoleted
+ AC_ENABLE_SHARED and friends.
* New tests for support of Automake subdir-objects.
* Fix libltdl on static platforms.
* New LT_CONFIG_LTDL_DIR macro.
Index: doc/libtool.texi
===================================================================
RCS file: /sources/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.215
diff -u -p -r1.215 libtool.texi
--- doc/libtool.texi 18 May 2006 00:10:37 -0000 1.215
+++ doc/libtool.texi 13 Jun 2006 11:48:09 -0000
@@ -1891,10 +1891,9 @@ By default, this macro turns on shared l
and also enables static libraries if they don't conflict with the shared
libraries. You can modify these defaults by passing either
@code{disable-shared} or @code{disable-static} in the option list to
address@hidden:@footnote{This used to be done with additional macro
-calls, @code{AC_DISABLE_SHARED} and @code{AC_DISABLE_STATIC}. If you
-are upgrading from such an old version, again @code{autoupdate} is your
-friend.}
address@hidden For symmetry, you can also request the options
address@hidden or @code{static} to explicitly request enabling shared and
+static libraries, respectively.
@example
# Turn off shared libraries during beta-testing, since they
@@ -1902,6 +1901,11 @@ friend.}
LT_INIT([disable-shared])
@end example
address@hidden may only be invoked once. If you need to change the
+default selections after the fact, such as based on whether a particular
address@hidden option was passed to @code{./configure}, you can use
+macros such as @code{LT_DISABLE_SHARED} or @code{LT_DISABLE_STATIC}.
+
The user may specify modified forms of the configure flags
@option{--enable-shared} and @option{--enable-static} to choose whether
shared or static libraries are built based on the name of the package.
@@ -1996,6 +2000,16 @@ Change the default behaviour of @command
address@hidden objects. The user may still override this default by
specifying @option{--with-pic} to @command{configure}.
address@hidden shared
+Change the default behaviour for @code{LT_INIT} to enable
+shared libraries. The user may still override this default by
+specifying @option{--disable-shared} to @command{configure}.
+
address@hidden static
+Change the default behaviour for @code{LT_INIT} to enable
+static libraries. The user may still override this default by
+specifying @option{--disable-static} to @command{configure}.
+
@end table
@end defmac
@@ -2140,6 +2154,40 @@ Automake regeneration rules, @file{confi
the file itself.
@end defmac
address@hidden LT_DISABLE_SHARED
address@hidden AC_DISABLE_SHARED
+This macro changes the created @file{libtool} to avoid creating shared
+libraries by default. It is equivalent to
address@hidden([disable-shared])}, except that it may be called after
address@hidden Older versions of libtool used the obsolete name
address@hidden
address@hidden defmac
+
address@hidden LT_DISABLE_STATIC
address@hidden AC_DISABLE_STATIC
+This macro changes the created @file{libtool} to avoid creating static
+libraries by default. It is equivalent to
address@hidden([disable-static])}, except that it may be called after
address@hidden Older versions of libtool used the obsolete name
address@hidden
address@hidden defmac
+
address@hidden LT_ENABLE_SHARED
address@hidden AC_ENABLE_SHARED
+This macro changes the created @file{libtool} to generate shared
+libraries by default. It is equivalent to @code{LT_INIT([shared])},
+except that it may be called after @code{LT_INIT}. Older versions of
+libtool used the obsolete name @code{AC_ENABLE_SHARED}.
address@hidden defmac
+
address@hidden LT_ENABLE_STATIC
address@hidden AC_ENABLE_STATIC
+This macro changes the created @file{libtool} to generate static
+libraries by default. It is equivalent to @code{LT_INIT([static])},
+except that it may be called after @code{LT_INIT}. Older versions of
+libtool used the obsolete name @code{AC_ENABLE_STATIC}.
address@hidden defmac
+
@pindex aclocal
When you invoke the @command{libtoolize} program (@pxref{Invoking
libtoolize}), it will tell you where to find a definition of
Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /sources/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.74
diff -u -p -r1.74 libtool.m4
--- libltdl/m4/libtool.m4 1 Jun 2006 18:39:24 -0000 1.74
+++ libltdl/m4/libtool.m4 13 Jun 2006 11:48:11 -0000
@@ -37,7 +37,7 @@ m4_define([_LT_COPYING], [dnl
# the same distribution terms that you use for the rest of that program.
])
-# serial 52 LT_INIT
+# serial 53 LT_INIT
# LT_PREREQ(VERSION)
@@ -78,8 +78,8 @@ AC_SUBST(LIBTOOL)dnl
_LT_SETUP
-# Only expand once:
-m4_define([LT_INIT])
+# Diagnose multiple calls:
+m4_define([LT_INIT], [AC_MSG_ERROR([[$0 can only be invoked once]])])
])# _LT_INIT
# Old names:
Index: libltdl/m4/ltoptions.m4
===================================================================
RCS file: /sources/libtool/libtool/libltdl/m4/ltoptions.m4,v
retrieving revision 1.7
diff -u -p -r1.7 ltoptions.m4
--- libltdl/m4/ltoptions.m4 12 Nov 2005 12:08:14 -0000 1.7
+++ libltdl/m4/ltoptions.m4 13 Jun 2006 11:48:11 -0000
@@ -1,13 +1,13 @@
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
# Written by Gary V. Vaughan <address@hidden>
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# serial 3 ltoptions.m4
+# serial 4 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -23,12 +23,15 @@ m4_define([_LT_MANGLE_OPTION],
# --------------------
# Set option NAME, and if there is a matching handler defined,
# dispatch to it. Other NAMEs are saved as a flag.
+# Die if NAME is not a literal.
m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1]),
- _LT_MANGLE_DEFUN([$1]),
- [m4_warning([Unknown Libtool option `$1'])])[]dnl
-])
+[AS_LITERAL_IF([$1],
+ [m4_define(_LT_MANGLE_OPTION([$1]))dnl
+ m4_ifdef(_LT_MANGLE_DEFUN([$1]),
+ _LT_MANGLE_DEFUN([$1]),
+ [m4_warning([Unknown Libtool option `$1'])])[]dnl],
+ [m4_error([Libtool option `$1' is not a literal]
+)])])
# _LT_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
@@ -182,33 +185,42 @@ AC_ARG_ENABLE([shared],
LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
+# LT_ENABLE_SHARED
+# ----------------
+# Set the --enable-shared flag by default.
+AC_DEFUN([LT_ENABLE_SHARED],
+[_LT_SET_OPTION([shared])])
+
+# LT_DISABLE_SHARED
+# -----------------
+# Set the --disable-shared flag by default.
+AC_DEFUN([LT_DISABLE_SHARED],
+[_LT_SET_OPTION([disable-shared])])
+
# Old names:
+
AU_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([shared])
+[LT_ENABLE_SHARED
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `shared' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
AU_DEFUN([AM_ENABLE_SHARED],
-[_LT_SET_OPTION([shared])
+[LT_ENABLE_SHARED
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `shared' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
AU_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([disable-shared])
+[LT_DISABLE_SHARED
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-shared' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
AU_DEFUN([AM_DISABLE_SHARED],
-[_LT_SET_OPTION([disable-shared])
+[LT_DISABLE_SHARED
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-shared' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
dnl aclocal-1.4 backwards compatibility:
@@ -255,33 +267,42 @@ AC_ARG_ENABLE([static],
LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
+# LT_ENABLE_STATIC
+# ----------------
+# Set the --enable-static flag by default.
+AC_DEFUN([LT_ENABLE_STATIC],
+[_LT_SET_OPTION([static])])
+
+# LT_DISABLE_STATIC
+# -----------------
+# Set the --disable-static flag by default.
+AC_DEFUN([LT_DISABLE_STATIC],
+[_LT_SET_OPTION([disable-static])])
+
# Old names:
+
AU_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([static])
+[LT_ENABLE_STATIC
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `static' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
AU_DEFUN([AM_ENABLE_STATIC],
-[_LT_SET_OPTION([static])
+[LT_ENABLE_STATIC
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `static' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
AU_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([disable-static])
+[LT_DISABLE_STATIC
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-static' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
AU_DEFUN([AM_DISABLE_STATIC],
-[_LT_SET_OPTION([disable-static])
+[LT_DISABLE_STATIC
AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-static' option into LT_INIT's first parameter.])
+[$0: This macro is obsolete.])
])
dnl aclocal-1.4 backwards compatibility: