aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@es.net>2014-05-19 15:02:02 -0700
committerBruce A. Mah <bmah@es.net>2014-05-19 15:02:02 -0700
commit8de51b589fa0daa00ebfee7a4ec8ee91bc968f7b (patch)
tree27b4e419ee4226ebae19a9b4f95d97266d4f18f7
parent426221a327ce8d37d4e6065d716f01422da4d16b (diff)
downloadiperf3-8de51b589fa0daa00ebfee7a4ec8ee91bc968f7b.tar.gz
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
-rw-r--r--configure.ac7
-rw-r--r--examples/Makefile.am4
-rw-r--r--src/Makefile.am10
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