From 54d3775467eb1af0054d43193ff71ce1b7b71eaa Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 5 Mar 2011 23:16:55 +0100 Subject: [PATCH] Switch to GNU autotools. --- .gitignore | 18 ++++++++++++++++++ Makefile | 10 ---------- Makefile.am | 1 + configure.ac | 28 ++++++++++++++++++++++++++++ src/Makefile.am | 2 ++ tlsproxy.c => src/tlsproxy.c | 2 ++ 6 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 .gitignore delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 configure.ac create mode 100644 src/Makefile.am rename tlsproxy.c => src/tlsproxy.c (99%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb15544 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Created by autoreconf. +Makefile.in +aclocal.m4 +autom4te.cache/ +build-aux/ +config.h.in +configure +src/Makefile.in +# Created by ./configure. +Makefile +config.h +config.log +config.status +src/.deps/ +src/Makefile +stamp-h1 +# Created by make. +src/tlsproxy diff --git a/Makefile b/Makefile deleted file mode 100644 index ed3deaf..0000000 --- a/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -all: tlsproxy - - -tlsproxy: tlsproxy.c - gcc -Wall -Wextra -DDEBUG -o tlsproxy $^ - -clean: - rm -f tlsproxy - -.PHONY: all clean diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..af437a6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..bf75ebb --- /dev/null +++ b/configure.ac @@ -0,0 +1,28 @@ +AC_INIT([tlsproxy], [0.1], [simon@ruderich.org]) + +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([src/tlsproxy.c]) + +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) + +AC_PROG_CC + +if test "x$GCC" = xyes; then + CFLAGS="-std=c89 -pedantic -Wall -Wextra -Werror -D_XOPEN_SOURCE=500 $CFLAGS" +fi + +AC_CHECK_LIB([gnutls], [gnutls_certificate_verify_peers2]) +if test "x$ac_cv_lib_gnutls_gnutls_certificate_verify_peers2" != xyes; then + AC_MSG_ERROR([GnuTLS is required]) +fi + +AC_ARG_ENABLE([debug], + [AC_HELP_STRING([--enable-debug], [enable debug output])], + [if test "x$enableval" = xyes; then + AC_DEFINE([DEBUG], 1, [Define to enable debug output.]) + fi]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..677f369 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,2 @@ +bin_PROGRAMS = tlsproxy +tlsproxy_SOURCES = tlsproxy.c diff --git a/tlsproxy.c b/src/tlsproxy.c similarity index 99% rename from tlsproxy.c rename to src/tlsproxy.c index 157633b..68b5a2e 100644 --- a/tlsproxy.c +++ b/src/tlsproxy.c @@ -35,6 +35,8 @@ /* poll() */ #include +#include + /* Maximum line of the request line. Longer request lines are aborted with an * error. The standard doesn't specify a maximum line length but this should -- 2.43.2