Assemble portability modules into libpgport library.

Some makefile simplifications.
This commit is contained in:
Peter Eisentraut 2002-07-27 20:10:05 +00:00
parent c3fdf8925e
commit b0c3c48eb3
24 changed files with 592 additions and 1545 deletions

View File

@ -1,5 +1,5 @@
# Macros that test various C library quirks
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.13 2002/03/30 00:59:52 petere Exp $
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.14 2002/07/27 20:10:03 petere Exp $
# PGAC_VAR_INT_TIMEZONE
@ -36,30 +36,6 @@ if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
fi])# PGAC_FUNC_GETTIMEOFDAY_1ARG
# PGAC_FUNC_MEMCMP
# ----------------
# Check if memcmp() properly handles negative bytes and returns +/-.
# SunOS does not.
# AC_FUNC_MEMCMP
AC_DEFUN([PGAC_FUNC_MEMCMP],
[AC_CACHE_CHECK(for 8-bit clean memcmp, pgac_cv_func_memcmp_clean,
[AC_TRY_RUN([
main()
{
char c0 = 0x40, c1 = 0x80, c2 = 0x81;
exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
}
], pgac_cv_func_memcmp_clean=yes, pgac_cv_func_memcmp_clean=no,
pgac_cv_func_memcmp_clean=no)])
if test $pgac_cv_func_memcmp_clean = no ; then
MEMCMP=memcmp.o
else
MEMCMP=
fi
AC_SUBST(MEMCMP)dnl
])
# PGAC_UNION_SEMUN
# ----------------
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.

