From: Bruno Haible Date: Sat, 29 Jan 2005 15:21:42 +0000 (+0000) Subject: Fix link error when building statically on MacOS X. X-Git-Tag: v0.14.2~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7606d5591d17428161b1a73ebcc6c4fbec9a44d9;p=thirdparty%2Fgettext.git Fix link error when building statically on MacOS X. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 64c19b41e..8b00bd401 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,8 @@ +2005-01-29 Bruno Haible + + * Makefile.am (libintl.la, libgnuintl.la): Use INTL_MACOSX_LIBS + instead of INTL_MACOSX_LDFLAGS. + 2004-09-08 Bruno Haible * vasnprintf.c (VASNPRINTF): Signal EOVERFLOW if the resulting length diff --git a/gettext-runtime/intl/Makefile.in b/gettext-runtime/intl/Makefile.in index 715961782..0fb5ad5f9 100644 --- a/gettext-runtime/intl/Makefile.in +++ b/gettext-runtime/intl/Makefile.in @@ -1,5 +1,5 @@ # Makefile for directory with message catalog handling library of GNU gettext -# Copyright (C) 1995-1998, 2000-2004 Free Software Foundation, Inc. +# Copyright (C) 1995-1998, 2000-2005 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published @@ -154,7 +154,7 @@ libintl.a libgnuintl.a: $(OBJECTS) libintl.la libgnuintl.la: $(OBJECTS) $(LIBTOOL) --mode=link \ $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \ - $(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LDFLAGS@ $(LIBS) -lc \ + $(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LIBS@ $(LIBS) -lc \ -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ -rpath $(libdir) \ -no-undefined diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog index 78d20a615..85eb82908 100644 --- a/gettext-runtime/m4/ChangeLog +++ b/gettext-runtime/m4/ChangeLog @@ -1,3 +1,11 @@ +2005-01-29 Bruno Haible + + * gettext.m4 (gt_INTL_MACOSX): New macro, extracted from + AM_INTL_SUBDIR. Set INTL_MACOSX_LIBS instead of INTL_MACOSX_LDFLAGS. + (AM_GNU_GETTEXT): Invoke it. Add the INTL_MACOSX_LIBS contents to + LIBINTL and LTLIBINTL. + (AM_INTL_SUBDIR): Require gt_INTL_MACOSX. + 2005-01-19 Bruno Haible * ansi-c++.m4, codeset.m4, gettext.m4, glibc21.m4, glibc2.m4, iconv.m4: diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index ae6752cb9..368907a29 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 33 (gettext-0.14.2) +# gettext.m4 serial 34 (gettext-0.14.2) dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -90,6 +90,9 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) + dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + dnl Set USE_NLS. AM_NLS @@ -243,6 +246,15 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", fi ]) + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, @@ -373,6 +385,7 @@ AC_DEFUN([AM_INTL_SUBDIR], AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl AC_REQUIRE([gt_INTTYPES_PRI])dnl AC_REQUIRE([gl_XSIZE])dnl + AC_REQUIRE([gt_INTL_MACOSX])dnl AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], @@ -429,6 +442,47 @@ __fsetlocking]) gt_LC_MESSAGES fi + if test -n "$INTL_MACOSX_LIBS"; then + CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +dnl Checks for special options needed on MacOS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ dnl Check for API introduced in MacOS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], gt_cv_func_CFPreferencesCopyAppValue, @@ -461,43 +515,11 @@ __fsetlocking]) AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi - INTL_MACOSX_LDFLAGS= + INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then - CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" - INTL_MACOSX_LDFLAGS="-Wl,-framework -Wl,CoreFoundation" - fi - AC_SUBST([INTL_MACOSX_LDFLAGS]) - - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi + AC_SUBST([INTL_MACOSX_LIBS]) ]) diff --git a/gettext-tools/libuniname/ChangeLog b/gettext-tools/libuniname/ChangeLog index 9674a3db7..79acf5bd3 100644 --- a/gettext-tools/libuniname/ChangeLog +++ b/gettext-tools/libuniname/ChangeLog @@ -1,3 +1,7 @@ +2005-01-29 Bruno Haible + + * Makefile.am (test_names_LDADD): Add INTL_MACOSX_LIBS. + 2004-01-29 Bruno Haible * gettext-0.14.1 released. diff --git a/gettext-tools/libuniname/Makefile.am b/gettext-tools/libuniname/Makefile.am index d6a59b1da..efeaa7e98 100644 --- a/gettext-tools/libuniname/Makefile.am +++ b/gettext-tools/libuniname/Makefile.am @@ -1,5 +1,5 @@ ## Makefile for libuniname directory in GNU gettext package. -## Copyright (C) 2002-2003 Free Software Foundation, Inc. +## Copyright (C) 2002-2003, 2005 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 @@ -34,7 +34,9 @@ TESTS = test-names.sh TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) $(SHELL) noinst_PROGRAMS = test-names -test_names_LDADD = libuniname.a ../lib/libgettextlib.la +# INTL_MACOSX_LIBS is needed because libgettextlib.la depends on libintl.la +# but libtool doesn't put -Wl,-framework options into .la files. +test_names_LDADD = libuniname.a ../lib/libgettextlib.la @INTL_MACOSX_LIBS@ EXTRA_DIST += $(TESTS) UnicodeDataNames.txt diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index e28b2587e..8ba07bb4d 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,10 @@ +2005-01-29 Bruno Haible + + * Makefile.am (msgcmp_LDADD, msgfmt_LDADD, msgmerge_LDADD, + msgunfmt_LDADD, xgettext_LDADD, msgattrib_LDADD, msgcat_LDADD, + msgcomm_LDADD, msgconv_LDADD, msgen_LDADD, msgexec_LDADD, + msgfilter_LDADD, msggrep_LDADD, msguniq_LDADD): Add INTL_MACOSX_LIBS. + 2005-01-27 Bruno Haible * msgfmt.c (formatstring_error_logger): Cast the fprrintf argument, diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index 2e54ded8e..01bebb819 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -182,22 +182,25 @@ libgettextpo_la_LDFLAGS = \ libgettextpo_la_DEPENDENCIES = libgettextsrc.la # Link dependencies. -msgcmp_LDADD = libgettextsrc.la -msgfmt_LDADD = libgettextsrc.la -msgmerge_LDADD = libgettextsrc.la -msgunfmt_LDADD = libgettextsrc.la -xgettext_LDADD = $(LIBUNINAME) libgettextsrc.la @LTLIBEXPAT@ -msgattrib_LDADD = libgettextsrc.la -msgcat_LDADD = libgettextsrc.la -msgcomm_LDADD = libgettextsrc.la -msgconv_LDADD = libgettextsrc.la -msgen_LDADD = libgettextsrc.la -msgexec_LDADD = libgettextsrc.la -msgfilter_LDADD = libgettextsrc.la -msggrep_LDADD = $(LIBGREP) libgettextsrc.la +# INTL_MACOSX_LIBS is needed because the programs depend on libintl.la +# but libtool doesn't put -Wl,-framework options into .la files. +# For msginit, it is also needed because of localename.c. +msgcmp_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgmerge_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgunfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +xgettext_LDADD = $(LIBUNINAME) libgettextsrc.la @INTL_MACOSX_LIBS@ @LTLIBEXPAT@ +msgattrib_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgcat_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgcomm_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgconv_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgen_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgexec_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msgfilter_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ +msggrep_LDADD = $(LIBGREP) libgettextsrc.la @INTL_MACOSX_LIBS@ msginit_LDADD = ../intl/localename.@INTL_LIBTOOL_SUFFIX_PREFIX@o \ - @INTL_MACOSX_LDFLAGS@ libgettextsrc.la -msguniq_LDADD = libgettextsrc.la + libgettextsrc.la @INTL_MACOSX_LIBS@ +msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ # Specify installation directory, for --enable-relocatable. msgcmp_CFLAGS = -DINSTALLDIR=\"$(bindir)\" diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index e405398e5..9747ab2d3 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,7 @@ +2005-01-29 Bruno Haible + + * Makefile.am (LDADD_yes): Add INTL_MACOSX_LIBS. + 2005-01-20 Bruno Haible * lang-guile: Make it work. diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index a57272cf5..44454c42c 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -165,8 +165,10 @@ AM_CPPFLAGS = \ -I../lib -I$(top_srcdir)/lib \ -I../intl DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ +# INTL_MACOSX_LIBS is needed because the programs depend on libintl.la +# but libtool doesn't put -Wl,-framework options into .la files. LDADD = $(LDADD_@USE_INCLUDED_LIBINTL@) -LDADD_yes = ../intl/libintl.la +LDADD_yes = ../intl/libintl.la @INTL_MACOSX_LIBS@ LDADD_no = ../intl/libgnuintl.la @LTLIBINTL@ noinst_PROGRAMS = tstgettext tstngettext testlocale cake fc3 fc4 fc5 tstgettext_SOURCES = tstgettext.c setlocale.c