Code in sys/dev/aic7xxx/aicasm/ contains a few checks on the __linux__
macro that actually break build on GNU systems (including Linux-based
ones but also GNU/kFreeBSD).

Some of them use __linux__ to include an alternate version of
<sys/queue.h> that would be placed in "../queue.h".  However that file
isn't present, which causes build failure.  However, this isn't needed
anyway, because non-BSD systems can use libbsd [1] to override the GNU
version of <sys/queue.h> with a suitable one (Debian uses this method
extensively).  Hence I propose simply including <sys/queue.h>.

In aicasm_symbol.c the __linux__ case again tries to include a
non-existant file.  As solution I propose assuming that non-BSD
systems have installed the 1.85 version of Sleepycat library, which
attempts to provide the same API as the BSD native libdb.

aicasm.c wants to include <endian.h> only on Linux-based systems, but
actually any system with Glibc would provide this file.  Proposing fix
to use __GLIBC__ instead.

Thanks

[1] http://libbsd.freedesktop.org/wiki/

-- 
Robert Millan
Index: sys/dev/aic7xxx/aicasm/aicasm.h
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm.h     (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm.h     (working copy)
@@ -42,11 +42,7 @@
  * $FreeBSD$
  */
 
-#ifdef __linux__
-#include "../queue.h"
-#else
 #include <sys/queue.h>
-#endif
 
 #ifndef TRUE
 #define TRUE 1
Index: sys/dev/aic7xxx/aicasm/aicasm_symbol.c
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm_symbol.c      (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm_symbol.c      (working copy)
@@ -44,10 +44,11 @@
 
 #include <sys/types.h>
 
-#ifdef __linux__
-#include "aicdb.h"
+#include <sys/param.h>         /* BSD */
+#ifdef BSD
+#include <db.h>                        /* BSD native libdb */
 #else
-#include <db.h>
+#include <db_185.h>            /* Sleepycat 1.85 compat */
 #endif
 #include <ctype.h>
 #include <fcntl.h>
Index: sys/dev/aic7xxx/aicasm/aicasm_symbol.h
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm_symbol.h      (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm_symbol.h      (working copy)
@@ -42,11 +42,7 @@
  * $FreeBSD$
  */
 
-#ifdef __linux__
-#include "../queue.h"
-#else
 #include <sys/queue.h>
-#endif
 
 typedef enum {
        UNINITIALIZED,
Index: sys/dev/aic7xxx/aicasm/aicasm_gram.y
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm_gram.y        (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm_gram.y        (working copy)
@@ -51,12 +51,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
-
-#ifdef __linux__
-#include "../queue.h"
-#else
 #include <sys/queue.h>
-#endif
 
 #include "aicasm.h"
 #include "aicasm_symbol.h"
Index: sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y  (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y  (working copy)
@@ -51,12 +51,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
-
-#ifdef __linux__
-#include "../queue.h"
-#else
 #include <sys/queue.h>
-#endif
 
 #include "aicasm.h"
 #include "aicasm_symbol.h"
Index: sys/dev/aic7xxx/aicasm/aicasm_scan.l
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm_scan.l        (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm_scan.l        (working copy)
@@ -51,11 +51,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sysexits.h>
-#ifdef __linux__
-#include "../queue.h"
-#else
 #include <sys/queue.h>
-#endif
 
 #include "aicasm.h"
 #include "aicasm_symbol.h"
Index: sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l  (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l  (working copy)
@@ -51,11 +51,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sysexits.h>
-#ifdef __linux__
-#include "../queue.h"
-#else
 #include <sys/queue.h>
-#endif
 
 #include "aicasm.h"
 #include "aicasm_symbol.h"
Index: sys/dev/aic7xxx/aicasm/aicasm.c
===================================================================
--- sys/dev/aic7xxx/aicasm/aicasm.c     (revision 223721)
+++ sys/dev/aic7xxx/aicasm/aicasm.c     (working copy)
@@ -53,7 +53,7 @@
 #include <sysexits.h>
 #include <unistd.h>
 
-#if linux
+#ifdef __GLIBC__
 #include <endian.h>
 #else
 #include <machine/endian.h>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to