1630
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.193 2002/07/19 17:35:09 momjian Exp $
dnl $Header: /cvsroot/pgsql/configure.in,v 1.194 2002/07/27 20:10:03 petere Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@ -747,6 +747,7 @@ fi
##
## Header files
##
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/un.h termios.h kernel/OS.h kernel/image.h SupportDefs.h])
@ -798,6 +799,7 @@ fi
##
## Types, structures, compiler characteristics
##
m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
AC_C_CONST
AC_C_INLINE
@ -840,12 +842,13 @@ fi
##
## Functions, global variables
##
PGAC_VAR_INT_TIMEZONE
AC_FUNC_ACCEPT_ARGTYPES
PGAC_FUNC_GETTIMEOFDAY_1ARG
# SunOS doesn't handle negative byte comparisons properly with +/- return
PGAC_FUNC_MEMCMP
AC_FUNC_MEMCMP
AC_CHECK_FUNCS([cbrt fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync])
@ -870,10 +873,9 @@ fi
# also decide to use snprintf.c if snprintf() is present but does not
# have working "long long int" support -- see below.
SNPRINTF=''
AC_CHECK_FUNCS(snprintf, [], SNPRINTF='$(top_builddir)/src/port/snprintf.o')
AC_CHECK_FUNCS(vsnprintf, [], SNPRINTF='$(top_builddir)/src/port/snprintf.o')
AC_SUBST(SNPRINTF)
pgac_need_repl_snprintf=no
AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
# Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
@ -895,49 +897,18 @@ AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
if test $ac_cv_func_isinf = yes ; then
AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have isinf()])
ISINF=
else
ISINF='isinf.o'
AC_LIBOBJ(isinf)
# Look for a way to implement a substitute for isinf()
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
fi
AC_SUBST(ISINF)
AC_REPLACE_FUNCS([gethostname getrusage inet_aton random srandom strcasecmp strdup strerror strtol strtoul])
AC_CHECK_FUNCS(getrusage, [], GETRUSAGE='$(top_builddir)/src/port/getrusage.o')
AC_SUBST(GETRUSAGE)
AC_CHECK_FUNCS(srandom, [], SRANDOM='$(top_builddir)/src/port/srandom.o')
AC_SUBST(SRANDOM)
AC_CHECK_FUNCS(gethostname, [], GETHOSTNAME='$(top_builddir)/src/port/gethostname.o')
AC_SUBST(GETHOSTNAME)
AC_CHECK_FUNCS(random, [], MISSING_RANDOM='$(top_builddir)/src/port/random.o')
AC_SUBST(MISSING_RANDOM)
AC_CHECK_FUNCS(inet_aton, [], INET_ATON='$(top_builddir)/src/port/inet_aton.o')
AC_SUBST(INET_ATON)
AC_CHECK_FUNCS(strerror, [], STRERROR='$(top_builddir)/src/port/strerror.o')
AC_SUBST(STRERROR)
AC_CHECK_FUNCS(strdup, [], STRDUP='$(top_builddir)/src/port/strdup.o')
AC_SUBST(STRDUP)
AC_CHECK_FUNCS(strtol, [], STRTOL='$(top_builddir)/src/port/strtol.o')
AC_SUBST(STRTOL)
AC_CHECK_FUNCS(strtoul, [], STRTOUL='$(top_builddir)/src/port/strtoul.o')
AC_SUBST(STRTOUL)
AC_CHECK_FUNCS(strcasecmp, [], STRCASECMP='$(top_builddir)/src/port/strcasecmp.o')
AC_SUBST(STRCASECMP)
# Set path of dllinit.c for cygwin
DLLINIT=""
# Solaris has a very slow qsort in certain cases.
case $host_os in
cygwin*) DLLINIT='$(top_builddir)/src/backend/port/dllinit.o' ;;
solaris*) AC_LIBOBJ(qsort) ;;
esac
AC_SUBST(DLLINIT)
# Set path of qsort for solaris, which has a very slow qsort in certain cases.
QSORT=""
case $host_os in
solaris*) DLLINIT='$(top_builddir)/src/backend/port/qsort.o' ;;
esac
AC_SUBST(QSORT)
# On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
# this hackery with HPUXMATHLIB allows us to cope.
@ -992,6 +963,14 @@ if test x"$pgac_cv_var_int_optreset" = x"yes"; then
AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'])
fi
AC_CHECK_FUNCS([strtoll strtoq], [break])
AC_CHECK_FUNCS([strtoull strtouq], [break])
# Check for one of atexit() or on_exit()
AC_CHECK_FUNCS(atexit, [],
[AC_CHECK_FUNCS(on_exit, [],
[AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
# This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it.
@ -1047,8 +1026,8 @@ dnl We cope with snprintfs that use either %lld or %qd as the format.
dnl If neither works, fall back to our own snprintf emulation (which we
dnl know uses %lld).
if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
if [[ x$SNPRINTF = x ]] ; then
if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
if test $pgac_need_repl_snprintf = no; then
AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
AC_TRY_RUN([#include <stdio.h>
typedef long long int int64;
@ -1108,17 +1087,17 @@ main() {
],
[ AC_MSG_RESULT(no)
# Force usage of our own snprintf, since system snprintf is broken
SNPRINTF='$(top_builddir)/src/port/snprintf.o'
pgac_need_repl_snprintf=yes
INT64_FORMAT='"%lld"'
],
[ AC_MSG_RESULT(assuming not on target machine)
[ AC_MSG_RESULT([cannot test (not on host machine)])
# Force usage of our own snprintf, since we cannot test foreign snprintf
SNPRINTF='$(top_builddir)/src/port/snprintf.o'
pgac_need_repl_snprintf=yes
INT64_FORMAT='"%lld"'
]) ],
[ AC_MSG_RESULT(assuming not on target machine)
[ AC_MSG_RESULT([cannot test (not on host machine)])
# Force usage of our own snprintf, since we cannot test foreign snprintf
SNPRINTF='$(top_builddir)/src/port/snprintf.o'
pgac_need_repl_snprintf=yes
INT64_FORMAT='"%lld"'
])
else
@ -1133,14 +1112,9 @@ fi
AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
[Define this as the appropriate snprintf format for 64-bit ints, if any])
AC_CHECK_FUNCS([strtoll strtoq], [break])
AC_CHECK_FUNCS([strtoull strtouq], [break])
# Check for one of atexit() or on_exit()
AC_CHECK_FUNCS(atexit, [],
[AC_CHECK_FUNCS(on_exit, [],
[AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
if test $pgac_need_repl_snprintf = yes; then
AC_LIBOBJ(snprintf)
fi
dnl Need a #define for the size of Datum (unsigned long)

View File

@ -1,16 +1,18 @@
# $Header: /cvsroot/pgsql/contrib/pg_controldata/Attic/Makefile,v 1.7 2002/07/18 04:33:39 momjian Exp $
# $Header: /cvsroot/pgsql/contrib/pg_controldata/Attic/Makefile,v 1.8 2002/07/27 20:10:03 petere Exp $
subdir = contrib/pg_controldata
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
all: submake-libpgport
PROGRAM = pg_controldata
OBJS = pg_controldata.o pg_crc.o $(SNPRINTF)
OBJS = pg_controldata.o pg_crc.o
pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
rm -f $@ && $(LN_S) $< .
EXTRA_CLEAN = pg_crc.c snprintf.c
EXTRA_CLEAN = pg_crc.c
DOCS = README.pg_controldata

View File

@ -1,16 +1,18 @@
# $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/Makefile,v 1.5 2002/07/18 04:33:39 momjian Exp $
# $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/Makefile,v 1.6 2002/07/27 20:10:03 petere Exp $
subdir = contrib/pg_resetxlog
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
all: submake-libpgport
PROGRAM = pg_resetxlog
OBJS = pg_resetxlog.o pg_crc.o $(SNPRINTF)
OBJS = pg_resetxlog.o pg_crc.o
pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
rm -f $@ && $(LN_S) $< .
EXTRA_CLEAN = pg_crc.c snprintf.c
EXTRA_CLEAN = pg_crc.c
DOCS = README.pg_resetxlog

View File

@ -3,7 +3,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL 7.2
Sun Solaris specific
to be read in conjunction with the installation instructions
============================================================
last updated: $Date: 2002/07/15 21:34:04 $
last updated: $Date: 2002/07/27 20:10:03 $
current maintainer: Peter Eisentraut <peter_e@gmx.net>
@ -88,15 +88,15 @@ to work on Solaris 7:
On Solaris 7 and older, the 64-bit version of libc has a buggy vsnprintf
routine, which leads to erratic core dumps in PostgreSQL. The simplest known
workaround is to force PostgreSQL to use its own version of vsnprintf rather
than the library copy. To do this, after you run 'configure' edit two files
than the library copy. To do this, after you run 'configure' edit a file
produced by configure:
(1) In src/Makefile.global, change the line
SNPRINTF =
In src/Makefile.global, change the line
LIBOBJS =
to read
SNPRINTF = $(top_builddir)/src/backend/port/snprint.o
LIBOBJS = snprintf.o
(2) In src/backend/port/Makefile, add "snprintf.o" to OBJS. (Skip this
step if you see "$(SNPRINTF)" already listed in OBJS.)
(There might be other files already listed in this variable. Order
does not matter.)
Then build as usual.

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/Makefile,v 1.25 2002/07/18 22:15:10 tgl Exp $
# $Header: /cvsroot/pgsql/src/Makefile,v 1.26 2002/07/27 20:10:04 petere Exp $
#
#-------------------------------------------------------------------------
@ -14,6 +14,7 @@ include Makefile.global
all install installdirs uninstall dep depend distprep:
$(MAKE) -C port $@
$(MAKE) -C backend $@
$(MAKE) -C include $@
$(MAKE) -C interfaces $@
@ -24,6 +25,7 @@ install-all-headers:
$(MAKE) -C include $@
clean:
$(MAKE) -C port $@
$(MAKE) -C backend $@
$(MAKE) -C include $@
$(MAKE) -C interfaces $@
@ -32,6 +34,7 @@ clean:
$(MAKE) -C test $@
distclean maintainer-clean:
-$(MAKE) -C port $@
-$(MAKE) -C backend $@
-$(MAKE) -C include $@
-$(MAKE) -C interfaces $@

View File

@ -1,5 +1,5 @@
# -*-makefile-*-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.151 2002/07/19 17:35:10 momjian Exp $
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.152 2002/07/27 20:10:04 petere Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
@ -294,6 +294,7 @@ ifeq ($(enable_rpath), yes)
LDFLAGS += $(rpath)
endif
##########################################################################
#
# Some variables needed to find some client interfaces
@ -302,6 +303,14 @@ libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
libpq_builddir = $(top_builddir)/src/interfaces/libpq
libpq = -L$(libpq_builddir) -lpq
submake-libpq:
$(MAKE) -C $(libpq_builddir) all
submake-libpgport:
$(MAKE) -C $(top_builddir)/src/port all
.PHONY: submake-libpq submake-libpgport
##########################################################################
#
@ -346,23 +355,14 @@ endif
#
# substitute implementations of the C library
GETHOSTNAME = @GETHOSTNAME@
GETRUSAGE = @GETRUSAGE@
INET_ATON = @INET_ATON@
ISINF = @ISINF@
MEMCMP = @MEMCMP@
MISSING_RANDOM = @MISSING_RANDOM@
QSORT = @QSORT@
SNPRINTF = @SNPRINTF@
SRANDOM = @SRANDOM@
STRCASECMP = @STRCASECMP@
STRDUP = @STRDUP@
STRERROR = @STRERROR@
STRTOL = @STRTOL@
STRTOUL = @STRTOUL@
LIBOBJS = @LIBOBJS@
ifneq (,$(LIBOBJS))
LIBS += -lpgport
LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
endif
# Not really standard libc functions, used by the backend.
DLLINIT = @DLLINIT@
TAS = @TAS@

View File

@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.59 2002/07/16 05:46:35 momjian Exp $
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.60 2002/07/27 20:10:04 petere Exp $
#
#-------------------------------------------------------------------------
@ -332,7 +332,7 @@ $(shlib) lib$(NAME).a: $(OBJS) $(DLLINIT)
$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(DLLLIBS) $(SHLIB_LINK)
$(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
$(DLLINIT):
$(DLLINIT): $(DLLINIT:%.o=%.c)
$(MAKE) -C $(@D) $(@F)
endif # PORTNAME == win

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.81 2002/07/18 02:02:29 ishii Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.82 2002/07/27 20:10:04 petere Exp $
#
#-------------------------------------------------------------------------
@ -29,7 +29,7 @@ endif
##########################################################################
all: postgres $(POSTGRES_IMP)
all: submake-libpgport postgres $(POSTGRES_IMP)
ifeq ($(enable_nls), yes)
$(MAKE) -C po all
endif
@ -41,13 +41,11 @@ postgres: $(OBJS)
else # win
# No points for style here. How about encapsulating some of these
# commands into variables?
postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a
dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
gcc $(LDFLAGS) -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(DLLLIBS)
dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
gcc $(LDFLAGS) -g -o $@$(X) $@.exp $(OBJS) $(DLLLIBS)
$(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
$(CC) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(DLLLIBS)
$(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
$(CC) $(LDFLAGS) -o $@$(X) $@.exp $(OBJS) $(DLLLIBS)
rm $@.exp $@.base
endif # win
@ -73,7 +71,7 @@ libpostgres.a: $(OBJS) $(DLLINIT) postgres.def
endif # MAKE_DLL
$(DLLINIT):
$(DLLINIT): $(DLLINIT:%.o=%.c)
$(MAKE) -C $(@D) $(@F)
# The postgres.o target is needed by the rule in Makefile.global that

View File

@ -13,7 +13,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.17 2002/07/19 17:35:11 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.18 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -21,14 +21,8 @@ subdir = src/backend/port
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS=$(GETHOSTNAME) $(GETRUSAGE) $(INET_ATON) $(ISINF) $(MEMCMP) \
$(MISSING_RANDOM) $(QSORT) $(SNPRINTF) $(SRANDOM) $(STRCASECMP) \
$(STRDUP) $(STRERROR) $(STRTOL) $(STRTOUL)
OBJS+=dynloader.o pg_sema.o pg_shmem.o
OBJS+=$(DLLINIT)
OBJS+=$(TAS)
ifeq ($(PORTNAME), qnx4)
@ -65,7 +59,7 @@ tas.o: tas.s
$(CC) $(CFLAGS) -c $<
# IPC test program
ipc_test: ipc_test.o pg_sema.o pg_shmem.o $(MEMCMP) $(SNPRINTF) $(STRERROR)
ipc_test: ipc_test.o pg_sema.o pg_shmem.o
$(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@
distclean clean:

View File

@ -1,152 +0,0 @@
/* $Id: inet_aton.c,v 1.20 2001/10/25 05:49:40 momjian Exp $
*
* This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this
* routine in their standard C libraries.
*
* The function was been extracted whole from the file inet_aton.c in
* Release 5.3.12 of the Linux C library, which is derived from the
* GNU C library, by Bryan Henderson in October 1996. The copyright
* notice from that file is below.
*/
/*
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. */
#include "c.h"
#include <sys/types.h>
#include <netinet/in.h>
#include <ctype.h>
/*
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not.
* This replaces inet_addr, the return value from which
* cannot distinguish between failure and a local broadcast address.
*/
int
inet_aton(const char *cp, struct in_addr * addr)
{
unsigned int val;
int base,
n;
char c;
u_int parts[4];
u_int *pp = parts;
for (;;)
{
/*
* Collect number up to ``.''. Values are specified as for C:
* 0x=hex, 0=octal, other=decimal.
*/
val = 0;
base = 10;
if (*cp == '0')
{
if (*++cp == 'x' || *cp == 'X')
base = 16, cp++;
else
base = 8;
}
while ((c = *cp) != '\0')
{
if (isdigit((unsigned char) c))
{
val = (val * base) + (c - '0');
cp++;
continue;
}
if (base == 16 && isxdigit((unsigned char) c))
{
val = (val << 4) +
(c + 10 - (islower((unsigned char) c) ? 'a' : 'A'));
cp++;
continue;
}
break;
}
if (*cp == '.')
{
/*
* Internet format: a.b.c.d a.b.c (with c treated as
* 16-bits) a.b (with b treated as 24 bits)
*/
if (pp >= parts + 3 || val > 0xff)
return 0;
*pp++ = val, cp++;
}
else
break;
}
/*
* Check for trailing junk.
*/
while (*cp)
if (!isspace((unsigned char) *cp++))
return 0;
/*
* Concoct the address according to the number of parts specified.
*/
n = pp - parts + 1;
switch (n)
{
case 1: /* a -- 32 bits */
break;
case 2: /* a.b -- 8.24 bits */
if (val > 0xffffff)
return 0;
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
if (val > 0xffff)
return 0;
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
if (val > 0xff)
return 0;
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
}
if (addr)
addr->s_addr = htonl(val);
return 1;
}

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.35 2002/07/15 21:34:05 momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.36 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -14,12 +14,11 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
pg_backup_files.o pg_backup_null.o pg_backup_tar.o sprompt.o \
$(STRDUP) $(STRTOUL)
pg_backup_files.o pg_backup_null.o pg_backup_tar.o sprompt.o
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
all: submake pg_dump pg_restore pg_dumpall
all: submake-libpq submake-libpgport pg_dump pg_restore pg_dumpall
pg_dump: pg_dump.o common.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dump.o common.o $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@
@ -34,10 +33,6 @@ pg_dumpall: pg_dumpall.sh
$< >$@
chmod a+x $@
.PHONY: submake
submake:
$(MAKE) -C $(libpq_builddir) all
install: all installdirs
$(INSTALL_PROGRAM) pg_dump$(X) $(DESTDIR)$(bindir)/pg_dump$(X)
$(INSTALL_PROGRAM) pg_restore$(X) $(DESTDIR)$(bindir)/pg_restore$(X)
@ -49,12 +44,5 @@ installdirs:
uninstall:
rm -f $(addprefix $(DESTDIR)$(bindir)/, pg_dump$(X) pg_restore$(X) pg_dumpall)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean distclean maintainer-clean:
rm -f pg_dump$(X) pg_restore$(X) $(OBJS) pg_dump.o common.o pg_restore.o pg_dumpall
ifeq (depend,$(wildcard depend))
include depend
endif

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1998, PostgreSQL Global Development Group
#
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.14 2001/03/23 05:46:05 ishii Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.15 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -14,23 +14,11 @@ include $(top_builddir)/src/Makefile.global
OBJS= pg_encoding.o
all: submake pg_encoding
ifdef STRTOUL
OBJS+=$(top_builddir)/src/backend/port/strtoul.o
$(top_builddir)/src/backend/port/strtoul.o:
$(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
endif
all: submake-libpq submake-libpgport pg_encoding
pg_encoding: $(OBJS)
$(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@
.PHONY: submake
submake:
$(MAKE) -C $(libpq_builddir) all
install: all installdirs
$(INSTALL_PROGRAM) pg_encoding$(X) $(DESTDIR)$(bindir)/pg_encoding$(X)
@ -40,12 +28,5 @@ installdirs:
uninstall:
rm -f $(DESTDIR)$(bindir)/pg_encoding$(X)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean distclean maintainer-clean:
rm -f pg_encoding$(X) pg_encoding.o
ifeq (depend,$(wildcard depend))
include depend
endif

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.34 2002/07/15 21:34:05 momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.35 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -19,12 +19,9 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS=command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
startup.o prompt.o variables.o large_obj.o print.o describe.o \
sprompt.o tab-complete.o mbprint.o $(SNPRINTF) $(STRDUP) \
$(STRERROR) $(STRTOUL)
sprompt.o tab-complete.o mbprint.o
all: submake psql
# End of hacks for picking up backend 'port' modules
all: submake-libpq submake-libpgport psql
psql: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@
@ -39,11 +36,6 @@ $(srcdir)/sql_help.h:
@echo "*** Perl is needed to build psql help."
endif
.PHONY: submake
submake:
$(MAKE) -C $(libpq_builddir) all
distprep: $(srcdir)/sql_help.h
install: all installdirs
@ -55,15 +47,8 @@ installdirs:
uninstall:
rm -f $(DESTDIR)$(bindir)/psql$(X)
depend dep:
$(CC) -MM -MG $(CFLAGS) *.c >depend
clean distclean:
rm -f psql$(X) $(OBJS)
maintainer-clean: distclean
rm -f $(srcdir)/sql_help.h
ifeq (depend,$(wildcard depend))
include depend
endif

View File

@ -1,4 +1,4 @@
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.84 2002/07/15 21:34:05 momjian Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.85 2002/07/27 20:10:05 petere Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
@ -18,10 +18,9 @@ override CFLAGS += -Wno-error
endif
OBJS=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 \
$(SNPRINTF) $(STRDUP)
keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o
all: ecpg
all: submake-libpgport ecpg
ecpg: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
@ -70,11 +69,3 @@ clean distclean:
# inadequate tools.
maintainer-clean: distclean
rm -f $(srcdir)/preproc.c $(srcdir)/preproc.h $(srcdir)/pgc.c
depend dep: preproc.c pgc.c
$(CC) -MM $(CFLAGS) *.c >depend
ifeq (depend,$(wildcard depend))
include depend
endif

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.26 2001/05/11 01:46:33 momjian Exp $
# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.27 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -27,11 +27,7 @@ SHLIB_LINK = $(libpq)
# braindead; users of libpq should not need to know what it depends on.)
SHLIB_LINK+= $(filter -L%, $(LDFLAGS)) $(filter -lcrypt, $(LIBS))
all: submake all-lib
.PHONY: submake
submake:
$(MAKE) -C $(libpq_builddir) all
all: submake-libpq all-lib
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/Makefile,v 1.14 2002/06/20 20:29:54 momjian Exp $
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/Makefile,v 1.15 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -31,8 +31,6 @@ all: $(PROGS)
$(PROGS): % : %.cc
$(CXX) $(CXXFLAGS) -o $@ $@.cc $(LDFLAGS)
.PHONY: submake
clean:
rm -f $(PROGS)

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.63 2002/07/18 03:59:49 momjian Exp $
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.64 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -22,7 +22,7 @@ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconf
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
pqexpbuffer.o dllist.o md5.o pqsignal.o fe-secure.o \
$(notdir $(INET_ATON)) $(notdir $(SNPRINTF)) $(notdir $(STRERROR))
$(filter inet_aton.o snprintf.o strerror.o, $(LIBOBJS))
ifdef MULTIBYTE
OBJS+= wchar.o encnames.o
@ -54,20 +54,8 @@ md5.c: $(backend_src)/libpq/md5.c
# symlink the source files in here and build our own object file.
# this only gets done if configure finds system doesn't have inet_aton()
ifdef INET_ATON
$(basename $(notdir $(INET_ATON))).c: $(basename $(INET_ATON)).c
inet_aton.c snprintf.c strerror.c: %.c : $(top_srcdir)/src/port/%.c
rm -f $@ && $(LN_S) $< .
endif
ifdef SNPRINTF
$(basename $(notdir $(SNPRINTF))).c: $(basename $(SNPRINTF)).c
rm -f $@ && $(LN_S) $< .
endif
ifdef STRERROR
$(basename $(notdir $(STRERROR))).c: $(basename $(STRERROR)).c
rm -f $@ && $(LN_S) $< .
endif
ifdef MULTIBYTE
wchar.c : % : $(backend_src)/utils/mb/%

View File

@ -1,9 +1,10 @@
# $Header: /cvsroot/pgsql/src/makefiles/Attic/Makefile.win,v 1.16 2002/07/16 05:46:35 momjian Exp $
# $Header: /cvsroot/pgsql/src/makefiles/Attic/Makefile.win,v 1.17 2002/07/27 20:10:05 petere Exp $
LDFLAGS+= -g
DLLTOOL= dlltool
DLLWRAP= dllwrap
DLLLIBS= -lcygipc -lcrypt
BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
DLLINIT = $(top_builddir)/src/utils/dllinit.o
MK_NO_LORDER=true
MAKE_DLL=true
#MAKE_DLL=false

View File

@ -7,7 +7,7 @@
# with broken/missing library files.
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/port/Makefile,v 1.2 2002/07/19 17:35:11 momjian Exp $
# $Header: /cvsroot/pgsql/src/port/Makefile,v 1.3 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
@ -15,9 +15,12 @@ subdir = src/port
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
ifdef LIBOBJS
all: libpgport.a
endif
#
# The backend/port directory removes these files.
#
#distclean clean:
# rm -f $(OBJS)
libpgport.a: $(LIBOBJS)
$(AR) crs $@ $^
clean distclean maintainer-clean:
rm -f libpgport.a $(LIBOBJS)

View File

@ -1,3 +0,0 @@
/* $Id: inet_aton.h,v 1.1 2002/07/18 04:13:59 momjian Exp $ */
int inet_aton(const char *cp, struct in_addr * addr);

18
src/utils/Makefile Normal file
View File

@ -0,0 +1,18 @@
#-------------------------------------------------------------------------
#
# Makefile for utils
#
# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.14 2002/07/27 20:10:05 petere Exp $
#
# dllinit.o is only built on Win32 platform.
#
#-------------------------------------------------------------------------
subdir = src/utils
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
all:
clean distclean maintainer-clean:
rm -f dllinit.o