From 48d12e42ada846e6d573bbccc3e3b8e7eaa1e1a7 Mon Sep 17 00:00:00 2001 From: seyko Date: Wed, 4 Mar 2015 11:47:52 +0300 Subject: [PATCH] gcc options and mingw: move a gcc options detection from a makefile to the configure + define XCC and XAR if mingw32 defined + use XCC and XAR in lib/Makefile if defined Try "./configure --enable-mingw32; make". This must work --- Makefile | 14 +------------- configure | 18 ++++++++++++++++-- lib/Makefile | 6 +++--- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 04c1828b..4fde8795 100644 --- a/Makefile +++ b/Makefile @@ -8,19 +8,7 @@ VPATH = $(top_srcdir) CPPFLAGS += -I$(TOP) # for config.h -ifeq (-$(findstring gcc,$(CC))-,-gcc-) -ifeq (-$(findstring $(GCC_MAJOR),01)-,--) -CFLAGS+=-fno-strict-aliasing -ifeq (-$(findstring $(GCC_MAJOR),23)-,--) -CFLAGS+=-Wno-pointer-sign -Wno-sign-compare -ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--) -CFLAGS+=-D_FORTIFY_SOURCE=0 -else -CFLAGS+=-Wno-unused-result -endif -endif -endif -else # not GCC +ifneq (-$(findstring gcc,$(CC))-,-gcc-) ifeq (-$(findstring clang,$(CC))-,-clang-) # make clang accept gnuisms in libtcc1.c CFLAGS+=-fheinous-gnu-extensions diff --git a/configure b/configure index 9b0c34a7..3637252d 100755 --- a/configure +++ b/configure @@ -373,8 +373,16 @@ else fi # a final configuration tuning -W_PRESENT="$($cc -v --help 2>&1 | grep deprecated-declarations)" -if test -n "$W_PRESENT"; then cc="$cc -Wno-deprecated-declarations"; fi +W_OPTIONS="deprecated-declarations strict-aliasing pointer-sign sign-compare unused-result uninitialized" +for i in $W_OPTIONS; do + O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)" + if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -Wno-$i"; fi +done +F_OPTIONS="strict-aliasing" +for i in $F_OPTIONS; do + O_PRESENT="$($cc -v --help 2>&1 | grep -- -f$i)" + if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -fno-$i"; fi +done if test -z "$tcc_lddir" -a "$cpu" = "x86-64"; then tcc_lddir="lib64"; fi echo "Binary directory $bindir" @@ -420,6 +428,12 @@ LDFLAGS=$LDFLAGS LIBSUF=$LIBSUF EXESUF=$EXESUF EOF +if test "$mingw32" = "yes"; then +cat >>config.mak <