summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-07-12 10:23:35 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-07-30 07:56:07 +0200
commit792b79ed405d42b984b0ad9bf6519539f782c52a (patch)
tree8496483e9414a2ba7ea589410502e6422f60319d
parent1efe6e15e35ad7adaac0ece40b70e91380748ec7 (diff)
downloadnetwork-manager-applet-lr/compiler-options.tar.gz
build: pass -std=gnu99 to compilerlr/compiler-options
With --enable-more-warnings, we already used -std=gnu99, see NetworkManager commit ba2b2de3adcf3e8286249523e3841858e0c2655c. Compilation may behave differently depending on the selected C standard that we choose. It seems wrong, with more-warnings, to build against a C standard, while otherwise leaving it undefind. Indeed, one might argue, that our build system should not use such compiler specific options. At least, not without detecting support for the compiler option during ./configure. However: - we already did this for --enable-more-warnings. - we should not program against a theoretical compiler. In practice, only gcc and clang works to build NetworkManager. Both these compilers support this option, so there is no reason to not use it. If we ever come into the situation to support another compiler, adjusting -std=gnu99 will be the smallest problem. Until that happens (and that's far from imminent), don't pretend to be portable to non-existing compilers and use the flag that in practice is available. [lkundrak@v3.sk: taken this from NetworkManager, did the Makefile.am and a trivial commit message adjustment.] See-also: https://gcc.gnu.org/onlinedocs/gcc/Standards.html (Taken from NetworkManager commit b9bc20f4da12f15b8950daea177e6dda42cd6c3f)
-rw-r--r--Makefile.am12
-rw-r--r--m4/compiler_options.m42
2 files changed, 13 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 3ad1af9a..601e5e46 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -55,6 +55,8 @@ SUBDIRS = \
. \
po
+dflt_cppflags = -std=gnu99
+
###############################################################################
icon16dir = $(datadir)/icons/hicolor/16x16/apps
@@ -171,6 +173,7 @@ shared_files = \
noinst_LTLIBRARIES += src/utils/libutils-libnm.la
src_utils_libutils_libnm_la_CPPFLAGS = \
+ $(dflt_cppflags) \
"-I$(srcdir)/shared" \
$(GTK3_CFLAGS) \
$(LIBNM_CFLAGS)
@@ -189,6 +192,7 @@ if WITH_LIBNM_GTK
noinst_LTLIBRARIES += src/utils/libutils-libnm-glib.la
src_utils_libutils_libnm_glib_la_CPPFLAGS = \
+ $(dflt_cppflags) \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY \
"-I$(srcdir)/shared" \
$(GTK3_CFLAGS) \
@@ -210,6 +214,7 @@ check_programs += src/utils/tests/test-utils
src_utils_tests_test_utils_SOURCES = src/utils/tests/test-utils.c
src_utils_tests_test_utils_CPPFLAGS = \
+ $(dflt_cppflags) \
"-I$(srcdir)/shared/" \
"-I$(srcdir)/src/utils" \
$(GTK3_CFLAGS) \
@@ -280,6 +285,7 @@ nodist_src_wireless_security_libwireless_security_libnm_la_SOURCES = \
$(wireless_security_c_gen)
src_wireless_security_libwireless_security_libnm_la_CPPFLAGS = \
+ $(dflt_cppflags) \
"-I$(srcdir)/shared" \
"-I$(srcdir)/src/utils" \
"-I$(srcdir)/src/libnma" \
@@ -305,6 +311,7 @@ nodist_src_wireless_security_libwireless_security_libnm_glib_la_SOURCES = \
$(wireless_security_c_gen)
src_wireless_security_libwireless_security_libnm_glib_la_CPPFLAGS = \
+ $(dflt_cppflags) \
$(GTK3_CFLAGS) \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY \
"-I$(srcdir)/shared" \
@@ -391,6 +398,7 @@ nodist_src_libnm_gtk_libnm_gtk_la_SOURCES = \
$(libnm_gtk_c_gen)
src_libnm_gtk_libnm_gtk_la_CFLAGS = \
+ $(dflt_cppflags) \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY \
-DICONDIR=\""$(datadir)/icons"\" \
-DBINDIR=\""$(bindir)"\" \
@@ -448,6 +456,7 @@ endif
check_programs += src/libnm-gtk/tests/test-mobile-providers
src_libnm_gtk_tests_test_mobile_providers_CPPFLAGS = \
+ $(dflt_cppflags) \
-DTEST_DATA_DIR=\""$(abs_srcdir)/src/libnm-gtk/tests"\" \
"-I$(srcdir)/shared" \
"-I$(srcdir)/src/libnm-gtk" \
@@ -547,6 +556,7 @@ nodist_src_libnma_libnma_la_SOURCES = \
$(libnma_c_gen)
src_libnma_libnma_la_CFLAGS = \
+ $(dflt_cppflags) \
-DICONDIR=\""$(datadir)/icons"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
@@ -710,6 +720,7 @@ nodist_src_connection_editor_nm_connection_editor_SOURCES = \
$(connection_editor_c_gen)
src_connection_editor_nm_connection_editor_CPPFLAGS = \
+ $(dflt_cppflags) \
-DICONDIR=\""$(datadir)/icons"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
@@ -835,6 +846,7 @@ nodist_src_nm_applet_SOURCES = \
$(nm_applet_c_gen)
src_nm_applet_CPPFLAGS = \
+ $(dflt_cppflags) \
-DICONDIR=\""$(datadir)/icons"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4
index 6266ffa9..d42501e8 100644
--- a/m4/compiler_options.m4
+++ b/m4/compiler_options.m4
@@ -58,7 +58,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
dnl attach it to the CFLAGS.
NM_COMPILER_WARNING([$1], [unknown-warning-option], [])
- CFLAGS="$CFLAGS -Wall -std=gnu99"
+ CFLAGS="$CFLAGS -Wall"
if test "x$set_more_warnings" = xerror; then
CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS -Werror"