7.0.2 on Solaris

From: pgsql-hackers(at)thewrittenword(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: 7.0.2 on Solaris
Date: 2000-06-27 17:54:43
Message-ID: 200006280317.WAA31093@postal.thewrittenword.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm in the process of fixing build problems in 7.0.2 for Solaris CC
(not GCC).

1. I'm curious why src/template/solaris_sparc_cc contains:
-DDISABLE_COMPLEX_MACRO
src/templates/solaris_i386_cc does not contains this definition.

This breaks the compilation:
gmake[3]: Entering directory
`/opt/build/postgresql-7.0.2/src/interfaces/ecpg/preproc'
cc -o ecpg preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o
keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o
../../../backend/port/snprintf.o -R/opt/TWWfsw/pgsql702/lib
-R/opt/TWWfsw/tcl83/lib -R/opt/TWWfsw/tk83/lib
-R/opt/TWWfsw/readline4/lib -L/opt/TWWfsw/tcl83/lib
-L/opt/TWWfsw/tk83/lib -L/opt/TWWfsw/readline4/lib -lgen -lsocket
-lnsl -ldl -lm -lreadline -ltermcap -lcurses
Undefined first referenced
symbol in file
nocachegetattr pgc.o

The reason for this is because nocachegetattr becomes a function when
DISABLE_COMPLEX_MACRO is defined (nocachegetattr is defined in
src/backend/access/common/heaptuple.c).

The first patch below removes this macro from
src/templates/solaris_sparc_cc.

2. Solaris CC does not like "-K PIC". It does like "-KPIC" though.

3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.

4. I moved some of the information out of
src/interfaces/libpq++/Makefile.in into src/Makefile.shlib where it
belongs. Assuming that CXXFLAGS should take on the shared library
flags for CFLAGS_SL is wrong though.

5. added '-' before pl/tcl/Makefile so make does not complain if it
cannot find pl/tcl/Makefile.tcldefs (which will be automatically
generated).

6. When building C++ shared libraries and archives under Solaris with
the Sun C/C++ compiler, use it to build the libraries and archives,
not ld/ar.

7. Honor CXXFLAGS from configure command-line.

8. In configure:
a) It is evil to use a library if it exists:
(AC_CHECK_LIB(util,main))
It is far better to check for a function in the library. Better
yet, make sure that function does not exist in libc or $LIBS
before checking in external libraries. I have fixed this for
some libraries but don't know what to check for in others
(like ipc, IPC, lc, ld, compat, BSD).
b) Added --with-readline=DIR to check for readline in DIR.

--
albert chin (china(at)thewrittenword(dot)com)

-- snip snip
--- src/template/solaris_sparc_cc.orig Tue Jun 20 19:22:44 2000
+++ src/template/solaris_sparc_cc Tue Jun 27 22:15:44 2000
@@ -1,6 +1,6 @@
AROPT:crs
-CFLAGS:-Xa -v -D__sparc__ -D__sun__ -DDISABLE_COMPLEX_MACRO
-SHARED_LIB:-K PIC
+CFLAGS:-Xa -v -D__sparc__ -D__sun__
+SHARED_LIB:-KPIC
ALL:
SRCH_INC:
SRCH_LIB:
--- src/template/solaris_i386_cc.orig Tue Jun 27 21:36:15 2000
+++ src/template/solaris_i386_cc Tue Jun 27 21:36:19 2000
@@ -1,6 +1,6 @@
AROPT:cq
CFLAGS:
-SHARED_LIB:-K PIC
+SHARED_LIB:-KPIC
ALL:
SRCH_INC:
SRCH_LIB:
--- src/include/port/solaris_i386.h.orig Tue Jun 27 11:53:06 2000
+++ src/include/port/solaris_i386.h Tue Jun 27 11:53:20 2000
@@ -31,8 +31,6 @@
double __d; }) \
{ __nan_bytes }).__d)

-#else /* Not GCC. */
-#define NAN (*(__const double *) __nan)
#endif /* GCC. */
#endif /* NAN */

--- src/interfaces/libpq++/Makefile.in.orig Tue Jun 20 17:55:36 2000
+++ src/interfaces/libpq++/Makefile.in Tue Jun 27 21:27:23 2000
@@ -39,22 +39,11 @@
SHLIB_LINK= $(LIBPQ)
endif

-# For CC on IRIX, must use CC as linker/archiver of C++ libraries
-ifeq ($(PORTNAME), irix5)
- ifeq ($(CXX), CC)
- AR = CC
- AROPT = -ar -o
- LD = CC
- endif
-endif
-
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib

-
-# Pull shared-lib CFLAGS into CXXFLAGS
+# Pull shared-lib CFLAGS into CXXFLAGS
CXXFLAGS+= $(CFLAGS_SL)
-

.PHONY: examples
examples:
--- src/pl/tcl/Makefile.orig Tue Jun 27 12:53:04 2000
+++ src/pl/tcl/Makefile Tue Jun 27 13:01:55 2000
@@ -19,7 +19,7 @@
# NOTE: GNU make will make this file automatically if it doesn't exist,
# using the make rule that appears below. Cute, eh?
#
-include Makefile.tcldefs
+-include Makefile.tcldefs

#
# Find out whether Tcl was built as a shared library --- if not,
--- src/Makefile.shlib.orig Tue Jun 27 12:22:09 2000
+++ src/Makefile.shlib Tue Jun 27 17:09:30 2000
@@ -130,16 +130,23 @@
ifeq ($(PORTNAME), hpux)
install-shlib-dep := install-shlib
# HPUX doesn't believe in version numbers for shlibs
- shlib := lib$(NAME)$(DLSUFFIX)
+ shlib := lib$(NAME)$(DLSUFFIX)
LDFLAGS_SL := -b
- CFLAGS += $(CFLAGS_SL)
+ CFLAGS += $(CFLAGS_SL)
endif

ifeq ($(PORTNAME), irix5)
- install-shlib-dep := install-shlib
- shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
- LDFLAGS_SL := -shared -rpath $(LIBDIR) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
- CFLAGS += $(CFLAGS_SL)
+ install-shlib-dep := install-shlib
+ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ LDFLAGS_SL := -shared -rpath $(LIBDIR) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+ CFLAGS += $(CFLAGS_SL)
+
+ # if archiving or linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR = CC
+ AROPT = -ar -o
+ LD = CC
+ endif
endif

ifeq ($(PORTNAME), linux)
@@ -156,7 +163,14 @@
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc
- CFLAGS += $(CFLAGS_SL)
+ CFLAGS += $(CFLAGS_SL)
+
+ # if archiving or linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR := CC
+ AROPT := -xar -o
+ LD := CC
+ endif
endif

ifeq ($(PORTNAME), solaris_sparc)
@@ -164,7 +178,14 @@
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc
- CFLAGS += $(CFLAGS_SL)
+ CFLAGS += $(CFLAGS_SL)
+
+ # if linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR := CC
+ AROPT := -xar -o
+ LD := CC
+ endif
endif

ifeq ($(PORTNAME), alpha)
--- src/Makefile.global.in.orig Tue Jun 20 17:53:01 2000
+++ src/Makefile.global.in Tue Jun 20 17:53:14 2000
@@ -209,6 +209,7 @@
LEX= @LEX@
AROPT= @AROPT@
CFLAGS= -I$(SRCDIR)/include -I$(SRCDIR)/backend @CPPFLAGS@ @CFLAGS@
+CXXFLAGS= @CXXFLAGS@
CFLAGS_SL= @SHARED_LIB@
PGSQL_INCLUDES= @PGSQL_INCLUDES@
LIBS= @LIBS@
--- src/configure.in.orig Tue Jun 20 17:42:51 2000
+++ src/configure.in Tue Jun 27 16:00:11 2000
@@ -675,24 +675,46 @@
AC_SUBST(YFLAGS)

AC_CHECK_LIB(sfio, main)
-for curses in ncurses curses ; do
- AC_CHECK_LIB(${curses}, main,
- [LIBS="-l${curses} $LIBS"; break])
+
+for termlib in ncurses curses termcap terminfo termlib; do
+ AC_CHECK_LIB(${termlib}, tputs, [LIBS="-l${termlib} $LIBS"; break])
done
-AC_CHECK_LIB(termcap, main)
-AC_CHECK_LIB(readline, main)
-AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
- AC_CHECK_LIB(history, main) )
+AC_ARG_WITH(readline,
+[ --with-readline=DIR search DIR for readline includes and libraries],[
+ case "$with_readline" in
+ no) ;;
+ *)
+ if test "$with_readline" != "yes"; then
+ _cppflags=${CPPFLAGS}
+ _ldflags=${LDFLAGS}
+ CPPFLAGS="${CPPFLAGS} -I$with_readline/include"
+ LDFLAGS="${LDFLAGS} -L$with_readline/lib"
+ fi
+
+ AC_CHECK_HEADERS(readline.h readline/history.h readline/readline.h,
+ AC_CHECK_LIB(readline, readline)
+ AC_CHECK_LIB(readline, using_history,
+ AC_DEFINE(HAVE_HISTORY_IN_READLINE),
+ AC_CHECK_LIB(history, add_history)))
+
+ if test -z "$ac_cv_header_readline_h" -a \
+ -z "$ac_cv_header_readline_readline_h"; then
+ if test -n "${_cppflags}"; then
+ CPPFLAGS="${_cppflags}" LDFLAGS="${_ldflags}"
+ fi
+ fi
+ ;;
+ esac])

if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
then
AC_CHECK_LIB(bsd, main)
fi
AC_CHECK_LIB(util, main)
-AC_CHECK_LIB(m, main)
-AC_CHECK_LIB(dl, main)
-AC_CHECK_LIB(socket, main)
-AC_CHECK_LIB(nsl, main)
+AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow))
+AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
+AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
+AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_LIB(ipc, main)
AC_CHECK_LIB(IPC, main)
AC_CHECK_LIB(lc, main)
@@ -701,7 +723,7 @@
AC_CHECK_LIB(ld, main)
AC_CHECK_LIB(compat, main)
AC_CHECK_LIB(BSD, main)
-AC_CHECK_LIB(crypt, main)
+AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt))
AC_CHECK_LIB(gen, main)
AC_CHECK_LIB(PW, main)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikheev, Vadim 2000-06-27 17:54:55 RE: Big 7.1 open items
Previous Message Philip Warner 2000-06-27 17:40:25 Re: AW: Proposal: More flexible backup/restore via pg_dump