From f473454ff7cdddd189998132fe31138ba1c49ef5 Mon Sep 17 00:00:00 2001 From: Job Snijders Date: Tue, 17 Aug 2021 11:16:35 +0000 Subject: [PATCH] Reorganize compat dir --- Makefile.am | 6 ++---- bgpq4.h | 4 ---- compat/Makefile.am | 11 +++++++++++ configure.ac | 14 +------------- include/Makefile.am | 1 + sys_queue.h => include/sys/queue.h | 0 sx_slentry.h | 9 --------- 7 files changed, 15 insertions(+), 30 deletions(-) create mode 100644 compat/Makefile.am rename sys_queue.h => include/sys/queue.h (100%) diff --git a/Makefile.am b/Makefile.am index 9965f7c..1ad5d72 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,15 +1,13 @@ AUTOMAKE_OPTIONS=foreign subdir-objects -SUBDIRS = include +SUBDIRS = include compat bin_PROGRAMS=bgpq4 -COMPAT_SOURCES=compat/strlcpy.c - bgpq4_SOURCES=bgpq4.c bgpq4.h config.h bgpq4_printer.c bgpq_expander.c \ expander_freeall.c expander_freeall.h sx_maxsockbuf.c \ sx_maxsockbuf.h sx_prefix.c sx_prefix.h sx_report.c sx_report.h \ - sx_slentry.c sx_slentry.h sys_queue.h $(COMPAT_SOURCES) + sx_slentry.c sx_slentry.h dist_man8_MANS=bgpq4.8 diff --git a/bgpq4.h b/bgpq4.h index 5ebfe81..545a027 100644 --- a/bgpq4.h +++ b/bgpq4.h @@ -1,11 +1,7 @@ #ifndef BGPQ4_H_ #define BGPQ4_H_ -#if HAVE_SYS_QUEUE_H && HAVE_STAILQ_IN_SYS_QUEUE #include -#else -#include "sys_queue.h" -#endif #include "sx_prefix.h" #include "sx_slentry.h" diff --git a/compat/Makefile.am b/compat/Makefile.am new file mode 100644 index 0000000..4eb89b5 --- /dev/null +++ b/compat/Makefile.am @@ -0,0 +1,11 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include + +noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la + +# compatibility functions that need to be built without optimizations +libcompatnoopt_la_CFLAGS = -O0 +libcompatnoopt_la_SOURCES = + +if !HAVE_STRLCPY +libcompat_la_SOURCES += strlcpy.c +endif diff --git a/configure.ac b/configure.ac index b0c4779..bcb4e2f 100644 --- a/configure.ac +++ b/configure.ac @@ -13,19 +13,6 @@ AC_PROG_INSTALL AC_CHECK_HEADERS([sys/cdefs.h sys/queue.h sys/tree.h sys/select.h]) AC_MSG_CHECKING([for STAILQ_ interface in queue.h]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#if HAVE_SYS_QUEUE_H -#include -#else -#include "sys_queue.h" -#endif -struct blah { - STAILQ_ENTRY(blah) next; -}; -])], -[AC_MSG_RESULT(yes) -AC_DEFINE([HAVE_STAILQ_IN_SYS_QUEUE], [1], [sys/queue.h have STAILQ_])], -[AC_MSG_RESULT(no)]) AC_CHECK_FUNCS(strlcpy) AC_CHECK_FUNCS(pledge) @@ -36,6 +23,7 @@ AC_CHECK_LIB(nsl,getaddrinfo) AC_CONFIG_FILES([ Makefile include/Makefile + compat/Makefile ]) AC_OUTPUT diff --git a/include/Makefile.am b/include/Makefile.am index 0aaa784..815c881 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,2 +1,3 @@ noinst_HEADERS = +noinst_HEADERS += sys/queue.h noinst_HEADERS += sys/tree.h diff --git a/sys_queue.h b/include/sys/queue.h similarity index 100% rename from sys_queue.h rename to include/sys/queue.h diff --git a/sx_slentry.h b/sx_slentry.h index 01b3825..a1631a3 100644 --- a/sx_slentry.h +++ b/sx_slentry.h @@ -1,17 +1,8 @@ #ifndef SX_SLENTRY_H_ #define SX_SLENTRY_H_ -#if HAVE_SYS_QUEUE_H && HAVE_STAILQ_IN_SYS_QUEUE #include -#else -#include "sys_queue.h" -#endif - -#if HAVE_SYS_TREE_H #include -#else -#include -#endif struct sx_slentry { STAILQ_ENTRY(sx_slentry) next;