+ dnl But when linking statically, weak symbols don't work.
+ case " $LDFLAGS " in
+ *" -static "*) gl_cv_have_weak=no ;;
+ esac
+ ])
+ dnl Check whether the linker supports the --as-needed/--no-as-needed options.
+ dnl Assume GCC, so that we can use the -Wl option.
+ AC_CACHE_CHECK([whether the linker supports --as-needed],
+ [gl_cv_linker_have_as_needed],
+ [if test -n "$GCC"; then
+ gl_saved_ldflags="$LDFLAGS"
+ LDFLAGS="$gl_saved_ldflags -Wl,--as-needed -Wl,--no-as-needed"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+ [gl_cv_linker_have_as_needed=yes],
+ [gl_cv_linker_have_as_needed=no])
+ LDFLAGS="$gl_saved_ldflags"
+ else
+ gl_cv_linker_have_as_needed=no
+ fi
+ ])
+ dnl Check whether the linker supports the --push-state/--pop-state options.
+ dnl Assume GCC, so that we can use the -Wl option.
+ AC_CACHE_CHECK([whether the linker supports --push-state],
+ [gl_cv_linker_have_push_state],
+ [if test -n "$GCC"; then
+ gl_saved_ldflags="$LDFLAGS"
+ LDFLAGS="$gl_saved_ldflags -Wl,--push-state -Wl,--pop-state"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+ [gl_cv_linker_have_push_state=yes],
+ [gl_cv_linker_have_push_state=no])
+ LDFLAGS="$gl_saved_ldflags"
+ else
+ gl_cv_linker_have_push_state=no
+ fi