Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23119d5

Browse files
committed
Refactor DLSUFFIX handling
Move DLSUFFIX from makefiles into header files for all platforms.Move the DLSUFFIX assignment from src/makefiles/ to src/templates/,have configure read it, and then substitute it into Makefile.globaland pg_config.h. This avoids the need for all makefile rules thatneed it to locally set CPPFLAGS. It also resolves an inconsistentsetup between the two Windows build systems.Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://www.postgresql.org/message-id/2f9861fb-8969-9005-7518-b8e60f2bead9@enterprisedb.com
1 parent5656683 commit23119d5

File tree

26 files changed

+42
-39
lines changed

26 files changed

+42
-39
lines changed

‎config/python.m4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ else
120120
found_shlib=0
121121
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
122122
do
123-
# We don't know the platform DLSUFFIX here, so check 'em all.
123+
# Note: DLSUFFIX is for loadable modules, not shared
124+
# libraries, so cannot be used here portably. Just
125+
# check all known possibilities.
124126
for e in .so .dll .dylib .sl; do
125127
if test -e "$d/lib${ldlibrary}$e"; then
126128
python_libdir="$d"

‎configure

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ autodepend
734734
PKG_CONFIG_LIBDIR
735735
PKG_CONFIG_PATH
736736
PKG_CONFIG
737+
DLSUFFIX
737738
TAS
738739
GCC
739740
CPP
@@ -3033,6 +3034,9 @@ PORTNAME=$template
30333034
need_tas=no
30343035
tas_file=dummy.s
30353036

3037+
# Default, works for most platforms, override in template file if needed
3038+
DLSUFFIX=".so"
3039+
30363040

30373041

30383042
##
@@ -7688,6 +7692,12 @@ else
76887692
fi
76897693

76907694

7695+
7696+
cat >>confdefs.h <<_ACEOF
7697+
#define DLSUFFIX "$DLSUFFIX"
7698+
_ACEOF
7699+
7700+
76917701
#
76927702
# Set up pkg_config in case we need it below
76937703
#
@@ -10560,7 +10570,9 @@ else
1056010570
found_shlib=0
1056110571
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
1056210572
do
10563-
# We don't know the platform DLSUFFIX here, so check 'em all.
10573+
# Note: DLSUFFIX is for loadable modules, not shared
10574+
# libraries, so cannot be used here portably. Just
10575+
# check all known possibilities.
1056410576
for e in .so .dll .dylib .sl; do
1056510577
if test -e "$d/lib${ldlibrary}$e"; then
1056610578
python_libdir="$d"

‎configure.ac

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ AC_SUBST(PORTNAME)
103103
need_tas=no
104104
tas_file=dummy.s
105105

106+
# Default, works for most platforms, override in template file if needed
107+
DLSUFFIX=".so"
108+
106109

107110

108111
##
@@ -721,6 +724,10 @@ else
721724
fi
722725
AC_SUBST(TAS)
723726

727+
AC_SUBST(DLSUFFIX)dnl
728+
AC_DEFINE_UNQUOTED([DLSUFFIX],["$DLSUFFIX"],
729+
[Define to the file name extension of dynamically-loadable modules.])
730+
724731
#
725732
# Set up pkg_config in case we need it below
726733
#

‎src/Makefile.global.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ WIN32_STACK_RLIMIT=4194304
545545
# Set if we have a working win32 crashdump header
546546
have_win32_dbghelp = @have_win32_dbghelp@
547547

548+
DLSUFFIX = @DLSUFFIX@
549+
548550
# Pull in platform-specific magic
549551
include$(top_builddir)/src/Makefile.port
550552

‎src/backend/jit/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ subdir = src/backend/jit
1515
top_builddir = ../../..
1616
include$(top_builddir)/src/Makefile.global
1717

18-
overrideCPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
19-
2018
OBJS =\
2119
jit.o
2220

‎src/backend/utils/fmgr/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ OBJS = \
1717
fmgr.o\
1818
funcapi.o
1919

20-
overrideCPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
21-
2220
include$(top_srcdir)/src/backend/common.mk

‎src/backend/utils/fmgr/dfmgr.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,6 @@ file_exists(const char *name)
483483
}
484484

485485

486-
/* Example format: ".so" */
487-
#ifndefDLSUFFIX
488-
#error "DLSUFFIX must be defined to compile this file."
489-
#endif
490-
491486
/*
492487
* If name contains a slash, check if the file exists, if so return
493488
* the name. Else (no slash) try to expand using search path (see

‎src/bin/pg_upgrade/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ OBJS = \
2525
util.o\
2626
version.o
2727

28-
overrideCPPFLAGS := -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)
28+
overrideCPPFLAGS := -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)
2929
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
3030

3131
all: pg_upgrade

‎src/include/pg_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
/* Define to the default TCP port number as a string constant. */
4343
#undef DEF_PGPORT_STR
4444

45+
/* Define to the file name extension of dynamically-loadable modules. */
46+
#undef DLSUFFIX
47+
4548
/* Define to build with GSSAPI support. (--with-gssapi) */
4649
#undef ENABLE_GSS
4750

‎src/include/port/win32_port.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,6 @@ typedef unsigned short mode_t;
529529
#defineW_OK 2
530530
#defineR_OK 4
531531

532-
/* Pulled from Makefile.port in MinGW */
533-
#defineDLSUFFIX ".dll"
534-
535532
#endif/* _MSC_VER */
536533

