]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/argz.h: Moved from here...
authorGary V. Vaughan <gary@gnu.org>
Thu, 22 Apr 2004 22:47:20 +0000 (22:47 +0000)
committerGary V. Vaughan <gary@gnu.org>
Thu, 22 Apr 2004 22:47:20 +0000 (22:47 +0000)
* libltdl/argz_.h: ...to here, so as not to shadow system
argz.h when we `#include <argz.h>' for example.
#include stdlib.h and sys/types.h to ensure we get a size_t
definition.
* libltdl/argz.c (HAVE_CONFIG_H): Set it up how ltdl likes it when
used by another client.
* m4/argz.m4: New file.
(gl_FUNC_ARGZ): Try to find an error_t definition, and a system
argz.h.
* m4/ltdl.m4: Use it.
(AC_LTDL_FUNC_ARGZ): Removed.
* libltdl/lt__glibc.h: #include <argz.h> to pick up either the
system argz.h or our libltdl/argz.h if necessary.
* libltdl/Makefile.am (libltdl_la_SOURCES): Move argz.h from
here...
(ltdldata_DATA): ...here. Along with argz.c.
(argz.h): Generate from argz_.h if the system file is missing.
Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>

ChangeLog
Makefile.am
libltdl/Makefile.am
libltdl/argz.c
libltdl/argz_.h [moved from libltdl/argz.h with 93% similarity]
libltdl/lt__glibc.h
m4/argz.m4 [new file with mode: 0644]
m4/ltdl.m4

index 65d8f0361525fd2ed2bee997b90b9a38f4df323d..534348b2729b0262b3e5ffa0df47e91be5d518e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2004-04-22  Gary V. Vaughan  <gary@gnu.org>
+
+       * libltdl/argz.h: Moved from here...
+       * libltdl/argz_.h: ...to here, so as not to shadow system
+       argz.h when we `#include <argz.h>' for example.
+       #include stdlib.h and sys/types.h to ensure we get a size_t
+       definition.
+       * libltdl/argz.c (HAVE_CONFIG_H): Set it up how ltdl likes it when
+       used by another client.
+       * m4/argz.m4: New file.
+       (gl_FUNC_ARGZ): Try to find an error_t definition, and a system
+       argz.h.
+       * m4/ltdl.m4: Use it.
+       (AC_LTDL_FUNC_ARGZ): Removed.
+       * libltdl/lt__glibc.h: #include <argz.h> to pick up either the
+       system argz.h or our libltdl/argz.h if necessary.
+       * libltdl/Makefile.am (libltdl_la_SOURCES): Move argz.h from
+       here...
+       (ltdldata_DATA): ...here. Along with argz.c.
+       (argz.h): Generate from argz_.h if the system file is missing.
+       Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
 2004-04-22  Gary V. Vaughan  <gary@gnu.org>
 
        According to Howard Chu <hyc@highlandsun.com>:
index 5e6837546805e11d56d835eadfde3401548e7575..717d5b57f47557ce930d426c8718386df655977e 100644 (file)
@@ -36,8 +36,8 @@ dist_pkgdata_DATA = config/config.guess config/config.sub config/ltmain.sh
 # Everything that gets picked up by aclocal is automatically distributed,
 # this is the list of macro files we install on the user's system.
 pkgmacrodir = $(pkgdatadir)/m4
-pkgmacro_DATA = m4/libtool.m4 m4/ltdl.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
-       m4/ltversion.m4
+pkgmacro_DATA = m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 \
+       m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4
 
 # We build ltversion.m4 here, instead of from config.status,
 # because config.status is rerun each time one og configure's
index bfbf2595e40eb74f9896165217f770ce31915799..2b20d70398811a4bf0112435eef0bada65e1c9d1 100644 (file)
 ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ## Boston, MA 02111-1307, USA.
 
+BUILT_SOURCES =
+MOSTLYCLEANFILES =
+EXTRA_DIST =
+
 AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS  = -I ../m4
 AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
