sgpemv2/m4/linkingflags.m4

27 lines
901 B
Plaintext
Raw Normal View History

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 ----------------------