From 717ac3f7fed248d3685884d54a5fef2602795b5d Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 26 Mar 2006 02:18:48 +1000 Subject: [PATCH] Remove gcc-specific cflags from makefile. Add them in the configure file, but only if the compiler is gcc. darcs-hash:20060325161848-ac50b-23919c1d23bbc5eed81fd709b95802ea2d4e8f52.gz --- Makefile.in | 19 ++----------------- configure.ac | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/Makefile.in b/Makefile.in index c37cd7fb3..775b774ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -36,22 +36,7 @@ CC := @CC@ INSTALL:=@INSTALL@ -# -# Compiler flags: -# -# -# -fno-optimize-sibling-calls seems to work around a bug where sending -# a SIGWINCH to fish on NetBSD causes fish to exit when compiled with -# GCC 3.3.3. This is probably either a compiler bug or a libc bug, but -# adding this flag seems to fix things for now. Long term, the real -# problem should be tracked down and truly fixed, at which point we -# can remove this silly flag. This bug has been verified to not exist -# on Linux using GCC 3.3.3. -# -# -Wall is there to keep me on my toes -# - -CFLAGS:=@CFLAGS@ -Wall -fno-optimize-sibling-calls +CFLAGS:=@CFLAGS@ CPPFLAGS=@CPPFLAGS@ LDFLAGS:= @LIBS@ @LDFLAGS@ @@ -211,7 +196,7 @@ all: $(PROGRAMS) user_doc .PHONY: all debug: - make fish CFLAGS="-O0 -Wno-unused -Werror -g -Wall -fno-optimize-sibling-calls" + make fish CFLAGS="@CFLAGS@ -O0 -Wno-unused -Werror -g" .PHONY: debug # User documentation, describing the features of the fish shell. diff --git a/configure.ac b/configure.ac index de3b4756a..22509e339 100644 --- a/configure.ac +++ b/configure.ac @@ -112,6 +112,54 @@ else AC_SUBST( XSEL_MAN_PATH,[ ]) fi +# +# If we are using gcc, set some flags that increase the odds of the +# compiler producing a working binary... +# + +if test "$CC" = gcc; then + + # + # This seems to be needed in some glibc versions in order to get + # the prototypes for wide character functions like wcsdup and + # fwprintf. Fish should not actually use anu C99-specific + # features - if it does, please report this as a bug. + # + + CFLAGS="$CFLAGS -std=c99" + + + # + # -fno-optimize-sibling-calls seems to work around a bug where + # sending a SIGWINCH to fish on NetBSD causes fish to exit when + # compiled with GCC 3.3.3. This is probably either a compiler bug + # or a libc bug, but adding this flag seems to fix things for + # now. Long term, the real problem should be tracked down and + # truly fixed, at which point we can remove this silly flag. This + # bug has been verified to not exist on Linux using GCC 3.3.3. + # + + CFLAGS="$CFLAGS -fno-optimize-sibling-calls" + + + # + # -Wall is there to keep me on my toes + # + + CFLAGS="$CFLAGS -Wall" + + # + # This gives us access to prototypes for gnu extensions if we are + # compiling agains glibc. All extensions that are used must have a + # fallback implementation available in fallback.h, in order to + # keep fish working on non-gnu platforms. + # + + CFLAGS="$CFLAGS -D _GNU_SOURCE" + +fi + + # Test cpu for special handling of ppc AC_CANONICAL_TARGET