From 36c1c94bca30a730bec1bb9f5163ccfbb7565fed Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Sat, 17 Jan 1998 23:33:58 +0000 Subject: [PATCH] From: "Billy G. Allie" The attached patches will allow postgreSQL to compile successfully on SCO UNIXWARE 2.1.x. The patches fix the following problems: 1. Configure did not properly recognize the UNIXWARE system as needing the univel port. It used the sys4 port. 2. Configure did not properly process the CC flag in the template file. 3. There was no working test and set locking implementation for the native UNIXWARE compiler. 4. The test and set locking used for Intel X86 that was selected by defining NEED_I386_TAS_ASM could fail in a multi-processor environment. 5. The makefiles for libpq and libpgtcl did not make a shared library for the univel port. --- src/backend/port/univel/port-protos.h | 2 +- src/configure | 23 ++++++++++++----------- src/configure.in | 23 ++++++++++++----------- src/include/port/univel.h | 13 +++++-------- src/include/storage/s_lock.h | 21 +++++++++++++++++++-- src/interfaces/libpgtcl/Makefile.in | 11 +++++++++-- src/interfaces/libpq/Makefile.in | 8 +++++++- src/makefiles/Makefile.univel | 7 +------ src/template/univel | 8 ++++---- 9 files changed, 70 insertions(+), 46 deletions(-) diff --git a/src/backend/port/univel/port-protos.h b/src/backend/port/univel/port-protos.h index 97d23fe6ac..9cafdd84e1 100644 --- a/src/backend/port/univel/port-protos.h +++ b/src/backend/port/univel/port-protos.h @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------- * * port-protos.h-- - * port-specific prototypes for Intel x86/Intel SVR4 + * port-specific prototypes for Intel x86/UNIXWARE * * * Copyright (c) 1994, Regents of the University of California diff --git a/src/configure b/src/configure index fbf182efd7..f00af00788 100755 --- a/src/configure +++ b/src/configure @@ -589,13 +589,13 @@ nextstep*) os=nextstep;; hpux*) os=hpux;; osf*) os=alpha;; sco*) os=sco;; - sysv4*) os=svr4;; machten*) os=machten;; sysv4.2*) case "$host_vendor" in univel) os=univel;; *) os=unknown;; esac ;; + sysv4*) os=svr4;; *) echo "" echo "*************************************************************" echo "configure does not currently recognize your operating system," @@ -682,16 +682,17 @@ fi export TEMPLATE echo "" -AROPT=`grep AROPT $TEMPLATE | awk -F: '{print $2}'` -SHARED_LIB=`grep SHARED_LIB $TEMPLATE | awk -F: '{print $2}'` -CFLAGS=`grep CFLAGS $TEMPLATE | awk -F: '{print $2}'` -SRCH_INC=`grep SRCH_INC $TEMPLATE | awk -F: '{print $2}'` -SRCH_LIB=`grep SRCH_LIB $TEMPLATE | awk -F: '{print $2}'` -USE_LOCALE=`grep USE_LOCALE $TEMPLATE | awk -F: '{print $2}'` -DLSUFFIX=`grep DLSUFFIX $TEMPLATE | awk -F: '{print $2}'` -DL_LIB=`grep DL_LIB $TEMPLATE | awk -F: '{print $2}'` -YACC=`grep YACC $TEMPLATE | awk -F: '{print $2}'` -YFLAGS=`grep YFLAGS $TEMPLATE | awk -F: '{print $2}'` +AROPT=`grep '^AROPT:' $TEMPLATE | awk -F: '{print $2}'` +SHARED_LIB=`grep '^SHARED_LIB:' $TEMPLATE | awk -F: '{print $2}'` +CFLAGS=`grep '^CFLAGS:' $TEMPLATE | awk -F: '{print $2}'` +SRCH_INC=`grep '^SRCH_INC:' $TEMPLATE | awk -F: '{print $2}'` +SRCH_LIB=`grep '^SRCH_LIB:' $TEMPLATE | awk -F: '{print $2}'` +USE_LOCALE=`grep '^USE_LOCALE:' $TEMPLATE | awk -F: '{print $2}'` +DLSUFFIX=`grep '^DLSUFFIX:' $TEMPLATE | awk -F: '{print $2}'` +DL_LIB=`grep '^DL_LIB:' $TEMPLATE | awk -F: '{print $2}'` +YACC=`grep '^YACC:' $TEMPLATE | awk -F: '{print $2}'` +YFLAGS=`grep '^YFLAGS:' $TEMPLATE | awk -F: '{print $2}'` +CC=`grep '^CC:' $TEMPLATE | awk -F: '{print $2}'` echo "**************************************************************" diff --git a/src/configure.in b/src/configure.in index bf89b8d951..f62b698267 100644 --- a/src/configure.in +++ b/src/configure.in @@ -25,13 +25,13 @@ nextstep*) os=nextstep;; hpux*) os=hpux;; osf*) os=alpha;; sco*) os=sco;; - sysv4*) os=svr4;; machten*) os=machten;; sysv4.2*) case "$host_vendor" in univel) os=univel;; *) os=unknown;; esac ;; + sysv4*) os=svr4;; *) echo "" echo "*************************************************************" echo "configure does not currently recognize your operating system," @@ -120,16 +120,17 @@ fi export TEMPLATE echo "" -AROPT=`grep AROPT $TEMPLATE | awk -F: '{print $2}'` -SHARED_LIB=`grep SHARED_LIB $TEMPLATE | awk -F: '{print $2}'` -CFLAGS=`grep CFLAGS $TEMPLATE | awk -F: '{print $2}'` -SRCH_INC=`grep SRCH_INC $TEMPLATE | awk -F: '{print $2}'` -SRCH_LIB=`grep SRCH_LIB $TEMPLATE | awk -F: '{print $2}'` -USE_LOCALE=`grep USE_LOCALE $TEMPLATE | awk -F: '{print $2}'` -DLSUFFIX=`grep DLSUFFIX $TEMPLATE | awk -F: '{print $2}'` -DL_LIB=`grep DL_LIB $TEMPLATE | awk -F: '{print $2}'` -YACC=`grep YACC $TEMPLATE | awk -F: '{print $2}'` -YFLAGS=`grep YFLAGS $TEMPLATE | awk -F: '{print $2}'` +AROPT=`grep '^AROPT:' $TEMPLATE | awk -F: '{print $2}'` +SHARED_LIB=`grep '^SHARED_LIB:' $TEMPLATE | awk -F: '{print $2}'` +CFLAGS=`grep '^CFLAGS:' $TEMPLATE | awk -F: '{print $2}'` +SRCH_INC=`grep '^SRCH_INC:' $TEMPLATE | awk -F: '{print $2}'` +SRCH_LIB=`grep '^SRCH_LIB:' $TEMPLATE | awk -F: '{print $2}'` +USE_LOCALE=`grep '^USE_LOCALE:' $TEMPLATE | awk -F: '{print $2}'` +DLSUFFIX=`grep '^DLSUFFIX:' $TEMPLATE | awk -F: '{print $2}'` +DL_LIB=`grep '^DL_LIB:' $TEMPLATE | awk -F: '{print $2}'` +YACC=`grep '^YACC:' $TEMPLATE | awk -F: '{print $2}'` +YFLAGS=`grep '^YFLAGS:' $TEMPLATE | awk -F: '{print $2}'` +CC=`grep '^CC:' $TEMPLATE | awk -F: '{print $2}'` dnl We now need to check for additional directories (include diff --git a/src/include/port/univel.h b/src/include/port/univel.h index 4acd2b1a75..3be6179f76 100644 --- a/src/include/port/univel.h +++ b/src/include/port/univel.h @@ -3,17 +3,14 @@ #define USE_POSIX_SIGNALS #define SYSV_DIRENT -#if 0 #define HAS_TEST_AND_SET +#define NEED_I386_TAS_ASM +#define USE_UNIVEL_CC_ASM /***************************************\ + | Define this if you are compiling with | + | the native UNIXWARE C compiler. | + \***************************************/ typedef unsigned char slock_t; -#endif - -extern long random(void); -extern void srandom(int seed); -extern int strcasecmp(char *s1, char *s2); -extern int gethostname(char *name, int namelen); - #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 #endif diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index e3efbc2295..6ad51713a3 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.16 1998/01/13 19:28:39 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.17 1998/01/17 23:33:14 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -294,14 +294,31 @@ tas_dummy() #if defined(NEED_I386_TAS_ASM) +#if defined(USE_UNIVEL_CC_ASM) +asm void S_LOCK(char *lval) +{ +% lab again; +/* Upon entry, %eax will contain the pointer to the lock byte */ + pushl %ebx + xchgl %eax,%ebx + movb $-1,%al +again: + lock + xchgb %al,(%ebx) + cmpb $0,%al + jne again + popl %ebx +} +#else #define S_LOCK(lock) do \ { \ slock_t _res; \ do \ { \ - __asm__("xchgb %0,%1": "=q"(_res), "=m"(*lock):"0"(0x1)); \ + __asm__("lock xchgb %0,%1": "=q"(_res), "=m"(*lock):"0"(0x1)); \ } while (_res != 0); \ } while (0) +#endif #define S_UNLOCK(lock) (*(lock) = 0) diff --git a/src/interfaces/libpgtcl/Makefile.in b/src/interfaces/libpgtcl/Makefile.in index 3b0141def0..0552736518 100644 --- a/src/interfaces/libpgtcl/Makefile.in +++ b/src/interfaces/libpgtcl/Makefile.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.1 1998/01/13 04:18:04 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.2 1998/01/17 23:33:32 scrappy Exp $ # #------------------------------------------------------------------------- @@ -51,7 +51,14 @@ endif ifeq ($(PORTNAME), i386_solaris) install-shlib-dep := install-shlib shlib := libpgtcl.so.1 - LDFLAGS_SL = -G -z text + LDFLAGS_SL = -G -z text -L $(SRCDIR)/interfaces/libpq -lpq + CFLAGS += $(CFLAGS_SL) +endif + +ifeq ($(PORTNAME), univel) + install-shlib-dep := install-shlib + shlib := libpgtcl.so.1 + LDFLAGS_SL = -G -z text -L $(SRCDIR)/interfaces/libpq -lpq CFLAGS += $(CFLAGS_SL) endif diff --git a/src/interfaces/libpq/Makefile.in b/src/interfaces/libpq/Makefile.in index 2cddba4eeb..44eb0bf6ae 100644 --- a/src/interfaces/libpq/Makefile.in +++ b/src/interfaces/libpq/Makefile.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.2 1998/01/13 04:20:51 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.3 1998/01/17 23:33:39 scrappy Exp $ # #------------------------------------------------------------------------- @@ -51,6 +51,12 @@ ifeq ($(PORTNAME), i386_solaris) LDFLAGS_SL = -G -z text CFLAGS += $(CFLAGS_SL) endif +ifeq ($(PORTNAME), univel) + install-shlib-dep := install-shlib + shlib := libpq.so.1 + LDFLAGS_SL = -G -z text + CFLAGS += $(CFLAGS_SL) +endif all: libpq.a $(shlib) c.h diff --git a/src/makefiles/Makefile.univel b/src/makefiles/Makefile.univel index 3bfc5c0799..4048f3977b 100644 --- a/src/makefiles/Makefile.univel +++ b/src/makefiles/Makefile.univel @@ -1,9 +1,4 @@ -# -# The univel port is almost guaranteed NOT to work yet. -# -# MAKE_EXPORTS is required for svr4 loaders that want a file of -# symbol names to tell them what to export/import. -#MAKE_EXPORTS= true +LDFLAGS+= -lc89 -Wl,-Bexport %.so: %.o $(LD) -G -Bdynamic -o $@ $< diff --git a/src/template/univel b/src/template/univel index a8a5286099..23770576e2 100644 --- a/src/template/univel +++ b/src/template/univel @@ -1,10 +1,10 @@ AROPT:crs -CFLAGS:-I$(SRCDIR)/backend/port/univel -SHARED_LIB:-fPIC -ALL:-DHAVE_RUSAGE -m486 -Dsvr4 +CFLAGS:-I$(SRCDIR)/backend/port/univel -Xa -v -DHAVE_RUSAGE -O -K i486,host,inline,loop_unroll -Dsvr4 +SHARED_LIB:-K PIC SRCH_INC: SRCH_LIB: USE_LOCALE:no DLSUFFIX:.so YFLAGS:-d -YACC:bison -y +YACC:yacc +CC:cc -- GitLab