Automatically link every program against libintl and libiconv.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 10 May 2011 22:57:44 +0000 (15:57 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 11 May 2011 04:21:01 +0000 (21:21 -0700)
On glibc systems, libiconv and libintl are both built into libc.  That
means that it's very easy to forget to link programs against them,
because it still builds OK on GNU/Linux.  However, on other systems
they are usually separate libraries and forgetting to link against
them breaks the build.

This commit switches from previous PSPP practice, in which these
libraries were linked explicitly to every binary that requires them,
to a simplified practice where they are in LIBS so that every binary
is automatically linked to them.  This has no disadvantage on
GNU/Linux, our primary target, and the advantage that on other targets
PSPP works more consistently.

Makefile.am
configure.ac
src/ui/gui/automake.mk
src/ui/terminal/automake.mk
tests/automake.mk

index 6cffa402776cf5f4fb5f8f5064d64edada8f74ba..deafc2e2cdfaffe066737d51764c5759e55140a0 100644 (file)
@@ -45,6 +45,7 @@ INSTALL_DATA_HOOKS =
 UNINSTALL_DATA_HOOKS =
 PHONY =
 SUFFIXES = .q
+LDADD = gl/libgl.la
 
 generate-changelog:
        if test -d $(top_srcdir)/.git; then                     \
index d560941024f800084e2470651accd431cc463eeb..35337d6cbb4cfc1a124e4ecf54863970f85e00d2 100644 (file)
@@ -35,11 +35,11 @@ PSPP_PERL
 dnl Disable automatic po/ support, because PSPP provides its own po/ support.
 AC_PROVIDE([AM_PO_SUBDIRS])
 AM_GNU_GETTEXT([external], [need-ngettext])
+LIBS="$LTLIBINTL $LIBS"
 
 dnl Checks for libraries.
 AC_SYS_LARGEFILE
 AC_SEARCH_LIBS([sin], [m])
-AC_SEARCH_LIBS([dcgettext], [intl])
 PSPP_LC_PAPER
 
 
@@ -327,6 +327,7 @@ AM_ICONV
 if test "$am_cv_func_iconv" != "yes"; then
    PSPP_REQUIRED_PREREQ([iconv (see http://www.gnu.org/software/libiconv/)])
 fi
+LIBS="$LTLIBICONV $LIBS"
 
 dnl Required by the gnulib 'relocatable-prog' module.
 dnl See doc/relocatable-maint.texi in the gnulib tree for details.
index a426cefdd3677b670c387a2e4c4684a5d5f09d30..f004fa6021e04a64fa71ae6a009956c76aed202e 100644 (file)
@@ -66,9 +66,7 @@ src_ui_gui_psppire_LDADD = \
        src/libpspp.la \
        src/libpspp-core.la \
        $(GTK_LIBS) \
-       $(CAIRO_LIBS) \
-       $(LIBICONV) \
-       $(LIBINTL)
+       $(CAIRO_LIBS)
 
 src_ui_gui_psppiredir = $(pkgdatadir)
 
index 3fa72c41739dc0505384762c67dabe1c1ac198b8..af397a10302079b5c566527b792f9e9e6a570f84 100644 (file)
@@ -24,8 +24,7 @@ src_ui_terminal_pspp_LDADD = \
        src/libpspp-core.la \
        $(CAIRO_LIBS) \
        $(NCURSES_LIBS) \
-       $(LIBICONV) \
-       $(LIBINTL) $(LIBREADLINE)
+       $(LIBREADLINE)
 
 
 src_ui_terminal_pspp_LDFLAGS = $(PSPP_LDFLAGS) $(PG_LDFLAGS)
index d62ef6379f071ff2df804d0df80acd0f17f45cb9..d9012a24083b8ab096613f566925eeb8502f393b 100644 (file)
@@ -33,25 +33,23 @@ check-programs: $(check_PROGRAMS)
 
 tests_data_datasheet_test_SOURCES = \
        tests/data/datasheet-test.c
-tests_data_datasheet_test_LDADD = src/libpspp-core.la $(LIBINTL) 
+tests_data_datasheet_test_LDADD = src/libpspp-core.la
 tests_data_datasheet_test_CFLAGS = $(AM_CFLAGS)
 
 tests_data_sack_SOURCES = \
        tests/data/sack.c
-tests_data_sack_LDADD = src/libpspp-core.la $(LIBINTL) 
+tests_data_sack_LDADD = src/libpspp-core.la 
 tests_data_sack_CFLAGS = $(AM_CFLAGS)
 
 tests_libpspp_ll_test_SOURCES = \
        src/libpspp/ll.c \
        tests/libpspp/ll-test.c
-tests_libpspp_ll_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_ll_test_CFLAGS = $(AM_CFLAGS)
 
 tests_libpspp_llx_test_SOURCES = \
        src/libpspp/ll.c \
        src/libpspp/llx.c \
        tests/libpspp/llx-test.c
-tests_libpspp_llx_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_llx_test_CFLAGS = $(AM_CFLAGS)
 
 tests_libpspp_encoding_guesser_test_SOURCES = \
@@ -63,42 +61,36 @@ tests_libpspp_heap_test_SOURCES = \
        src/libpspp/pool.c \
        src/libpspp/temp-file.c \
        tests/libpspp/heap-test.c
-tests_libpspp_heap_test_LDADD = gl/libgl.la $(LIBINTL) 
 tests_libpspp_heap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_hmap_test_SOURCES = \
        src/libpspp/hmap.c \
        tests/libpspp/hmap-test.c
-tests_libpspp_hmap_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_hmap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_hmapx_test_SOURCES = \
        src/libpspp/hmap.c \
        src/libpspp/hmapx.c \
        tests/libpspp/hmapx-test.c
-tests_libpspp_hmapx_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_hmapx_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_i18n_test_SOURCES = tests/libpspp/i18n-test.c
-tests_libpspp_i18n_test_LDADD = src/libpspp/libpspp.la gl/libgl.la $(LIBINTL) 
+tests_libpspp_i18n_test_LDADD = src/libpspp/libpspp.la gl/libgl.la 
 
 tests_libpspp_abt_test_SOURCES = \
        src/libpspp/abt.c \
        tests/libpspp/abt-test.c
-tests_libpspp_abt_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_abt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_bt_test_SOURCES = \
        src/libpspp/bt.c \
        tests/libpspp/bt-test.c
-tests_libpspp_bt_test_LDADD = gl/libgl.la
 tests_libpspp_bt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_range_map_test_SOURCES = \
        src/libpspp/bt.c \
        src/libpspp/range-map.c \
        tests/libpspp/range-map-test.c
-tests_libpspp_range_map_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_range_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_range_set_test_SOURCES = \
@@ -107,12 +99,11 @@ tests_libpspp_range_set_test_SOURCES = \
        src/libpspp/range-set.c \
        src/libpspp/temp-file.c \
        tests/libpspp/range-set-test.c
-tests_libpspp_range_set_test_LDADD = gl/libgl.la $(LIBINTL) 
 tests_libpspp_range_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_str_test_SOURCES = \
        tests/libpspp/str-test.c
-tests_libpspp_str_test_LDADD = src/libpspp/libpspp.la gl/libgl.la $(LIBINTL) 
+tests_libpspp_str_test_LDADD = src/libpspp/libpspp.la gl/libgl.la 
 
 tests_libpspp_string_map_test_SOURCES = \
        src/libpspp/hash-functions.c \
@@ -120,7 +111,6 @@ tests_libpspp_string_map_test_SOURCES = \
        src/libpspp/string-map.c \
        src/libpspp/string-set.c \
        tests/libpspp/string-map-test.c
-tests_libpspp_string_map_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_string_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_stringi_map_test_SOURCES = \
@@ -133,7 +123,6 @@ tests_libpspp_stringi_map_test_SOURCES = \
        src/libpspp/stringi-set.c \
        src/libpspp/temp-file.c \
        tests/libpspp/stringi-map-test.c
-tests_libpspp_stringi_map_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_stringi_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_string_set_test_SOURCES = \
@@ -141,7 +130,6 @@ tests_libpspp_string_set_test_SOURCES = \
        src/libpspp/hmap.c \
        src/libpspp/string-set.c \
        tests/libpspp/string-set-test.c
-tests_libpspp_string_set_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_string_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_stringi_set_test_SOURCES = \
@@ -152,7 +140,6 @@ tests_libpspp_stringi_set_test_SOURCES = \
        src/libpspp/stringi-set.c \
        src/libpspp/temp-file.c \
        tests/libpspp/stringi-set-test.c
-tests_libpspp_stringi_set_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_libpspp_stringi_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_tower_test_SOURCES = \
@@ -161,7 +148,6 @@ tests_libpspp_tower_test_SOURCES = \
        src/libpspp/temp-file.c \
        src/libpspp/tower.c \
        tests/libpspp/tower-test.c
-tests_libpspp_tower_test_LDADD = gl/libgl.la $(LIBINTL) 
 tests_libpspp_tower_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_u8_istream_test_SOURCES = tests/libpspp/u8-istream-test.c
@@ -172,7 +158,6 @@ tests_libpspp_sparse_array_test_SOURCES = \
        src/libpspp/pool.c \
        tests/libpspp/sparse-array-test.c \
        src/libpspp/temp-file.c
-tests_libpspp_sparse_array_test_LDADD = gl/libgl.la $(LIBINTL) 
 tests_libpspp_sparse_array_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_sparse_xarray_test_SOURCES = \
@@ -188,7 +173,6 @@ tests_libpspp_sparse_xarray_test_SOURCES = \
        src/libpspp/pool.c \
        src/libpspp/temp-file.c \
        tests/libpspp/sparse-xarray-test.c
-tests_libpspp_sparse_xarray_test_LDADD = gl/libgl.la $(LIBINTL) 
 tests_libpspp_sparse_xarray_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_data_inexactify_SOURCES = tests/data/inexactify.c
@@ -198,7 +182,6 @@ tests_dissect_sysfile_SOURCES = \
        src/libpspp/integer-format.c \
        src/libpspp/float-format.c \
        tests/dissect-sysfile.c
-tests_dissect_sysfile_LDADD = gl/libgl.la $(LIBINTL) 
 tests_dissect_sysfile_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
 
 check_PROGRAMS += tests/language/lexer/command-name-test
@@ -208,8 +191,7 @@ tests_language_lexer_command_name_test_SOURCES = \
        tests/language/lexer/command-name-test.c
 tests_language_lexer_command_name_test_LDADD = \
        src/libpspp/libpspp.la \
-       gl/libgl.la \
-       $(LIBINTL) 
+       gl/libgl.la 
 tests_language_lexer_command_name_test_CFLAGS = $(AM_CFLAGS)
 
 check_PROGRAMS += tests/language/lexer/scan-test
@@ -224,7 +206,6 @@ tests_language_lexer_scan_test_SOURCES = \
        src/libpspp/str.c \
        src/libpspp/temp-file.c \
        tests/language/lexer/scan-test.c
-tests_language_lexer_scan_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_language_lexer_scan_test_CFLAGS = $(AM_CFLAGS)
 
 check_PROGRAMS += tests/language/lexer/segment-test
@@ -237,7 +218,6 @@ tests_language_lexer_segment_test_SOURCES = \
        src/libpspp/str.c \
        src/libpspp/temp-file.c \
        tests/language/lexer/segment-test.c
-tests_language_lexer_segment_test_LDADD = gl/libgl.la $(LIBINTL)
 tests_language_lexer_segment_test_CFLAGS = $(AM_CFLAGS)
 
 check_PROGRAMS += tests/output/render-test
@@ -245,9 +225,7 @@ tests_output_render_test_SOURCES = tests/output/render-test.c
 tests_output_render_test_LDADD = \
        src/libpspp.la \
        src/libpspp-core.la \
-       $(CAIRO_LIBS) \
-       $(LIBICONV) \
-       $(LIBINTL)
+       $(CAIRO_LIBS)
 
 EXTRA_DIST += \
        tests/coverage.sh \