Skip to content

Commit ec5e0ef

Browse files
committed
Reorganize Win32 includes to only include <port.h> after system includes
under Win32. Also fix other compile issues.
1 parent 5e04f38 commit ec5e0ef

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11397,7 +11397,8 @@ esac
1139711397
# Win32 can't to rename or unlink on an open file
1139811398
case $host_os in mingw*)
1139911399
LIBOBJS="$LIBOBJS dirmod.$ac_objext"
11400-
LIBOBJS="$LIBOBJS copydir.$ac_objext" ;;
11400+
LIBOBJS="$LIBOBJS copydir.$ac_objext"
11401+
LIBOBJS="$LIBOBJS gettimeofday.$ac_objext" ;;
1140111402
esac
1140211403
1140311404
if test "$with_readline" = yes; then

configure.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.251 2003/05/15 17:59:17 momjian Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.252 2003/05/16 01:57:51 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -865,7 +865,8 @@ esac
865865
# Win32 can't to rename or unlink on an open file
866866
case $host_os in mingw*)
867867
AC_LIBOBJ(dirmod)
868-
AC_LIBOBJ(copydir) ;;
868+
AC_LIBOBJ(copydir)
869+
AC_LIBOBJ(gettimeofday) ;;
869870
esac
870871

871872
if test "$with_readline" = yes; then

src/include/c.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: c.h,v 1.146 2003/05/15 23:39:27 tgl Exp $
15+
* $Id: c.h,v 1.147 2003/05/16 01:57:51 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -52,7 +52,9 @@
5252

5353
#include "pg_config.h"
5454
#include "pg_config_manual.h" /* must be after pg_config.h */
55+
#ifndef WIN32
5556
#include "pg_config_os.h" /* must be before any system header files */
57+
#endif
5658
#include "postgres_ext.h"
5759

5860
#include <stdio.h>
@@ -71,6 +73,11 @@
7173
#include <SupportDefs.h>
7274
#endif
7375

76+
#ifdef WIN32
77+
/* We have to redefine some system functions after they are included above */
78+
#include "pg_config_os.h"
79+
#endif
80+
7481
/* Must be before gettext() games below */
7582
#include <locale.h>
7683

src/include/port.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: port.h,v 1.1 2003/05/15 16:35:29 momjian Exp $
9+
* $Id: port.h,v 1.2 2003/05/16 01:57:51 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -22,21 +22,26 @@ int fseeko(FILE *stream, off_t offset, int whence);
2222
off_t ftello(FILE *stream);
2323
#endif
2424

25+
#ifdef WIN32
2526
/*
2627
* Win32 doesn't have reliable rename/unlink during concurrent access
2728
*/
28-
#if defined(WIN32) && !defined(FRONTEND)
29+
#ifndef FRONTEND
2930
int pgrename(const char *from, const char *to);
3031
int pgunlink(const char *path);
3132
#define rename(from, to) pgrename(from, to)
3233
#define unlink(path) pgunlink(path)
3334
#endif
3435

36+
extern int copydir(char *fromdir,char *todir);
37+
extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
38+
39+
#else
40+
3541
/*
3642
* Win32 requires a special close for sockets and pipes, while on Unix
3743
* close() does them all.
3844
*/
39-
#ifndef WIN32
4045
#define closesocket close
4146
#endif
4247

@@ -45,7 +50,7 @@ int pgunlink(const char *path);
4550
* When necessary, these routines are provided by files in src/port/.
4651
*/
4752
#ifndef HAVE_CRYPT
48-
char *crypt(const char *key, const char *setting);
53+
extern char *crypt(const char *key, const char *setting);
4954
#endif
5055

5156
#ifndef HAVE_FSEEKO
@@ -90,4 +95,3 @@ extern long random(void);
9095
#ifndef HAVE_SRANDOM
9196
extern void srandom(unsigned int seed);
9297
#endif
93-

src/port/copydir.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
#include "postgres.h"
88

9+
#undef mkdir /* no reason to use that macro because we ignore the 2nd arg */
10+
11+
#include "dirent.h"
12+
13+
914
int
1015
copydir(char *fromdir,char *todir)
1116
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy