On Wed, 24 Jan 2001, Sam TH wrote:
> So, now we have a real build problem.  ms-ole.c complains about the
> inclusion of unistd.h in wv.  Strangely enough, this is wrapped in a
> _HAVE_UNISTD_H ifdef.  However, this file is included twice in the .c
> file, and I suspect this may be the cause of the breakage.  

Okay, slight revision to earlier patch which fixes this as well.

=====

Can I just add, as a general comment, that "config.h" is very often
application specific and should not be visible to independent packages.

For one thing, since all the defs have standard names there can be
conflicts when one config.h defines
#define HasPNG
and another config.h defines
#define HasPNG 1
for example.

For another, the config.h represents the configuration at the
time configure was run, so the presence of old, visible config.h files
littering the system is highly undesireable.

Finally, config.h often has additional defines unrelated to the usual
tests, and including the wrong one will miss these.

For certainty, there should always be only one config.h in the include
path...

Regards, Frank
<[EMAIL PROTECTED]>

Francis James Franklin
[EMAIL PROTECTED]

Diodorus the professor of logic died of shame because he could not at once 
solve a problem put to him in jest by Stilpo.
                                                       --- Pliny the Elder
diff -Naur wv.orig/getopt.c wv/getopt.c
--- wv.orig/getopt.c    Sat Sep  2 21:04:10 2000
+++ wv/getopt.c Thu Jan 25 10:16:47 2001
@@ -70,7 +70,9 @@
 /* Don't include stdlib.h for non-GNU C libraries because some of them
    contain conflicting prototypes for getopt.  */
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #endif /* GNU C library.  */
 
 #ifdef VMS
diff -Naur wv.orig/gtk/tester.c wv/gtk/tester.c
--- wv.orig/gtk/tester.c        Fri Dec  8 06:01:22 2000
+++ wv/gtk/tester.c     Thu Jan 25 10:16:47 2001
@@ -5,7 +5,9 @@
 #include <gnome.h>
 #include <gtk/gtk.h>
 #include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <limits.h>
 
 #ifndef MAXPATH
diff -Naur wv.orig/libole2/ms-ole.c wv/libole2/ms-ole.c
--- wv.orig/libole2/ms-ole.c    Thu Jan 25 08:52:46 2001
+++ wv/libole2/ms-ole.c Thu Jan 25 10:18:10 2001
@@ -10,6 +10,10 @@
 
 #include <stdio.h>
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 /* BSDs require unistd.h before including stat.h */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -23,20 +27,13 @@
 #include <glib.h>
 #include <string.h>
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "ms-ole.h"
 
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 #endif
 
-#ifdef HAVE_UNISTD_H 
-#      include <unistd.h>
-#else
-
+#ifndef HAVE_UNISTD_H 
 #if 0
 #include <io.h> 
 #endif
diff -Naur wv.orig/magick/magick.h wv/magick/magick.h
--- wv.orig/magick/magick.h     Sat Sep  2 21:04:34 2000
+++ wv/magick/magick.h  Thu Jan 25 10:16:47 2001
@@ -4,6 +4,10 @@
 #ifndef _MAGICK_H
 #define _MAGICK_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if defined(sun)
 #define __EXTENSIONS__  1
 #endif
@@ -33,7 +37,9 @@
 #if defined(_VISUALC_)
 #include <direct.h>
 #else
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #endif
 #include <ctype.h>
 #include <signal.h>
diff -Naur wv.orig/wvConvert.c wv/wvConvert.c
--- wv.orig/wvConvert.c Fri Dec  8 06:01:20 2000
+++ wv/wvConvert.c      Thu Jan 25 10:16:47 2001
@@ -1,11 +1,10 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-/* already done in wv.h
- #include "config.h"
-*/
 #ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
 #endif
 #include "wv.h"
 #include "getopt.h"
diff -Naur wv.orig/wvRTF.c wv/wvRTF.c
--- wv.orig/wvRTF.c     Wed Dec 27 18:48:33 2000
+++ wv/wvRTF.c  Thu Jan 25 10:16:47 2001
@@ -1,13 +1,15 @@
-#include <stdlib.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <time.h>
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "getopt.h"
 #include "wv.h"
 
diff -Naur wv.orig/wvWare.c wv/wvWare.c
--- wv.orig/wvWare.c    Thu Dec 28 16:50:53 2000
+++ wv/wvWare.c Thu Jan 25 10:16:47 2001
@@ -1,10 +1,12 @@
-#include <stdlib.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
 #endif
 #include "wv.h"
 #include "getopt.h"

Reply via email to