From ac652466ec9ee98087650b9f164e4a4b5692e3a7 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun, 24 Jul 2005 23:30:10 +0000
Subject: [PATCH] Partial fixes for contrib build on AIX: include -lm where
 needed. Per Rocco Altier.

---
 contrib/cube/Makefile          | 3 ++-
 contrib/earthdistance/Makefile | 4 +++-
 contrib/tablefunc/Makefile     | 2 ++
 contrib/tsearch2/Makefile      | 4 ++--
 src/makefiles/Makefile.aix     | 2 +-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index f4b0d0b5017..dd953aae53d 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/contrib/cube/Makefile,v 1.12 2004/08/20 20:13:02 momjian Exp $
+# $PostgreSQL: pgsql/contrib/cube/Makefile,v 1.13 2005/07/24 23:30:09 tgl Exp $
 
 MODULE_big = cube
 OBJS= cube.o cubeparse.o
@@ -9,6 +9,7 @@ REGRESS = cube
 
 EXTRA_CLEAN = cubeparse.c cubeparse.h cubescan.c y.tab.c y.tab.h
 
+SHLIB_LINK += $(filter -lm, $(LIBS))
 
 ifdef USE_PGXS
 PGXS = $(shell pg_config --pgxs)
diff --git a/contrib/earthdistance/Makefile b/contrib/earthdistance/Makefile
index 35ad6d61046..8cb804ee19b 100644
--- a/contrib/earthdistance/Makefile
+++ b/contrib/earthdistance/Makefile
@@ -1,10 +1,12 @@
-# $PostgreSQL: pgsql/contrib/earthdistance/Makefile,v 1.14 2004/08/20 20:13:03 momjian Exp $
+# $PostgreSQL: pgsql/contrib/earthdistance/Makefile,v 1.15 2005/07/24 23:30:09 tgl Exp $
 
 MODULES = earthdistance
 DATA_built = earthdistance.sql
 DOCS = README.earthdistance
 REGRESS = earthdistance
 
+SHLIB_LINK += $(filter -lm, $(LIBS))
+
 ifdef USE_PGXS
 PGXS = $(shell pg_config --pgxs)
 include $(PGXS)
diff --git a/contrib/tablefunc/Makefile b/contrib/tablefunc/Makefile
index 4b87fd95a58..b2b8cb2e003 100644
--- a/contrib/tablefunc/Makefile
+++ b/contrib/tablefunc/Makefile
@@ -3,6 +3,8 @@ DATA_built = tablefunc.sql
 DOCS = README.tablefunc
 REGRESS = tablefunc
 
+SHLIB_LINK += $(filter -lm, $(LIBS))
+
 ifdef USE_PGXS
 PGXS = $(shell pg_config --pgxs)
 include $(PGXS)
diff --git a/contrib/tsearch2/Makefile b/contrib/tsearch2/Makefile
index 15983db4281..1691dd578d2 100644
--- a/contrib/tsearch2/Makefile
+++ b/contrib/tsearch2/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/contrib/tsearch2/Makefile,v 1.8 2004/10/17 23:09:31 tgl Exp $
+# $PostgreSQL: pgsql/contrib/tsearch2/Makefile,v 1.9 2005/07/24 23:30:10 tgl Exp $
 
 MODULE_big = tsearch2
 OBJS = dict_ex.o dict.o snmap.o stopword.o common.o prs_dcfg.o \
@@ -19,7 +19,7 @@ DATA_built = tsearch2.sql untsearch2.sql
 DOCS = README.tsearch2
 REGRESS = tsearch2
 
-SHLIB_LINK := -lm
+SHLIB_LINK += $(filter -lm, $(LIBS))
 
 
 ifdef USE_PGXS
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index bb0c2fd58b8..99099272eb2 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -28,6 +28,6 @@ MKLDEXPORT=$(top_srcdir)/src/backend/port/aix/mkldexport.sh
 
 %$(DLSUFFIX): %.o %$(EXPSUFF)
 	@echo Making shared library $@ from $*.o, $*$(EXPSUFF) and postgres.imp
-	$(CC) $(LDFLAGS) $(LDFLAGS_SL) -o $@ $*.o -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP) -Wl,-bE:$*$(EXPSUFF) $(LIBS)
+	$(CC) $(LDFLAGS) $(LDFLAGS_SL) -o $@ $*.o -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP) -Wl,-bE:$*$(EXPSUFF) $(SHLIB_LINK)
 
 sqlmansect = 7
-- 
GitLab