aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYunchih Chen <yunchih.cat@gmail.com>2017-12-05 22:11:39 +0800
committerYunchih Chen <yunchih.cat@gmail.com>2017-12-05 22:15:15 +0800
commit8b6e3cf751327281f64f06c804f065b43ebc69e7 (patch)
treea35a353a1e7e5a51746c469dca43b1540f6d4c7f
parentcf5a816a464cd38050152c6189e9ae400f888d5c (diff)
downloadnfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.tar
nfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.tar.gz
nfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.tar.bz2
nfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.tar.lz
nfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.tar.xz
nfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.tar.zst
nfcollect-8b6e3cf751327281f64f06c804f065b43ebc69e7.zip
Use Autotools to generate Makefile
-rw-r--r--.gitignore6
-rw-r--r--Makefile16
-rw-r--r--Makefile.am2
-rwxr-xr-xbootstrap.sh2
-rw-r--r--configure.ac25
5 files changed, 35 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 5b156a7..c2458e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,9 @@
.*.swp
*.o
ref
+configure
+config.*
+build-aux
+autom4te.cache
+aclocal.*
+Makefile.in
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 7559941..0000000
--- a/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-
-SRC = $(wildcard *.c)
-OBJECT = $(SRC:.c=.o)
-TARGET = nfcollect
-CC = gcc
-CFLAGS = -g -Wall -Wextra -DDEBUG
-LDFLAGS = -lnetfilter_log -lpthread
-
-$(TARGET): $(OBJECT)
- $(CC) -o $(TARGET) $^ $(LDFLAGS)
-
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-clean:
- rm -f $(TARGET) $(OBJECT)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..2d8def4
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,2 @@
+bin_PROGRAMS = nfcollect
+nfcollect_SOURCES = nflog.c commit.c main.c
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..91ce531
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+autoreconf -f -i
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..343a8c9
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,25 @@
+AC_INIT([nfcollect], [1.0])
+
+# Safety checks in case user overwritten --srcdir
+AC_CONFIG_SRCDIR([main.c])
+
+# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess)
+# in this dir (build-aux)
+AC_CONFIG_AUX_DIR([build-aux])
+
+# Init automake, and specify this program use relaxed structures.
+# i.e. this program doesn't follow the gnu coding standards, and doesn't have
+# ChangeLog, COPYING, AUTHORS, INSTALL, README etc. files.
+AM_INIT_AUTOMAKE([-Wall -Werror foreign dist-xz])
+
+AC_PROG_CC
+
+AC_CHECK_HEADERS(libnetfilter_log/libnetfilter_log.h)
+AC_SEARCH_LIBS(nflog_open, netfilter_log)
+
+AC_CHECK_HEADERS(pthread.h)
+AC_SEARCH_LIBS(pthread_create, pthread)
+
+AC_CONFIG_FILES([Makefile])
+
+AC_OUTPUT