Restore AIX support.

The concerns that led us to remove AIX support in commit 0b16bb877
have now been alleviated:

1. IBM has stepped forward to provide support, including buildfarm
animal(s).
2. AIX 7.2 and later seem to be fine with large pg_attribute_aligned
requirements.  Since 7.1 is now EOL anyway, we can just cease to
support it.
3. Tossing xlc support overboard seems okay as well.  It's a bit
sad to drop one of the few remaining non-gcc-alike compilers, but
working around xlc's bugs and idiosyncrasies doesn't seem justified
by the theoretical portability benefits.
4. Likewise, we can stop supporting 32-bit AIX builds.  This is
not so much about whether we could build such executables as that
they're too much of a pain to manage in the field, due to limited
address space available for dynamic library loading.
5. We hit on a way to manage catalog column alignment that doesn't
require continuing developer effort (see commit ecae09725).

Hence, this commit reverts 0b16bb877 and some follow-on commits
such as e6bb491bf, except for not putting back XLC support nor
the changes related to catalog column alignment.

Some other notable changes from the way things were in v16:

Prefer unnamed POSIX semaphores on AIX, rather than the default
choice of SysV semaphores.

Include /opt/freeware/lib in -Wl,-blibpath, even when it is not
mentioned anywhere in LDFLAGS.

Remove platform-specific adjustment of MEMSET_LOOP_LIMIT; maybe
that's still the right thing, but it really ought to be re-tested.

Silence compiler warnings related to getpeereid(), wcstombs_l(),
and PAM conversation procs.

Accept "libpythonXXX.a" as an okay name for the Python shared
library (but only on AIX!).

