mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
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.global and pg_config.h. This avoids the need for all makefile rules that need it to locally set CPPFLAGS. It also resolves an inconsistent setup 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
This commit is contained in:
parent
5656683503
commit
23119d51a1
@ -120,7 +120,9 @@ else
|
||||
found_shlib=0
|
||||
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
|
||||
do
|
||||
# We don't know the platform DLSUFFIX here, so check 'em all.
|
||||
# Note: DLSUFFIX is for loadable modules, not shared
|
||||
# libraries, so cannot be used here portably. Just
|
||||
# check all known possibilities.
|
||||
for e in .so .dll .dylib .sl; do
|
||||
if test -e "$d/lib${ldlibrary}$e"; then
|
||||
python_libdir="$d"
|
||||
|
14
configure
vendored
14
configure
vendored
@ -734,6 +734,7 @@ autodepend
|
||||
PKG_CONFIG_LIBDIR
|
||||
PKG_CONFIG_PATH
|
||||
PKG_CONFIG
|
||||
DLSUFFIX
|
||||
TAS
|
||||
GCC
|
||||
CPP
|
||||
@ -3033,6 +3034,9 @@ PORTNAME=$template
|
||||
need_tas=no
|
||||
tas_file=dummy.s
|
||||
|
||||
# Default, works for most platforms, override in template file if needed
|
||||
DLSUFFIX=".so"
|
||||
|
||||
|
||||
|
||||
##
|
||||
@ -7688,6 +7692,12 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define DLSUFFIX "$DLSUFFIX"
|
||||
_ACEOF
|
||||
|
||||
|
||||
#
|
||||
# Set up pkg_config in case we need it below
|
||||
#
|
||||
@ -10560,7 +10570,9 @@ else
|
||||
found_shlib=0
|
||||
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
|
||||
do
|
||||
# We don't know the platform DLSUFFIX here, so check 'em all.
|
||||
# Note: DLSUFFIX is for loadable modules, not shared
|
||||
# libraries, so cannot be used here portably. Just
|
||||
# check all known possibilities.
|
||||
for e in .so .dll .dylib .sl; do
|
||||
if test -e "$d/lib${ldlibrary}$e"; then
|
||||
python_libdir="$d"
|
||||
|
@ -103,6 +103,9 @@ AC_SUBST(PORTNAME)
|
||||
need_tas=no
|
||||
tas_file=dummy.s
|
||||
|
||||
# Default, works for most platforms, override in template file if needed
|
||||
DLSUFFIX=".so"
|
||||
|
||||
|
||||
|
||||
##
|
||||
@ -721,6 +724,10 @@ else
|
||||
fi
|
||||
AC_SUBST(TAS)
|
||||
|
||||
AC_SUBST(DLSUFFIX)dnl
|
||||
AC_DEFINE_UNQUOTED([DLSUFFIX], ["$DLSUFFIX"],
|
||||
[Define to the file name extension of dynamically-loadable modules.])
|
||||
|
||||
#
|
||||
# Set up pkg_config in case we need it below
|
||||
#
|
||||
|
@ -545,6 +545,8 @@ WIN32_STACK_RLIMIT=4194304
|
||||
# Set if we have a working win32 crashdump header
|
||||
have_win32_dbghelp = @have_win32_dbghelp@
|
||||
|
||||
DLSUFFIX = @DLSUFFIX@
|
||||
|
||||
# Pull in platform-specific magic
|
||||
include $(top_builddir)/src/Makefile.port
|
||||
|
||||
|
@ -15,8 +15,6 @@ subdir = src/backend/jit
|
||||
top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
override CPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
|
||||
|
||||
OBJS = \
|
||||
jit.o
|
||||
|
||||
|
@ -17,6 +17,4 @@ OBJS = \
|
||||
fmgr.o \
|
||||
funcapi.o
|
||||
|
||||
override CPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
|
||||
|
||||
include $(top_srcdir)/src/backend/common.mk
|
||||
|
@ -483,11 +483,6 @@ file_exists(const char *name)
|
||||
}
|
||||
|
||||
|
||||
/* Example format: ".so" */
|
||||
#ifndef DLSUFFIX
|
||||
#error "DLSUFFIX must be defined to compile this file."
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If name contains a slash, check if the file exists, if so return
|
||||
* the name. Else (no slash) try to expand using search path (see
|
||||
|
@ -25,7 +25,7 @@ OBJS = \
|
||||
util.o \
|
||||
version.o
|
||||
|
||||
override CPPFLAGS := -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
|
||||
override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
|
||||
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
|
||||
|
||||
all: pg_upgrade
|
||||
|
@ -42,6 +42,9 @@
|
||||
/* Define to the default TCP port number as a string constant. */
|
||||
#undef DEF_PGPORT_STR
|
||||
|
||||
/* Define to the file name extension of dynamically-loadable modules. */
|
||||
#undef DLSUFFIX
|
||||
|
||||
/* Define to build with GSSAPI support. (--with-gssapi) */
|
||||
#undef ENABLE_GSS
|
||||
|
||||
|
@ -529,9 +529,6 @@ typedef unsigned short mode_t;
|
||||
#define W_OK 2
|
||||
#define R_OK 4
|
||||
|
||||
/* Pulled from Makefile.port in MinGW */
|
||||
#define DLSUFFIX ".dll"
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || \
|
||||
|
@ -12,7 +12,6 @@ override CPPFLAGS := \
|
||||
'-I$(top_srcdir)/src/test/regress' \
|
||||
'-DHOST_TUPLE="$(host_tuple)"' \
|
||||
'-DSHELLPROG="$(SHELL)"' \
|
||||
'-DDLSUFFIX="$(DLSUFFIX)"' \
|
||||
$(CPPFLAGS)
|
||||
|
||||
# default encoding for regression tests
|
||||
|
@ -14,7 +14,6 @@ else
|
||||
rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
|
||||
endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
ifeq ($(host_os), aix3.2.5)
|
||||
ifneq ($(GCC), yes)
|
||||
LDFLAGS_SL += -e _nostart -H512 -bM:SRE
|
||||
|
@ -11,7 +11,6 @@ endif
|
||||
LIBS:=$(filter-out -lm -lc, $(LIBS))
|
||||
|
||||
AROPT = crs
|
||||
DLSUFFIX = .dll
|
||||
|
||||
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
AROPT = crs
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
# env var name to use in place of LD_LIBRARY_PATH
|
||||
ld_library_path_var = DYLD_LIBRARY_PATH
|
||||
|
||||
|
@ -3,8 +3,6 @@ AROPT = cr
|
||||
export_dynamic = -Wl,-export-dynamic
|
||||
rpath = -Wl,-R'$(rpathdir)'
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
# extra stuff for $(with_temp_install)
|
||||
# we need this to get LD_LIBRARY_PATH searched ahead of the compiled-in
|
||||
# rpath, if no DT_RUNPATH is present in the executable. The conditions
|
||||
|
@ -25,12 +25,6 @@ INSTALL_SHLIB_OPTS = -m 555
|
||||
|
||||
AROPT = crs
|
||||
|
||||
ifeq ($(host_cpu), ia64)
|
||||
DLSUFFIX = .so
|
||||
else
|
||||
DLSUFFIX = .sl
|
||||
endif
|
||||
|
||||
# env var name to use in place of LD_LIBRARY_PATH
|
||||
ld_library_path_var = SHLIB_PATH
|
||||
|
||||
|
@ -5,8 +5,6 @@ export_dynamic = -Wl,-E
|
||||
# This allows LD_LIBRARY_PATH to still work when needed.
|
||||
rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
%.so: %.o
|
||||
|
@ -3,8 +3,6 @@ AROPT = cr
|
||||
export_dynamic = -Wl,-E
|
||||
rpath = -Wl,-R'$(rpathdir)'
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
%.so: %.o
|
||||
|
@ -3,8 +3,6 @@ AROPT = cr
|
||||
export_dynamic = -Wl,-E
|
||||
rpath = -Wl,-R'$(rpathdir)'
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
%.so: %.o
|
||||
|
@ -9,8 +9,6 @@ else
|
||||
rpath = -Wl,-R'$(rpathdir)'
|
||||
endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
%.so: %.o
|
||||
|
@ -11,7 +11,6 @@ endif
|
||||
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
|
||||
|
||||
AROPT = crs
|
||||
DLSUFFIX = .dll
|
||||
|
||||
ifneq (,$(findstring backend,$(subdir)))
|
||||
ifeq (,$(findstring conversion_procs,$(subdir)))
|
||||
|
@ -13,3 +13,5 @@ CFLAGS_SL=""
|
||||
# we'd prefer to use --disable-auto-import to match MSVC linking behavior,
|
||||
# but support for it in Cygwin is too haphazard
|
||||
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition -Wl,--enable-auto-import"
|
||||
|
||||
DLSUFFIX=".dll"
|
||||
|
@ -25,3 +25,10 @@ case $host in
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case $host_cpu in
|
||||
ia64)
|
||||
DLSUFFIX=".so";;
|
||||
*)
|
||||
DLSUFFIX=".sl";;
|
||||
esac
|
||||
|
@ -7,3 +7,5 @@ CFLAGS_SL=""
|
||||
# pg_toupper() etc. in both libpq and pgport
|
||||
# --disable-auto-import is to ensure we get MSVC-like linking behavior
|
||||
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition -Wl,--disable-auto-import"
|
||||
|
||||
DLSUFFIX=".dll"
|
||||
|
@ -25,8 +25,7 @@ endif
|
||||
|
||||
# stuff to pass into build of pg_regress
|
||||
EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
|
||||
'-DSHELLPROG="$(SHELL)"' \
|
||||
'-DDLSUFFIX="$(DLSUFFIX)"'
|
||||
'-DSHELLPROG="$(SHELL)"'
|
||||
|
||||
##
|
||||
## Prepare for tests
|
||||
|
@ -216,6 +216,7 @@ sub GenerateFiles
|
||||
CONFIGURE_ARGS => '"' . $self->GetFakeConfigure() . '"',
|
||||
DEF_PGPORT => $port,
|
||||
DEF_PGPORT_STR => qq{"$port"},
|
||||
DLSUFFIX => '".dll"',
|
||||
ENABLE_GSS => $self->{options}->{gss} ? 1 : undef,
|
||||
ENABLE_NLS => $self->{options}->{nls} ? 1 : undef,
|
||||
ENABLE_THREAD_SAFETY => 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user