From: Gary V. Vaughan Date: Thu, 22 Apr 2004 22:47:20 +0000 (+0000) Subject: * libltdl/argz.h: Moved from here... X-Git-Tag: release-1-9b~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04e0cebad7bfbfcd3951f027f9b7a4c8d6dc3920;p=thirdparty%2Flibtool.git * libltdl/argz.h: Moved from here... * libltdl/argz_.h: ...to here, so as not to shadow system argz.h when we `#include ' 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 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 --- diff --git a/ChangeLog b/ChangeLog index 65d8f0361..534348b27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2004-04-22 Gary V. Vaughan + + * libltdl/argz.h: Moved from here... + * libltdl/argz_.h: ...to here, so as not to shadow system + argz.h when we `#include ' 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 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 + 2004-04-22 Gary V. Vaughan According to Howard Chu : diff --git a/Makefile.am b/Makefile.am index 5e6837546..717d5b57f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/libltdl/Makefile.am b/libltdl/Makefile.am index bfbf2595e..2b20d7039 100644 --- a/libltdl/Makefile.am +++ b/libltdl/Makefile.am @@ -17,6 +17,10 @@ ## 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 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 diff --git a/libltdl/argz.c b/libltdl/argz.c index 8bda7a890..05dd30e43 100644 --- a/libltdl/argz.c +++ b/libltdl/argz.c @@ -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 +#endif + +#if defined(HAVE_CONFIG_H) +# include HAVE_CONFIG_H +#endif + +#include #include #include diff --git a/libltdl/argz.h b/libltdl/argz_.h similarity index 93% rename from libltdl/argz.h rename to libltdl/argz_.h index 6344fc5b0..5c8d977e2 100644 --- a/libltdl/argz.h +++ b/libltdl/argz_.h @@ -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 +#include #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)*/ diff --git a/libltdl/lt__glibc.h b/libltdl/lt__glibc.h index 0e91c918b..16b3c53ef 100644 --- a/libltdl/lt__glibc.h +++ b/libltdl/lt__glibc.h @@ -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 + #endif /*!defined(LT__GLIBC_H)*/ diff --git a/m4/argz.m4 b/m4/argz.m4 new file mode 100644 index 000000000..66f3bc1e7 --- /dev/null +++ b/m4/argz.m4 @@ -0,0 +1,43 @@ +# Portability macros for glibc argz. -*- Autoconf -*- +# Written by Gary V. Vaughan + +# 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 +#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], [:]) diff --git a/m4/ltdl.m4 b/m4/ltdl.m4 index 3798743c1..e8e6f9cb2 100644 --- a/m4/ltdl.m4 +++ b/m4/ltdl.m4 @@ -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 -#endif]) - -AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next \ - argz_stringify], [], [AC_LIBOBJ([argz])]) -])# AC_LTDL_FUNC_ARGZ