Skip to content

Commit 727c2cc

Browse files
committed
Select CFLAGS_SL at configure time, not in platform-specific Makefiles.
Move the platform-dependent logic that sets CFLAGS_SL from src/makefiles/Makefile.foo to src/template/foo, so that the value is determined at configure time and thus is available while running configure's tests. On a couple of platforms this might save a few microseconds of build time by eliminating a test that make otherwise has to do over and over. Otherwise it's pretty much a wash for build purposes; in particular, this makes no difference to anyone who might be overriding CFLAGS_SL via a make option. This patch in itself does nothing with the value and thus should not change any behavior, though you'll probably have to re-run configure to get a correctly updated Makefile.global. We'll use the new configure variable in a follow-on patch. Per gripe from Kyotaro Horiguchi. Back-patch to all supported branches, because the follow-on patch is a portability bug fix. Discussion: https://postgr.es/m/20191010.144533.263180400.horikyota.ntt@gmail.com
1 parent 930787c commit 727c2cc

27 files changed

+77
-33
lines changed

configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ autodepend
723723
TAS
724724
GCC
725725
CPP
726+
CFLAGS_SL
726727
CFLAGS_VECTOR
727728
SUN_STUDIO_CC
728729
OBJEXT
@@ -5009,7 +5010,6 @@ fi
50095010

50105011
fi
50115012

5012-
CFLAGS_VECTOR=$CFLAGS_VECTOR
50135013

50145014

50155015
# supply -g if --enable-debug
@@ -5048,6 +5048,9 @@ fi
50485048
# the automatic additions.
50495049
CFLAGS="$CFLAGS $user_CFLAGS"
50505050

5051+
# The template file must set up CFLAGS_SL; we don't support user override
5052+
5053+
50515054
# Check if the compiler still works with the final flag settings
50525055
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler still works" >&5
50535056
$as_echo_n "checking whether the C compiler still works... " >&6; }

configure.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ elif test "$PORTNAME" = "hpux"; then
475475
PGAC_PROG_CC_CFLAGS_OPT([+Olibmerrno])
476476
fi
477477

478-
AC_SUBST(CFLAGS_VECTOR, $CFLAGS_VECTOR)
478+
AC_SUBST(CFLAGS_VECTOR)
479479

480480
# supply -g if --enable-debug
481481
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
@@ -512,6 +512,9 @@ fi
512512
# the automatic additions.
513513
CFLAGS="$CFLAGS $user_CFLAGS"
514514

515+
# The template file must set up CFLAGS_SL; we don't support user override
516+
AC_SUBST(CFLAGS_SL)
517+
515518
# Check if the compiler still works with the final flag settings
516519
AC_MSG_CHECKING([whether the C compiler still works])
517520
AC_TRY_LINK([], [return 0;],

src/Makefile.global.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ CC = @CC@
241241
GCC = @GCC@
242242
SUN_STUDIO_CC = @SUN_STUDIO_CC@
243243
CFLAGS = @CFLAGS@
244+
CFLAGS_SL = @CFLAGS_SL@
244245
CFLAGS_VECTOR = @CFLAGS_VECTOR@
245246

246247
# Kind-of compilers

src/makefiles/Makefile.cygwin

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ LIBS:=$(filter-out -lm -lc, $(LIBS))
1212

1313
AROPT = crs
1414
DLSUFFIX = .dll
15-
CFLAGS_SL =
1615

1716
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
1817

src/makefiles/Makefile.freebsd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ endif
77

88
DLSUFFIX = .so
99

10-
CFLAGS_SL = -fPIC -DPIC
11-
1210

1311
# Rule for building a shared library from a single .o file
1412
%.so: %.o

src/makefiles/Makefile.hpux

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ ifeq ($(host_cpu), ia64)
3737
else
3838
DLSUFFIX = .sl
3939
endif
40-
ifeq ($(GCC), yes)
41-
CFLAGS_SL = -fPIC
42-
else
43-
CFLAGS_SL = +Z
44-
endif
4540

4641
# Rule for building a shared library from a single .o file
4742
%$(DLSUFFIX): %.o

src/makefiles/Makefile.linux

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
77

88
DLSUFFIX = .so
99

10-
CFLAGS_SL = -fPIC
11-
1210

1311
# Rule for building a shared library from a single .o file
1412
%.so: %.o

src/makefiles/Makefile.netbsd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ endif
99

1010
DLSUFFIX = .so
1111

12-
CFLAGS_SL = -fPIC -DPIC
13-
1412

1513
# Rule for building a shared library from a single .o file
1614
%.so: %.o

src/makefiles/Makefile.openbsd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ endif
77

88
DLSUFFIX = .so
99

10-
CFLAGS_SL = -fPIC -DPIC
11-
1210

1311
# Rule for building a shared library from a single .o file
1412
%.so: %.o

src/makefiles/Makefile.osf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AROPT = crs
22
DLSUFFIX = .so
3-
CFLAGS_SL =
3+
44
rpath = -rpath '$(rpathdir)'
55

66
# Rule for building a shared library from a single .o file

0 commit comments

Comments
 (0)