Skip to content

Commit df247b8

Browse files
committed
Massive commits for SunOS4 port.
1 parent 919ace0 commit df247b8

File tree

15 files changed

+339
-148
lines changed

15 files changed

+339
-148
lines changed

configure

Lines changed: 252 additions & 126 deletions
Large diffs are not rendered by default.

configure.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,9 @@ AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask s
777777
dnl Check whether <unistd.h> declares fdatasync().
778778
AC_EGREP_HEADER(fdatasync, unistd.h, AC_DEFINE(HAVE_FDATASYNC_DECL))
779779

780+
dnl Check whether <unistd.h> declares optarg
781+
AC_EGREP_HEADER(optarg, unistd.h, AC_DEFINE(HAVE_OPTARG_DECL))
782+
780783
AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
781784
[AC_TRY_LINK(
782785
[#include <machine/vmparam.h>
@@ -1073,6 +1076,12 @@ AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
10731076
AC_CHECK_FUNCS([strtoll strtoq], [break])
10741077
AC_CHECK_FUNCS([strtoull strtouq], [break])
10751078

1079+
dnl psql needs atexit() or on_exit()
1080+
AC_CHECK_FUNC(atexit,
1081+
[AC_DEFINE(HAVE_ATEXIT)],
1082+
[AC_CHECK_FUNCS(on_exit,
1083+
[AC_DEFINE(HAVE_ON_EXIT)],
1084+
[AC_MSG_ERROR([atexi() nor on_exit() found])])])
10761085

10771086
dnl Need a #define for the size of Datum (unsigned long)
10781087

src/Makefile.global.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.119 2001/02/20 19:20:28 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.120 2001/02/27 08:13:29 ishii Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -288,6 +288,7 @@ INET_ATON = @INET_ATON@
288288
STRERROR = @STRERROR@
289289
SNPRINTF = @SNPRINTF@
290290
STRDUP = @STRDUP@
291+
STRTOUL = @STRTOUL@
291292

292293

293294
##########################################################################

src/Makefile.shlib

Lines changed: 6 additions & 1 deletion
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-
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.45 2001/02/20 19:20:28 petere Exp $
9+
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.46 2001/02/27 08:13:29 ishii Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -184,6 +184,11 @@ ifeq ($(PORTNAME), solaris)
184184
SHLIB_LINK += -lm -lc
185185
endif
186186

187+
ifeq ($(PORTNAME), sunos4)
188+
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
189+
LINK.shared = $(LD) -assert pure-text -Bdynamic
190+
endif
191+
187192
ifeq ($(PORTNAME), osf)
188193
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
189194
LINK.shared = $(LD) -shared -expect_unresolved '*'

src/backend/utils/adt/formatting.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.32 2001/02/12 12:52:02 momjian Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.33 2001/02/27 08:13:28 ishii Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
@@ -1398,7 +1398,7 @@ int4len(int4 num)
13981398
{
13991399
char b[16];
14001400

1401-
return sprintf(b, "%d", num);
1401+
return snprintf(b, sizeof(b), "%d", num);
14021402
}
14031403

14041404
/* ----------
@@ -3211,7 +3211,7 @@ int_to_roman(int number)
32113211
fill_str(result, '#', 15);
32123212
return result;
32133213
}
3214-
len = sprintf(numstr, "%d", number);
3214+
len = snprintf(numstr, sizeof(numstr), "%d", number);
32153215

32163216
for (p = numstr; *p != '\0'; p++, --len)
32173217
{
@@ -4013,7 +4013,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
40134013
Np->inout_p += strlen(Np->inout_p) - 1;
40144014
}
40154015
else
4016-
Np->inout_p += sprintf(Np->inout_p, "%15s", Np->number_p) - 1;
4016+
Np->inout_p += snprintf(Np->inout_p, plen - (Np->inout_p - Np->inout), "%15s", Np->number_p) - 1;
40174017
break;
40184018

40194019
case NUM_rn:
@@ -4023,7 +4023,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
40234023
Np->inout_p += strlen(Np->inout_p) - 1;
40244024
}
40254025
else
4026-
Np->inout_p += sprintf(Np->inout_p, "%15s", str_tolower(Np->number_p)) - 1;
4026+
Np->inout_p += snprintf(Np->inout_p, plen - (Np->inout_p - Np->inout), "%15s", str_tolower(Np->number_p)) - 1;
40274027
break;
40284028

40294029
case NUM_th:

src/bin/pg_dump/Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.29 2001/02/20 19:20:28 petere Exp $
8+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.30 2001/02/27 08:13:28 ishii Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -14,7 +14,21 @@ top_builddir = ../../..
1414
include $(top_builddir)/src/Makefile.global
1515

1616
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o pg_backup_files.o \
17-
pg_backup_null.o pg_backup_tar.o $(STRDUP)
17+
pg_backup_null.o pg_backup_tar.o
18+
19+
ifdef STRDUP
20+
OBJS+=$(top_builddir)/src/utils/strdup.o
21+
22+
$(top_builddir)/src/utils/strdup.o:
23+
$(MAKE) -C $(top_builddir)/src/utils strdup.o
24+
endif
25+
26+
ifdef STRTOUL
27+
OBJS+=$(top_builddir)/src/backend/port/strtoul.o
28+
29+
$(top_builddir)/src/backend/port/strtoul.o:
30+
$(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
31+
endif
1832

1933
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
2034

@@ -26,9 +40,6 @@ pg_dump: pg_dump.o common.o $(OBJS) $(libpq_builddir)/libpq.a
2640
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
2741
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@
2842

29-
../../utils/strdup.o:
30-
$(MAKE) -C ../../utils strdup.o
31-
3243
pg_dumpall: pg_dumpall.sh
3344
sed -e 's,@VERSION@,$(VERSION),g' \
3445
-e 's,@MULTIBYTE@,$(MULTIBYTE),g' \

src/bin/pg_dump/pg_restore.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@
6868
#ifdef HAVE_GETOPT_H
6969
#include <getopt.h>
7070
#else
71+
#ifdef HAVE_OPTARG_DECL
7172
#include <unistd.h>
72-
#endif
73+
#else
74+
extern char *optarg;
75+
extern int optind, opterr, optopt;
76+
#endif /* HAVE_OPTARG_DECL */
77+
#endif /* HAVE_GETOPT_H */
7378

7479
/* Forward decls */
7580
static void usage(const char *progname);

src/bin/pg_id/pg_id.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,21 @@
66
*
77
* Copyright (C) 2000 by PostgreSQL Global Development Group
88
*
9-
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.17 2001/02/10 02:31:27 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.18 2001/02/27 08:13:28 ishii Exp $
1010
*/
1111
#include "postgres_fe.h"
1212

1313
#ifdef HAVE_GETOPT_H
1414
#include <getopt.h>
15-
#endif
15+
#else
16+
#ifdef HAVE_OPTARG_DECL
17+
#include <unistd.h>
18+
#else
19+
extern char *optarg;
20+
extern int optind, opterr, optopt;
21+
#endif /* HAVE_OPTARG_DECL */
22+
#endif /* HAVE_GETOPT_H */
23+
1624
#include <pwd.h>
1725
#include <stdio.h>
1826
#include <stdlib.h>

src/bin/psql/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.29 2001/02/20 19:20:29 petere Exp $
8+
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.30 2001/02/27 08:13:27 ishii Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -46,6 +46,13 @@ $(top_builddir)/src/backend/port/snprintf.o:
4646
$(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
4747
endif
4848

49+
ifdef STRTOUL
50+
OBJS+=$(top_builddir)/src/backend/port/strtoul.o
51+
52+
$(top_builddir)/src/backend/port/strtoul.o:
53+
$(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
54+
endif
55+
4956
# End of hacks for picking up backend 'port' modules
5057

5158
psql: $(OBJS) $(libpq_builddir)/libpq.a

src/bin/psql/input.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/input.c,v 1.15 2001/02/10 02:31:28 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/input.c,v 1.16 2001/02/27 08:13:27 ishii Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "input.h"
@@ -151,7 +151,11 @@ initializeInput(int flags)
151151
}
152152
#endif
153153

154+
#ifdef HAVE_ATEXIT
154155
atexit(finishInput);
156+
#else
157+
on_exit(finishInput);
158+
#endif
155159
}
156160

157161

src/bin/psql/print.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.15 2001/02/10 02:31:28 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.16 2001/02/27 08:13:27 ishii Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "print.h"
@@ -21,6 +21,8 @@
2121
#include "pqsignal.h"
2222
#include "libpq-fe.h"
2323

24+
#include "settings.h"
25+
2426
#ifndef __CYGWIN__
2527
#define DEFAULT_PAGER "more"
2628
#else

src/bin/psql/stringutils.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.27 2001/02/10 02:31:28 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.28 2001/02/27 08:13:27 ishii Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "stringutils.h"
10+
#include "settings.h"
1011

1112
#include <ctype.h>
1213
#include <assert.h>

src/include/config.h.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.158 2001/02/18 04:39:42 tgl Exp $
11+
* $Id: config.h.in,v 1.159 2001/02/27 08:13:27 ishii Exp $
1212
*/
1313

1414
#ifndef CONFIG_H
@@ -579,6 +579,9 @@ extern int fdatasync(int fildes);
579579
/* Set to 1 if you have getopt_long() (GNU long options) */
580580
#undef HAVE_GETOPT_LONG
581581

582+
/* Set to 1 if optarg is declared in unistd.h */
583+
#undef HAVE_OPTARG_DECL
584+
582585
/* Set to 1 if you have union semun */
583586
#undef HAVE_UNION_SEMUN
584587

@@ -651,6 +654,11 @@ extern int fdatasync(int fildes);
651654
# define HAVE_STRTOULL 1
652655
#endif
653656

657+
/* Define if you have atexit() */
658+
#undef HAVE_ATEXIT
659+
660+
/* Define if you have on_exit() */
661+
#undef HAVE_ON_EXIT
654662

655663
/*
656664
*------------------------------------------------------------------------

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#ifdef HAVE_GETOPT_H
1010
#include "getopt.h"
11+
#else
12+
extern char *optarg;
13+
extern int optind, opterr, optopt;
1114
#endif
1215

1316
#include "extern.h"

src/makefiles/Makefile.sunos4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AROPT = cr
22

33
DLSUFFIX = .so
44
ifeq ($(GCC), yes)
5-
CFLAGS_SL = -fPIC
5+
CFLAGS_SL = -fpic
66
else
77
CFLAGS_SL = -PIC
88
endif
@@ -13,4 +13,5 @@ CXXFLAGS_SL = -PIC
1313
endif
1414

1515
%.so: %.o
16-
$(LD) -dc -dp -Bdynamic -o $@ $<
16+
$(LD) -assert pure-text -Bdynamic -o $@ $<
17+

0 commit comments

Comments
 (0)