mirror of
https://github.com/postgres/postgres.git
synced 2025-05-30 00:02:11 -04:00
Win32 can't have the same function coming from two library object files,
so we make is_absolute_path a macro so libpq doesn't use path.o.
This commit is contained in:
parent
48eb73b556
commit
f16874c23d
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.32 2004/05/17 14:35:34 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.33 2004/05/19 04:21:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -21,7 +21,6 @@
|
||||
bool set_noblock(int sock);
|
||||
|
||||
/* Portable path handling for Unix/Win32 */
|
||||
extern bool is_absolute_path(const char *filename);
|
||||
extern char *first_path_separator(const char *filename);
|
||||
extern char *last_path_separator(const char *filename);
|
||||
extern void canonicalize_path(char *path);
|
||||
@ -32,6 +31,31 @@ extern void get_include_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_pkginclude_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
|
||||
|
||||
/*
|
||||
* is_absolute_path
|
||||
*
|
||||
* This capability is needed by libpq and initdb.c
|
||||
* On Win32, you can't reference the same object file that is
|
||||
* in two different libraries (pgport and libpq), so a macro is best.
|
||||
*/
|
||||
#ifndef WIN32
|
||||
#define is_absolute_path(filename) \
|
||||
( \
|
||||
((filename)[0] == '/') \
|
||||
)
|
||||
#else
|
||||
#define is_absolute_path(filename) \
|
||||
( \
|
||||
((filename)[0] == '/') || \
|
||||
(filename)[0] == '\\' || \
|
||||
(isalpha((filename)[0]) && (filename)[1] == ':' && \
|
||||
((filename)[2] == '\\' || (filename)[2] == '/')) \
|
||||
)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Portable way to find binaries */
|
||||
extern int find_my_exec(const char *argv0, char *full_path);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.106 2004/05/17 14:35:34 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.107 2004/05/19 04:21:49 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -30,7 +30,7 @@ override CFLAGS += $(PTHREAD_CFLAGS) \
|
||||
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
|
||||
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \
|
||||
dllist.o md5.o ip.o wchar.o encnames.o \
|
||||
$(filter crypt.o getaddrinfo.o inet_aton.o noblock.o pgstrcasecmp.o snprintf.o strerror.o open.o path.o thread.o, $(LIBOBJS))
|
||||
$(filter crypt.o getaddrinfo.o inet_aton.o noblock.o pgstrcasecmp.o snprintf.o strerror.o open.o thread.o, $(LIBOBJS))
|
||||
ifeq ($(PORTNAME), win32)
|
||||
OBJS+=win32.o
|
||||
endif
|
||||
@ -59,7 +59,7 @@ backend_src = $(top_srcdir)/src/backend
|
||||
# For port modules, this only happens if configure decides the module
|
||||
# is needed (see filter hack in OBJS, above).
|
||||
|
||||
crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c path.c thread.c: % : $(top_srcdir)/src/port/%
|
||||
crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c: % : $(top_srcdir)/src/port/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
md5.c ip.c: % : $(backend_src)/libpq/%
|
||||
@ -85,4 +85,4 @@ uninstall: uninstall-lib
|
||||
rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h
|
||||
|
||||
clean distclean maintainer-clean: clean-lib
|
||||
rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
|
||||
rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.9 2004/05/18 03:36:45 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.10 2004/05/19 04:21:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,24 +34,6 @@ static void trim_trailing_separator(char *path);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* is_absolute_path
|
||||
*/
|
||||
bool
|
||||
is_absolute_path(const char *filename)
|
||||
{
|
||||
return filename[0] == '/'
|
||||
#ifdef WIN32 /* WIN32 paths can either have forward or
|
||||
* backward slashes */
|
||||
|| filename[0] == '\\'
|
||||
|| (isalpha(filename[0]) && filename[1] == ':'
|
||||
&& (filename[2] == '\\' || filename[2] == '/'))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* first_path_separator
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user