Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9b5e108

Browse files
committed
Fix shared library creation to work properly on AIX. Albe Laurenz
1 parent 48fe137 commit 9b5e108

File tree

7 files changed

+42
-23
lines changed

7 files changed

+42
-23
lines changed

src/Makefile.global.in

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.229 2006/09/11 13:35:08 tgl Exp $
2+
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.230 2006/09/19 15:36:07 tgl Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -345,13 +345,6 @@ libpq := -L$(libpq_builddir) -lpq
345345
ifeq ($(enable_shared), no)
346346
libpq += $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt, $(LIBS)) \
347347
$(LDAP_LIBS_FE) $(PTHREAD_LIBS)
348-
else
349-
# On AIX even shared libraries do not remember their required libs,
350-
# so again add in what libpq depends on.
351-
ifeq ($(PORTNAME), aix)
352-
libpq += $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt, $(LIBS)) \
353-
$(LDAP_LIBS_FE) $(PTHREAD_LIBS)
354-
endif
355348
endif
356349

357350
# This macro is for use by client executables (not libraries) that use libpq.

src/Makefile.shlib

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.104 2006/04/28 02:53:20 tgl Exp $
9+
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.105 2006/09/19 15:36:07 tgl Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -96,8 +96,8 @@ override CFLAGS += $(CFLAGS_SL)
9696
soname = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
9797

9898
ifeq ($(PORTNAME), aix)
99-
shlib = lib$(NAME)$(DLSUFFIX)
100-
# SHLIB_LINK += -lc
99+
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
100+
haslibarule = yes
101101
endif
102102

103103
ifeq ($(PORTNAME), darwin)
@@ -295,9 +295,13 @@ endif
295295
else # PORTNAME == aix
296296

297297
# AIX case
298-
$(shlib): lib$(NAME).a
298+
$(shlib) lib$(NAME).a: $(OBJS)
299+
$(LINK.static) lib$(NAME).a $^
300+
$(RANLIB) lib$(NAME).a
299301
$(MKLDEXPORT) lib$(NAME).a > lib$(NAME)$(EXPSUFF)
300-
$(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $@ $< -Wl,-bE:lib$(NAME)$(EXPSUFF) $(SHLIB_LINK)
302+
$(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:lib$(NAME)$(EXPSUFF) $(SHLIB_LINK)
303+
rm -f lib$(NAME).a
304+
$(AR) $(AROPT) lib$(NAME).a $(shlib)
301305

302306
endif # PORTNAME == aix
303307

@@ -350,6 +354,7 @@ endif
350354

351355
ifeq ($(enable_shared), yes)
352356
install-lib-shared: $(shlib)
357+
ifneq ($(PORTNAME), aix) # we don't install $(shlib) on AIX
353358
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
354359
ifneq ($(PORTNAME), cygwin)
355360
ifneq ($(PORTNAME), win32)
@@ -365,6 +370,7 @@ ifneq ($(shlib), $(shlib_bare))
365370
endif
366371
endif # not win32
367372
endif # not cygwin
373+
endif # not aix
368374
endif # enable_shared
369375

370376

src/interfaces/ecpg/test/Makefile.regress

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ override CPPFLAGS := -I../../include -I$(top_srcdir)/src/interfaces/ecpg/include
22
-I$(libpq_srcdir) $(CPPFLAGS)
33
override CFLAGS += $(PTHREAD_CFLAGS)
44

5-
override LDFLAGS := -L../../ecpglib -L../../pgtypeslib -L../../../libpq $(LDFLAGS)
6-
override LIBS := -lpgtypes -lecpg -lpq $(LIBS) $(PTHREAD_LIBS)
5+
override LDFLAGS := -L../../ecpglib -L../../pgtypeslib $(LDFLAGS)
6+
override LIBS := -lecpg -lpgtypes $(libpq) $(LIBS) $(PTHREAD_LIBS)
77

88
ECPG = ../../preproc/ecpg -I$(srcdir)/../../include
99

src/interfaces/ecpg/test/compat_informix/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ top_builddir = ../../../../..
33
include $(top_builddir)/src/Makefile.global
44
include $(top_srcdir)/$(subdir)/../Makefile.regress
55

6-
# special informix compatiblity switches
6+
# special informix compatibility switches
77
ECPG += -C INFORMIX
88
ECPG_NOIND = $(ECPG) -r no_indicator
9-
override LDFLAGS += -L../../compatlib
10-
override LIBS += $(LIBS) -lecpg_compat
9+
10+
override LDFLAGS := -L../../compatlib $(LDFLAGS)
11+
override LIBS := -lecpg_compat $(LIBS)
1112

1213
TESTS = test_informix test_informix.c \
1314
test_informix2 test_informix2.c \

src/interfaces/ecpg/test/pg_regress.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.13 2006/09/08 13:32:27 meskes Exp $
2+
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.14 2006/09/19 15:36:08 tgl Exp $
33

44
me=`basename $0`
55

@@ -322,6 +322,7 @@ do_temp_install(){
322322
# Set up shared library paths, needed by psql and pg_encoding
323323
# (if you run multibyte). LD_LIBRARY_PATH covers many platforms.
324324
# DYLD_LIBRARY_PATH works on Darwin, and maybe other Mach-based systems.
325+
# LIBPATH is for AIX.
325326
# Feel free to account for others as well.
326327
# ----------
327328

@@ -339,6 +340,13 @@ do_temp_install(){
339340
fi
340341
export DYLD_LIBRARY_PATH
341342

343+
if [ -n "$LIBPATH" ]; then
344+
LIBPATH="$libdir:$LIBPATH"
345+
else
346+
LIBPATH=$libdir
347+
fi
348+
export LIBPATH
349+
342350
# ----------
343351
# Windows needs shared libraries in PATH. (Only those linked into
344352
# executables, not dlopen'ed ones)

src/makefiles/Makefile.aix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ MAKE_EXPORTS= true
55
RANLIB= touch
66
AROPT = crs
77

8+
# -blibpath must contain ALL directories where we should look for libraries
9+
libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
10+
11+
ifeq ($(host_os), aix3.2.5)
12+
rpath = -L$(rpathdir)
13+
else
14+
rpath = -Wl,-blibpath:$(rpathdir)$(libpath)
15+
endif
16+
817
DLSUFFIX = .so
918
ifeq ($(host_os), aix3.2.5)
1019
ifneq ($(GCC), yes)

src/test/regress/pg_regress.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.20 2006/08/13 20:39:07 tgl Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.21 2006/09/19 15:36:08 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -507,12 +507,14 @@ initialize_environment(void)
507507
* Set up shared library paths to include the temp install.
508508
*
509509
* LD_LIBRARY_PATH covers many platforms. DYLD_LIBRARY_PATH works on
510-
* Darwin, and maybe other Mach-based systems. Windows needs shared
511-
* libraries in PATH. (Only those linked into executables, not
512-
* dlopen'ed ones) Feel free to account for others as well.
510+
* Darwin, and maybe other Mach-based systems. LIBPATH is for AIX.
511+
* Windows needs shared libraries in PATH (only those linked into
512+
* executables, not dlopen'ed ones).
513+
* Feel free to account for others as well.
513514
*/
514515
add_to_path("LD_LIBRARY_PATH", ':', libdir);
515516
add_to_path("DYLD_LIBRARY_PATH", ':', libdir);
517+
add_to_path("LIBPATH", ':', libdir);
516518
#if defined(WIN32) || defined(__CYGWIN__)
517519
add_to_path("PATH", ';', libdir);
518520
#endif

0 commit comments

Comments
 (0)