@@ -42,7 +46,7 @@ libltdl_la_SOURCES  = ltdl.h ltdl.c \
                      loader-preopen.c \
                      lt_error.h lt_error.c \
                      lt__private.h lt__alloc.h lt__alloc.c \
-                     lt__glibc.h argz.h lt__dirent.h \
+                     lt__glibc.h lt__dirent.h \
                      lt_system.h
 libltdl_la_LDFLAGS  = -no-undefined -version-info 5:0:2
 libltdl_la_LIBADD   = $(LIBADD_DL) $(LTLIBOBJS)
@@ -53,4 +57,23 @@ libltdlc_la_LIBADD  = $(LIBADD_DL) $(LTLIBOBJS)
 ## These are installed as a subdirectory of pkgdatadir so that
 ## libtoolize --ltdl can find them later:
 ltdldatadir = $(pkgdatadir)/libltdl
-ltdldata_DATA = COPYING.LIB Makefile.am README $(libltdl_la_SOURCES)
+ltdldata_DATA = COPYING.LIB Makefile.am README $(libltdl_la_SOURCES) \
+               argz_.h argz.c
+
+
+## --------------------------- ##
+## Gnulib Makefile.am snippets ##
+## --------------------------- ##
+
+## ((( gnulib module argz
+BUILT_SOURCES += $(ARGZ_H)
+EXTRA_DIST += argz_.h
+
+# We need the following in order to create an <argz.h> when the system
+# doesn't have one that works with the given compiler.
+all-local $(lib_OBJECTS): $(ARGZ_H)
+argz.h: argz_.h
+       cp $(srcdir)/argz_.h $@-t
+       mv $@-t $@
+MOSTLYCLEANFILES += argz.h argz.h-t
+## ))) gnulib module argz
index 8bda7a890aeab1925940e47bd21302d355c6d39b..05dd30e438c611fe553b28c0c4ca2875776be1e6 100644 (file)
@@ -27,7 +27,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
 */
 
-#include "argz.h"
+/* Provide our wierdo HAVE_CONFIG_H rvalue for other clients.  */
+#if !defined(LTDL) && defined(HAVE_CONFIG_H)
+#  define HAVE_CONFIG_H <config.h>
+#endif
+
+#if defined(HAVE_CONFIG_H)
+#  include HAVE_CONFIG_H
+#endif
+
+#include <argz.h>
 
 #include <assert.h>
 #include <stddef.h>
similarity index 93%
rename from libltdl/argz.h
rename to libltdl/argz_.h
index 6344fc5b098d8b799d611350ad7bd785cfef96b1..5c8d977e288fc1b972c101db30f83cb5b0b8afae 100644 (file)
@@ -27,8 +27,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
 */
 
-#if !defined(ARGZ_H)
-#define ARGZ_H 1
+#if !defined(LT__ARGZ_H)
+#define LT__ARGZ_H 1
+
+#include <stdlib.h>
+#include <sys/types.h>
 
 #if defined(LTDL)
 #  include "lt__glibc.h"
@@ -51,4 +54,4 @@ void  argz_stringify  (char *argz, size_t argz_len, int sep);
 }
 #endif
 
-#endif /*!defined(ARGZ_H)*/
+#endif /*!defined(LT__ARGZ_H)*/
index 0e91c918b57cd2820323954ed04d6357cd808260..16b3c53efb05a5c8dae451c565c75407c41b6fa5 100644 (file)
@@ -34,40 +34,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 #  include HAVE_CONFIG_H
 #endif
 
