diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4 index f470f8f7..62af30f6 100644 --- a/m4/ax_compiler_flags_cflags.m4 +++ b/m4/ax_compiler_flags_cflags.m4 @@ -25,7 +25,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 11 +#serial 12 AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AC_REQUIRE([AC_PROG_SED]) @@ -34,7 +34,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) # Variable names - m4_define(ax_warn_cflags_variable, + m4_define([ax_warn_cflags_variable], [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))]) AC_LANG_PUSH([C]) diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4 index 2d875e85..d702aac0 100644 --- a/m4/ax_compiler_flags_cxxflags.m4 +++ b/m4/ax_compiler_flags_cxxflags.m4 @@ -26,7 +26,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[ AC_REQUIRE([AC_PROG_SED]) @@ -35,7 +35,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[ AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) # Variable names - m4_define(ax_warn_cxxflags_variable, + m4_define([ax_warn_cxxflags_variable], [m4_normalize(ifelse([$1],,[WARN_CXXFLAGS],[$1]))]) AC_LANG_PUSH([C++]) diff --git a/m4/ax_compiler_flags_gir.m4 b/m4/ax_compiler_flags_gir.m4 index 180f50d4..4a854f0d 100644 --- a/m4/ax_compiler_flags_gir.m4 +++ b/m4/ax_compiler_flags_gir.m4 @@ -26,13 +26,13 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 4 +#serial 5 AC_DEFUN([AX_COMPILER_FLAGS_GIR],[ AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) # Variable names - m4_define(ax_warn_scannerflags_variable, + m4_define([ax_warn_scannerflags_variable], [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))]) # Base flags diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4 index 228471ec..fd7974e7 100644 --- a/m4/ax_compiler_flags_ldflags.m4 +++ b/m4/ax_compiler_flags_ldflags.m4 @@ -25,15 +25,16 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 5 +#serial 7 AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) + AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) # Variable names - m4_define(ax_warn_ldflags_variable, + m4_define([ax_warn_ldflags_variable], [m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))]) # Always pass -Werror=unknown-warning-option to get Clang to fail on bad @@ -47,9 +48,25 @@ AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ ax_compiler_flags_test="" ]) + # macOS linker does not have --as-needed + AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [ + ax_compiler_flags_as_needed_option="-Wl,--no-as-needed" + ], [ + ax_compiler_flags_as_needed_option="" + ]) + + # macOS linker speaks with a different accent + ax_compiler_flags_fatal_warnings_option="" + AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [ + ax_compiler_flags_fatal_warnings_option="-Wl,--fatal-warnings" + ]) + AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [ + ax_compiler_flags_fatal_warnings_option="-Wl,-fatal_warnings" + ]) + # Base flags AX_APPEND_LINK_FLAGS([ dnl - -Wl,--no-as-needed dnl + $ax_compiler_flags_as_needed_option dnl $3 dnl ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) @@ -66,7 +83,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ # suggest-attribute=format is disabled because it gives too many false # positives AX_APPEND_LINK_FLAGS([ dnl - -Wl,--fatal-warnings dnl + $ax_compiler_flags_fatal_warnings_option dnl ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) ]) diff --git a/m4/ax_generate_changelog.m4 b/m4/ax_generate_changelog.m4 index d9d5cd10..71c5fd11 100644 --- a/m4/ax_generate_changelog.m4 +++ b/m4/ax_generate_changelog.m4 @@ -52,7 +52,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 1 +#serial 2 AC_DEFUN([AX_GENERATE_CHANGELOG],[ # Find git, defaulting to the 'missing' script so the user gets a nice @@ -73,7 +73,7 @@ GENERATE_CHANGELOG_RULES=' # - CHANGELOG_GIT_DIR: .git directory to use. (Default: $(top_srcdir)/.git) # git-specific -CHANGELOG_GIT_FLAGS ?= --stat -M -C --name-status --no-color +CHANGELOG_GIT_FLAGS ?= --stat -M -C --name-status --no-color --no-decorate CHANGELOG_GIT_DIR ?= $(top_srcdir)/.git ifeq ($(CHANGELOG_START),) diff --git a/m4/ax_is_release.m4 b/m4/ax_is_release.m4 index c728b1e7..0892e657 100644 --- a/m4/ax_is_release.m4 +++ b/m4/ax_is_release.m4 @@ -26,6 +26,10 @@ # * micro-version: ax_is_release will be 'no' if the micro version number # in $PACKAGE_VERSION is odd; this assumes # $PACKAGE_VERSION follows the 'major.minor.micro' scheme +# * dash-version: ax_is_release will be 'no' if there is a dash '-' +# in $PACKAGE_VERSION, for example 1.2-pre3, 1.2.42-a8b9 +# or 2.0-dirty (in particular this is suitable for use +# with git-version-gen) # * always: ax_is_release will always be 'yes' # * never: ax_is_release will always be 'no' # @@ -34,12 +38,13 @@ # LICENSE # # Copyright (c) 2015 Philip Withnall +# Copyright (c) 2016 Collabora Ltd. # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. -#serial 4 +#serial 5 AC_DEFUN([AX_IS_RELEASE],[ AC_BEFORE([AC_INIT],[$0]) @@ -61,9 +66,15 @@ AC_DEFUN([AX_IS_RELEASE],[ AS_IF([test "$(( $micro_version % 2 ))" -ne 0], [ax_is_release=no],[ax_is_release=yes]) ], + [dash-version],[ + # $is_release = ($PACKAGE_VERSION has a dash) + AS_CASE([$PACKAGE_VERSION], + [*-*], [ax_is_release=no], + [*], [ax_is_release=yes]) + ], [always],[ax_is_release=yes], [never],[ax_is_release=no], [ - AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version.]) + AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version, micro-version, dash-version, always, never.]) ]) ])