Changeset 2592


Ignore:
Timestamp:
Jun 18, 2012, 12:50:38 AM (13 years ago)
Author:
bird
Message:

kmk build fixes for win.amd64.

Location:
trunk/src/kmk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/config.h.win

    r2591 r2592  
    523523#endif
    524524
    525 /* bird hacks */
     525/* bird hacks - similar in mscfakes.h */
    526526#include <sys/stat.h>
    527 extern int my_stat(const char *, struct stat *);
    528 #define stat(_path, _st) my_stat(_path, _st)
     527#include <io.h>
     528#include <direct.h>
     529#ifndef STAT_REDEFINED_ALREADY
     530# define STAT_REDEFINED_ALREADY
     531# undef stat
     532# define stat(_path, _st) bird_w32_stat(_path, _st)
     533extern int bird_w32_stat(const char *, struct stat *);
     534#endif
    529535
    530536/* cygwin sucks to much in one end or the other. */
  • trunk/src/kmk/function.c

    r2591 r2592  
    8282# define STR_N_EQUALS(a_psz, a_cch, a_szConst) \
    8383    ( (a_cch) == sizeof (a_szConst) - 1 && !strncmp ((a_psz), (a_szConst), sizeof (a_szConst) - 1) )
     84
     85# ifdef _MSC_VER
     86#  include "kmkbuiltin/mscfakes.h"
     87# endif
    8488#endif
    8589
  • trunk/src/kmk/job.c

    r2591 r2592  
    11291129#else
    11301130  char **argv;
     1131# if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32) && !defined(VMS)
    11311132  char ** volatile volatile_argv;
    11321133  int volatile volatile_flags;
     1134# endif
    11331135#endif
    11341136
  • trunk/src/kmk/kmkbuiltin/mscfakes.c

    r2484 r2592  
    533533
    534534
    535 #undef stat
    536535/*
    537536 * Workaround for directory names with trailing slashes.
    538  * Added by bird reasons stated.
    539537 */
     538#undef stat
    540539int
    541 my_other_stat(const char *path, struct stat *st)
     540bird_w32_stat(const char *path, struct stat *st)
    542541{
    543542    int rc = stat(path, st);
     
    564563        }
    565564    }
    566     return rc;
    567 }
    568 
     565#ifdef KMK_PRF
     566    {
     567        int err = errno;
     568        fprintf(stderr, "stat(%s,) -> %d/%d\n", path, rc, errno);
     569        errno = err;
     570    }
     571#endif
     572    return rc;
     573}
     574
  • trunk/src/kmk/kmkbuiltin/mscfakes.h

    r2413 r2592  
    3535#include "getopt.h"
    3636
     37/* Note: Duplicated it config.h.win */
     38#include <sys/stat.h>
     39#include <io.h>
     40#include <direct.h>
    3741#if defined(MSC_DO_64_BIT_IO) && _MSC_VER >= 1400 /* We want 64-bit file lengths here when possible. */
    3842# define off_t __int64
     43# undef stat
    3944# define stat  _stat64
    4045# define fstat _fstat64
    4146# define lseek _lseeki64
    4247#else
    43 # undef stat
    44 # define stat(_path, _st) my_other_stat(_path, _st)
    45 extern int my_other_stat(const char *, struct stat *);
     48# ifndef STAT_REDEFINED_ALREADY
     49#  define STAT_REDEFINED_ALREADY
     50#  undef stat
     51#  define stat(_path, _st) bird_w32_stat(_path, _st)
     52extern int bird_w32_stat(const char *, struct stat *);
     53# endif
    4654#endif
    47 
    48 
    4955
    5056#ifndef S_ISDIR
  • trunk/src/kmk/vpath.c

    r2591 r2592  
    292292         Usually this is maxelem - 1.  If not, shrink down.  */
    293293      if (elem < (maxelem - 1))
    294         vpath = xrealloc (vpath, (elem+1) * sizeof (const char *));
     294        vpath = (const char **)xrealloc (vpath, (elem+1) * sizeof (const char *));
    295295
    296296      /* Put the nil-pointer terminator on the end of the VPATH list.  */
  • trunk/src/kmk/w32/pathstuff.c

    r2591 r2592  
    143143
    144144        return p;
    145 }
    146 
    147 #undef stat
    148 /*
    149  * Workaround for directory names with trailing slashes.
    150  * Added by bird reasons stated.
    151  */
    152 int
    153 my_stat(const char *path, struct stat *st)
    154 {
    155     int rc = stat(path, st);
    156     if (    rc != 0
    157         &&  errno == ENOENT
    158         &&  *path != '\0')
    159       {
    160         char *slash = strchr(path, '\0') - 1;
    161         if (*slash == '/' || *slash == '\\')
    162           {
    163             size_t len_path = slash - path + 1;
    164             char *tmp = alloca(len_path + 4);
    165             memcpy(tmp, path, len_path);
    166             tmp[len_path] = '.';
    167             tmp[len_path + 1] = '\0';
    168             errno = 0;
    169             rc = stat(tmp, st);
    170             if (    rc == 0
    171                 &&  !S_ISDIR(st->st_mode))
    172               {
    173                 errno = ENOTDIR;
    174                 rc = -1;
    175               }
    176           }
    177       }
    178 #ifdef KMK_PRF
    179     {
    180         int err = errno;
    181         fprintf(stderr, "stat(%s,) -> %d/%d\n", path, rc, errno);
    182         errno = err;
    183     }
    184 #endif
    185     return rc;
    186145}
    187146
Note: See TracChangeset for help on using the changeset viewer.