-#include "lt_system.h"
-
-/* First redefine any glibc symbols we reimplement... */
-#undef  argz_append
-#define argz_append            lt__argz_append
-#undef  argz_create_sep
-#define argz_create_sep                lt__argz_create_sep
-#undef  argz_insert
-#define argz_insert            lt__argz_insert
-#undef  argz_next
-#define argz_next              lt__argz_next
-#undef  argz_stringify
-#define argz_stringify         lt__argz_stringify
-
-/* ...import our implementations into the lt__ namespace... */
-#include "argz.h"
-
-/* ...finally, we revert to the library implementations of any symbols
-   that are provided by the host since they may be more optimised (say
-   with inline assembler) than the generic versions we provide here.  */
-#if defined(HAVE_ARGZ_APPEND)
-#  undef argz_append
-#endif
-#if defined(HAVE_ARGZ_CREATE_SEP)
-#  undef argz_create_sep
-#endif
-#if defined(HAVE_ARGZ_INSERT)
-#  undef argz_insert
-#endif
-#if defined(HAVE_ARGZ_NEXT)
-#  undef argz_next
-#endif
-#if defined(HAVE_ARGZ_STRINGIFY)
-#  undef argz_stringify
+#if !defined(HAVE_ARGZ_H)
+/* Redefine any glibc symbols we reimplement to import the
+   implementations into our lt__ namespace so we don't ever
+   clash with the system library if our clients use argz_*
+   from there in addition to libltdl.  */
+#  undef  argz_append
+#  define argz_append          lt__argz_append
+#  undef  argz_create_sep
+#  define argz_create_sep      lt__argz_create_sep
+#  undef  argz_insert
+#  define argz_insert          lt__argz_insert
+#  undef  argz_next
+#  define argz_next            lt__argz_next
+#  undef  argz_stringify
+#  define argz_stringify       lt__argz_stringify
 #endif
 
+#include <argz.h>
+
 #endif /*!defined(LT__GLIBC_H)*/
diff --git a/m4/argz.m4 b/m4/argz.m4
new file mode 100644 (file)
index 0000000..66f3bc1
--- /dev/null
@@ -0,0 +1,43 @@
+# Portability macros for glibc argz.                    -*- Autoconf -*-
+# Written by Gary V. Vaughan <gary@gnu.org>
+
+# Copyright (C) 2004  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+AC_DEFUN([gl_FUNC_ARGZ],
+[gl_PREREQ_ARGZ
+
+AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
+
+AC_CHECK_TYPES([error_t],
+  [],
+  [AC_DEFINE([error_t], [int],
+   [Define to a type to use for `error_t' if it is not otherwise available.])],
+  [#if defined(HAVE_ARGZ_H)
+#  include <argz.h>
+#endif])
+
+ARGZ_H=
+AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next \
+       argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])])
+AC_SUBST([ARGZ_H])
+])
+
+# Prerequisites of lib/argz.c.
+AC_DEFUN([gl_PREREQ_ARGZ], [:])
index 3798743c12571e7035b7669932fcf4eb4a822817..e8e6f9cb2681f5159f8ec0e07274af2d783b138d 100644 (file)
@@ -94,7 +94,7 @@ AC_REQUIRE([AC_LTDL_DLLIB])
 AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
 AC_REQUIRE([AC_LTDL_DLSYM_USCORE])
 AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])
-AC_REQUIRE([AC_LTDL_FUNC_ARGZ])
+AC_REQUIRE([gl_FUNC_ARGZ])
 
 # In order that ltdl.c can compile, run AC_CONFIG_HEADERS for the user
 # if they did not call it themself.  This is so that ltdl.h can pick up
@@ -436,21 +436,3 @@ if test x"$libltdl_cv_need_uscore" = xyes; then
     [Define if dlsym() requires a leading underscore in symbol names.])
 fi
 ])# AC_LTDL_DLSYM_USCORE
-
-
-# AC_LTDL_FUNC_ARGZ
-# -----------------
-AC_DEFUN([AC_LTDL_FUNC_ARGZ],
-[AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
-
-AC_CHECK_TYPES([error_t],
-  [],
-  [AC_DEFINE([error_t], [int],
-    [Define to a type to use for `error_t' if it is not otherwise available.])],
-  [#if HAVE_ARGZ_H
-#  include <argz.h>
-#endif])
-
-AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next \
-       argz_stringify], [], [AC_LIBOBJ([argz])])
-])# AC_LTDL_FUNC_ARGZ