Fix all references to config.h

config.h is created in $(top_buildir)/config.h.
Let's make sure all CPPFLAGS add correct -Ipath includes,
and that all code includes the correct file.

Change-Id: Ie9ea38bb009bc715b01cde4d66d181f7bec2e7bd
diff --git a/src/codec/Makefile.am b/src/codec/Makefile.am
index c16ce9a..f05ac1f 100644
--- a/src/codec/Makefile.am
+++ b/src/codec/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=3:1:3
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS)
 
 if ENABLE_PSEUDOTALLOC
diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am
index d856918..42b16e8 100644
--- a/src/coding/Makefile.am
+++ b/src/coding/Makefile.am
@@ -5,7 +5,9 @@
 
 AM_CPPFLAGS = \
 	-I"$(top_srcdir)/include" \
-	-I"$(top_builddir)/include"
+	-I"$(top_builddir)/include" \
+	-I"$(top_builddir)" \
+	$(NULL)
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS)
 
 if ENABLE_PSEUDOTALLOC
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 2cfb281..9b812ce 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=19:0:0
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS) $(LIBSCTP_CFLAGS) $(LIBMNL_CFLAGS)
 
 if ENABLE_PSEUDOTALLOC
diff --git a/src/core/gsmtap_util.c b/src/core/gsmtap_util.c
index 2571b85..cb7538b 100644
--- a/src/core/gsmtap_util.c
+++ b/src/core/gsmtap_util.c
@@ -19,7 +19,7 @@
  *
  */
 
-#include "../config.h"
+#include "config.h"
 
 #include <osmocom/core/gsmtap_util.h>
 #include <osmocom/core/logging.h>
diff --git a/src/core/it_q.c b/src/core/it_q.c
index fda6c1f..a3ff420 100644
--- a/src/core/it_q.c
+++ b/src/core/it_q.c
@@ -32,7 +32,7 @@
  * and call a queue-specific callback function.
  */
 
-#include "../config.h"
+#include "config.h"
 
 #ifdef HAVE_SYS_EVENTFD_H
 
diff --git a/src/core/logging.c b/src/core/logging.c
index ce42e4c..938c65f 100644
--- a/src/core/logging.c
+++ b/src/core/logging.c
@@ -25,7 +25,7 @@
  *
  * \file logging.c */
 
-#include "../config.h"
+#include "config.h"
 
 #include <stdarg.h>
 #include <stdlib.h>
