autoconf: Rely on ar supporting index creation
authorAndres Freund <andres@anarazel.de>
Fri, 7 Oct 2022 18:53:39 +0000 (11:53 -0700)
committerAndres Freund <andres@anarazel.de>
Fri, 7 Oct 2022 18:53:39 +0000 (11:53 -0700)
This way we don't need RANLIB anymore, making it a bit simpler for the meson
build to generate Makefile.global for PGXS compatibility.

FreeBSD, NetBSD, OpenBSD, the only platforms where we didn't use AROPT=crs,
all have supported the 's' option for a long time.

On macOS we ran ranlib after installing a static library. This was added a
long time ago, in 58ad65ec2def. I cannot reproduce an issue in more recent
macOS versions. This is removed now.

Based on discussion with Tom, I left the 'touch' at the end of static
libraries generation, added in 826eff57c4c, in place. While it looks like
current versions of Apple's ar/ranlib don't need it, it was needed not too
long ago.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20221005200710.luvw5evhwf6clig6@awork3.anarazel.de

13 files changed:
configure
configure.ac
src/Makefile.global.in
src/Makefile.shlib
src/makefiles/Makefile.aix
src/makefiles/Makefile.cygwin
src/makefiles/Makefile.darwin
src/makefiles/Makefile.freebsd
src/makefiles/Makefile.linux
src/makefiles/Makefile.netbsd
src/makefiles/Makefile.openbsd
src/makefiles/Makefile.solaris
src/makefiles/Makefile.win32

index a5a03f6cec30c6b826b5b82dec1ffe346df920a6..e04ee9fb4166b7162b38783b0c40f0540d70b0fc 100755 (executable)
--- a/configure
+++ b/configure
@@ -692,7 +692,6 @@ AR
 STRIP_SHARED_LIB
 STRIP_STATIC_LIB
 STRIP
-RANLIB
 with_gnu_ld
 LD
 LDFLAGS_SL
@@ -9557,98 +9556,6 @@ with_gnu_ld=$ac_cv_prog_gnu_ld
 
 
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
-else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
-
 
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
index c696566a7ff55ea9d748c55e81b1c4d023ac4208..f146c8301ae100cf3c2fccb7b3280cda729844bb 100644 (file)
@@ -1131,7 +1131,6 @@ AC_ARG_VAR(LDFLAGS_SL, [extra linker flags for linking shared libraries only])
 PGAC_PROG_LD
 AC_SUBST(LD)
 AC_SUBST(with_gnu_ld)
-AC_PROG_RANLIB
 PGAC_CHECK_STRIP
 AC_CHECK_TOOL(AR, ar, ar)
 if test "$PORTNAME" = "win32"; then
index d8ea2da583c7034639999667b1a99773d6e99ed6..99889167e18bf5371fd660a5af6f70c3be8717eb 100644 (file)
@@ -284,6 +284,7 @@ ZIC = @ZIC@
 # Linking
 
 AR = @AR@
+AROPT = crs
 LIBS = @LIBS@
 LDAP_LIBS_FE = @LDAP_LIBS_FE@
 LDAP_LIBS_BE = @LDAP_LIBS_BE@
@@ -318,7 +319,6 @@ LDFLAGS_EX = @LDFLAGS_EX@
 LDFLAGS_SL += @LDFLAGS_SL@
 LDREL = -r
 LDOUT = -o
-RANLIB = @RANLIB@
 WINDRES = @WINDRES@
 X = @EXEEXT@
 
index db466b3b84594bd0f7790f3ae99ff45fd7978e0b..35abce58d22a6ffc47ac343d5664667e2e11a38f 100644 (file)
@@ -252,7 +252,7 @@ all-static-lib: $(stlib)
 all-shared-lib: $(shlib)
 
 # In this rule, "touch $@" works around a problem on some platforms wherein
-# ranlib updates the library file's mod time with a value calculated to
+# ar updates the library file's mod time with a value calculated to
 # seconds precision.  If the filesystem has sub-second timestamps, this can
 # cause the library file to appear older than its input files, triggering
 # parallel-make problems.
