[PATCH 5/9] drop GCC specific compiler flag -include

Michael Haubenwallner michael.haubenwallner at ssi-schaefer.com
Mon Apr 10 11:10:42 UTC 2017


Instead, explicitly include config.h in library source files for
increased portability.
---
 src/Makefile.am | 3 ++-
 src/helper.c    | 4 ++++
 src/md2.c       | 4 ++++
 src/md4.c       | 4 ++++
 src/md5.c       | 4 ++++
 src/rmd160.c    | 5 +++++
 src/sha1.c      | 4 ++++
 src/sha2.c      | 4 ++++
 8 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index dc0d160..041b6d8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
 AM_CPPFLAGS = \
+	-I$(top_builddir) \
 	-I$(top_srcdir)/include \
-	-include $(top_builddir)/config.h
+	$(nil)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = \
diff --git a/src/helper.c b/src/helper.c
index 5b16ec1..5548f31 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -9,6 +9,10 @@
  * ----------------------------------------------------------------------------
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/param.h>
 #include <sys/stat.h>
 
diff --git a/src/md2.c b/src/md2.c
index 4516326..73f3160 100644
--- a/src/md2.c
+++ b/src/md2.c
@@ -29,6 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if defined(LIBC_SCCS) && !defined(lint)
 __RCSID("$NetBSD: md2.c,v 1.7 2012/06/25 22:32:44 abs Exp $");
 #endif /* LIBC_SCCS and not lint */
diff --git a/src/md4.c b/src/md4.c
index cf32b29..caa070a 100644
--- a/src/md4.c
+++ b/src/md4.c
@@ -18,6 +18,10 @@
  * will fill a supplied 16-byte array with the digest.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <string.h>
 #include <md4.h>
diff --git a/src/md5.c b/src/md5.c
index 0fc118a..ac111c9 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -17,6 +17,10 @@
  * will fill a supplied 16-byte array with the digest.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <string.h>
 #include <md5.h>
diff --git a/src/rmd160.c b/src/rmd160.c
index d68f2e4..62471ef 100644
--- a/src/rmd160.c
+++ b/src/rmd160.c
@@ -26,6 +26,11 @@
  * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997,
  * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <string.h>
 #include <sys/types.h>
 #ifdef HAVE_SYS_ENDIAN_H
diff --git a/src/sha1.c b/src/sha1.c
index 9f69f15..4fa4f76 100644
--- a/src/sha1.c
+++ b/src/sha1.c
@@ -14,6 +14,10 @@
  *   34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/param.h>
 #include <string.h>
 #include <sha1.h>
diff --git a/src/sha2.c b/src/sha2.c
index 029d0d4..6ce41d3 100644
--- a/src/sha2.c
+++ b/src/sha2.c
@@ -34,6 +34,10 @@
  * $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 
 #include <string.h>
-- 
2.10.2



More information about the libbsd mailing list