From 4f54dc0c5f9bbd4d44f5c6c8f97ae8b84a16ff01 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Tue, 1 Jan 2019 13:49:05 +0000 Subject: [PATCH] Try to ensure a C99 compiler. Some still-supported Linux distributions (Debian jessie and Ubuntu 14.04 at least) still use GCC 4, where C99 isn't the default. For autoconf, we do it the autotools way. For the standalone Makefiles, we go for -std=gnu99 rather than c99, to avoid trouble with fdopen(). --- configure.ac | 4 +++- mkfiles.pl | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index a09d6417..ce7985ff 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # To compile this into a configure script, you need: -# * Autoconf 2.50 or newer +# * Autoconf 2.59c or newer # * Gtk (for $prefix/share/aclocal/gtk.m4) # * Automake (for aclocal) # If you've got them, running "autoreconf" should work. @@ -17,6 +17,8 @@ AC_PROG_RANLIB ifdef([AM_PROG_AR],[AM_PROG_AR]) AM_PROG_CC_C_O +AC_PROG_CC_C99 + # Mild abuse of the '--enable' option format to allow manual # specification of setuid or setgid setup in pterm. setidtype=none diff --git a/mkfiles.pl b/mkfiles.pl index de68fd0e..9427db65 100755 --- a/mkfiles.pl +++ b/mkfiles.pl @@ -627,8 +627,8 @@ if (defined $makefiles{'cygwin'}) { "# You may also need to tell windres where to find include files:\n". "# RCINC = --include-dir c:\\cygwin\\include\\\n". "\n". - &splitline("CFLAGS = -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT". - " -D_NO_OLDNAMES " . + &splitline("CFLAGS = -Wall -O2 -std=gnu99 -D_WINDOWS -DDEBUG". + " -DWIN32S_COMPAT -D_NO_OLDNAMES " . (join " ", map {"-I$dirpfx$_"} @srcdirs)) . "\n". "LDFLAGS = -s\n". @@ -1420,7 +1420,7 @@ if (defined $makefiles{'gtk'}) { "\n". "unexport CFLAGS # work around a weird issue with krb5-config\n". "\n". - &splitline("CFLAGS = -O2 -Wall -Werror -g " . + &splitline("CFLAGS = -O2 -Wall -Werror -std=gnu99 -g " . (join " ", map {"-I$dirpfx$_"} @srcdirs) . " \$(shell \$(GTK_CONFIG) --cflags)"). " -D _FILE_OFFSET_BITS=64\n". @@ -1501,7 +1501,7 @@ if (defined $makefiles{'unix'}) { "\n". "unexport CFLAGS # work around a weird issue with krb5-config\n". "\n". - &splitline("CFLAGS = -O2 -Wall -Werror -g " . + &splitline("CFLAGS = -O2 -Wall -Werror -std=gnu99 -g " . (join " ", map {"-I$dirpfx$_"} @srcdirs)). " -D _FILE_OFFSET_BITS=64\n". "ULDFLAGS = \$(LDFLAGS)\n". @@ -1743,7 +1743,7 @@ if (defined $makefiles{'osx'}) { print "CC = \$(TOOLPATH)gcc\n". "\n". - &splitline("CFLAGS = -O2 -Wall -Werror -g " . + &splitline("CFLAGS = -O2 -Wall -Werror -std=gnu99 -g " . (join " ", map {"-I$dirpfx$_"} @srcdirs))."\n". "MLDFLAGS = -framework Cocoa\n". "ULDFLAGS =\n".