Changes needed to build on NetBSD

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: pgsql-patches(at)PostgreSQL(dot)org
Subject: Changes needed to build on NetBSD
Date: 2001-05-09 09:50:16
Message-ID: 20010509095016.6AD771A80@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

These patches were passed to me by Johnny C. Lam <lamj(at)stat(dot)cmu(dot)edu>. Note
that PostgreSQL builds fine without these changes on NetBSD. These changes
are there to make building in the packages system easier.

Thanks.

###########################################################################
##
## This patch adds two flags to the configure script:
##
## --disable-readline disables readline support
## --with-python-compile byte-compile Python modules
##
## The former is useful if you wish to only compile the libraries, but don't
## want the libpq shared libraries to be linked against readline. The latter
## optionally allows byte-compiling the Python modules as an optimization.
##
--- configure.in.orig Fri Apr 13 17:22:46 2001
+++ configure.in
@@ -150,6 +150,15 @@


#
+# Readline support
+#
+AC_MSG_CHECKING([whether to build with readline support])
+PGAC_ARG_BOOL(enable, readline, yes,
+ [ --disable-readline disable readline support])
+AC_MSG_RESULT([$enable_readline])
+
+
+#
# Locale (--enable-locale)
#
AC_MSG_CHECKING([whether to build with locale support])
@@ -401,6 +410,17 @@
[AC_MSG_RESULT(no)])
AC_SUBST(with_python)

+# If python is enabled (above), then optionally byte-compile the modules.
+AC_MSG_CHECKING([whether to byte-compile Python modules])
+if test "$with_python" = yes; then
+ PGAC_ARG_BOOL(with, python_compile, no, [ --with-python-compile byte-compile modules if Python is enabled])
+else
+ with_python_compile=no
+fi
+AC_MSG_RESULT([$with_python_compile])
+AC_SUBST([with_python_compile])
+
+
#
# Optionally build the Java/JDBC tools
#
@@ -650,8 +670,10 @@
##

AC_CHECK_LIB(sfio, main)
+if test "$enable_readline" = yes; then
PGAC_CHECK_READLINE
AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)])
+fi

if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
then
@@ -720,8 +742,10 @@

PGAC_HEADER_STRING

-AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
-AC_CHECK_HEADERS([readline/history.h history.h], [break])
+if test "$enable_readline" = yes; then
+ AC_CHECK_HEADERS([readline/readline.h readline.h], [break], [AC_MSG_ERROR([missing header files for readline support])])
+ AC_CHECK_HEADERS([readline/history.h history.h], [break], [AC_MSG_ERROR([missing header files for readline support])])
+fi

if test "$with_krb4" = yes ; then
AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
@@ -876,6 +900,7 @@
AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))


+if test "$enable_readline" = yes; then
# Readline versions < 2.1 don't have rl_completion_append_character
AC_MSG_CHECKING([for rl_completion_append_character])
AC_TRY_LINK([#include <stdio.h>
@@ -907,6 +932,7 @@
[AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
+fi



###########################################################################
##
## Add found_man code analogous to the found_html code already in the
## Makefile.
##
--- doc/Makefile.orig Sat Jan 6 21:03:22 2001
+++ doc/Makefile
@@ -45,12 +45,17 @@


installdirs:
- $(mkinstalldirs) $(DESTDIR)$(mandir) $(DESTDIR)$(docdir)/html
+ifdef found_html
+ $(mkinstalldirs) $(DESTDIR)$(docdir)
+endif
+ifdef found_man
+ $(mkinstalldirs) $(DESTDIR)$(mandir)
+endif


uninstall:
ifdef found_html
-rm -f $(addprefix $(DESTDIR)$(docdir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
endif
ifdef found_man
-rm -f $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | tar tf -))
###########################################################################
##
## Add with_python_compile variable to hold value from configure script,
## and move the libpgtcl_* dir settings from $(libpgtcl_srcdir)/Makefile
## to here to allow overriding their values in Makefile.custom.
##
--- src/Makefile.global.in.orig Fri Mar 16 16:50:39 2001
+++ src/Makefile.global.in
@@ -110,6 +110,7 @@
with_java = @with_java@
with_perl = @with_perl@
with_python = @with_python@
+with_python_compile = @with_python_compile@
with_tcl = @with_tcl@
with_tk = @with_tk@
enable_odbc = @enable_odbc@
@@ -242,6 +243,10 @@
libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
libpq_builddir = $(top_builddir)/src/interfaces/libpq
libpq = -L$(libpq_builddir) -lpq
+
+libpgtcl_srcdir = $(top_srcdir)/src/interfaces/libpgtcl
+libpgtcl_builddir = $(top_builddir)/src/interfaces/libpgtcl
+libpgtcl = -L$(libpgtcl_builddir) -lpgtcl


##########################################################################
###########################################################################
##
## Only generate the additional shared library links on ELF systems.
##
--- src/Makefile.shlib.orig Sun Apr 1 15:17:30 2001
+++ src/Makefile.shlib
@@ -275,10 +275,12 @@
# Normal case
$(shlib): $(OBJS)
$(LINK.shared) $(OBJS) $(SHLIB_LINK) -o $@
+ifdef ELF_SYSTEM
# If we're using major and minor versions, then make a symlink to major-version-only.
ifneq ($(shlib), lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION))
rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+endif
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), lib$(NAME)$(DLSUFFIX))
###########################################################################
##
## Modifications with no functional changes. This just allows separate
## building of the pgtksh binary after installing the libpgtcl library.
## A new target "install-tk" is created for this purpose.
##
--- src/bin/pgtclsh/Makefile.orig Fri Feb 23 13:12:17 2001
+++ src/bin/pgtclsh/Makefile
@@ -22,19 +22,17 @@
-include Makefile.tkdefs
endif

