+2002-05-05 Robert Collins <rbtcollins@hotmail.com>
+
+ * Makefile.am (inlint_SOURCES): Add conditional objects to inilint
+ depending on platform.
+ Add file:// support.
+ * configure.in: Set conditional MINGWTARGET if compiling against mingw
+ libraries.
+ * Makefile.in: Regenerate.
+ * configure: Ditto.
+ * io_stream_file.cc: Only use win32 calls when building for mingw.
+
2002-05-05 Robert Collins <rbtcollins@hotmail.com>
* Makefile.am (noinst_PROGRAMS): Make inilint configurable.
inilex.cc \
iniparse.cc
+if MINGWTARGET
+ inilint_extras = \
+ autoload.c \
+ mklink2.cc\
+ mklink2.cc
+else
+ inilint_extras =
+endif
+
inilint_LDADD = libgetopt++/libgetopt++.la -lstdc++ -luser32 -lkernel32
inilint_SOURCES = \
filemanip.cc \
iniparse.h \
io_stream.h \
io_stream.cc \
+ io_stream_file.h \
+ io_stream_file.cc \
IOStreamProvider.h \
PackageTrust.h \
rfc1738.cc \
rfc1738.h \
String++.cc \
- String++.h
+ String++.h \
+ $(inilint_extras)
setup_LDADD = res.o zlib/libzcygw.a bz2lib/libbz2.a libgetopt++/libgetopt++.la \
-lstdc++ -luser32 -lkernel32 \
iniparse.cc
+@MINGWTARGET_TRUE@inilint_extras = \
+@MINGWTARGET_TRUE@ autoload.c \
+@MINGWTARGET_TRUE@ mklink2.cc\
+@MINGWTARGET_TRUE@ mklink2.cc
+
+@MINGWTARGET_FALSE@inilint_extras =
+
inilint_LDADD = libgetopt++/libgetopt++.la -lstdc++ -luser32 -lkernel32
inilint_SOURCES = \
filemanip.cc \
iniparse.h \
io_stream.h \
io_stream.cc \
+ io_stream_file.h \
+ io_stream_file.cc \
IOStreamProvider.h \
PackageTrust.h \
rfc1738.cc \
rfc1738.h \
String++.cc \
- String++.h
+ String++.h \
+ $(inilint_extras)
setup_LDADD = res.o zlib/libzcygw.a bz2lib/libbz2.a libgetopt++/libgetopt++.la \
noinst_PROGRAMS = setup$(EXEEXT) @INILINT@
PROGRAMS = $(noinst_PROGRAMS)
+@MINGWTARGET_TRUE@am__objects_1 = autoload.$(OBJEXT) mklink2.$(OBJEXT) \
+@MINGWTARGET_TRUE@ mklink2.$(OBJEXT)
+@MINGWTARGET_FALSE@am__objects_1 =
am_inilint_OBJECTS = filemanip.$(OBJEXT) LogSingleton.$(OBJEXT) \
IniDBBuilder.$(OBJEXT) inilex.$(OBJEXT) inilintmain.$(OBJEXT) \
- iniparse.$(OBJEXT) io_stream.$(OBJEXT) rfc1738.$(OBJEXT) \
- String++.$(OBJEXT)
+ iniparse.$(OBJEXT) io_stream.$(OBJEXT) io_stream_file.$(OBJEXT) \
+ rfc1738.$(OBJEXT) String++.$(OBJEXT) $(am__objects_1)
inilint_OBJECTS = $(am_inilint_OBJECTS)
inilint_DEPENDENCIES = libgetopt++/libgetopt++.la
inilint_LDFLAGS =
#! /bin/sh
-# From configure.in Revision: 2.8 .
+# From configure.in Revision: 2.9 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53.
#
subdirs="$subdirs libgetopt++"
+case "$host_os" in
+mingw32)
+
+
+if true; then
+ MINGWTARGET_TRUE=
+ MINGWTARGET_FALSE='#'
+else
+ MINGWTARGET_TRUE='#'
+ MINGWTARGET_FALSE=
+fi
+
+ ;;
+*)
+
+
+if false; then
+ MINGWTARGET_TRUE=
+ MINGWTARGET_FALSE='#'
+else
+ MINGWTARGET_TRUE='#'
+ MINGWTARGET_FALSE=
+fi
+
+ ;;
+esac
+
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${MINGWTARGET_TRUE}" && test -z "${MINGWTARGET_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"MINGWTARGET\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MINGWTARGET\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${MINGWTARGET_TRUE}" && test -z "${MINGWTARGET_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"MINGWTARGET\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MINGWTARGET\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
s,@WINDRES@,$WINDRES,;t t
s,@ac_ct_WINDRES@,$ac_ct_WINDRES,;t t
s,@subdirs@,$subdirs,;t t
+s,@MINGWTARGET_TRUE@,$MINGWTARGET_TRUE,;t t
+s,@MINGWTARGET_FALSE@,$MINGWTARGET_FALSE,;t t
CEOF
_ACEOF
AC_CONFIG_SUBDIRS(bz2lib)
AC_CONFIG_SUBDIRS(libgetopt++)
+dnl add portability sources to inilint
+case "$host_os" in
+mingw32)
+ AM_CONDITIONAL(MINGWTARGET, true)
+ ;;
+*)
+ AM_CONDITIONAL(MINGWTARGET, false)
+ ;;
+esac
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AC_CONFIG_SUBDIRS(bz2lib)
AC_CONFIG_SUBDIRS(libgetopt++)
+dnl add portability sources to inilint
+case "$host_os" in
+mingw32)
+ AM_CONDITIONAL(MINGWTARGET, true)
+ ;;
+*)
+ AM_CONDITIONAL(MINGWTARGET, false)
+ ;;
+esac
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
"\n%%% $Id$\n";
#endif
+#if defined(WIN32) && !defined (_CYGWIN_)
#include "win32.h"
+#include "port.h"
+#include "mkdir.h"
+#include "mklink2.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
-#include "port.h"
-#include "mkdir.h"
-#include "mklink2.h"
-#include "io_stream.h"
#include "io_stream_file.h"
#include "IOStreamProvider.h"
int
io_stream_file::exists (String const &path)
{
+#if defined(WIN32) && !defined (_CYGWIN_)
if (_access (path.cstr_oneuse(), 0) == 0)
+#else
+ if (access (path.cstr_oneuse(), F_OK) == 0)
+#endif
return 1;
return 0;
}
{
if (!path.size())
return 1;
-
+#if defined(WIN32) && !defined (_CYGWIN_)
unsigned long w = GetFileAttributes (path.cstr_oneuse());
if (w != 0xffffffff && w & FILE_ATTRIBUTE_DIRECTORY)
{
delete[] tmp;
}
return !DeleteFileA (path.cstr_oneuse());
-
+#else
+ // FIXME: try rmdir if unlink fails - remove the dir
+ return unlink (path.cstr_oneuse());
+#endif
}
int
{
if (!from.size() || !to.size())
return 1;
+#if defined(WIN32) && !defined (_CYGWIN_)
switch (linktype)
{
case IO_STREAM_SYMLINK:
case IO_STREAM_HARDLINK:
return 1;
}
+#else
+ switch (linktype)
+ {
+ case IO_STREAM_SYMLINK:
+ return symlink (to.cstr_oneuse(), from.cstr_oneuse());
+ case IO_STREAM_HARDLINK:
+ return link (to.cstr_oneuse(), from.cstr_oneuse());
+ }
+#endif
return 1;
}
return 1;
if (fp)
fclose (fp);
+#if defined(WIN32) && !defined (_CYGWIN_)
long long ftimev = mtime * NSPERSEC + FACTOR;
FILETIME ftime;
ftime.dwHighDateTime = ftimev >> 32;
CloseHandle (h);
return 0;
}
+#else
+ throw new runtime_error ("set_mtime not supported on posix yet.");
+#endif
return 1;
}
{
if (!fname.size())
return 0;
+#if defined(WIN32) && !defined (_CYGWIN_)
HANDLE h;
WIN32_FIND_DATA buf;
DWORD ret = 0;
FindClose (h);
}
return ret;
+#else
+ struct stat buf;
+ if (stat(fname.cstr_oneuse(), &buf))
+ throw new runtime_error ("Failed to stat file - has it been deleted?");
+ return buf.st_size;
+#endif
}