Reorganize compat dir

This commit is contained in:
Job Snijders
2021-08-17 11:16:35 +00:00
parent 16fd7f7668
commit f473454ff7
7 changed files with 15 additions and 30 deletions

View File

@@ -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

View File

@@ -1,11 +1,7 @@
#ifndef BGPQ4_H_
#define BGPQ4_H_
#if HAVE_SYS_QUEUE_H && HAVE_STAILQ_IN_SYS_QUEUE
#include <sys/queue.h>
#else
#include "sys_queue.h"
#endif
#include "sx_prefix.h"
#include "sx_slentry.h"

11
compat/Makefile.am Normal file
View File

@@ -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

View File

@@ -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 <sys/queue.h>
#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

View File

@@ -1,2 +1,3 @@
noinst_HEADERS =
noinst_HEADERS += sys/queue.h
noinst_HEADERS += sys/tree.h

View File

@@ -1,17 +1,8 @@
#ifndef SX_SLENTRY_H_
#define SX_SLENTRY_H_
#if HAVE_SYS_QUEUE_H && HAVE_STAILQ_IN_SYS_QUEUE
#include <sys/queue.h>
#else
#include "sys_queue.h"
#endif
#if HAVE_SYS_TREE_H
#include <sys/tree.h>
#else
#include <sys/tree.h>
#endif
struct sx_slentry {
STAILQ_ENTRY(sx_slentry) next;