Skip to content

Commit 485041c

Browse files
committed
Tricky "make install", due to dependencies iconv -> libintl -> libiconv.
1 parent 8252300 commit 485041c

File tree

8 files changed

+62
-21
lines changed

8 files changed

+62
-21
lines changed

ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2002-05-29 Bruno Haible <bruno@clisp.org>
2+
3+
Fix installation of iconv program when linked with a libintl that was
4+
built against an earlier libiconv.
5+
* src/iconv.c: Conditionally disable NLS.
6+
* src/iconv_no_i18n.c: New file.
7+
* src/Makefile.in (libdir): New variable.
8+
(all): Depend on iconv_no_i18n, iconv.@OBJEXT@ but not iconv. Make
9+
directory writable, so iconv executable can be created during "make
10+
install".
11+
(iconv): Remove rule.
12+
(iconv_no_i18n, iconv_no_i18n.@OBJEXT@): New rules.
13+
(install): Link iconv now, after the new libiconv.so is installed.
14+
(clean): Also remove iconv_no_i18n.
15+
* tests/Makefile.in: (check, check-extra-yes): Depend on iconv_no_i18n,
16+
not iconv.
17+
* tests/check-stateful: Use iconv_no_i18n, not iconv.
18+
* tests/check-translit: LIkewise.
19+
* tests/check-translitfailure: Likewise.
20+
121
2002-05-29 Bruno Haible <bruno@clisp.org>
222

323
* configure.in: Call AC_PROG_INSTALL instead of CL_PROG_INSTALL.

src/Makefile.in

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ prefix = @prefix@
1010
local_prefix = /usr/local
1111
exec_prefix = @exec_prefix@
1212
bindir = @bindir@
13+
libdir = @libdir@
1314
datadir = @datadir@
1415
localedir = $(datadir)/locale
1516

@@ -39,20 +40,25 @@ SHELL = /bin/sh
3940
# Needed by $(LIBTOOL).
4041
top_builddir = ..
4142

42-
all : iconv
43-
44-
# When linking with libintl and producing a shared libiconv, we need to omit
45-
# the -liconv flag that might be present in @LTLIBINTL@. Otherwise, on FreeBSD,
46-
# when a libiconv <= 1.7 is already installed and we install a libiconv >= 1.8,
47-
# we get a link error.
48-
iconv : iconv.@OBJEXT@ ../lib/libiconv.la
49-
build_shared=`$(LIBTOOL) --config | grep '^build_libtool_libs=' | sed -e 's/build_libtool_libs=//'`; \
50-
libintl=`if test "$$build_shared" = yes; then \
51-
echo " @LTLIBINTL@ " | sed -e 's, -liconv , ,g' -e 's, [^ ]*/libiconv\.[^ ]* , ,g'; \
52-
else \
53-
echo " @LTLIBINTL@ "; \
54-
fi` ; \
55-
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) iconv.@OBJEXT@ ../lib/libiconv.la $$libintl -o $@
43+
# We cannot link with libintl until libiconv is installed. (When we call
44+
# libtool with arguments "../lib/libiconv.la -lintl", libtool will call ld
45+
# with "../lib/.libs/libiconv.so $libdir/libintl.so $libdir/libiconv.so",
46+
# (remember that $libdir/libintl.la lists $libdir/libiconv.so as a dependency),
47+
# and this gives a fatal linker error on Solaris because the two libiconv.so
48+
# files are different but have the same soname.
49+
# So we can link the iconv executable only after we have installed libiconv,
50+
# i.e. during "make install". The intermediate 'iconv' executable is built
51+
# without internationalization and not linked with libintl.
52+
53+
all : iconv_no_i18n iconv.@OBJEXT@
54+
chmod 777 .
55+
56+
# This is the temporary iconv executable, without internationalization.
57+
iconv_no_i18n : iconv_no_i18n.@OBJEXT@ ../lib/libiconv.la
58+
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) iconv_no_i18n.@OBJEXT@ ../lib/libiconv.la -o $@
59+
60+
iconv_no_i18n.@OBJEXT@ : $(srcdir)/iconv_no_i18n.c $(srcdir)/iconv.c
61+
$(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) -DLOCALEDIR=\"$(localedir)\" $(srcdir)/iconv_no_i18n.c
5662

5763
iconv.@OBJEXT@ : $(srcdir)/iconv.c
5864
$(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) -DLOCALEDIR=\"$(localedir)\" $(srcdir)/iconv.c
@@ -61,10 +67,19 @@ iconv.@OBJEXT@ : $(srcdir)/iconv.c
6167
../lib/libiconv.la :
6268
cd ../lib && $(MAKE) libiconv.la
6369

