- Check for --as-needed linking flag

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@318 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-02-12 16:06:38 +00:00
parent d6a19ca35d
commit 98cc6fb20b
4 changed files with 29 additions and 1 deletions

View File

@ -63,6 +63,7 @@ AC_PROG_CXX
AC_CHECK_CXXFLAG([Wall])
AC_CHECK_CXXFLAG([pedantic])
AC_CHECK_CXXFLAG([Wextra])
AC_CHECK_LDFLAG([--as-needed])
AC_PROG_INSTALL

View File

@ -23,6 +23,7 @@
# better if we don't install our macros...
# -> aclocal_DATA = ...
macros = compilerflags.m4 \
linkingflags.m4 \
ac_python_devel.m4 \
ac_pkg_swig.m4 \
ac_python_module.m4

26
m4/linkingflags.m4 Normal file
View File

@ -0,0 +1,26 @@
dnl **************************************************
dnl Copyright (C) 2004 Matteo Settenvini
dnl **************************************************
dnl ---------- AX_CHECK_LDFLAG ---------------------
dnl This macro checks if a particular flag for the
dnl C++ compiler works. If it is so, it adds the flag
dnl to the CXXFLAGS variable.
dnl Example of usage : AC_CHECK_LDFLAG([--as-needed])
dnl -------------------------------------------------
AC_DEFUN([AC_CHECK_LDFLAG],
[ AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([whether the linker supports the $1 flag])
ac_check_ldflags=$LDFLAGS
LDFLAGS="-Wl,$1"
AC_LANG_PUSH([C])
AC_LINK_IFELSE(
AC_LANG_PROGRAM([], [return 0;]),
[AC_MSG_RESULT([yes])
LDFLAGS="-Wl,$1 $ac_check_ldflags" ],
[AC_MSG_RESULT([no])
LDFLAGS=$ac_check_ldflags ]
)
AC_LANG_POP
])dnl ------- AC_CHECK_LDFLAG ----------------------