diff --git a/src/core/logging_gsmtap.c b/src/core/logging_gsmtap.c
index cc95388..dfd059b 100644
--- a/src/core/logging_gsmtap.c
+++ b/src/core/logging_gsmtap.c
@@ -27,7 +27,7 @@
  *  @{
  * \file logging_gsmtap.c */
 
-#include "../config.h"
+#include "config.h"
 
 #include <stdarg.h>
 #include <stdlib.h>
diff --git a/src/core/logging_syslog.c b/src/core/logging_syslog.c
index 2090856..1153bdf 100644
--- a/src/core/logging_syslog.c
+++ b/src/core/logging_syslog.c
@@ -22,7 +22,7 @@
  *  @{
  * \file logging_syslog.c */
 
-#include "../config.h"
+#include "config.h"
 
 #ifdef HAVE_SYSLOG_H
 
diff --git a/src/core/panic.c b/src/core/panic.c
index 6c92522..bbf6d08 100644
--- a/src/core/panic.c
+++ b/src/core/panic.c
@@ -27,7 +27,7 @@
 #include <osmocom/core/panic.h>
 #include <osmocom/core/backtrace.h>
 
-#include "../config.h"
+#include "config.h"
 
 
 static osmo_panic_handler_t osmo_panic_handler = (void*)0;
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 5f44a40..687ad40 100644
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
@@ -23,7 +23,7 @@
  *  @{
  * \file plugin.c */
 
-#include "../config.h"
+#include "config.h"
 
 #if HAVE_DLFCN_H
 
diff --git a/src/core/select.c b/src/core/select.c
index 026d457..72f794f 100644
--- a/src/core/select.c
+++ b/src/core/select.c
@@ -36,7 +36,7 @@
 #include <osmocom/core/stat_item.h>
 #include <osmocom/core/stats_tcp.h>
 
-#include "../config.h"
+#include "config.h"
 
 #if defined(HAVE_SYS_SELECT_H) && defined(HAVE_POLL_H)
 #include <sys/select.h>
diff --git a/src/core/socket.c b/src/core/socket.c
index ee49c27..43736e0 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -17,7 +17,7 @@
  *
  */
 
-#include "../config.h"
+#include "config.h"
 
 /*! \addtogroup socket
  *  @{
diff --git a/src/core/utils.c b/src/core/utils.c
index 2012b74..231b65c 100644
--- a/src/core/utils.c
+++ b/src/core/utils.c
@@ -459,7 +459,7 @@
 	__attribute__((weak, alias("osmo_hexdump_nospc")));
 #endif
 
-#include "../config.h"
+#include "config.h"
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
 /*! Convert an entire string to lower case
diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am
index 20de7d6..3134079 100644
--- a/src/ctrl/Makefile.am
+++ b/src/ctrl/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=7:0:7
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS)
 
 if ENABLE_CTRL
diff --git a/src/gb/Makefile.am b/src/gb/Makefile.am
index 32a03c8..1a26939 100644
--- a/src/gb/Makefile.am
+++ b/src/gb/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=14:0:0
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall -fno-strict-aliasing \
 	    $(TALLOC_CFLAGS) \
 	    $(LIBMNL_CFLAGS) \
diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c
index ccefe54..c26cd82 100644
--- a/src/gsm/gsm0411_utils.c
+++ b/src/gsm/gsm0411_utils.c
@@ -27,7 +27,7 @@
  *
  */
 
-#include "../../config.h"
+#include "config.h"
 
 #include <time.h>
 #include <string.h>
diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index bbc7dd6..48341ae 100644
--- a/src/gsm/gsm_utils.c
+++ b/src/gsm/gsm_utils.c
@@ -92,7 +92,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "../../config.h"
+#include "config.h"
 
 #if (!EMBEDDED)
 /* FIXME: this can be removed once we bump glibc requirements to 2.25: */
diff --git a/src/gsm/kdf.c b/src/gsm/kdf.c
index 6982f6f..4113aad 100644
--- a/src/gsm/kdf.c
+++ b/src/gsm/kdf.c
@@ -22,7 +22,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "../../config.h"
+#include "config.h"
 #if (USE_GNUTLS)
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
diff --git a/src/gsm/mncc.c b/src/gsm/mncc.c
index 938cf9a..8a7dc4d 100644
--- a/src/gsm/mncc.c
+++ b/src/gsm/mncc.c
@@ -20,7 +20,7 @@
  *
  */
 
-#include "../config.h"
+#include "config.h"
 
 #ifdef HAVE_SYS_SOCKET_H
 
diff --git a/src/pseudotalloc/Makefile.am b/src/pseudotalloc/Makefile.am
index 1b86183..030b281 100644
--- a/src/pseudotalloc/Makefile.am
+++ b/src/pseudotalloc/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I. -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I. -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall
 
 if ENABLE_PSEUDOTALLOC
diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am
index 51424c7..dee59bb 100644
--- a/src/sim/Makefile.am
+++ b/src/sim/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=3:1:1
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -fPIC -Wall $(TALLOC_CFLAGS)
 AM_LDFLAGS = $(COVERAGE_LDFLAGS)
 
diff --git a/src/usb/Makefile.am b/src/usb/Makefile.am
index b097aa7..c7d7a2a 100644
--- a/src/usb/Makefile.am
+++ b/src/usb/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=0:1:0
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -fPIC -Wall $(LIBUSB_CFLAGS) $(TALLOC_CFLAGS)
 AM_LDFLAGS = $(COVERAGE_LDFLAGS)
 
diff --git a/src/vty/Makefile.am b/src/vty/Makefile.am
index c2d133a..3da0919 100644
--- a/src/vty/Makefile.am
+++ b/src/vty/Makefile.am
@@ -3,7 +3,7 @@
 # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
 LIBVERSION=11:0:2
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS)
 
 if ENABLE_VTY
diff --git a/src/vty/cpu_sched_vty.c b/src/vty/cpu_sched_vty.c
index 301e7a6..7198f74 100644
--- a/src/vty/cpu_sched_vty.c
+++ b/src/vty/cpu_sched_vty.c
@@ -25,7 +25,7 @@
 
 #define _GNU_SOURCE
 
-#include "../../config.h"
+#include "config.h"
 
 #include <string.h>
 #include <stdlib.h>
diff --git a/src/vty/fsm_vty.c b/src/vty/fsm_vty.c
index 777d38c..da6038f 100644
--- a/src/vty/fsm_vty.c
+++ b/src/vty/fsm_vty.c
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "../../config.h"
+#include "config.h"
 
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/buffer.h>
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 59c8a9c..2a07422 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "../../config.h"
+#include "config.h"
 
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/logging.h>
diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c
index 299ec24..f940018 100644
--- a/src/vty/stats_vty.c
+++ b/src/vty/stats_vty.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "../../config.h"
+#include "config.h"
 
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/buffer.h>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f0eaaca..78666e9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS)
 AM_LDFLAGS = -no-install
 LDADD = $(top_builddir)/src/core/libosmocore.la $(TALLOC_LIBS) $(PTHREAD_LIBS)
diff --git a/tests/socket/socket_sctp_test.c b/tests/socket/socket_sctp_test.c
index b318fe5..e099be9 100644
--- a/tests/socket/socket_sctp_test.c
+++ b/tests/socket/socket_sctp_test.c
@@ -31,7 +31,7 @@
 #include <osmocom/core/logging.h>
 #include <osmocom/core/bits.h>
 
-#include "../config.h"
+#include "config.h"
 
 void *ctx = NULL;
 
diff --git a/tests/socket/socket_test.c b/tests/socket/socket_test.c
index b3b9584..ddb6926 100644
--- a/tests/socket/socket_test.c
+++ b/tests/socket/socket_test.c
@@ -32,7 +32,7 @@
 #include <osmocom/core/logging.h>
 #include <osmocom/core/bits.h>
 
-#include "../config.h"
+#include "config.h"
 
 void *ctx = NULL;
 
diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c
index b06c774..9c51ad9 100644
--- a/tests/timer/timer_test.c
+++ b/tests/timer/timer_test.c
@@ -29,7 +29,7 @@
 #include <osmocom/core/select.h>
 #include <osmocom/core/linuxlist.h>
 
-#include "../config.h"
+#include "config.h"
 
 static void main_timer_fired(void *data);
 static void secondary_timer_fired(void *data);
diff --git a/utils/osmo-stat-dummy/osmo-stat-dummy.c b/utils/osmo-stat-dummy/osmo-stat-dummy.c
index d8036e4..37da7b3 100644
--- a/utils/osmo-stat-dummy/osmo-stat-dummy.c
+++ b/utils/osmo-stat-dummy/osmo-stat-dummy.c
@@ -36,7 +36,7 @@
 #include <osmocom/vty/stats.h>
 #include <osmocom/vty/misc.h>
 
-#include "../../config.h"
+#include "config.h"
 
 void *tall_statdummy_ctx  = NULL;
 static bool quit = false;