@@ -260,7 +260,6 @@ ifndef haslibarule
 $(stlib): $(OBJS) | $(SHLIB_PREREQS)
    rm -f $@
    $(LINK.static) $@ $^
-   $(RANLIB) $@
    touch $@
 endif #haslibarule
 
@@ -394,10 +393,6 @@ install-lib-pc: lib$(NAME).pc installdirs-lib
 
 install-lib-static: $(stlib) installdirs-lib
    $(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/$(stlib)'
-ifeq ($(PORTNAME), darwin)
-   cd '$(DESTDIR)$(libdir)' && \
-   $(RANLIB) $(stlib)
-endif
 
 install-lib-shared: $(shlib) installdirs-lib
 ifdef soname
index 56d7f22aff6b6fab979a58b785e152e5dbfd7cb0..dd16a7a0378b61aa3798b534c92b6ebb23353332 100644 (file)
@@ -2,9 +2,6 @@
 # symbol names to tell them what to export/import.
 MAKE_EXPORTS= true
 
-RANLIB= touch
-AROPT = crs
-
 # -blibpath must contain ALL directories where we should look for libraries
 libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
 
index 6afa9a06a1b90e9393f7dfb367b69c5eafdf21ae..7759397263821738f8557c6cc60bb42adbfb2443 100644 (file)
@@ -10,8 +10,6 @@ endif
 # (see http://sources.redhat.com/cygwin/faq/faq.html#SEC110)
 LIBS:=$(filter-out -lm -lc, $(LIBS))
 
-AROPT = crs
-
 override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
 
 ifneq (,$(findstring backend,$(subdir)))
index 45f253a5b4326839b5f693bd74eb692d30b4e8b7..7095f66e25cb07d28f8c7b58b9e0cde857a79136 100644 (file)
@@ -1,5 +1,3 @@
-AROPT = crs
-
 # env var name to use in place of LD_LIBRARY_PATH
 ld_library_path_var = DYLD_LIBRARY_PATH
 
index 0e77616b0f91be81919793b24c2dea1692fa0ace..db74a21568c51f7db7f6e2047a4a0486541ab9e6 100644 (file)
@@ -1,5 +1,3 @@
-AROPT = cr
-
 export_dynamic = -Wl,-export-dynamic
 rpath = -Wl,-R'$(rpathdir)'
 
index 1ffec9d16980c882ccae1342af3fcb84a36d8c23..5a9451371ab037ca2a2b42691cb68a222ca49c3b 100644 (file)
@@ -1,5 +1,3 @@
-AROPT = crs
-
 export_dynamic = -Wl,-E
 # Use --enable-new-dtags to generate DT_RUNPATH instead of DT_RPATH.
 # This allows LD_LIBRARY_PATH to still work when needed.
index 421b735e407e8a4d7c3bc211298b8a2d418f76ce..4f8e9ec2521298b71933de0716d9a4b14e34d61c 100644 (file)
@@ -1,5 +1,3 @@
-AROPT = cr
-
 export_dynamic = -Wl,-E
 rpath = -Wl,-R'$(rpathdir)'
 
index 421b735e407e8a4d7c3bc211298b8a2d418f76ce..4f8e9ec2521298b71933de0716d9a4b14e34d61c 100644 (file)
@@ -1,5 +1,3 @@
-AROPT = cr
-
 export_dynamic = -Wl,-E
 rpath = -Wl,-R'$(rpathdir)'
 
index acdf44cc0f2368abd6fceab15e4e90fa927e87e6..3de73ebc010102d02557cf7a26edc9d4f36a48ad 100644 (file)
@@ -1,6 +1,4 @@
 # src/makefiles/Makefile.solaris
-
-AROPT = crs
 rpath = -Wl,-rpath,'$(rpathdir)'
 
 ifeq ($(with_gnu_ld), yes)
index d268b3ebafd89028b62e107e0777a25d71584d9f..dc1aafa115ae04209119d8d2ade21da20e355cdb 100644 (file)
@@ -10,8 +10,6 @@ endif
 
 override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
 
-AROPT = crs
-
 ifneq (,$(findstring backend,$(subdir)))
 ifeq (,$(findstring conversion_procs,$(subdir)))
 ifeq (,$(findstring libpqwalreceiver,$(subdir)))