diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ax_compiler_flags_cflags.m4 | 34 | ||||
-rw-r--r-- | m4/ax_compiler_flags_ldflags.m4 | 23 | ||||
-rw-r--r-- | m4/ax_generate_changelog.m4 | 99 | ||||
-rw-r--r-- | m4/libtool.m4 | 21 |
4 files changed, 62 insertions, 115 deletions
diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4 index aeb16e3..44d2882 100644 --- a/m4/ax_compiler_flags_cflags.m4 +++ b/m4/ax_compiler_flags_cflags.m4 @@ -19,13 +19,14 @@ # LICENSE # # Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk> +# Copyright (c) 2017, 2018 Reini Urban <rurban@cpan.org> # # 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. This file is offered as-is, without any # warranty. -#serial 14 +#serial 16 AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AC_REQUIRE([AC_PROG_SED]) @@ -39,6 +40,13 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ + [#ifndef __cplusplus + #error "no C++" + #endif]])], + [ax_compiler_cxx=yes;], + [ax_compiler_cxx=no;]) + # Always pass -Werror=unknown-warning-option to get Clang to fail on bad # flags, otherwise they are always appended to the warn_cflags variable, and # Clang warns on them for every compilation unit. @@ -69,18 +77,13 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ -Wall dnl -Wextra dnl -Wundef dnl - -Wnested-externs dnl -Wwrite-strings dnl -Wpointer-arith dnl -Wmissing-declarations dnl - -Wmissing-prototypes dnl - -Wstrict-prototypes dnl -Wredundant-decls dnl -Wno-unused-parameter dnl -Wno-missing-field-initializers dnl - -Wdeclaration-after-statement dnl -Wformat=2 dnl - -Wold-style-definition dnl -Wcast-align dnl -Wformat-nonliteral dnl -Wformat-security dnl @@ -96,15 +99,32 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ -Wmissing-include-dirs dnl -Wunused-but-set-variable dnl -Warray-bounds dnl - -Wimplicit-function-declaration dnl -Wreturn-type dnl -Wswitch-enum dnl -Wswitch-default dnl + -Wduplicated-cond dnl + -Wduplicated-branches dnl + -Wlogical-op dnl + -Wrestrict dnl + -Wnull-dereference dnl + -Wdouble-promotion dnl $4 dnl $5 dnl $6 dnl $7 dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) + if test "$ax_compiler_cxx" = "no" ; then + # C-only flags. Warn in C++ + AX_APPEND_COMPILE_FLAGS([ dnl + -Wnested-externs dnl + -Wmissing-prototypes dnl + -Wstrict-prototypes dnl + -Wdeclaration-after-statement dnl + -Wimplicit-function-declaration dnl + -Wold-style-definition dnl + -Wjump-misses-init dnl + ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) + fi ]) AS_IF([test "$ax_enable_compile_warnings" = "error"],[ # "error" flags; -Werror has to be appended unconditionally because diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4 index 842e329..976d119 100644 --- a/m4/ax_compiler_flags_ldflags.m4 +++ b/m4/ax_compiler_flags_ldflags.m4 @@ -19,13 +19,14 @@ # LICENSE # # Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk> +# Copyright (c) 2017, 2018 Reini Urban <rurban@cpan.org> # # 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. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS]) @@ -48,7 +49,25 @@ AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ ax_compiler_flags_test="" ]) - # macOS linker does not have --as-needed + AX_CHECK_LINK_FLAG([-Wl,--as-needed], [ + AX_APPEND_LINK_FLAGS([-Wl,--as-needed], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + AX_CHECK_LINK_FLAG([-Wl,-z,relro], [ + AX_APPEND_LINK_FLAGS([-Wl,-z,relro], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + AX_CHECK_LINK_FLAG([-Wl,-z,now], [ + AX_APPEND_LINK_FLAGS([-Wl,-z,now], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [ + AX_APPEND_LINK_FLAGS([-Wl,-z,noexecstack], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + # textonly, retpolineplt not yet + + # macOS and cygwin linker do not have --as-needed AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [ ax_compiler_flags_as_needed_option="-Wl,--no-as-needed" ], [ diff --git a/m4/ax_generate_changelog.m4 b/m4/ax_generate_changelog.m4 deleted file mode 100644 index e2f0c54..0000000 --- a/m4/ax_generate_changelog.m4 +++ /dev/null @@ -1,99 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_generate_changelog.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_GENERATE_CHANGELOG() -# -# DESCRIPTION -# -# Builds a rule for generating a ChangeLog file from version control -# system commit messages. Currently, the only supported VCS is git, but -# support for others could be added in future. -# -# Defines GENERATE_CHANGELOG_RULES which should be substituted in your -# Makefile. -# -# Usage example: -# -# configure.ac: -# -# AX_GENERATE_CHANGELOG -# -# Makefile.am: -# -# @GENERATE_CHANGELOG_RULES@ -# CHANGELOG_START = 0.2.3^ -# dist-hook: dist-ChangeLog -# -# ChangeLog (stub committed to VCS): -# -# The ChangeLog is auto-generated when releasing. -# If you are seeing this, use 'git log' for a detailed list of changes. -# -# This results in a "dist-ChangeLog" rule being added to the Makefile. -# When run, "dist-ChangeLog" will generate a ChangeLog in the -# $(top_distdir), using $(CHANGELOG_GIT_FLAGS) to format the output from -# "git log" being run in $(CHANGELOG_GIT_DIR). -# -# Unless Automake is initialised with the 'foreign' option, a dummy -# ChangeLog file must be committed to VCS in $(top_srcdir), containing the -# text above (for example). It will be substituted by the automatically -# generated ChangeLog during "make dist". -# -# LICENSE -# -# Copyright (c) 2015 David King <amigadave@amigadave.com> -# Copyright (c) 2015 Philip Withnall <philip.withnall@collabora.co.uk> -# -# 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. This file is offered as-is, without any -# warranty. - -#serial 3 - -AC_DEFUN([AX_GENERATE_CHANGELOG],[ - # Find git, defaulting to the 'missing' script so the user gets a nice - # message if git is missing, rather than a plain 'command not found'. - AC_PATH_PROG([GIT],[git],[${am_missing_run}git]) - AC_SUBST([GIT]) - - # Build the ChangeLog rules. - m4_pattern_allow([AM_V_GEN]) -GENERATE_CHANGELOG_RULES=' -# Generate ChangeLog -# -# Optional: -# - CHANGELOG_START: git commit ID or tag name to output changelogs from -# (exclusive). (Default: include all commits) -# - CHANGELOG_GIT_FLAGS: General flags to pass to git-log when generating the -# ChangeLog. (Default: various) -# - CHANGELOG_GIT_DIR: .git directory to use. (Default: $(top_srcdir)/.git) - -# git-specific -CHANGELOG_GIT_FLAGS ?= --stat -M -C --name-status --no-color --no-decorate -CHANGELOG_GIT_DIR ?= $(top_srcdir)/.git - -ifeq ($(CHANGELOG_START),) -CHANGELOG_GIT_RANGE = -else -CHANGELOG_GIT_RANGE = $(CHANGELOG_START).. -endif - -# Generate a ChangeLog in $(top_distdir) -dist-ChangeLog: - $(AM_V_GEN)if $(GIT) \ - --git-dir=$(CHANGELOG_GIT_DIR) --work-tree=$(top_srcdir) log \ - $(CHANGELOG_GIT_FLAGS) $(CHANGELOG_GIT_RANGE) \ - | fmt --split-only >.ChangeLog.tmp; \ - then mv -f .ChangeLog.tmp "$(top_distdir)/ChangeLog"; \ - else rm -f .ChangeLog.tmp; exit 1; fi - -.PHONY: dist-ChangeLog -' - - AC_SUBST([GENERATE_CHANGELOG_RULES]) - m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([GENERATE_CHANGELOG_RULES])]) -]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index ee80844..9d6dd9f 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -4063,7 +4063,8 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -4703,6 +4704,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -6438,7 +6445,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no @@ -6813,7 +6820,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -6878,7 +6885,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -7217,7 +7224,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support @@ -7301,7 +7308,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -7312,7 +7319,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' |