+# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
+# This is much easier than trying to filter LIBS to the minimum for each
+# executable. (Note that shared library links won't use this switch, though.)
+# On (at least) some Red-Hat-derived systems, this switch breaks linking to
+# libreadline; therefore we postpone testing it until we know what library
+# dependencies readline has. The test code will try to link with $LIBS.
+if test "$with_readline" = yes; then
+ link_test_func=readline
+else
+ link_test_func=exit
+fi
+if test "$PORTNAME" != "darwin"; then
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func)
+else
+ # On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-dead_strip_dylibs], $link_test_func)
+fi
+
+
+# Begin output steps
+
+AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
+AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
+AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
+