summaryrefslogtreecommitdiff
path: root/m4
Commit message (Collapse)AuthorAgeFilesLines
* build: re-enable "-Wmissing-braces" warningThomas Haller2019-02-081-6/+0
| | | | | | | We should always get the nesting in struct initializers right. Everyhing else is error-prone, and the warning is good. Enable it.
* build: fix building with LTOBeniamino Galvani2019-02-041-2/+2
| | | | | | | Building with link-time optimization requires some tricks explained in [1]. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
* build: don't change CFLAGS from configure.acBeniamino Galvani2018-09-181-5/+5
| | | | | | | | If configure.ac automatically adds compiler flags to CFLAGS, it becomes hard to override one of them for a specific target because CFLAGS is added last. It is better to use AM_CFLAGS. See [1]. [1] https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
* build: set -Wall when probing extra warning optionsLubomir Rintel2018-08-071-1/+1
| | | | | | | | Some warnings depends on others: -Wformat-security won't work without -Wformat. With -Wall we're confident enough that we have important warnings enabled and in any case we're going to enable it anyway. https://github.com/NetworkManager/NetworkManager/pull/175
* build: check whether g-ir-scanner actually worksLubomir Rintel2018-08-071-34/+31
| | | | | | | | | | | | | g-ir-scanner uses distutils that have an unfortunate misfeature of inheriting the compiler flags it itself was built with. This includes the hardening flags that don't work with without redhat-rpm-build and break with clang every full moon. A configure check makes it clear about what went wrong in case introspection is desired, otherwise turns it off. (Taken from network-manager commit 678890ed0347849990787e8893122a39f95cb708)
* build: pass -std=gnu99 to compilerThomas Haller2018-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | With --enable-more-warnings, we already used -std=gnu99, see 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. See-also: https://gcc.gnu.org/onlinedocs/gcc/Standards.html
* m4/trivial: fix indentationThomas Haller2018-07-171-1/+1
|
* m4: parametrize flags variableLubomir Rintel2018-02-161-20/+23
| | | | | | Make it possible to add compiler options to a different variable than CFLAGS. This is useful to conditionally disable a compiler warning for a subpart of a tree.
* m4/trivial: add a bug link to a compiler warning checkLubomir Rintel2018-02-081-0/+1
|
* all: replace non-leading tabs with spacesThomas Haller2018-02-071-2/+2
| | | | | | We commonly only allow tabs at the beginning of a line, not afterwards. The reason for this style is so that the code looks formated right with tabstop=4 and tabstop=8.
* m4: disable -Wcast-function-typeLubomir Rintel2018-02-071-0/+10
| | | | | This fixes the GCC 8 build. It disables the warning conditionally so that we get the warning back if glib gets fixed.
* build: enable unused-but-set warningLubomir Rintel2017-12-181-1/+0
| | | | | It was disabled for shady reasons (not checking write() return value) that are long gone. Worse even, it hid some real bugs.
* build: add "-Wvla" to warn about uses of variable-length arraysThomas Haller2017-12-151-0/+1
| | | | | | | | | | | | | | | | | We don't use them, so add a compiler warning about their use. I think they are annoying, because sizeof(x) and typeof(x) might evaluate at runtime. Especially the typeof() extension is useful for macros, but behaves badly with variable-length arrays due to running code at runtime. But the worst is, G_STATIC_ASSERT() is implemented by declaring an array of negative length. Usually, the checked condition should be a compile time constant, but with VLAs the compiler would not evaluate the static-assert at compile time and instead accept it silently. It's easy to mess up static asserts to wrongly have a non-constant condition, especially when the static-assert is used inside a macro. Just say no.
* build: disable lcov version checkBeniamino Galvani2017-10-201-24/+2
| | | | | | | | | | | | Ideally we should switch to the standard macro AX_CODE_COVERAGE for code coverage, but infortunately it's not supported on older distros (e.g. on Travis). Keep using the current macro, but remove the lcov version check as it's not clear why it's needed in the first place (see [1]). The latest version of lcov is now 1.13. [1] http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commit;h=dedd290bdb647704d74c13992bd04275d9cb648e
* build: enable -Wlogical-op and -Wshift-negative-value compiler warningThomas Haller2017-05-181-0/+2
|
* m4: disable -Wmissing-braces for newer clangLubomir Rintel2017-04-181-0/+6
| | | | | | | | | | | | src/NetworkManagerUtils.c:347:18: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] NMIPAddr a1 = { 0 }, a2 = { 0 }; ^ {} Should we initialize unions this way? I think it's all right -- the initializer works well and { { { 0 } } } is probably not what we'd like to see. (cherry picked from commit 43012156a31fb452ba774196baf106027c2c9067)
* build: test for support of -flto compiler flagThomas Haller2017-02-101-3/+8
| | | | ... and prepend the $ld_gc_flags instead of appending to the $CFLAGS.
* build: add m4 macros for --enable-lto and --enable-ld-gcThomas Haller2017-02-101-0/+27
|
* build: reorder flags in "m4/compiler_options.m4"Thomas Haller2017-02-061-16/+16
| | | | | | Mostly sort alphabetically, but - keep -Wextra first - move "-Wno-*" flags to the end
* build: enable -Wextra warningThomas Haller2017-02-061-0/+2
|
* build: disable -Wformat-truncation warningThomas Haller2017-02-061-0/+1
| | | | | | | | | | | | | | | | | The warning seems questionable and overly strict. For now, just disable it to allow building with gcc7. src/systemd/src/basic/time-util.c: In function ‘format_timespan’: src/systemd/src/basic/time-util.c:509:46: error: ‘%0*lu’ directive output between 1 and 2147483648 bytes may cause result to exceed ‘INT_MAX’ [-Werror=format-truncation=] "%s"USEC_FMT".%0*"PRI_USEC"%s", ^~~~ src/systemd/src/basic/time-util.c:509:60: note: format string is defined here "%s"USEC_FMT".%0*"PRI_USEC"%s", src/systemd/src/basic/time-util.c:509:46: note: directive argument in the range [0, 18446744073709551614] "%s"USEC_FMT".%0*"PRI_USEC"%s", ^~~~ https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00001.html
* build: enable -Wimplicit-fallthrough warning from gcc7Thomas Haller2017-02-061-0/+1
|
* m4/compiler_options.m4: add line breaks for compiler options to checkThomas Haller2017-02-061-6/+17
| | | | No change in behavior.
* build: move the --enable-more-warning option from m4/ to configure.acLubomir Rintel2017-01-191-1/+1
| | | | | | It will make it easier to policy the default. (cherry picked from commit 8647be3717b551164a540f315b1a3643aa20aba4)
* build: allow using GCC C99 dialect instead of C89Thomas Haller2016-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already use several GCC extenions, like typeof() and __attribute__((cleanup)). They are too convinient to miss and every supported compiler must support these. Currently, gcc and clang does. Maybe other compilers would support that too, but who knows, nobody seems to test that. We also already use stdbool.h (C99) and the imported systemd code is mostly gnu99 too (it's not clear to me, because I don't find it precisely documented. Certainly it makes use of C99 features too). C99/gnu99 has some nice improvements that we no longer should miss out. For example "flexible array members" or "variable declaration in init-part of for loop". It doesn't mean we have to use every obscure (badly supported?) feature, it means we don't have to forgo features that are well supported. C99 is 17 years old, I mean, really... If somebody comes along and ports NM to non-gcc/clang, we can address bugs about unsupported language features as they surface. But let's not restrict us to some hypothetical compiler (or language specification). Also, NetworkManager is not ported on environment beside Linux. We don't have to be so considerate about the required build environment. Gcc is probably the most portable compiler out there. I doubt porting NetworkManager to *BSD fails due to missing gnu99 features. And if that causes issues, we should fix them after they happen in practice.
* build: move detection of NM_GIT_SHA to separate "m4/git-sha-record.m4"Thomas Haller2016-09-141-0/+15
| | | | | | | | | | | | | | We want to embed the current commit-id in the ./configure script. That way the generated ./configure file in the source tarball references the commit-id from which the tarball was created. Then, in a second step, a script can check ./configure to find the parent commit. This is for example done by the 'makerepo.sh' script. This is generally useful, and also done by network-manager-applet and libnl3 projects. Move the function to a separate m4 macro to reuse it. It should also be re-used in NetworkManager's VPN plugins.
* build: disable warning "-Wformat-y2k"Thomas Haller2016-06-061-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=767207
* build: configure.ac: always set -fno-strict-aliasingBeniamino Galvani2016-06-031-1/+1
| | | | | | We break the aliasing rules in the code, and thus the flag should always be enabled to prevent wrong optimizations, even without --enable-more-warnings.
* build: import attributes.m4 from systemdBeniamino Galvani2016-06-031-0/+292
| | | | | | It contains useful macros for determining compiler support for flags/attributes. We already similar macros in compiler_options.m4, but the plan is to replace them.
* build: add -Wformat-nonliteral to --enable-more-warnings flagsDan Williams2016-06-031-1/+1
| | | | New with gcc 6.0.
* build: add macro to check the compiler flag supportLubomir Rintel2016-05-181-20/+23
| | | | Also, fold duplicate chunks together.
* trivial: rename compiler_warnings.m4 to compiler_options.m4Lubomir Rintel2016-05-181-0/+0
| | | | We'll use that for more compiler feature-checking macros.
* build: use the glib cflags when checking the compiler flagsLubomir Rintel2016-05-181-1/+1
| | | | Some of the checks include glib headers.
* build: compile with -Wno-duplicate-decl-specifierThomas Haller2016-03-091-0/+1
| | | | | | | Duplicated const specifiers are allowed by C99 and can easily happen in macros. Also, systemd's interal code will use them. Disable this warning, it doesn't seem useful.
* m4: update introspection.m4 with original file from gobject-introspectionThomas Haller2016-03-041-0/+2
| | | | | | | | Originally m4/introspection.m4 was copied from gobject-introspection repository. We however modified it in commit f6272144e98c00db18cf67. Reimport the file with latest changes, but still preserving our workaround.
* build: hack around compiler warning in g-ir-scannerThomas Haller2015-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | The autoconf macro for GIR passes $CFLAGS to g-ir-scanner. g-ir-scanner extends those flags with the system-default which includes -D_FORTIFY_SOURCE=2. Probably it should not do that, but if you disable optimization, this results in a compler warning in "/usr/include/features.h" [1] export CFLAGS='-O0' # Happens both with clang or gcc. #export CC=clang git clean -fdx ./autogen.sh make Work around that by injecting -Wno-error to $CFLAGS when invoking g-ir-scanner. [1] Related: https://sourceware.org/bugzilla/show_bug.cgi?id=13979
* build: set -Werror when checking whether a -W<warning> option worksLubomir Rintel2015-09-291-1/+1
| | | | | | | | Otherwise the check is effectively a no-op and unknown options still get turned on. This results in unknown warnings when build without --with-extra-warnings=error: warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
* build: don't default to -Werrorlr/ancient-ubuntuLubomir Rintel2015-06-021-1/+1
| | | | | | | | | | It seems like a poor default for various downstream toolchains. We can't anticipate the compiler warnings for future compiler versions and older ones are prone to false positives. Also, older gdbus-codegen is known to generate code that triggers compiler warnings. Let's keep it enabled for maintainer builds and distcheck so that we're sure a tool chain that builds releases without warnings exists.
* build: correct help message about missing readline + termcap librariesDan Williams2015-05-111-1/+1
|
* build: fix clang + glib 2.43 buildLubomir Rintel2015-03-191-0/+3
| | | | Known glib issue. Fixes Fedora 22 build.
* build: disable warnings that trigger known clang problemsLubomir Rintel2015-03-191-16/+64
| | | | Fixes build with clang 3.5 on Fedora 21.
* build: disable warnings where macros expand to tautological comparisonsLubomir Rintel2015-03-191-1/+1
|
* build: fix detecting support for -Wno-* compiler flagsThomas Haller2015-02-241-1/+2
| | | | | | | | | | | Since GCC 4.4, gcc does not warn about unknown -Wno-* flags. At least, it does not warning unless another warning is raised as well (https://gcc.gnu.org/wiki/FAQ#wnowarning). We didn't notice up to now, because we only tested flags that GCC actually supports. Hack around this, by checking for the -W* counterpart instead.
* build: fix wrongly linking against libreadline in all applicationsThomas Haller2014-11-261-0/+2
| | | | | | | | | | Every Makefile in the subtrees would include -lreadline as part of LIBS, hence every application would link against the library. This was broken since we added 'm4/ax_lib_readline.m4'. Fixes: 29297f8531e24d4df616c5c3acace9e23a695a02
* dhcp: add systemd-based "internal" DHCP clientDan Williams2014-11-061-1/+1
| | | | | | | | | We must also remove -Waggregate-return from m4/compiler-warnings.m4 because systemd uses aggregate return (correctly) in a couple cases, and we cannot keep single-level makefiles and override aggregate-return only for the systemd sub-library. This client currently only supports DHCPv4 because the base systemd code does not yet fully support DHCPv6.
* build: renable -Wstrict-prototypes compiler warningThomas Haller2014-10-291-0/+1
| | | | | | | | | | | | | The warning -Wstrict-prototypes was disabled by commit db9b1df0e47996ff8aaea468a11e1e97f64ee126 . Enable it again, but avoid warnings for WiMax SDK by explicitly disabling the compiler warning where needed. Apparently clang does not produce a warning for -Wstrict-prototypes, hence we don't need a clang specific #pragma. Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: refactor compiler_warnings.m4 macroThomas Haller2014-10-291-16/+12
| | | | | | | | | | | NM_COMPILER_WARNINGS still works the same, but rename variables to have a CFLAGS_* prefix. Also cleanup the construction of CFLAGS by appending to CFLAGS_MORE_WARNINGS variable instead of appending to CFLAGS, and resetting to SAVE_CFLAGS. Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: ensure rl_echo_signal_char() exists in the readline libraryDan Williams2014-10-141-0/+13
|
* build/clang: fix detection of valid warning compiler flagsThomas Haller2014-08-011-1/+21
| | | | | | | | | | | | | | clang does not exit with error when it is called with an unrecognized (warning) option. Instead it just prints a warning that makes the configure script believe the warning is supported. Later, during build we might pass -Werror, which causes clang to fail due to unrecognized arguments. Fix the script to detect compiler warnings by passing '-Werror=unknown-warning-option', which lets clang fail too. Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: check harder for readlineDan Williams2014-06-271-0/+106
| | | | | | | | | | | | Not all distros build their readline linked with a termcap library, since apps are (apparently) supposed to choose one for themselves and explicitly link to it when using readline. So add some checks to figure out whether readline is already linked, and if not, prefer ncurses since we use that for nmtui already. ax_lib_readline based off: http://www.gnu.org/software/autoconf-archive/ax_lib_readline.html