Commit 63dc461a authored by Thomas White's avatar Thomas White Committed by Thomas White
Browse files

Use gl_IGNORE_UNUSED_LIBRARIES

parent 63039a76
......@@ -17,7 +17,7 @@ endif
AM_CFLAGS = -Wall
AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib -I$(top_srcdir)/lib
LDADD = $(top_builddir)/lib/libgnu.a
LDADD = $(top_builddir)/lib/libgnu.a @IGNORE_UNUSED_LIBRARIES_CFLAGS@
src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c src/utils.c \
src/image.c src/cell.c src/hdf5-file.c \
......
......@@ -57,7 +57,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
$(top_srcdir)/m4/extensions.m4 \
$(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/memchr.m4 \
$(top_srcdir)/m4/include_next.m4 \
$(top_srcdir)/m4/lib-ignore.m4 $(top_srcdir)/m4/memchr.m4 \
$(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/onceonly.m4 \
$(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/string_h.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
......@@ -412,6 +413,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
HAVE_WCHAR_T = @HAVE_WCHAR_T@
IGNORE_UNUSED_LIBRARIES_CFLAGS = @IGNORE_UNUSED_LIBRARIES_CFLAGS@
INCLUDE_NEXT = @INCLUDE_NEXT@
INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
INSTALL = @INSTALL@
......@@ -555,7 +557,7 @@ SUBDIRS = lib
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Wall
AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib -I$(top_srcdir)/lib
LDADD = $(top_builddir)/lib/libgnu.a
LDADD = $(top_builddir)/lib/libgnu.a @IGNORE_UNUSED_LIBRARIES_CFLAGS@
src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c \
src/utils.c src/image.c src/cell.c src/hdf5-file.c \
src/detector.c src/sfac.c src/peaks.c src/reflections.c \
......
......@@ -1383,6 +1383,7 @@ m4_include([m4/extensions.m4])
m4_include([m4/gnulib-common.m4])
m4_include([m4/gnulib-comp.m4])
m4_include([m4/include_next.m4])
m4_include([m4/lib-ignore.m4])
m4_include([m4/memchr.m4])
m4_include([m4/mmap-anon.m4])
m4_include([m4/onceonly.m4])
......
......@@ -703,6 +703,7 @@ GNULIB_MEMRCHR
GNULIB_MEMPCPY
GNULIB_MEMMEM
GNULIB_MEMCHR
IGNORE_UNUSED_LIBRARIES_CFLAGS
GL_COND_LIBTOOL_FALSE
GL_COND_LIBTOOL_TRUE
LIBOBJS
......@@ -4469,6 +4470,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
# Code from module extensions:
# Code from module include_next:
# Code from module lib-ignore:
# Code from module memchr:
# Code from module stddef:
# Code from module string:
......@@ -5763,6 +5765,64 @@ fi
# Code from module c++defs:
# Code from module extensions:
# Code from module include_next:
# Code from module lib-ignore:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler flag to ignore unused libraries" >&5
$as_echo_n "checking for C compiler flag to ignore unused libraries... " >&6; }
if test "${gl_cv_prog_c_ignore_unused_libraries+set}" = set; then :
$as_echo_n "(cached) " >&6
else
gl_cv_prog_c_ignore_unused_libraries=none
gl_saved_ldflags=$LDFLAGS
gl_saved_libs=$LIBS
# Link with -lm to detect binutils 2.16 bug with --as-needed; see
# <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00131.html>.
LIBS="$LIBS -lm"
# Use long option sequences like '-z ignore' to test for the feature,
# to forestall problems with linkers that have -z, -i, -g, -n, etc. flags.
# GCC + binutils likes '-Wl,--as-needed'.
# GCC + Solaris ld likes '-Wl,-z,ignore'.
# Sun C likes '-Wl,-z,ignore'. '-z ignore' is accepted but has no effect.
# Don't try bare '--as-needed'; nothing likes it and the HP-UX 11.11
# native cc issues annoying warnings and then ignores it,
# which would cause us to incorrectly conclude that it worked.
for gl_flags in '-Wl,--as-needed' \
'-Wl,-z,ignore' \
'-z ignore'
do
LDFLAGS="$gl_flags $LDFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
gl_cv_prog_c_ignore_unused_libraries=$gl_flags
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$gl_saved_ldflags
test "$gl_cv_prog_c_ignore_unused_libraries" != none &&
break
done
LIBS=$gl_saved_libs
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_c_ignore_unused_libraries" >&5
$as_echo "$gl_cv_prog_c_ignore_unused_libraries" >&6; }
IGNORE_UNUSED_LIBRARIES_CFLAGS=
if test "$gl_cv_prog_c_ignore_unused_libraries" != none; then
IGNORE_UNUSED_LIBRARIES_CFLAGS="$gl_cv_prog_c_ignore_unused_libraries"
fi
# Code from module memchr:
......@@ -7177,12 +7237,72 @@ $as_echo "yes" >&6; }
fi
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler flag to ignore unused libraries" >&5
$as_echo_n "checking for C compiler flag to ignore unused libraries... " >&6; }
if test "${gl_cv_prog_c_ignore_unused_libraries+set}" = set; then :
$as_echo_n "(cached) " >&6
else
gl_cv_prog_c_ignore_unused_libraries=none
gl_saved_ldflags=$LDFLAGS
gl_saved_libs=$LIBS
# Link with -lm to detect binutils 2.16 bug with --as-needed; see
# <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00131.html>.
LIBS="$LIBS -lm"
# Use long option sequences like '-z ignore' to test for the feature,
# to forestall problems with linkers that have -z, -i, -g, -n, etc. flags.
# GCC + binutils likes '-Wl,--as-needed'.
# GCC + Solaris ld likes '-Wl,-z,ignore'.
# Sun C likes '-Wl,-z,ignore'. '-z ignore' is accepted but has no effect.
# Don't try bare '--as-needed'; nothing likes it and the HP-UX 11.11
# native cc issues annoying warnings and then ignores it,
# which would cause us to incorrectly conclude that it worked.
for gl_flags in '-Wl,--as-needed' \
'-Wl,-z,ignore' \
'-z ignore'
do
LDFLAGS="$gl_flags $LDFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
gl_cv_prog_c_ignore_unused_libraries=$gl_flags
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$gl_saved_ldflags
test "$gl_cv_prog_c_ignore_unused_libraries" != none &&
break
done
LIBS=$gl_saved_libs
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_c_ignore_unused_libraries" >&5
$as_echo "$gl_cv_prog_c_ignore_unused_libraries" >&6; }
IGNORE_UNUSED_LIBRARIES_CFLAGS=
if test "$gl_cv_prog_c_ignore_unused_libraries" != none; then
IGNORE_UNUSED_LIBRARIES_CFLAGS="$gl_cv_prog_c_ignore_unused_libraries"
fi
CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread $GTK_CFLAGS"
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
LIBS="$LIBS $GDK_pixbuf_2_LIBS"
LIBS="$LIBS $GDK_pixbuf_2_LIBS $LDFLAGS"
ac_config_files="$ac_config_files Makefile lib/Makefile"
......
......@@ -153,12 +153,16 @@ PKG_CHECK_MODULES([GDK_pixbuf], [gdk-pixbuf], [],
])
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
gl_IGNORE_UNUSED_LIBRARIES
CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread $GTK_CFLAGS"
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
LIBS="$LIBS $GDK_pixbuf_2_LIBS"
LIBS="$LIBS $GDK_pixbuf_2_LIBS $LDFLAGS"
AC_CONFIG_FILES(Makefile lib/Makefile)
AC_OUTPUT
......@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl strndup
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl lib-ignore strndup
AUTOMAKE_OPTIONS = 1.5 gnits
......
......@@ -24,7 +24,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl strndup
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl lib-ignore strndup
......@@ -55,7 +55,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
$(top_srcdir)/m4/extensions.m4 \
$(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/memchr.m4 \
$(top_srcdir)/m4/include_next.m4 \
$(top_srcdir)/m4/lib-ignore.m4 $(top_srcdir)/m4/memchr.m4 \
$(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/onceonly.m4 \
$(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/string_h.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
......@@ -226,6 +227,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
HAVE_WCHAR_T = @HAVE_WCHAR_T@
IGNORE_UNUSED_LIBRARIES_CFLAGS = @IGNORE_UNUSED_LIBRARIES_CFLAGS@
INCLUDE_NEXT = @INCLUDE_NEXT@
INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
INSTALL = @INSTALL@
......
......@@ -32,7 +32,7 @@
Compiling this file, and adding its object file to the library, will
prevent the library from exporting no symbols. */
#if defined __sun || defined __APPLE__
#ifdef __sun
/* This declaration ensures that the library will export at least 1 symbol. */
int gl_dummy_symbol;
#else
......
......@@ -15,11 +15,12 @@
# Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl strndup
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl lib-ignore strndup
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
lib-ignore
strndup
])
gl_AVOID([])
......
......@@ -31,6 +31,7 @@ AC_DEFUN([gl_EARLY],
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module include_next:
# Code from module lib-ignore:
# Code from module memchr:
# Code from module stddef:
# Code from module string:
......@@ -59,6 +60,8 @@ AC_DEFUN([gl_INIT],
# Code from module c++defs:
# Code from module extensions:
# Code from module include_next:
# Code from module lib-ignore:
gl_IGNORE_UNUSED_LIBRARIES
# Code from module memchr:
gl_FUNC_MEMCHR
gl_STRING_MODULE_INDICATOR([memchr])
......@@ -228,6 +231,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/extensions.m4
m4/gnulib-common.m4
m4/include_next.m4
m4/lib-ignore.m4
m4/memchr.m4
m4/mmap-anon.m4
m4/onceonly.m4
......
# If possible, ignore libraries that are not depended on.
dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Written by Paul Eggert.
# gl_IGNORE_UNUSED_LIBRARIES
# --------------------------
# Determines the option to be passed to the C/C++/Fortran compiler, so that it
# omits unused libraries.
# Example (on Solaris):
# $ cc foo.c -lnsl; ldd ./a.out
# libnsl.so.1 => /lib/libnsl.so.1
# libc.so.1 => /lib/libc.so.1
# libmp.so.2 => /lib/libmp.so.2
# libmd.so.1 => /lib/libmd.so.1
# libscf.so.1 => /lib/libscf.so.1
# libdoor.so.1 => /lib/libdoor.so.1
# libuutil.so.1 => /lib/libuutil.so.1
# libgen.so.1 => /lib/libgen.so.1
# libm.so.2 => /lib/libm.so.2
# $ cc foo.c -lnsl -Wl,-z,ignore; ldd ./a.out
# libc.so.1 => /lib/libc.so.1
# libm.so.2 => /lib/libm.so.2
#
# Note that the option works only for the C compiler, not for the C++
# compiler:
# - Sun C likes '-Wl,-z,ignore'.
# '-Qoption ld -z,ignore' is not accepted.
# '-z ignore' is accepted but has no effect.
# - Sun C++ and Sun Fortran like '-Qoption ld -z,ignore'.
# '-Wl,-z,ignore' is not accepted.
# '-z ignore' is accepted but has no effect.
#
# Sets and substitutes a variable that depends on the current language:
# - IGNORE_UNUSED_LIBRARIES_CFLAGS for C
# - IGNORE_UNUSED_LIBRARIES_CXXFLAGS for C++
# - IGNORE_UNUSED_LIBRARIES_FFLAGS for Fortran
#
# Note that the option works only for direct invocation of the compiler, not
# through libtool: When libtool is used to create a shared library, it will
# honor and translate '-Wl,-z,ignore' to '-Qoption ld -z -Qoption ld ignore'
# if needed, but it will drop a '-Qoption ld -z,ignore' on the command line.
#
AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES],
[
AC_CACHE_CHECK([for []_AC_LANG[] compiler flag to ignore unused libraries],
[gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries],
[gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries=none
gl_saved_ldflags=$LDFLAGS
gl_saved_libs=$LIBS
# Link with -lm to detect binutils 2.16 bug with --as-needed; see
# <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00131.html>.
LIBS="$LIBS -lm"
# Use long option sequences like '-z ignore' to test for the feature,
# to forestall problems with linkers that have -z, -i, -g, -n, etc. flags.
# GCC + binutils likes '-Wl,--as-needed'.
# GCC + Solaris ld likes '-Wl,-z,ignore'.
# Sun C likes '-Wl,-z,ignore'. '-z ignore' is accepted but has no effect.
# Don't try bare '--as-needed'; nothing likes it and the HP-UX 11.11
# native cc issues annoying warnings and then ignores it,
# which would cause us to incorrectly conclude that it worked.
for gl_flags in _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS
do
LDFLAGS="$gl_flags $LDFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
[gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries=$gl_flags])
LDFLAGS=$gl_saved_ldflags
test "$gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries" != none &&
break
done
LIBS=$gl_saved_libs
])
IGNORE_UNUSED_LIBRARIES_[]_AC_LANG_PREFIX[]FLAGS=
if test "$gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries" != none; then
IGNORE_UNUSED_LIBRARIES_[]_AC_LANG_PREFIX[]FLAGS="$gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries"
fi
AC_SUBST([IGNORE_UNUSED_LIBRARIES_]_AC_LANG_PREFIX[FLAGS])
])
# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS
# -----------------------------------
# Expands to the language dependent options to be tried.
AC_DEFUN([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS],
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C)
# --------------------------------------
m4_define([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C)],
[ '-Wl,--as-needed' \
'-Wl,-z,ignore' \
'-z ignore'
])
# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C++)
# ----------------------------------------
m4_define([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C++)],
[ '-Wl,--as-needed' \
'-Qoption ld -z,ignore' \
'-Wl,-z,ignore' \
'-z ignore'
])
# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran 77)
# -----------------------------------------------
m4_copy([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C++)],
[_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran 77)])
# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran)
# --------------------------------------------
m4_copy([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran 77)],
[_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran)])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment