]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
2002-05-05 Robert Collins <rbtcollins@hotmail.com>
authorRobert Collins <rbtcollins@hotmail.com>
Mon, 6 May 2002 14:34:53 +0000 (14:34 +0000)
committerRobert Collins <rbtcollins@hotmail.com>
Mon, 6 May 2002 14:34:53 +0000 (14:34 +0000)
        * 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.

ChangeLog
Makefile.am
Makefile.in
configure
configure.ac
configure.in
io_stream_file.cc

index 49b26d7b331c5689356e66fd42000c01da1ab01f..a825fde0d27d7af7126edd3582977c53459713a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
index 703efb458db0bf9d8aee2da7ae592046cc263178..8e996613f3a3452bff15f4509f776f5eaa95150e 100644 (file)
@@ -58,6 +58,15 @@ BUILT_SOURCES = setup_version.c \
        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 \
@@ -72,12 +81,15 @@ inilint_SOURCES = \
   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 \
index 20b93e0b36f1e97494a4b5f611e58e4c25632239..361d6a1e06fb7254677eece1e3ce7fdc8e7c79be 100644 (file)
@@ -155,6 +155,13 @@ BUILT_SOURCES = setup_version.c \
        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 \
@@ -169,12 +176,15 @@ inilint_SOURCES = \
   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 \
@@ -338,10 +348,13 @@ EXTRA_PROGRAMS = inilint$(EXEEXT)
 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 =
index 3cd84b78b4ee7d78a4360cadf1daed99bce4cdb8..39de72bc009fb5a210c85198dd37b358fc992bdf 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /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.
 #
@@ -15100,6 +15100,33 @@ subdirs="$subdirs bz2lib"
 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
@@ -15223,6 +15250,20 @@ echo "$as_me: error: conditional \"AMDEP\" 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
+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
@@ -15767,6 +15808,8 @@ s,@LIBTOOL@,$LIBTOOL,;t t
 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
index c937f1ab37c8bd88ec76798fa2feca5fe41707cd..ddea32febe868973b53ea8aa3778074754f5a640 100644 (file)
@@ -74,5 +74,15 @@ AC_CONFIG_SUBDIRS(zlib)
 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
index c937f1ab37c8bd88ec76798fa2feca5fe41707cd..ddea32febe868973b53ea8aa3778074754f5a640 100644 (file)
@@ -74,5 +74,15 @@ AC_CONFIG_SUBDIRS(zlib)
 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
index f9018e38a2032740be2dccfd56d67b3a3d117cce..ad4359cd6b17a75e295189a24936ee0610953b36 100644 (file)
@@ -18,16 +18,18 @@ static const char *cvsid =
   "\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"
 
@@ -86,7 +88,11 @@ io_stream_file::~io_stream_file ()
 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;
 }
@@ -96,7 +102,7 @@ io_stream_file::remove (String const &path)
 {
   if (!path.size())
     return 1;
-
+#if defined(WIN32) && !defined (_CYGWIN_)
   unsigned long w = GetFileAttributes (path.cstr_oneuse());
   if (w != 0xffffffff && w & FILE_ATTRIBUTE_DIRECTORY)
     {
@@ -114,7 +120,10 @@ io_stream_file::remove (String const &path)
       delete[] tmp;
     }
   return !DeleteFileA (path.cstr_oneuse());
-
+#else
+  // FIXME: try rmdir if unlink fails - remove the dir
+  return unlink (path.cstr_oneuse());
+#endif
 }
 
 int
@@ -123,6 +132,7 @@ io_stream_file::mklink (String const &from, String const &to,
 {
   if (!from.size() || !to.size())
     return 1;
+#if defined(WIN32) && !defined (_CYGWIN_)
   switch (linktype)
     {
     case IO_STREAM_SYMLINK:
@@ -130,6 +140,15 @@ io_stream_file::mklink (String const &from, String const &to,
     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;
 }
 
@@ -201,6 +220,7 @@ io_stream_file::set_mtime (int mtime)
     return 1;
   if (fp)
     fclose (fp);
+#if defined(WIN32) && !defined (_CYGWIN_)
   long long ftimev = mtime * NSPERSEC + FACTOR;
   FILETIME ftime;
   ftime.dwHighDateTime = ftimev >> 32;
@@ -215,6 +235,9 @@ io_stream_file::set_mtime (int mtime)
       CloseHandle (h);
       return 0;
     }
+#else
+  throw new runtime_error ("set_mtime not supported on posix yet.");
+#endif
   return 1;
 }
 
@@ -231,6 +254,7 @@ io_stream_file::get_size ()
 {
   if (!fname.size())
     return 0;
+#if defined(WIN32) && !defined (_CYGWIN_)
   HANDLE h;
   WIN32_FIND_DATA buf;
   DWORD ret = 0;
@@ -243,4 +267,10 @@ io_stream_file::get_size ()
       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
 }
This page took 0.056926 seconds and 5 git commands to generate.