+# If compiler will take -Wl,--as-needed (or various platform-specific
+# spellings thereof) then add that to LDFLAGS. This is much easier than
+# trying to filter LIBS to the minimum for each executable.
+# 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,-dead_strip_dylibs], $link_test_func)
+elif test "$PORTNAME" = "openbsd"; then
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-Bdynamic], $link_test_func)
+else
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $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])
+
+# Create compiler version string
+if test x"$GCC" = x"yes" ; then
+ cc_string=`${CC} --version | sed q`
+ case $cc_string in [[A-Za-z]]*) ;; *) cc_string="GCC $cc_string";; esac
+elif test x"$SUN_STUDIO_CC" = x"yes" ; then
+ cc_string=`${CC} -V 2>&1 | sed q`
+else
+ cc_string=$CC
+fi
+
+AC_DEFINE_UNQUOTED(PG_VERSION_STR,
+ ["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
+ [A string containing the version number, platform, and C compiler])
+
+# Supply a numeric version string for use by 3rd party add-ons
+# awk -F is a regex on some platforms, and not on others, so make "." a tab
+[PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
+tr '.' ' ' |
+$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
+AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
+
+