537534
#if (defined(_MSC_VER)&& (_MSC_VER<1900))|| \

‎src/interfaces/ecpg/test/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ override CPPFLAGS := \
1212
'-I$(top_srcdir)/src/test/regress'\
1313
'-DHOST_TUPLE="$(host_tuple)"'\
1414
'-DSHELLPROG="$(SHELL)"'\
15-
'-DDLSUFFIX="$(DLSUFFIX)"'\
1615
$(CPPFLAGS)
1716

1817
# default encoding for regression tests

‎src/makefiles/Makefile.aix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ else
1414
rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
1515
endif
1616

17-
DLSUFFIX = .so
1817
ifeq ($(host_os), aix3.2.5)
1918
ifneq ($(GCC), yes)
2019
LDFLAGS_SL += -e _nostart -H512 -bM:SRE

‎src/makefiles/Makefile.cygwin

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

1313
AROPT = crs
14-
DLSUFFIX = .dll
1514

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

‎src/makefiles/Makefile.darwin

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
AROPT = crs
22

3-
DLSUFFIX = .so
4-
53
# env var name to use in place of LD_LIBRARY_PATH
64
ld_library_path_var = DYLD_LIBRARY_PATH
75

‎src/makefiles/Makefile.freebsd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ AROPT = cr
33
export_dynamic = -Wl,-export-dynamic
44
rpath = -Wl,-R'$(rpathdir)'
55

6-
DLSUFFIX = .so
7-
86
# extra stuff for $(with_temp_install)
97
# we need this to get LD_LIBRARY_PATH searched ahead of the compiled-in
108
# rpath, if no DT_RUNPATH is present in the executable. The conditions

‎src/makefiles/Makefile.hpux

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ INSTALL_SHLIB_OPTS = -m 555
2525

2626
AROPT = crs
2727

28-
ifeq ($(host_cpu), ia64)
29-
DLSUFFIX = .so
30-
else
31-
DLSUFFIX = .sl
32-
endif
33-
3428
# env var name to use in place of LD_LIBRARY_PATH
3529
ld_library_path_var = SHLIB_PATH
3630

‎src/makefiles/Makefile.linux

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ export_dynamic = -Wl,-E
55
# This allows LD_LIBRARY_PATH to still work when needed.
66
rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
77

8-
DLSUFFIX = .so
9-
108

119
# Rule for building a shared library from a single .o file
1210
%.so: %.o

‎src/makefiles/Makefile.netbsd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ AROPT = cr
33
export_dynamic = -Wl,-E
44
rpath = -Wl,-R'$(rpathdir)'
55

6-
DLSUFFIX = .so
7-
86

97
# Rule for building a shared library from a single .o file
108
%.so: %.o

‎src/makefiles/Makefile.openbsd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ AROPT = cr
33
export_dynamic = -Wl,-E
44
rpath = -Wl,-R'$(rpathdir)'
55

6-
DLSUFFIX = .so
7-
86

97
# Rule for building a shared library from a single .o file
108
%.so: %.o

‎src/makefiles/Makefile.solaris

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ else
99
rpath = -Wl,-R'$(rpathdir)'
1010
endif
1111

12-
DLSUFFIX = .so
13-
1412

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

‎src/makefiles/Makefile.win32

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ endif
1111
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
1212

1313
AROPT = crs
14-
DLSUFFIX = .dll
1514

1615
ifneq (,$(findstring backend,$(subdir)))
1716
ifeq (,$(findstring conversion_procs,$(subdir)))

‎src/template/cygwin

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ CFLAGS_SL=""
1313
# we'd prefer to use --disable-auto-import to match MSVC linking behavior,
1414
# but support for it in Cygwin is too haphazard
1515
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition -Wl,--enable-auto-import"
16+
17+
DLSUFFIX=".dll"

‎src/template/hpux

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ case $host in
2525
fi
2626
;;
2727
esac
28+
29+
case $host_cpu in
30+
ia64)
31+
DLSUFFIX=".so";;
32+
*)
33+
DLSUFFIX=".sl";;
34+
esac

‎src/template/win32

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ CFLAGS_SL=""
77
# pg_toupper() etc. in both libpq and pgport
88
# --disable-auto-import is to ensure we get MSVC-like linking behavior
99
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition -Wl,--disable-auto-import"
10+
11+
DLSUFFIX=".dll"

‎src/test/regress/GNUmakefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ endif
2525

2626
# stuff to pass into build of pg_regress
2727
EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"'\
28-
'-DSHELLPROG="$(SHELL)"'\
29-
'-DDLSUFFIX="$(DLSUFFIX)"'
28+
'-DSHELLPROG="$(SHELL)"'
3029

3130
##
3231
## Prepare for tests

‎src/tools/msvc/Solution.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ sub GenerateFiles
216216
CONFIGURE_ARGS=>'"' .$self->GetFakeConfigure() .'"',
217217
DEF_PGPORT=>$port,
218218
DEF_PGPORT_STR=>qq{"$port"},
219+
DLSUFFIX=>'".dll"',
219220
ENABLE_GSS=>$self->{options}->{gss} ? 1 :undef,
220221
ENABLE_NLS=>$self->{options}->{nls} ? 1 :undef,
221222
ENABLE_THREAD_SAFETY=> 1,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp