mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Make Win32 build use our port/snprintf.c routines, instead of depending
on libintl which may or may not provide what we need. Make a few marginal cleanups to ensure this works. Andrew Dunstan and Tom Lane.
This commit is contained in:
parent
dc68b9ec30
commit
f244c488fb
19
configure
vendored
19
configure
vendored
@ -13852,7 +13852,11 @@ fi
|
|||||||
# also decide to use snprintf.c if snprintf() is present but does not
|
# also decide to use snprintf.c if snprintf() is present but does not
|
||||||
# have all the features we need --- see below.
|
# have all the features we need --- see below.
|
||||||
|
|
||||||
pgac_need_repl_snprintf=no
|
if test "$PORTNAME" = "win32"; then
|
||||||
|
# Win32 gets this built unconditionally
|
||||||
|
pgac_need_repl_snprintf=yes
|
||||||
|
else
|
||||||
|
pgac_need_repl_snprintf=no
|
||||||
|
|
||||||
for ac_func in snprintf
|
for ac_func in snprintf
|
||||||
do
|
do
|
||||||
@ -14061,6 +14065,7 @@ else
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
|
# Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
|
||||||
@ -17110,14 +17115,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Force use of our snprintf if system's doesn't do arg control
|
# Force use of our snprintf if system's doesn't do arg control
|
||||||
# This feature is used by NLS
|
# This feature is needed by NLS
|
||||||
if test "$enable_nls" = yes &&
|
if test "$enable_nls" = yes -a "$pgac_need_repl_snprintf" = no; then
|
||||||
test $pgac_need_repl_snprintf = no &&
|
|
||||||
# On Win32, libintl replaces snprintf() with its own version that
|
|
||||||
# understands arg control, so we don't need our own. In fact, it
|
|
||||||
# also uses macros that conflict with ours, so we _can't_ use
|
|
||||||
# our own.
|
|
||||||
test "$PORTNAME" != "win32"; then
|
|
||||||
echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
|
echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
|
||||||
echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
|
echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
|
||||||
if test "${pgac_cv_printf_arg_control+set}" = set; then
|
if test "${pgac_cv_printf_arg_control+set}" = set; then
|
||||||
@ -17604,7 +17603,7 @@ _ACEOF
|
|||||||
if test $pgac_need_repl_snprintf = yes; then
|
if test $pgac_need_repl_snprintf = yes; then
|
||||||
|
|
||||||
cat >>confdefs.h <<\_ACEOF
|
cat >>confdefs.h <<\_ACEOF
|
||||||
#define USE_SNPRINTF 1
|
#define USE_REPL_SNPRINTF 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
case $LIBOBJS in
|
case $LIBOBJS in
|
||||||
|
25
configure.in
25
configure.in
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl $PostgreSQL: pgsql/configure.in,v 1.431 2005/11/05 04:01:41 pgsql Exp $
|
dnl $PostgreSQL: pgsql/configure.in,v 1.431.2.1 2005/12/06 02:29:25 tgl Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -850,9 +850,14 @@ fi
|
|||||||
# also decide to use snprintf.c if snprintf() is present but does not
|
# also decide to use snprintf.c if snprintf() is present but does not
|
||||||
# have all the features we need --- see below.
|
# have all the features we need --- see below.
|
||||||
|
|
||||||
pgac_need_repl_snprintf=no
|
if test "$PORTNAME" = "win32"; then
|
||||||
AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
|
# Win32 gets this built unconditionally
|
||||||
AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
|
pgac_need_repl_snprintf=yes
|
||||||
|
else
|
||||||
|
pgac_need_repl_snprintf=no
|
||||||
|
AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
|
||||||
|
AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
|
# Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
|
||||||
@ -1045,14 +1050,8 @@ AC_MSG_ERROR([[
|
|||||||
|
|
||||||
|
|
||||||
# Force use of our snprintf if system's doesn't do arg control
|
# Force use of our snprintf if system's doesn't do arg control
|
||||||
# This feature is used by NLS
|
# This feature is needed by NLS
|
||||||
if test "$enable_nls" = yes &&
|
if test "$enable_nls" = yes -a "$pgac_need_repl_snprintf" = no; then
|
||||||
test $pgac_need_repl_snprintf = no &&
|
|
||||||
# On Win32, libintl replaces snprintf() with its own version that
|
|
||||||
# understands arg control, so we don't need our own. In fact, it
|
|
||||||
# also uses macros that conflict with ours, so we _can't_ use
|
|
||||||
# our own.
|
|
||||||
test "$PORTNAME" != "win32"; then
|
|
||||||
PGAC_FUNC_PRINTF_ARG_CONTROL
|
PGAC_FUNC_PRINTF_ARG_CONTROL
|
||||||
if test $pgac_cv_printf_arg_control != yes ; then
|
if test $pgac_cv_printf_arg_control != yes ; then
|
||||||
pgac_need_repl_snprintf=yes
|
pgac_need_repl_snprintf=yes
|
||||||
@ -1127,7 +1126,7 @@ AC_DEFINE_UNQUOTED(UINT64_FORMAT, $UINT64_FORMAT,
|
|||||||
|
|
||||||
# Now we have checked all the reasons to replace snprintf
|
# Now we have checked all the reasons to replace snprintf
|
||||||
if test $pgac_need_repl_snprintf = yes; then
|
if test $pgac_need_repl_snprintf = yes; then
|
||||||
AC_DEFINE(USE_SNPRINTF, 1, [Use replacement snprintf() functions.])
|
AC_DEFINE(USE_REPL_SNPRINTF, 1, [Use replacement snprintf() functions.])
|
||||||
AC_LIBOBJ(snprintf)
|
AC_LIBOBJ(snprintf)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/c.h,v 1.190 2005/10/15 02:49:41 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/c.h,v 1.190.2.1 2005/12/06 02:29:26 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -101,9 +101,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These strings are to be translation via xgettext. We can't
|
* Use this to mark strings to be translated by gettext, in places where
|
||||||
* call gettext() because it is located in variable initialization and
|
* you don't want an actual function call to occur (eg, constant tables).
|
||||||
* a function call can not be used.
|
|
||||||
*/
|
*/
|
||||||
#define gettext_noop(x) (x)
|
#define gettext_noop(x) (x)
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@
|
|||||||
#undef USE_PAM
|
#undef USE_PAM
|
||||||
|
|
||||||
/* Use replacement snprintf() functions. */
|
/* Use replacement snprintf() functions. */
|
||||||
#undef USE_SNPRINTF
|
#undef USE_REPL_SNPRINTF
|
||||||
|
|
||||||
/* Define to build with (Open)SSL support. (--with-openssl) */
|
/* Define to build with (Open)SSL support. (--with-openssl) */
|
||||||
#undef USE_SSL
|
#undef USE_SSL
|
||||||
|
@ -23,10 +23,6 @@
|
|||||||
#define HAVE_RANDOM
|
#define HAVE_RANDOM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* use _snprintf instead of snprintf */
|
|
||||||
#define HAVE_DECL_SNPRINTF 1
|
|
||||||
#define snprintf _snprintf
|
|
||||||
|
|
||||||
/* defines for dynamic linking on Win32 platform */
|
/* defines for dynamic linking on Win32 platform */
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.84 2005/10/15 02:49:41 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/port.h,v 1.84.2.1 2005/12/06 02:29:26 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -112,7 +112,8 @@ extern int pg_strncasecmp(const char *s1, const char *s2, size_t n);
|
|||||||
extern unsigned char pg_toupper(unsigned char ch);
|
extern unsigned char pg_toupper(unsigned char ch);
|
||||||
extern unsigned char pg_tolower(unsigned char ch);
|
extern unsigned char pg_tolower(unsigned char ch);
|
||||||
|
|
||||||
#ifdef USE_SNPRINTF
|
#ifdef USE_REPL_SNPRINTF
|
||||||
|
|
||||||
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||||
extern int
|
extern int
|
||||||
pg_snprintf(char *str, size_t count, const char *fmt,...)
|
pg_snprintf(char *str, size_t count, const char *fmt,...)
|
||||||
@ -131,6 +132,26 @@ pg_printf(const char *fmt,...)
|
|||||||
/* This extension allows gcc to check the format string */
|
/* This extension allows gcc to check the format string */
|
||||||
__attribute__((format(printf, 1, 2)));
|
__attribute__((format(printf, 1, 2)));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some versions of libintl try to replace printf and friends with macros;
|
||||||
|
* if we are doing likewise, make sure our versions win.
|
||||||
|
*/
|
||||||
|
#ifdef vsnprintf
|
||||||
|
#undef vsnprintf
|
||||||
|
#endif
|
||||||
|
#ifdef snprintf
|
||||||
|
#undef snprintf
|
||||||
|
#endif
|
||||||
|
#ifdef sprintf
|
||||||
|
#undef sprintf
|
||||||
|
#endif
|
||||||
|
#ifdef fprintf
|
||||||
|
#undef fprintf
|
||||||
|
#endif
|
||||||
|
#ifdef printf
|
||||||
|
#undef printf
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The GCC-specific code below prevents the __attribute__(... 'printf')
|
* The GCC-specific code below prevents the __attribute__(... 'printf')
|
||||||
* above from being replaced, and this is required because gcc doesn't
|
* above from being replaced, and this is required because gcc doesn't
|
||||||
@ -149,7 +170,8 @@ __attribute__((format(printf, 1, 2)));
|
|||||||
#define fprintf pg_fprintf
|
#define fprintf pg_fprintf
|
||||||
#define printf pg_printf
|
#define printf pg_printf
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
#endif /* USE_REPL_SNPRINTF */
|
||||||
|
|
||||||
/* Portable prompt handling */
|
/* Portable prompt handling */
|
||||||
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
|
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1994, Regents of the University of California
|
# Copyright (c) 1994, Regents of the University of California
|
||||||
#
|
#
|
||||||
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.33 2005/03/14 17:27:50 momjian Exp $
|
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.33.2.1 2005/12/06 02:29:26 tgl Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -21,11 +21,12 @@ override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/interfaces/ecpg/include \
|
|||||||
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
|
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
|
||||||
override CFLAGS += $(PTHREAD_CFLAGS)
|
override CFLAGS += $(PTHREAD_CFLAGS)
|
||||||
|
|
||||||
# Need to recomple any libpgport object files
|
# Need to recompile any libpgport object files
|
||||||
LIBS := $(patsubst -lpgport,, $(LIBS))
|
LIBS := $(filter-out -lpgport, $(LIBS))
|
||||||
|
|
||||||
OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
|
OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
|
||||||
connect.o misc.o path.o exec.o
|
connect.o misc.o path.o exec.o \
|
||||||
|
$(filter snprintf.o, $(LIBOBJS))
|
||||||
|
|
||||||
SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
|
SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
|
||||||
$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
|
$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
|
||||||
@ -45,10 +46,7 @@ include $(top_srcdir)/src/Makefile.shlib
|
|||||||
# necessarily use the same object files as the backend uses. Instead,
|
# necessarily use the same object files as the backend uses. Instead,
|
||||||
# symlink the source files in here and build our own object file.
|
# symlink the source files in here and build our own object file.
|
||||||
|
|
||||||
path.c: % : $(top_srcdir)/src/port/%
|
path.c exec.c snprintf.c: % : $(top_srcdir)/src/port/%
|
||||||
rm -f $@ && $(LN_S) $< .
|
|
||||||
|
|
||||||
exec.c: % : $(top_srcdir)/src/port/%
|
|
||||||
rm -f $@ && $(LN_S) $< .
|
rm -f $@ && $(LN_S) $< .
|
||||||
|
|
||||||
path.o: path.c $(top_builddir)/src/port/pg_config_paths.h
|
path.o: path.c $(top_builddir)/src/port/pg_config_paths.h
|
||||||
@ -64,7 +62,7 @@ installdirs:
|
|||||||
uninstall: uninstall-lib
|
uninstall: uninstall-lib
|
||||||
|
|
||||||
clean distclean maintainer-clean: clean-lib
|
clean distclean maintainer-clean: clean-lib
|
||||||
rm -f $(OBJS) path.c exec.c
|
rm -f $(OBJS) path.c exec.c snprintf.c
|
||||||
|
|
||||||
depend dep:
|
depend dep:
|
||||||
$(CC) -MM $(CFLAGS) *.c >depend
|
$(CC) -MM $(CFLAGS) *.c >depend
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
#define write(a,b,c) _write(a,b,c)
|
#define write(a,b,c) _write(a,b,c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d)
|
|
||||||
#define snprintf _snprintf
|
|
||||||
|
|
||||||
#undef EAGAIN /* doesn't apply on sockets */
|
#undef EAGAIN /* doesn't apply on sockets */
|
||||||
#undef EINTR
|
#undef EINTR
|
||||||
#define EINTR WSAEINTR
|
#define EINTR WSAEINTR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user