Author: Aditya Kamath <Aditya.Kamath1@ibm.com>
Author: Srirama Kucherlapati <sriram.rk@in.ibm.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CY5PR11MB63928CC05906F27FB10D74D0FD322@CY5PR11MB6392.namprd11.prod.outlook.com
This commit is contained in:
Tom Lane
2026-02-23 13:34:22 -05:00
parent ecae097252
commit 4a1b05caa5
26 changed files with 381 additions and 23 deletions
-2
View File
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
+5
View File
@@ -97,6 +97,11 @@ python_ldlibrary=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sys
# If LDLIBRARY exists and has a shlib extension, use it verbatim.
ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's/\.dylib$//' -e 's/\.sl$//'`
if test "$PORTNAME" = "aix"; then
# On AIX, '.a' should also be believed to be a shlib.
ldlibrary=`echo "${ldlibrary}" | sed -e 's/\.a$//'`
fi
if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}"
then
ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
Vendored
+8 -1
View File
@@ -3022,6 +3022,7 @@ else
# --with-template not given
case $host_os in
aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -10807,6 +10808,11 @@ python_ldlibrary=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sys
# If LDLIBRARY exists and has a shlib extension, use it verbatim.
ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's/\.dylib$//' -e 's/\.sl$//'`
if test "$PORTNAME" = "aix"; then
# On AIX, '.a' should also be believed to be a shlib.
ldlibrary=`echo "${ldlibrary}" | sed -e 's/\.a$//'`
fi
if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}"
then
ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
@@ -13481,7 +13487,8 @@ fi
fi
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
# also, on AIX, we may need to have openssl in LIBS for this step.
if test "$with_ldap" = yes ; then
_LIBS="$LIBS"
if test "$PORTNAME" != "win32"; then
+3 -1
View File
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -1483,7 +1484,8 @@ if test "$with_zstd" = yes ; then
AC_CHECK_LIB(zstd, ZSTD_compress, [], [AC_MSG_ERROR([library 'zstd' is required for ZSTD support])])
fi
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
# also, on AIX, we may need to have openssl in LIBS for this step.
if test "$with_ldap" = yes ; then
_LIBS="$LIBS"
if test "$PORTNAME" != "win32"; then
+38 -2
View File
@@ -3450,7 +3450,7 @@ export MANPATH
<para>
<productname>PostgreSQL</productname> can be expected to work on current
versions of these operating systems: Linux, Windows,
FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, Solaris, and illumos.
FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
Other Unix-like systems may also work but are not currently
being tested. In most cases, all CPU architectures supported by
a given operating system will work. Look in
@@ -3472,7 +3472,7 @@ export MANPATH
Historical versions of <productname>PostgreSQL</productname> or POSTGRES
also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
M88K, NS32K, PA-RISC, SuperH, and VAX,
and operating systems including 4.3BSD, AIX, BEOS,
and operating systems including 4.3BSD, BEOS,
BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
Tru64 UNIX, and ULTRIX.
</para>
@@ -3495,6 +3495,42 @@ export MANPATH
installation issues.
</para>
<sect2 id="installation-notes-aix">
<title>AIX</title>
<indexterm zone="installation-notes-aix">
<primary>AIX</primary>
<secondary>installation on</secondary>
</indexterm>
<para>
You must use GCC
to build <productname>PostgreSQL</productname>
on <productname>AIX</productname>.
The native IBM compiler <command>xlc</command> is not supported.
</para>
<para>
Also, only 64-bit builds are supported. While the make-based build
system will automatically create 64-bit executables and libraries,
the meson build system requires you to
set <varname>OBJECT_MODE</varname> before building:
<programlisting>
export OBJECT_MODE=64
meson setup ...
</programlisting>
Failure to do that will usually manifest as complaints
from <application>ar</application> about files having the wrong
object file mode.
</para>
<para>
<productname>AIX</productname> versions before 7.2 are no longer
tested nor supported by the <productname>PostgreSQL</productname>
community.
</para>
</sect2>
<sect2 id="installation-notes-cygwin">
<title>Cygwin</title>
+23
View File
@@ -901,6 +901,29 @@ $ <userinput>postgres -D $PGDATA -C num_os_semaphores</userinput>
<variablelist>
<varlistentry>
<term><systemitem class="osname">AIX</systemitem>
<indexterm><primary>AIX</primary><secondary>IPC configuration</secondary></indexterm>
</term>
<listitem>
<para>
It should not be necessary to do
any special configuration for such parameters as
<varname>SHMMAX</varname>, as it appears this is configured to
allow all memory to be used as shared memory. That is the
sort of configuration commonly used for other databases such
as <application>DB/2</application>.</para>
<para> It might, however, be necessary to modify the global
<command>ulimit</command> information in
<filename>/etc/security/limits</filename>, as the default hard
limits for file sizes (<varname>fsize</varname>) and numbers of
files (<varname>nofiles</varname>) might be too low.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><systemitem class="osname">FreeBSD</systemitem>
<indexterm><primary>FreeBSD</primary><secondary>IPC configuration</secondary></indexterm>
+32 -1
View File
@@ -229,7 +229,38 @@ endif
# that purpose.
portname = host_system
if host_system == 'cygwin'
if host_system == 'aix'
sema_kind = 'unnamed_posix'
library_path_var = 'LIBPATH'
export_file_format = 'aix'
export_fmt = '-Wl,-bE:@0@'
mod_link_args_fmt = ['-Wl,-bI:@0@']
mod_link_with_dir = 'libdir'
mod_link_with_name = '@0@.imp'
# We force 64-bit builds, because AIX doesn't play very nice with dynamic
# library loading in 32-bit mode: there's not enough address space.
cppflags += '-maix64'
ldflags += '-maix64'
# Note: it's also necessary to tell programs like 'ar' to work in 64-bit
# mode. Since meson, in its infinite wisdom, doesn't allow us either
# to pass '-X64' to ar or to set the OBJECT_MODE environment variable
# from here, we have to tell the user to set OBJECT_MODE.
# M:SRE sets a flag indicating that an object is a shared library.
ldflags_sl += '-Wl,-bM:SRE'
# -brtllib indicates binaries should use runtime-loaded shared libraries.
ldflags_be += '-Wl,-brtllib'
# On AIX, shared libraries are wrapped in static libraries and can have
# the same extension '.a'. Therefore we must refrain from trying to build
# static libraries alongside shared ones, or meson will complain about
# duplicate targets. Note however that we leave dlsuffix with its default
# value of '.so'; this results in using '.so' for loadable modules, which
# is fine.
build_static_lib = false
elif host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
dlsuffix = '.dll'
+29
View File
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
ifeq ($(PORTNAME), aix)
LINK.shared = $(COMPILER)
ifdef SO_MAJOR_VERSION
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
endif
haslibarule = yes
# $(exports_file) is also usable as an import file
exports_file = lib$(NAME).exp
BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
ifneq (,$(SHLIB_EXPORTS))
LINK.shared += -Wl,-bE:$(exports_file)
endif
endif
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
# AIX wraps shared libraries inside a static library, which can be used both
# for static and shared linking
ifeq ($(PORTNAME), aix)
$(stlib): $(shlib)
rm -f $(stlib)
$(AR) $(AROPT) $(stlib) $(shlib)
endif # aix
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
# except on AIX, where that's not a thing
ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
# we don't install $(shlib) on AIX
# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
+35 -3
View File
@@ -81,16 +81,18 @@ override LDFLAGS := $(LDFLAGS) $(LDFLAGS_EX) $(LDFLAGS_EX_BE)
##########################################################################
all: submake-libpgport submake-catalog-headers submake-utils-headers postgres
all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP)
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
endif
ifeq ($(PORTNAME), cygwin)
@@ -117,6 +119,24 @@ libpostgres.a: postgres
endif # win32
ifeq ($(PORTNAME), aix)
postgres: $(POSTGRES_IMP)
$(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
# Linking to a single .o with -r is a lot faster than building a .a or passing
# all objects to MKLDEXPORT.
#
# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
# trivially work with gcc, due to gcc specific static libraries linked in with
# -r.
$(POSTGRES_IMP): $(OBJS)
ld -b64 -r -o SUBSYS.o $(call expand_subsys,$^)
$(MKLDEXPORT) SUBSYS.o . > $@
@rm -f SUBSYS.o
endif # aix
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
@@ -210,8 +230,12 @@ install-postgres-bitcode: $(OBJS) all
$(call install_llvm_module,postgres,$(call expand_subsys, $(filter-out $(top_builddir)/src/timezone/objfiles.txt, $(SUBDIROBJS))))
endif
install-bin: postgres installdirs
install-bin: postgres $(POSTGRES_IMP) installdirs
$(INSTALL_PROGRAM) postgres$(X) '$(DESTDIR)$(bindir)/postgres$(X)'
ifeq ($(MAKE_EXPORTS), true)
$(INSTALL_DATA) $(POSTGRES_IMP) '$(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)'
$(INSTALL_PROGRAM) $(MKLDEXPORT) '$(DESTDIR)$(pgxsdir)/$(MKLDEXPORT_DIR)/mkldexport.sh'
endif
.PHONY: install-bin
@@ -227,12 +251,20 @@ ifeq ($(MAKE_DLL), true)
$(MKDIR_P) '$(DESTDIR)$(libdir)'
endif
endif
ifeq ($(MAKE_EXPORTS), true)
$(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
$(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(MKLDEXPORT_DIR)'
endif
##########################################################################
uninstall:
rm -f '$(DESTDIR)$(bindir)/postgres$(X)'
ifeq ($(MAKE_EXPORTS), true)
rm -f '$(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)'
rm -f '$(DESTDIR)$(pgxsdir)/$(MKLDEXPORT_DIR)/mkldexport.sh'
endif
ifeq ($(PORTNAME), cygwin)
ifeq ($(MAKE_DLL), true)
rm -f '$(DESTDIR)$(libdir)/libpostgres.a'
@@ -257,7 +289,7 @@ endif
##########################################################################
clean:
rm -f $(LOCALOBJS) postgres$(X)
rm -f $(LOCALOBJS) postgres$(X) $(POSTGRES_IMP)
ifeq ($(PORTNAME), cygwin)
rm -f postgres.dll libpostgres.a
endif
+19
View File
@@ -91,6 +91,25 @@ if cc.get_id() == 'msvc'
# be restricted to b_pch=true.
backend_link_with += postgres_lib
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
# main executable, allowing extension libraries to resolve their undefined
# symbols to symbols in the postgres binary.
postgres_imp = custom_target('postgres.imp',
command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
input: postgres_lib,
output: 'postgres.imp',
capture: true,
install: true,
install_dir: dir_lib_pkg,
build_by_default: false,
)
# -Wl,-bE:exportfile indicates these symbols are exported by postgres binary
backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
backend_link_depends += postgres_imp
install_data(
'port/aix/mkldexport.sh',
install_dir: dir_pgxs / 'src/backend/port/aix')
endif
backend_input = []
+71
View File
@@ -0,0 +1,71 @@
#!/bin/sh
#
# mkldexport
# create an AIX exports file from an object file
#
# src/backend/port/aix/mkldexport.sh
#
# Usage:
# mkldexport objectfile [location]
# where
# objectfile is the current location of the object file.
# location is the eventual (installed) location of the
# object file (if different from the current
# working directory).
#
# On AIX, executables do not automatically expose their symbols to shared
# modules. Extensions therefore cannot call functions in the main Postgres
# binary unless those symbols are explicitly exported. Unlike other platforms,
# AIX executables are not default symbol providers; each shared module must
# link against an export list that defines which symbols it can use.
#
# The mkldexport.sh script fixes AIX's symbol export issue by generating an
# explicit export list. It uses nm to gather all symbols from the Postgres
# object files, then writes them into the export file. When invoked with ".",
# it outputs #! ., which tells AIX the list applies to the main executable.
# This way, extension modules can link against that list and resolve their
# undefined symbols directly from the Postgres binary.
#
# Search for the nm command binary.
if [ -x /usr/ucb/nm ]
then NM=/usr/ucb/nm
elif [ -x /usr/bin/nm ]
then NM=/usr/bin/nm
elif [ -x /usr/ccs/bin/nm ]
then NM=/usr/ccs/bin/nm
elif [ -x /usr/usg/bin/nm ]
then NM=/usr/usg/bin/nm
else echo "Fatal error: cannot find `nm' ... please check your installation."
exit 1
fi
# instruct nm to process 64-bit objects
export OBJECT_MODE=64
CMDNAME=`basename $0`
if [ -z "$1" ]; then
echo "Usage: $CMDNAME object [location]"
exit 1
fi
OBJNAME=`basename $1`
if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
OBJNAME=`basename $OBJNAME .o`.so
fi
if [ -z "$2" ]; then
echo '#!'
else
if [ "$2" = "." ]; then
# for the base executable (AIX 4.2 and up)
echo '#! .'
else
echo '#!' $2
fi
fi
$NM -BCg $1 | \
egrep ' [TDB] ' | \
sed -e 's/.* //' | \
egrep -v '\$' | \
sed -e 's/^[.]//' | \
sort | \
uniq
+2
View File
@@ -915,7 +915,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
+2 -2
View File
@@ -52,7 +52,7 @@ bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
#define PS_USE_SETPROCTITLE_FAST
#elif defined(HAVE_SETPROCTITLE)
#define PS_USE_SETPROCTITLE
#elif defined(__linux__) || defined(__sun) || defined(__darwin__) || defined(__GNU__)
#elif defined(__linux__) || defined(_AIX) || defined(__sun) || defined(__darwin__) || defined(__GNU__)
#define PS_USE_CLOBBER_ARGV
#elif defined(WIN32)
#define PS_USE_WIN32
@@ -62,7 +62,7 @@ bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
/* Different systems want the buffer padded differently */
#if defined(__linux__) || defined(__darwin__) || defined(__GNU__)
#if defined(_AIX) || defined(__linux__) || defined(__darwin__) || defined(__GNU__)
#define PS_PADDING '\0'
#else
#define PS_PADDING ' '
+22
View File
@@ -0,0 +1,22 @@
/*
* src/include/port/aix.h
*/
#include <stddef.h> /* for size_t */
#include <sys/types.h> /* for uid_t and gid_t */
#include <wchar.h> /* for wchar_t and locale_t */
/* AIX has getpeereid(), but fails to declare it as of 7.3 */
extern int getpeereid(int socket, uid_t *euid, gid_t *egid);
/* AIX has wcstombs_l(), but fails to declare it as of 7.3 */
extern size_t wcstombs_l(char *dest, const wchar_t *src, size_t n,
locale_t loc);
/*
* AIX doesn't seem to have ever modernized pam_appl.h to include
* "const" in the declaration of PAM conversation procs. We can avoid
* a compile error by setting _PAM_LEGACY_NONCONST; that doesn't do
* anything in AIX's system headers, but it makes us omit the "const"
* in our own code. (Compare solaris.h.)
*/
#define _PAM_LEGACY_NONCONST 1
+1 -1
View File
@@ -35,7 +35,7 @@ ecpg_compat_so = shared_library('libecpg_compat',
c_args: ecpg_compat_c_args,
dependencies: [frontend_shlib_code, thread_dep],
link_with: [ecpglib_so, ecpg_pgtypes_so],
soversion: host_system != 'windows' ? '3' : '',
soversion: host_system not in ['aix', 'windows'] ? '3' : '',
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
version: '3.' + pg_version_major.to_string(),
link_args: export_fmt.format(export_file.full_path()),
+1 -1
View File
@@ -46,7 +46,7 @@ ecpglib_so = shared_library('libecpg',
c_pch: pch_postgres_fe_h,
dependencies: [frontend_shlib_code, libpq, thread_dep],
link_with: ecpg_pgtypes_so,
soversion: host_system != 'windows' ? '6' : '',
soversion: host_system not in ['aix', 'windows'] ? '6' : '',
darwin_versions: ['6', '6.' + pg_version_major.to_string()],
version: '6.' + pg_version_major.to_string(),
link_args: export_fmt.format(export_file.full_path()),
+1 -1
View File
@@ -41,7 +41,7 @@ ecpg_pgtypes_so = shared_library('libpgtypes',
c_pch: pch_postgres_fe_h,
dependencies: frontend_shlib_code,
version: '3.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '3' : '',
soversion: host_system not in ['aix', 'windows'] ? '3' : '',
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
link_args: export_fmt.format(export_file.full_path()),
link_depends: export_file,
+2
View File
@@ -136,7 +136,9 @@ $(stlib): $(OBJS_STATIC)
# expect them to honor this coding rule.
libpq-refs-stamp: $(shlib)
ifneq ($(enable_coverage), yes)
ifeq (,$(filter aix,$(PORTNAME)))
$(PERL) $(srcdir)/libpq_check.pl --input_file $< --nm='$(NM)'
endif
endif
touch $@
+4 -3
View File
@@ -55,8 +55,9 @@ libpq_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
# libpq_st, and {pgport,common}_shlib for libpq_sh
#
# We could try to avoid building the source files twice, but it probably adds
# more complexity than its worth (reusing object files requires also linking
# to the library on windows or breaks precompiled headers).
# more complexity than its worth (AIX doesn't support link_whole yet, reusing
# object files requires also linking to the library on windows or breaks
# precompiled headers).
if build_static_lib
libpq_st = static_library('libpq',
libpq_sources,
@@ -76,7 +77,7 @@ libpq_so = shared_library('libpq',
c_args: libpq_c_args + libpq_so_c_args,
c_pch: pch_postgres_fe_h,
version: '5.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '5' : '',
soversion: host_system not in ['aix', 'windows'] ? '5' : '',
darwin_versions: ['5', '5.' + pg_version_major.to_string()],
dependencies: [frontend_shlib_code, libpq_deps],
link_depends: export_file,
+42
View File
@@ -0,0 +1,42 @@
# MAKE_EXPORTS is required for svr4 loaders that want a file of
# symbol names to tell them what to export/import.
MAKE_EXPORTS= true
# -blibpath must contain ALL directories where we should look for libraries
libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/opt/freeware/lib:/usr/lib:/lib
# when building with gcc, need to make sure that libgcc can be found
ifeq ($(GCC), yes)
libpath := $(libpath):$(dir $(shell gcc -print-libgcc-file-name))
endif
rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
# gcc needs to know it's building a shared lib, otherwise it'll not emit
# correct code / link to the right support libraries
ifeq ($(GCC), yes)
LDFLAGS_SL += -shared
endif
# instruct ar to process 64-bit objects
AROPT := -X64 $(AROPT)
# env var name to use in place of LD_LIBRARY_PATH
ld_library_path_var = LIBPATH
POSTGRES_IMP= postgres.imp
ifdef PGXS
BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
else
BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
endif
MKLDEXPORT_DIR=src/backend/port/aix
MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
%$(DLSUFFIX): %.o
$(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
+1 -1
View File
@@ -28,5 +28,5 @@ applications.
from libpgport are linked first. This avoids having applications
dependent on symbols that are _used_ by libpq, but not intended to be
exported by libpq. libpq's libpgport usage changes over time, so such a
dependency is a problem. Windows, Linux, and macOS use an export
dependency is a problem. Windows, Linux, AIX, and macOS use an export
list to control the symbols exported by libpq.
+2
View File
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
+19
View File
@@ -0,0 +1,19 @@
# src/template/aix
# Prefer unnamed POSIX semaphores if available, unless user overrides choice
if test x"$PREFERRED_SEMAPHORES" = x"" ; then
PREFERRED_SEMAPHORES=UNNAMED_POSIX
fi
# Extra CFLAGS for code that will go into a shared library
CFLAGS_SL=""
if test "$GCC" = yes; then
# We force 64-bit builds, because AIX doesn't play very nice with dynamic
# library loading in 32-bit mode: there's not enough address space.
CPPFLAGS="$CPPFLAGS -maix64"
# For large binaries/libraries, there will be TOC overflows in AIX. To
# avoid this, pass -bbigtoc linker option to enlarge TOC access range.
LDFLAGS="$LDFLAGS -maix64 -Wl,-bbigtoc"
fi
+5
View File
@@ -7,6 +7,11 @@
# GNU make uses a make file named "GNUmakefile" in preference to "Makefile"
# if it exists. Postgres is shipped with a "GNUmakefile".
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
all:
all install clean check installcheck:
@echo "You must use GNU make to use Postgres. It may be installed"
@echo "on your system with the name 'gmake'."
+13 -4
View File
@@ -16,11 +16,12 @@ GetOptions(
'input:s' => \$input,
'output:s' => \$output) or die "wrong arguments";
if (not( $format eq 'darwin'
if (not( $format eq 'aix'
or $format eq 'darwin'
or $format eq 'gnu'
or $format eq 'win'))
{
die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
die "$0: $format is not yet handled (only aix, darwin, gnu, win are)\n";
}
open(my $input_handle, '<', $input)
@@ -30,7 +31,11 @@ open(my $output_handle, '>', $output)
or die "$0: could not open output file '$output': $!\n";
if ($format eq 'gnu')
if ($format eq 'aix')
{
print $output_handle "#!\n";
}
elsif ($format eq 'gnu')
{
print $output_handle "{
global:
@@ -55,7 +60,11 @@ while (<$input_handle>)
}
elsif (/^(\S+)\s+(\S+)/)
{
if ($format eq 'darwin')
if ($format eq 'aix')
{
print $output_handle "$1\n";
}
elsif ($format eq 'darwin')
{
print $output_handle "_$1\n";
}
+1
View File
@@ -89,6 +89,7 @@ do
# These files are platform-specific, and c.h will include the
# one that's relevant for our current platform anyway.
test "$f" = src/include/port/aix.h && continue
test "$f" = src/include/port/cygwin.h && continue
test "$f" = src/include/port/darwin.h && continue
test "$f" = src/include/port/freebsd.h && continue