diff options
author | Andres Freund <andres@anarazel.de> | 2022-12-06 18:55:28 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2022-12-06 18:55:28 -0800 |
commit | 9db49fc5bfdc0126be03f4b8986013e59d93b91d (patch) | |
tree | 9b3a2ee004e98feec42933a5174f9159ca862788 /config | |
parent | 8018ffbf5895ee16a1fd7117c4526b47ac42332e (diff) | |
download | postgresql-9db49fc5bfdc0126be03f4b8986013e59d93b91d.tar.gz postgresql-9db49fc5bfdc0126be03f4b8986013e59d93b91d.zip |
autoconf: Move export_dynamic determination to configure
Previously export_dynamic was set in src/makefiles/Makefile.$port. For solaris
this required exporting with_gnu_ld. The determination of with_gnu_ld would be
nontrivial to copy for meson PGXS compatibility. It's also nice to delete
libtool.m4.
This uses -Wl,--export-dynamic on all platforms, previously all platforms but
FreeBSD used -Wl,-E. The likelihood of a name conflict seems lower with the
longer spelling.
Discussion: https://postgr.es/m/20221005200710.luvw5evhwf6clig6@awork3.anarazel.de
Diffstat (limited to 'config')
-rw-r--r-- | config/c-compiler.m4 | 25 | ||||
-rw-r--r-- | config/libtool.m4 | 119 |
2 files changed, 17 insertions, 127 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index eb8cc8ce170..5be8f0f08dc 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -468,29 +468,38 @@ AC_DEFUN([PGAC_PROG_CXX_CFLAGS_OPT], -# PGAC_PROG_CC_LDFLAGS_OPT +# PGAC_PROG_CC_LD_VARFLAGS_OPT # ------------------------ # Given a string, check if the compiler supports the string as a -# command-line option. If it does, add the string to LDFLAGS. +# command-line option. If it does, add to the given variable. # For reasons you'd really rather not know about, this checks whether # you can link to a particular function, not just whether you can link. # In fact, we must actually check that the resulting program runs :-( -AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], -[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_ldflags_$1])])dnl -AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar], +AC_DEFUN([PGAC_PROG_CC_LD_VARFLAGS_OPT], +[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_$1_$2])])dnl +AC_CACHE_CHECK([whether $CC supports $2, for $1], [Ac_cachevar], [pgac_save_LDFLAGS=$LDFLAGS -LDFLAGS="$pgac_save_LDFLAGS $1" -AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])], +LDFLAGS="$pgac_save_LDFLAGS $2" +AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $3 (); void (*fptr) () = $3;],[])], [Ac_cachevar=yes], [Ac_cachevar=no], [Ac_cachevar="assuming no"]) LDFLAGS="$pgac_save_LDFLAGS"]) if test x"$Ac_cachevar" = x"yes"; then - LDFLAGS="$LDFLAGS $1" + $1="${$1} $2" fi undefine([Ac_cachevar])dnl +])# PGAC_PROG_CC_LD_VARFLAGS_OPT + +# PGAC_PROG_CC_LDFLAGS_OPT +# ------------------------ +# Convenience wrapper around PGAC_PROG_CC_LD_VARFLAGS_OPT that adds to +# LDFLAGS. +AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], +[PGAC_PROG_CC_LD_VARFLAGS_OPT(LDFLAGS, [$1], [$2]) ])# PGAC_PROG_CC_LDFLAGS_OPT + # PGAC_HAVE_GCC__SYNC_CHAR_TAS # ---------------------------- # Check if the C compiler understands __sync_lock_test_and_set(char), diff --git a/config/libtool.m4 b/config/libtool.m4 deleted file mode 100644 index f6e426dbdf1..00000000000 --- a/config/libtool.m4 +++ /dev/null @@ -1,119 +0,0 @@ -## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- -## Copyright (C) 1996-1999,2000 Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -# No, PostgreSQL doesn't use libtool (yet), we just borrow stuff from it. -# This file was taken on 2000-10-20 from the multi-language branch (since -# that is the branch that PostgreSQL would most likely adopt anyway). -# --petere - -# ... bunch of stuff removed here ... - -# PGAC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN([PGAC_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [[default=no]]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -dnl ###not for PostgreSQL### AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -changequote([,])dnl - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -PGAC_PROG_LD_GNU -]) - -AC_DEFUN([PGAC_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$ac_cv_prog_gnu_ld -]) - -# ... more stuff removed ... |