diff options
author | Bruno Haible <bruno@clisp.org> | 2001-12-04 19:25:21 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-21 23:33:59 +0200 |
commit | 42ae2b7a4a96e0dcdc205377b9329ead90a4c77b (patch) | |
tree | a4e42df7967f0140f553a33751c767186be4402d | |
parent | a16654cc6e441f96114242d2b1fb68b1aedafb57 (diff) | |
download | external_gettext-42ae2b7a4a96e0dcdc205377b9329ead90a4c77b.zip external_gettext-42ae2b7a4a96e0dcdc205377b9329ead90a4c77b.tar.gz external_gettext-42ae2b7a4a96e0dcdc205377b9329ead90a4c77b.tar.bz2 |
Solve the rpath problem.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rwxr-xr-x | config.rpath | 497 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gettext.texi | 3 | ||||
-rw-r--r-- | m4/ChangeLog | 14 | ||||
-rw-r--r-- | m4/Makefile.am | 10 | ||||
-rw-r--r-- | m4/gettext.m4 | 42 | ||||
-rw-r--r-- | m4/iconv.m4 | 33 | ||||
-rw-r--r-- | m4/lib-ld.m4 | 91 | ||||
-rw-r--r-- | m4/lib-link.m4 | 389 | ||||
-rw-r--r-- | m4/lib-prefix.m4 | 120 | ||||
-rw-r--r-- | misc/ChangeLog | 5 | ||||
-rw-r--r-- | misc/gettextize.in | 6 |
14 files changed, 1182 insertions, 44 deletions
@@ -1,4 +1,10 @@ -2001-11-30 Bruno Haible <haible@clisp.cons.org> +2001-12-02 Bruno Haible <bruno@clisp.org> + + * config.rpath: New file. + * Makefile.am (EXTRA_DIST): Add it. + (gettextsrc_SCRIPTS): New variable. + +2001-11-30 Bruno Haible <bruno@clisp.org> * configure.in: Change version number to 0.11-pre2. diff --git a/Makefile.am b/Makefile.am index e13737f..9c66aee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,10 +22,11 @@ ACLOCAL_AMFLAGS = -I m4 gettextsrcdir = $(datadir)/gettext gettextsrc_DATA = ABOUT-NLS +gettextsrc_SCRIPTS = config.rpath SUBDIRS = doc intl intl-java lib src po man m4 projects misc tests -EXTRA_DIST = BUGS DISCLAIM README.gemtext README-alpha \ +EXTRA_DIST = config.rpath BUGS DISCLAIM README.gemtext README-alpha \ djgpp/Makefile.maint djgpp/README.in djgpp/README \ djgpp/config.bat djgpp/config.in djgpp/config.sed \ djgpp/config.site djgpp/edtests.bat djgpp/fnchange.in \ diff --git a/config.rpath b/config.rpath new file mode 100755 index 0000000..324f427 --- /dev/null +++ b/config.rpath @@ -0,0 +1,497 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of an executable in an executable. +# +# Copyright 1996-2001 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +shlibext= + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix3* | aix4* | aix5*) + if test "$host_cpu" = ia64; then + wl='-Wl,' + fi + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6*) + wl='-Wl,' + ;; + linux*) + echo '__INTEL_COMPILER' > conftest.$ac_ext + if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null + then + : + else + # Intel icc + wl='-Qoption,ld,' + fi + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + if test "x$host_vendor" = xsni; then + wl='-LD' + else + wl='-Wl,' + fi + ;; + esac +fi + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* ) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + ;; + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + else + hardcode_direct=yes + fi + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + # Test if we are trying to use run time linking, or normal AIX style linking. + # If -brtl is somewhere in LDFLAGS, we need to do run time linking. + aix_use_runtimelinking=no + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then + aix_use_runtimelinking=yes + break + fi + done + fi + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=yes + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9* | hpux10* | hpux11*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + ;; + irix5* | irix6*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + sco3.2v5*) + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + if test "x$host_vendor" = xsno; then + hardcode_direct=yes # is this really true??? + else + hardcode_direct=no # Motorola manual says yes, but my tests say they lie + fi + ;; + sysv4.3*) + ;; + sysv5*) + hardcode_libdir_flag_spec= + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4.2uw2*) + hardcode_direct=yes + hardcode_minus_L=no + ;; + sysv5uw7* | unixware7*) + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +libname_spec='lib$name' +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +case "$host_os" in + aix3*) + shlibext=so + ;; + aix4* | aix5*) + shlibext=so + ;; + amigaos*) + shlibext=ixlibrary + ;; + beos*) + shlibext=so + ;; + bsdi4*) + shlibext=so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + ;; + cygwin* | mingw* | pw32*) + case $GCC,$host_os in + yes,cygwin*) + shlibext=dll.a + ;; + yes,mingw*) + shlibext=dll + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + shlibext=dll + ;; + *) + shlibext=dll + ;; + esac + ;; + darwin* | rhapsody*) + shlibext=dylib + ;; + freebsd1*) + ;; + freebsd*) + shlibext=so + ;; + gnu*) + shlibext=so + ;; + hpux9* | hpux10* | hpux11*) + shlibext=sl + ;; + irix5* | irix6*) + shlibext=so + case "$host_os" in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 ") libsuff= shlibsuff= ;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 2;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + ;; + linux-gnu*) + shlibext=so + ;; + netbsd*) + shlibext=so + ;; + newsos6) + shlibext=so + ;; + openbsd*) + shlibext=so + ;; + os2*) + libname_spec='$name' + shlibext=dll + ;; + osf3* | osf4* | osf5*) + shlibext=so + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + sco3.2v5*) + shlibext=so + ;; + solaris*) + shlibext=so + ;; + sunos4*) + shlibext=so + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + shlibext=so + case "$host_vendor" in + motorola) + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + uts4*) + shlibext=so + ;; + dgux*) + shlibext=so + ;; + sysv4*MP*) + if test -d /usr/nec; then + shlibext=so + fi + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF + +# How to pass a linker flag through the compiler. +wl="$escaped_wl" + +# Static library suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally "so"). +shlibext="$shlibext" + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="$hardcode_libdir_separator" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct="$hardcode_direct" + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L="$hardcode_minus_L" + +# Compile-time system search path for libraries +sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec" + +EOF diff --git a/doc/ChangeLog b/doc/ChangeLog index 16b18f6..6b4c2f3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2001-12-02 Bruno Haible <bruno@clisp.org> + + * gettext.texi (aclocal): Add lib-ld.m4, lib-link.m4, lib-prefix.m4 + to the list of autoconf macro files. + 2001-11-25 Bruno Haible <bruno@clisp.org> * gettext.texi (po/Makevars): New node. diff --git a/doc/gettext.texi b/doc/gettext.texi index 30651dd..06218bd 100644 --- a/doc/gettext.texi +++ b/doc/gettext.texi @@ -5338,7 +5338,8 @@ AC_CONFIG_AUX_DIR([@var{subdir}]) If you do not have an @file{aclocal.m4} file in your distribution, the simplest is to concatenate the files @file{codeset.m4}, @file{gettext.m4}, @file{glibc21.m4}, @file{iconv.m4}, @file{isc-posix.m4}, -@file{lcmessage.m4}, @file{progtest.m4} from GNU @code{gettext}'s +@file{lcmessage.m4}, @file{lib-ld.m4}, @file{lib-link.m4}, +@file{lib-prefix.m4}, @file{progtest.m4} from GNU @code{gettext}'s @file{m4/} directory into a single file. If you have suppressed the @file{intl/} directory, only @file{gettext.m4}, @file{iconv.m4}, @file{progtest.m4} need to be concatenated. diff --git a/m4/ChangeLog b/m4/ChangeLog index 5cac075..a464210 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,5 +1,19 @@ 2001-12-02 Bruno Haible <bruno@clisp.org> + * lib-ld.m4: New file, extracted from libtool-1.4 libtool.m4. + * lib-link.m4: New file. + * lib-prefix.m4: New file. + * Makefile.am (aclocal_DATA): Add them. + (EXTRA_DIST): Likewise. + * iconv.m4 (AM_ICONV): Remove AC_ARG_WITH call. Invoke + AC_LIB_LINKFLAGS_BODY. Use $LIBICONV instead of "-lintl". Add + $INCICONV to CPPFLAGS if appropriate. + * gettext.m4 (AM_WITH_LIBINTL): Remove macro. + (AM_GNU_GETTEXT): Invoke AC_LIB_LINKFLAGS_BODY. Use $LIBINTL instead + of "-lintl $LIBICONV". Add $INCINTL to CPPFLAGS if appropriate. + +2001-12-02 Bruno Haible <bruno@clisp.org> + * gettext.m4 (AM_GNU_GETTEXT): Avoid an error message if there is no Rules-* file. diff --git a/m4/Makefile.am b/m4/Makefile.am index 3376282..23054aa 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- aclocaldir = @aclocaldir@ -aclocal_DATA = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 +aclocal_DATA = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 lcmessage.m4 progtest.m4 # Generate this list with # find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \ @@ -9,7 +9,7 @@ aclocal_DATA = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage. EXTRA_DIST = README \ backupfile.m4 c-bs-a.m4 codeset.m4 flex.m4 getline.m4 gettext.m4 \ glibc21.m4 hostname.m4 iconv.m4 inttypes_h.m4 isc-posix.m4 javacomp.m4 \ -javaexec.m4 lcmessage.m4 libtool.m4 mbrtowc.m4 mbstate_t.m4 mbswidth.m4 \ -mkdtemp.m4 progtest.m4 setenv.m4 setlocale.m4 siginfo.m4 signalblocking.m4 \ -signed.m4 ssize_t.m4 stdbool.m4 stdint_h.m4 tmpdir.m4 uintmax_t.m4 \ -ulonglong.m4 unionwait.m4 +javaexec.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 libtool.m4 \ +mbrtowc.m4 mbstate_t.m4 mbswidth.m4 mkdtemp.m4 progtest.m4 setenv.m4 \ +setlocale.m4 siginfo.m4 signalblocking.m4 signed.m4 ssize_t.m4 stdbool.m4 \ +stdint_h.m4 tmpdir.m4 uintmax_t.m4 ulonglong.m4 unionwait.m4 diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 604edeb..2bb87ac 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -11,7 +11,7 @@ # gettext package package is covered by the GNU General Public License. # They are *not* in the public domain. -# serial 11 +# serial 12 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [LIBDIR]). dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The @@ -58,12 +58,15 @@ AC_DEFUN([AM_GNU_GETTEXT], define(gt_included_intl, ifelse([$1], [external], [no], [yes])) define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) - AC_REQUIRE([AM_WITH_LIBINTL])dnl AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, @@ -101,9 +104,12 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl to fall back to GNU NLS library. dnl Add a version number to the cache macros. - define(gt_api_version, ifelse([$2], [need-ngettext], 2, 1)) - define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]gt_api_version[_libc]) - define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]gt_api_version[_libintl]) + define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1)) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + dnl Search for libintl and define LIBINTL and INCINTL accordingly. + AC_LIB_LINKFLAGS_BODY([intl], [iconv]) AC_CHECK_HEADER(libintl.h, [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, @@ -120,14 +126,17 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", ]) AC_CACHE_CHECK([for GNU gettext in libintl], gt_cv_func_gnugettext_libintl, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" AC_TRY_LINK([#include <libintl.h> extern int _nl_msg_cat_cntr;], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], gt_cv_func_gnugettext_libintl=yes, gt_cv_func_gnugettext_libintl=no) + CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) fi @@ -168,9 +177,10 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - dnl If iconv() is in a separate libiconv library, then anyone - dnl linking with libintl{.a,.so} also needs to link with libiconv. - INTLLIBS="-lintl $LIBICONV" + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + INTLLIBS="$LIBINTL" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. @@ -224,18 +234,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", ]) -AC_DEFUN([AM_WITH_LIBINTL], -[ - AC_ARG_WITH([libintl-prefix], -[ --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib], [ - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - ]) -]) - - dnl Checks for all prerequisites of the intl subdirectory, dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 1723734..ab81915 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -1,4 +1,4 @@ -#serial AM2 +#serial AM3 dnl From Bruno Haible. @@ -7,13 +7,19 @@ AC_DEFUN([AM_ICONV], dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). - AC_ARG_WITH([libiconv-prefix], -[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - ]) + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV and INCICONV accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" @@ -26,7 +32,7 @@ AC_DEFUN([AM_ICONV], am_cv_func_iconv=yes) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" + LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include <stdlib.h> #include <iconv.h>], [iconv_t cd = iconv_open("",""); @@ -61,9 +67,14 @@ size_t iconv(); AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi - LIBICONV= if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= fi AC_SUBST(LIBICONV) ]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..f9f7db8 --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,91 @@ +# serial 1 + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$acl_cv_prog_gnu_ld +]) + +dnl From libtool-1.4. Sets the variable LD. +AC_DEFUN([AC_LIB_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 new file mode 100644 index 0000000..052e51a --- /dev/null +++ b/m4/lib-link.m4 @@ -0,0 +1,389 @@ +# serial 1 + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} variable and augments the CPPFLAGS +dnl variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]name[]_libs="$LIB[]NAME" + ac_cv_lib[]name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]name[]_libs" + INC[]NAME="$ac_cv_lib[]name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC[]NAME]) + AC_SUBST([LIB[]NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L, +dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the INC${NAME} and LIB${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_libdir=\"$libdir\" + AC_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_libdir=\"$libdir\" + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + INC[]NAME= + rpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LIB[]NAME; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + dnl Most of the following complexities is not needed when libtool + dnl is used. + ifdef([AC_PROG_][LIBTOOL], [], [ + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "X$found_dir" = "X/usr/include"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + dnl FIXME: Which systems does this affect? + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + ]) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + ifdef([AC_PROG_][LIBTOOL], [], [ + fi + fi + ]) + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS $INC[]NAME; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + libdir="$alldirs" wl="$wl" eval flag=\"$hardcode_libdir_flag_spec\" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + libdir="$found_dir" wl="$wl" eval flag=\"$hardcode_libdir_flag_spec\" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..9bfd04e --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,120 @@ +# serial 1 + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + dnl By default, look in $includedir and $libdir. + use_additional=yes + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_libdir=\"$libdir\" + AC_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_libdir=\"$libdir\" + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + prefix="$acl_final_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" +]) diff --git a/misc/ChangeLog b/misc/ChangeLog index 770f999..550b2c7 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2001-12-02 Bruno Haible <bruno@clisp.org> + + * gettextize.in: Also copy config.rpath, and recommend to copy + lib-ld.m4, lib-link.m4, lib-prefix.m4. + 2001-11-25 Karl Eichwalder <ke@suse.de> * po-mode.el (po-guess-archive-name): Verify that versions provided by diff --git a/misc/gettextize.in b/misc/gettextize.in index cb321bd..071922b 100644 --- a/misc/gettextize.in +++ b/misc/gettextize.in @@ -153,7 +153,7 @@ cd $gettext_dir || { # Now copy all files. Take care for the destination directories. for file in *; do case $file in - ABOUT-NLS) + ABOUT-NLS | config.rpath) rm -f $srcdir/$file ($try_ln_s && ln -s $gettext_dir/$file $srcdir/$file && $echo "Symlinking file $file") 2>/dev/null || { $echo "Copying file $file"; cp $file $srcdir/$file; } @@ -221,9 +221,9 @@ echo echo "Please add the files" if test -n "$intldir"; then echo " codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4" - echo " progtest.m4" + echo " lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4" else - echo " gettext.m4 iconv.m4 progtest.m4" + echo " gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4" fi echo "from the @datadir@/aclocal directory to your autoconf macro directory" if test -f $srcdir/Makefile.am; then |