-libpgtcl_srcdir = $(top_srcdir)/src/interfaces/libpgtcl
-libpgtcl_builddir = $(top_builddir)/src/interfaces/libpgtcl
-libpgtcl = -L$(libpgtcl_builddir) -lpgtcl
-
override CPPFLAGS := -I$(libpgtcl_srcdir) $(CPPFLAGS) $(TK_XINCLUDES)


# If we are here then Tcl is available
PROGRAMS = pgtclsh
+INSTALL_TARGET = install-tcl

# Add Tk targets if Tk is available
ifeq ($(with_tk), yes)
PROGRAMS += pgtksh
+INSTALL_TARGET += install-tk
endif

all: submake $(PROGRAMS)
@@ -49,8 +47,12 @@
submake:
$(MAKE) -C $(libpgtcl_builddir) all

-install: all installdirs
+install: $(INSTALL_TARGET)
+
+install-tcl: installdirs pgtclsh
$(INSTALL_PROGRAM) pgtclsh $(DESTDIR)$(bindir)/pgtclsh
+
+install-tk: installdirs pgtksh
ifeq ($(with_tk), yes)
$(INSTALL_PROGRAM) pgtksh $(DESTDIR)$(bindir)/pgtksh
endif
###########################################################################
##
## Code to optionally byte-compile the Python modules and install them
## depending on --with-python-compile setting.
##
--- src/interfaces/python/GNUmakefile.orig Sun Apr 1 15:17:33 2001
+++ src/interfaces/python/GNUmakefile
@@ -12,9 +12,22 @@
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global

-all: Makefile pgmodule.c libpq-all
+PY_SCRIPTS = pg.py pgdb.py
+ifeq ($(with_python_compile), yes)
+PY_COMPILED_SCRIPTS = $(PY_SCRIPTS:%.py=%.pyc) $(PY_SCRIPTS:%.py=%.pyo)
+else
+PY_COMPILED_SCRIPTS =
+endif
+
+all: Makefile pgmodule.c libpq-all $(PY_COMPILED_SCRIPTS)
$(MAKE) -f Makefile

+%.pyc: %.py
+ $(PYTHON) -c "import py_compile; py_compile.compile(\"$<\")"
+
+%.pyo: %.py
+ $(PYTHON) -O -c "import py_compile; py_compile.compile(\"$<\")"
+
.PHONY: libpq-all
libpq-all:
$(MAKE) -C $(libpq_builddir) all
@@ -34,7 +47,9 @@

install: all
@echo "Installing Python module"
- @if ( $(INSTALL_DATA) pg.py $(python_moduledir) && \
+ @if ( ( for i in $(PY_SCRIPTS) $(PY_COMPILED_SCRIPTS); do \
+ $(INSTALL_DATA) $$i $(python_moduledir); \
+ done ) && \
$(MAKE) -f Makefile install ); then : ; else \
echo "*****" ;\
echo "* Skipping the installation of the Python interface module for lack"; \
###########################################################################
##
## Add -lc, needed if a shared object is linked with -Bsymbolic on ELF
## to resolve the C library functions.
##
--- src/makefiles/Makefile.netbsd.orig Sat Jan 6 21:03:41 2001
+++ src/makefiles/Makefile.netbsd
@@ -3,7 +3,9 @@
ifdef ELF_SYSTEM
export_dynamic = -Wl,-E
rpath = -Wl,-R$(libdir)
-shlib_symbolic = -Wl,-Bsymbolic
+shlib_symbolic = -Wl,-Bsymbolic -lc
+else
+rpath = -R$(libdir)
endif

DLSUFFIX = .so

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-05-09 16:57:50 Re: \du in psql patchp
Previous Message Bruce Momjian 2001-05-08 21:02:38 Re: ANALYZE command [REPOST]