From 96dda0ecb616168420e2cdcc29f6550b09615930 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Fri, 9 Sep 2016 12:33:22 +0800 Subject: [PATCH] Fix mingw building --- configure | 21 +++++++++++++++++++++ m4/pcre.m4 | 1 + src/http.c | 6 ++++++ src/rule.c | 9 +++++++++ src/rule.h | 2 -- src/tls.c | 10 ++++++++++ 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/configure b/configure index dbd10332..6c4d2e94 100755 --- a/configure +++ b/configure @@ -12149,6 +12149,27 @@ if test "$enable_pcre" != "no"; then fi + if test "x$CFLAGS" = "x"; then + test "x$verbose" = "xyes" && echo " setting CFLAGS to \"-DPCRE_STATIC\"" + CFLAGS="-DPCRE_STATIC" + else + ats_addto_bugger="-DPCRE_STATIC" + for i in $ats_addto_bugger; do + ats_addto_duplicate="0" + for j in $CFLAGS; do + if test "x$i" = "x$j"; then + ats_addto_duplicate="1" + break + fi + done + if test $ats_addto_duplicate = "0"; then + test "x$verbose" = "xyes" && echo " adding \"$i\" to CFLAGS" + CFLAGS="$CFLAGS $i" + fi + done + fi + + if test "x$LDFLAGS" = "x"; then test "x$verbose" = "xyes" && echo " setting LDFLAGS to \"-L${pcre_ldflags}\"" LDFLAGS="-L${pcre_ldflags}" diff --git a/m4/pcre.m4 b/m4/pcre.m4 index 4123b63b..4d965bc7 100644 --- a/m4/pcre.m4 +++ b/m4/pcre.m4 @@ -129,6 +129,7 @@ if test "$enable_pcre" != "no"; then pcre_have_libs=0 if test "$pcre_base_dir" != "/usr"; then TS_ADDTO(CFLAGS, [-I${pcre_include}]) + TS_ADDTO(CFLAGS, [-DPCRE_STATIC]) TS_ADDTO(LDFLAGS, [-L${pcre_ldflags}]) TS_ADDTO_RPATH(${pcre_ldflags}) fi diff --git a/src/http.c b/src/http.c index 77c3beb1..742a1cec 100644 --- a/src/http.c +++ b/src/http.c @@ -23,11 +23,17 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include /* malloc() */ #include /* strncpy() */ #include /* strncasecmp() */ #include /* isblank() */ + #include "http.h" #include "protocol.h" diff --git a/src/rule.c b/src/rule.c index e07481b6..df5456de 100644 --- a/src/rule.c +++ b/src/rule.c @@ -24,9 +24,18 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include +#ifdef __MINGW32__ +extern void ss_error(const char *s); +#endif + #include "rule.h" #include "utils.h" diff --git a/src/rule.h b/src/rule.h index 72a6bae7..015bc42b 100644 --- a/src/rule.h +++ b/src/rule.h @@ -31,7 +31,6 @@ #include "config.h" #endif -#include #include #ifdef HAVE_PCRE_H @@ -56,5 +55,4 @@ void remove_rule(rule_t *); rule_t *new_rule(); int accept_rule_arg(rule_t *, const char *); - #endif diff --git a/src/tls.c b/src/tls.c index f611a63b..dabaf453 100644 --- a/src/tls.c +++ b/src/tls.c @@ -28,10 +28,20 @@ * extension. This was created based primarily on Wireshark dissection of a * TLS handshake and RFC4366. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include /* malloc() */ #include /* strncpy() */ + +#ifndef __MINGW32__ #include +#else +#include +#endif #include "tls.h" #include "protocol.h"