From 8de51b589fa0daa00ebfee7a4ec8ee91bc968f7b Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Mon, 19 May 2014 15:02:02 -0700 Subject: [PATCH] Portability fixes for Solaris Sun Studio and MacOS. Only do -Wall by default if on GCC (or something that looks like GCC, such as clang/llvm). Turn on -Werror so we can get some better error-checking, but we also need -Wno-deprecated-declarations at least for MacOS, because daemon(3) is deprecated starting with MacOS 10.5. Fixes #174 (I think). Submitted by: @marksolaris --- configure.ac | 7 +++++++ examples/Makefile.am | 4 ++-- src/Makefile.am | 10 +++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 4045679..5bbc0dd 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,13 @@ AC_PROG_RANLIB AC_PROG_LN_S AC_PROG_LIBTOOL +# Add -Wall -Werror if we are using GCC. +# We also need -Wno-deprecated-declarations, primarily because on MacOS, daemon(3) +# is deprecated starting from MacOS 10.5. +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -Wall -Werror -Wno-deprecated-declarations" +fi + # Checks for header files. AC_HEADER_STDC diff --git a/examples/Makefile.am b/examples/Makefile.am index 3b9dc87..0f0c658 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,12 +1,12 @@ noinst_PROGRAMS = mic mis # Build, but don't install mic_SOURCES = mic.c -mic_CFLAGS = -g -Wall +mic_CFLAGS = -g mic_LDADD = ../src/libiperf.la mic_LDFLAGS = -g mis_SOURCES = mis.c -mis_CFLAGS = -g -Wall +mis_CFLAGS = -g mis_LDADD = ../src/libiperf.la mis_LDFLAGS = -g diff --git a/src/Makefile.am b/src/Makefile.am index cc32e36..55d4816 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,7 +39,7 @@ libiperf_la_SOURCES = \ # Specify the sources and various flags for the iperf binary iperf3_SOURCES = main.c -iperf3_CFLAGS = -g -Wall +iperf3_CFLAGS = -g iperf3_LDADD = libiperf.la iperf3_LDFLAGS = -g @@ -48,23 +48,23 @@ iperf3_LDFLAGS = -g iperf3_profile_SOURCES = main.c \ $(libiperf_la_SOURCES) -iperf3_profile_CFLAGS = -pg -g -Wall +iperf3_profile_CFLAGS = -pg -g iperf3_profile_LDADD = libiperf.la iperf3_profile_LDFLAGS = -pg -g # Specify the sources and various flags for the test cases t_timer_SOURCES = t_timer.c -t_timer_CFLAGS = -g -Wall +t_timer_CFLAGS = -g t_timer_LDFLAGS = t_timer_LDADD = libiperf.la t_units_SOURCES = t_units.c -t_units_CFLAGS = -g -Wall +t_units_CFLAGS = -g t_units_LDFLAGS = t_units_LDADD = libiperf.la t_uuid_SOURCES = t_uuid.c -t_uuid_CFLAGS = -g -Wall +t_uuid_CFLAGS = -g t_uuid_LDFLAGS = t_uuid_LDADD = libiperf.la