Use -fno-stack-protector with GCC versions that support it, to fix a
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 26 Jan 2008 16:43:15 +0000 (16:43 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 26 Jan 2008 16:43:15 +0000 (16:43 +0000)
linker error on platform on which -fstack-protector is default, such
as recent versions of Ubuntu.

src/Make.config

index 16db6d5271a25cc4dcb11373ae088be2653e722f..841e9104bbce9f3f881271ee0d643b75282d205b 100644 (file)
@@ -39,6 +39,11 @@ ASFLAGS = -Wa,--gstabs
 LDFLAGS = 
 DEPS = -MMD -MF $(@:.o=.d)
 
 LDFLAGS = 
 DEPS = -MMD -MF $(@:.o=.d)
 
+# Turn off -fstack-protector, which we don't support.
+ifeq ($(strip $(shell echo | $(CC) -fno-stack-protector -E - > /dev/null 2>&1; echo $$?)),0)
+CFLAGS += -fno-stack-protector
+endif
+
 %.o: %.c
        $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(DEFINES) $(DEPS)
 
 %.o: %.c
        $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(DEFINES) $(DEPS)