70+
# During "make install", we can build the final iconv executable.
71+
# On HP-UX, in order to ensure that the new libiconv.sl will override the old
72+
# one that is hardcoded in libintl.sl, we need to mention libiconv.sl before
73+
# libintl.sl on the link command line. We have to bypass libtool in order to
74+
# achieve this.
6475
install : all force
6576
if [ ! -d $(DESTDIR)$(prefix) ] ; then mkdir $(DESTDIR)$(prefix) ; fi
6677
if [ ! -d $(DESTDIR)$(exec_prefix) ] ; then mkdir $(DESTDIR)$(exec_prefix) ; fi
6778
if [ ! -d $(DESTDIR)$(bindir) ] ; then mkdir $(DESTDIR)$(bindir) ; fi
79+
case "@host_os@" in \
80+
hpux*) $(CC) $(LDFLAGS) iconv.@OBJEXT@ -L$(libdir) -liconv @LIBINTL@ -o iconv;; \
81+
*) $(LIBTOOL_LINK) $(CC) $(LDFLAGS) iconv.@OBJEXT@ $(libdir)/libiconv.la @LTLIBINTL@ -o iconv;; \
82+
esac
6883
$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) iconv $(DESTDIR)$(bindir)/iconv
6984

7085
installdirs : force
@@ -80,7 +95,7 @@ check : all
8095
mostlyclean : clean
8196

8297
clean : force
83-
$(RM) *.@OBJEXT@ *.lo iconv core
98+
$(RM) *.@OBJEXT@ *.lo iconv_no_i18n iconv core
8499
$(RM) -r .libs _libs
85100

86101
distclean : clean

src/iconv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#include <locale.h>
2828
#endif
2929
#include <fcntl.h>
30+
31+
#ifdef NO_I18N
32+
# undef ENABLE_NLS
33+
#endif
3034
#include "gettext.h"
3135

3236
#define _(str) gettext(str)

src/iconv_no_i18n.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define NO_I18N
2+
#include "iconv.c"

tests/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ top_builddir = ..
2828

2929
all :
3030

31-
check : all table-from table-to ../src/iconv
31+
check : all table-from table-to ../src/iconv_no_i18n
3232
$(srcdir)/check-stateless $(srcdir) ASCII
3333
# /* General multi-byte encodings */
3434
$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) $(srcdir)/genutf8.c -o genutf8 && \
@@ -142,7 +142,7 @@ check : all table-from table-to ../src/iconv
142142

143143
check-extra: check-extra-@USE_EXTRA_ENCODINGS@
144144
check-extra-no:
145-
check-extra-yes: all table-from table-to ../src/iconv
145+
check-extra-yes: all table-from table-to ../src/iconv_no_i18n
146146
# /* AIX specific encodings */
147147
$(srcdir)/check-stateless $(srcdir) CP856
148148
$(srcdir)/check-stateless $(srcdir) CP922

tests/check-stateful

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
srcdir="$1"
55
charset="$2"
66
set -e
7-
../src/iconv -f "$charset" -t UTF-8 < "${srcdir}"/"$charset"-snippet > tmp-snippet
7+
../src/iconv_no_i18n -f "$charset" -t UTF-8 < "${srcdir}"/"$charset"-snippet > tmp-snippet
88
cmp "${srcdir}"/"$charset"-snippet.UTF-8 tmp-snippet
9-
../src/iconv -f UTF-8 -t "$charset" < "${srcdir}"/"$charset"-snippet.UTF-8 > tmp-snippet
9+
../src/iconv_no_i18n -f UTF-8 -t "$charset" < "${srcdir}"/"$charset"-snippet.UTF-8 > tmp-snippet
1010
cmp "${srcdir}"/"$charset"-snippet tmp-snippet
1111
rm -f tmp-snippet
1212
exit 0

tests/check-translit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ file="$2"
66
fromcode="$3"
77
tocode="$4"
88
set -e
9-
../src/iconv -f "$fromcode" -t "$tocode"//TRANSLIT < "${srcdir}"/"$file"."$fromcode" > tmp
9+
../src/iconv_no_i18n -f "$fromcode" -t "$tocode"//TRANSLIT < "${srcdir}"/"$file"."$fromcode" > tmp
1010
cmp "${srcdir}"/"$file"."$tocode" tmp
1111
rm -f tmp
1212
exit 0

tests/check-translitfailure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ srcdir="$1"
55
file="$2"
66
fromcode="$3"
77
tocode="$4"
8-
../src/iconv -f "$fromcode" -t "$tocode"//TRANSLIT < "${srcdir}"/"$file"."$fromcode" >/dev/null 2>/dev/null
8+
../src/iconv_no_i18n -f "$fromcode" -t "$tocode"//TRANSLIT < "${srcdir}"/"$file"."$fromcode" >/dev/null 2>/dev/null
99
test $? = 1
1010
exit $?

0 commit comments

Comments
 (0)