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 <[email protected]>
Discussion: https://www.postgresql.org/message-id/
2f9861fb-8969-9005-7518-
b8e60f2bead9@enterprisedb.com
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"
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
+DLSUFFIX
TAS
GCC
CPP
need_tas=no
tas_file=dummy.s
+# Default, works for most platforms, override in template file if needed
+DLSUFFIX=".so"
+
##
fi
+
+cat >>confdefs.h <<_ACEOF
+#define DLSUFFIX "$DLSUFFIX"
+_ACEOF
+
+
#
# Set up pkg_config in case we need it below
#
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"
need_tas=no
tas_file=dummy.s
+# Default, works for most platforms, override in template file if needed
+DLSUFFIX=".so"
+
##
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
#
# 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
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-override CPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
-
OBJS = \
jit.o
fmgr.o \
funcapi.o
-override CPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
-
include $(top_srcdir)/src/backend/common.mk
}
-/* 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
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
/* 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
#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)) || \
'-I$(top_srcdir)/src/test/regress' \
'-DHOST_TUPLE="$(host_tuple)"' \
'-DSHELLPROG="$(SHELL)"' \
- '-DDLSUFFIX="$(DLSUFFIX)"' \
$(CPPFLAGS)
# default encoding for regression tests
rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
endif
-DLSUFFIX = .so
ifeq ($(host_os), aix3.2.5)
ifneq ($(GCC), yes)
LDFLAGS_SL += -e _nostart -H512 -bM:SRE
LIBS:=$(filter-out -lm -lc, $(LIBS))
AROPT = crs
-DLSUFFIX = .dll
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
AROPT = crs
-DLSUFFIX = .so
-
# env var name to use in place of LD_LIBRARY_PATH
ld_library_path_var = DYLD_LIBRARY_PATH
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
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
# 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
export_dynamic = -Wl,-E
rpath = -Wl,-R'$(rpathdir)'
-DLSUFFIX = .so
-
# Rule for building a shared library from a single .o file
%.so: %.o
export_dynamic = -Wl,-E
rpath = -Wl,-R'$(rpathdir)'
-DLSUFFIX = .so
-
# Rule for building a shared library from a single .o file
%.so: %.o
rpath = -Wl,-R'$(rpathdir)'
endif
-DLSUFFIX = .so
-
# Rule for building a shared library from a single .o file
%.so: %.o
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
AROPT = crs
-DLSUFFIX = .dll
ifneq (,$(findstring backend,$(subdir)))
ifeq (,$(findstring conversion_procs,$(subdir)))
# 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"
fi
;;
esac
+
+case $host_cpu in
+ ia64)
+ DLSUFFIX=".so";;
+ *)
+ DLSUFFIX=".sl";;
+esac
# 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"
# stuff to pass into build of pg_regress
EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
- '-DSHELLPROG="$(SHELL)"' \
- '-DDLSUFFIX="$(DLSUFFIX)"'
+ '-DSHELLPROG="$(SHELL)"'
##
## Prepare for tests
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,