mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Merge pull request #1094 from hamishcoleman/autoconf
Autoconf Refactoring
This commit is contained in:
commit
40c99fcdee
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
|
@ -106,7 +106,6 @@ jobs:
|
|||
fail-fast: true
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-22.04
|
||||
- ubuntu-20.04
|
||||
- ubuntu-22.04
|
||||
|
||||
|
@ -178,7 +177,6 @@ jobs:
|
|||
fail-fast: true
|
||||
matrix:
|
||||
os:
|
||||
- macos-12
|
||||
- macos-11
|
||||
- macos-12
|
||||
|
||||
|
@ -282,6 +280,10 @@ jobs:
|
|||
./scripts/hack_fakeautoconf.sh
|
||||
shell: bash
|
||||
|
||||
- name: Build the project
|
||||
run: make
|
||||
shell: bash
|
||||
|
||||
- name: Run embedded unit tests
|
||||
run: make test.units
|
||||
shell: bash
|
||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,12 +3,12 @@
|
|||
*.gz
|
||||
configure
|
||||
config.log
|
||||
config.mak
|
||||
config.rpath
|
||||
config.status
|
||||
include/config.h
|
||||
include/config.h.in
|
||||
/Makefile
|
||||
tools/Makefile
|
||||
tools/config.mak
|
||||
autom4te.cache
|
||||
edge
|
||||
example_edge_embed_quick_edge_init
|
||||
|
|
|
@ -1,24 +1,10 @@
|
|||
|
||||
# NOTE: these are needed by the configure.in inside the packages folder
|
||||
N2N_VERSION=@N2N_VERSION@
|
||||
|
||||
########
|
||||
|
||||
export CC
|
||||
export AR
|
||||
CC=@CC@
|
||||
AR=@AR@
|
||||
include config.mak
|
||||
|
||||
#Ultrasparc64 users experiencing SIGBUS should try the following gcc options
|
||||
#(thanks to Robert Gibbon)
|
||||
PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs
|
||||
|
||||
export CFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
CFLAGS=@CFLAGS@ -I./include
|
||||
LDFLAGS=@LDFLAGS@ -L.
|
||||
|
||||
OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?)
|
||||
ifeq ($(OPENSSL_CFLAGS), 0)
|
||||
CFLAGS+=$(shell pkg-config --cflags-only-I openssl)
|
||||
|
@ -78,8 +64,44 @@ MAN7DIR=$(MANDIR)/man7
|
|||
MAN8DIR=$(MANDIR)/man8
|
||||
|
||||
N2N_LIB=libn2n.a
|
||||
N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c))
|
||||
N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile
|
||||
N2N_OBJS=\
|
||||
src/aes.o \
|
||||
src/auth.o \
|
||||
src/cc20.o \
|
||||
src/curve25519.o \
|
||||
src/edge_management.o \
|
||||
src/edge_utils.o \
|
||||
src/edge_utils_win32.o \
|
||||
src/header_encryption.o \
|
||||
src/hexdump.o \
|
||||
src/json.o \
|
||||
src/management.o \
|
||||
src/minilzo.o \
|
||||
src/n2n.o \
|
||||
src/n2n_port_mapping.o \
|
||||
src/n2n_regex.o \
|
||||
src/network_traffic_filter.o \
|
||||
src/pearson.o \
|
||||
src/random_numbers.o \
|
||||
src/sn_management.o \
|
||||
src/sn_selection.o \
|
||||
src/sn_utils.o \
|
||||
src/speck.o \
|
||||
src/tf.o \
|
||||
src/transform_aes.o \
|
||||
src/transform_cc20.o \
|
||||
src/transform_lzo.o \
|
||||
src/transform_null.o \
|
||||
src/transform_speck.o \
|
||||
src/transform_tf.o \
|
||||
src/transform_zstd.o \
|
||||
src/tuntap_freebsd.o \
|
||||
src/tuntap_linux.o \
|
||||
src/tuntap_netbsd.o \
|
||||
src/tuntap_osx.o \
|
||||
src/wire.o \
|
||||
|
||||
N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) config.mak
|
||||
|
||||
# As source files pass the linter, they can be added here (If all the source
|
||||
# is passing the linter tests, this can be refactored)
|
||||
|
@ -119,10 +141,9 @@ LINT_CCODE=\
|
|||
tools/tests-transform.c \
|
||||
tools/tests-wire.c \
|
||||
|
||||
export LDLIBS
|
||||
|
||||
LDLIBS+=-ln2n
|
||||
LDLIBS+=@N2N_LIBS@
|
||||
LDLIBS+=$(LDLIBS_EXTRA)
|
||||
|
||||
#For OpenSolaris (Solaris too?)
|
||||
ifeq ($(CONFIG_TARGET), sunos)
|
||||
|
@ -259,6 +280,7 @@ endif
|
|||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f src/edge.o src/supernode.o src/example_edge_embed.o src/example_edge_embed_quick_edge_init.o src/example_sn_embed.o
|
||||
rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~
|
||||
rm -f tests/*.out src/*.gcno src/*.gcda
|
||||
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
rm -f include/config.h include/config.h.in include/config.h.in~ Makefile configure
|
||||
rm -f include/config.h include/config.h.in include/config.h.in~ config.mak configure
|
||||
|
||||
echo "Wait please..."
|
||||
autoreconf -if
|
||||
|
|
15
config.mak.in
Normal file
15
config.mak.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
export N2N_VERSION
|
||||
export CC
|
||||
export AR
|
||||
export CFLAGS
|
||||
export LDFLAGS
|
||||
export LDLIBS_EXTRA
|
||||
export TOOLS_ADDITIONAL
|
||||
|
||||
N2N_VERSION=@N2N_VERSION@
|
||||
CC=@CC@
|
||||
AR=@AR@
|
||||
CFLAGS=@CFLAGS@ -I./include
|
||||
LDFLAGS=@LDFLAGS@ -L.
|
||||
LDLIBS_EXTRA=@N2N_LIBS_EXTRA@
|
||||
TOOLS_ADDITIONAL=@TOOLS_ADDITIONAL@
|
23
configure.ac
23
configure.ac
|
@ -11,7 +11,7 @@ if test "${AR+set}" != set; then
|
|||
AR=ar
|
||||
fi
|
||||
|
||||
N2N_LIBS=
|
||||
N2N_LIBS_EXTRA=
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
|
@ -35,7 +35,7 @@ AS_IF([test "x$with_zstd" != "xno"],
|
|||
[AC_CHECK_LIB([zstd], [ZSTD_compress],
|
||||
[
|
||||
AC_DEFINE([HAVE_ZSTD], [1], [Have ZSTD support])
|
||||
N2N_LIBS="-lzstd ${N2N_LIBS}"
|
||||
N2N_LIBS_EXTRA="-lzstd ${N2N_LIBS_EXTRA}"
|
||||
],
|
||||
[AC_MSG_ERROR([zstd library not found])]
|
||||
)],
|
||||
|
@ -49,7 +49,7 @@ AS_IF([test "x$with_openssl" != xno],
|
|||
[AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset],
|
||||
[
|
||||
AC_DEFINE([HAVE_OPENSSL_1_1], [1], [OpenSSL 1.1 is present])
|
||||
N2N_LIBS="-lcrypto ${N2N_LIBS}"
|
||||
N2N_LIBS_EXTRA="-lcrypto ${N2N_LIBS_EXTRA}"
|
||||
],
|
||||
[AC_MSG_ERROR([openssl library not found])]
|
||||
)],
|
||||
|
@ -62,7 +62,7 @@ AS_IF([test "x$enable_miniupnp" != xno],
|
|||
[AC_CHECK_LIB([miniupnpc], [upnpDiscover],
|
||||
[
|
||||
AC_DEFINE([HAVE_MINIUPNP], [1], [Have miniupnp library])
|
||||
N2N_LIBS="-lminiupnpc ${N2N_LIBS}"
|
||||
N2N_LIBS_EXTRA="-lminiupnpc ${N2N_LIBS_EXTRA}"
|
||||
],
|
||||
[AC_MSG_ERROR([miniupnp library not found])]
|
||||
)],
|
||||
|
@ -75,7 +75,7 @@ AS_IF([test "x$enable_natpmp" != xno],
|
|||
[AC_CHECK_LIB([natpmp], [initnatpmp],
|
||||
[
|
||||
AC_DEFINE([HAVE_NATPMP], [1], [Have natpmp library])
|
||||
N2N_LIBS="-lnatpmp ${N2N_LIBS}"
|
||||
N2N_LIBS_EXTRA="-lnatpmp ${N2N_LIBS_EXTRA}"
|
||||
],
|
||||
[AC_MSG_ERROR([natpmp library not found])]
|
||||
)],
|
||||
|
@ -88,8 +88,8 @@ AS_IF([test "x$enable_pcap" != xno],
|
|||
[AC_CHECK_LIB([pcap], [pcap_open_live],
|
||||
[
|
||||
AC_DEFINE([N2N_HAVE_PCAP], [1], [Have PCAP library])
|
||||
N2N_LIBS="-lpcap ${N2N_LIBS}"
|
||||
ADDITIONAL_TOOLS="$ADDITIONAL_TOOLS n2n-decode"
|
||||
N2N_LIBS_EXTRA="-lpcap ${N2N_LIBS_EXTRA}"
|
||||
TOOLS_ADDITIONAL="$TOOLS_ADDITIONAL n2n-decode"
|
||||
|
||||
# TODO
|
||||
# - pcap_set_immediate_mode has been available since libpcap 1.5
|
||||
|
@ -109,7 +109,7 @@ AS_IF([test "x$enable_cap" != xno],
|
|||
[AC_CHECK_LIB([cap], [cap_get_proc],
|
||||
[
|
||||
AC_DEFINE([HAVE_LIBCAP],[1],[Support for linux capabilities])
|
||||
N2N_LIBS="${N2N_LIBS} -lcap"
|
||||
N2N_LIBS_EXTRA="${N2N_LIBS_EXTRA} -lcap"
|
||||
],
|
||||
[AC_MSG_ERROR([cap library not found])]
|
||||
)],
|
||||
|
@ -150,10 +150,9 @@ AC_SUBST(AR)
|
|||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(LDFLAGS)
|
||||
AC_SUBST(N2N_VERSION)
|
||||
AC_SUBST(N2N_LIBS)
|
||||
AC_SUBST(ADDITIONAL_TOOLS)
|
||||
AC_SUBST(N2N_LIBS_EXTRA)
|
||||
AC_SUBST(TOOLS_ADDITIONAL)
|
||||
AC_CONFIG_HEADERS(include/config.h)
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
AC_CONFIG_FILES(tools/Makefile)
|
||||
AC_CONFIG_FILES(config.mak)
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -51,6 +51,7 @@ typedef int ssize_t;
|
|||
typedef unsigned long in_addr_t;
|
||||
|
||||
#include "n2n_win32.h"
|
||||
// FIXME - the above include is from a different subdir
|
||||
|
||||
#endif /* #if defined(_MSC_VER) || defined(__MINGW32__) */
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
# Specifically for windows, where installing autoconf looks suspiciously
|
||||
# like boiling the ocean.
|
||||
|
||||
sed \
|
||||
-e "s%@CC@%gcc%g" \
|
||||
-e "s%@AR@%ar%g" \
|
||||
-e "s%@CFLAGS@%$CFLAGS%g" \
|
||||
-e "s%@LDFLAGS@%$LDFLAGS%g" \
|
||||
-e "s%@N2N_LIBS@%$LDLIBS%g" \
|
||||
< Makefile.in > Makefile
|
||||
cat >config.mak <<EOF
|
||||
CC=gcc
|
||||
AR=ar
|
||||
CFLAGS=$CFLAGS -g -O2 -I./include
|
||||
LDFLAGS=$LDFLAGS -L.
|
||||
N2N_LIBS_EXTRA=$LDLIBS
|
||||
EOF
|
||||
|
||||
sed \
|
||||
-e "s%@ADDITIONAL_TOOLS@%%g" \
|
||||
< tools/Makefile.in > tools/Makefile
|
||||
cat >tools/config.mak <<EOF
|
||||
TOOLS_ADDITIONAL=
|
||||
EOF
|
||||
|
||||
cat <<EOF >include/config.h
|
||||
#define PACKAGE_VERSION "FIXME"
|
||||
|
|
|
@ -2,13 +2,20 @@
|
|||
# This is not a standalone makefile, it must be called from the toplevel
|
||||
# makefile to inherit the correct environment
|
||||
|
||||
# The vars included here should be part of the environment.
|
||||
# TODO - refactor this and debug why they need to be included for windows
|
||||
include ../config.mak
|
||||
|
||||
DEBUG?=-g3
|
||||
|
||||
HEADERS=$(wildcard include/*.h)
|
||||
CFLAGS+=-I../include
|
||||
LDLIBS+=-ln2n
|
||||
|
||||
ifeq ($(CONFIG_TARGET),mingw)
|
||||
CFLAGS+=-I../win32
|
||||
LDLIBS+=-lnetapi32
|
||||
LDLIBS+=$(abspath ../win32/n2n_win32.a)
|
||||
LDLIBS+=-lnetapi32 -lws2_32 -liphlpapi
|
||||
endif
|
||||
CFLAGS+=$(DEBUG)
|
||||
LDFLAGS+=-L..
|
||||
|
@ -16,7 +23,7 @@ LDFLAGS+=-L..
|
|||
N2N_LIB=../libn2n.a
|
||||
|
||||
TOOLS=n2n-benchmark n2n-keygen n2n-route n2n-portfwd
|
||||
TOOLS+=@ADDITIONAL_TOOLS@
|
||||
TOOLS+=$(TOOLS_ADDITIONAL)
|
||||
|
||||
TESTS=tests-compress tests-elliptic tests-hashing tests-transform
|
||||
TESTS+=tests-wire
|
||||
|
@ -25,12 +32,12 @@ TESTS+=tests-auth
|
|||
.PHONY: all clean install
|
||||
all: $(TOOLS) $(TESTS)
|
||||
|
||||
n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||
n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||
n2n-route.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||
n2n-portfwd.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||
n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
||||
n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
||||
n2n-route.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
||||
n2n-portfwd.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
||||
|
||||
n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||
n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../config.mak
|
||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDLIBS) -lpcap -o $@
|
||||
|
||||
# See comments in the topdir Makefile about how to generate coverage
|
|
@ -1,5 +0,0 @@
|
|||
add_library(n2n_win32
|
||||
getopt1.c
|
||||
getopt.c
|
||||
wintap.c)
|
||||
target_link_libraries(n2n_win32 PUBLIC ws2_32.lib)
|
|
@ -2,7 +2,11 @@
|
|||
# This is not a standalone makefile, it must be called from the toplevel
|
||||
# makefile to inherit the correct environment
|
||||
|
||||
CFLAGS+=-I../include
|
||||
# The vars included here should be part of the environment.
|
||||
# TODO - refactor this and debug why they need to be included for windows
|
||||
include ../config.mak
|
||||
|
||||
CFLAGS+=-I../include -I.
|
||||
LDFLAGS+=-L..
|
||||
|
||||
.PHONY: all clean install
|
||||
|
|
Loading…
Reference in New Issue
Block a user