ADDED aclocal/ax_check_link_flag.m4 Index: aclocal/ax_check_link_flag.m4 ================================================================== --- /dev/null +++ aclocal/ax_check_link_flag.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# 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 6 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS Index: autogen.sh ================================================================== --- autogen.sh +++ autogen.sh @@ -14,10 +14,11 @@ urls=( http://chiselapp.com/user/rkeene/repository/autoconf/doc/trunk/tcl.m4 http://chiselapp.com/user/rkeene/repository/autoconf/doc/trunk/shobj.m4 http://chiselapp.com/user/rkeene/repository/autoconf/doc/trunk/versionscript.m4 'http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4' + 'http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_link_flag.m4' ) localFiles=( ) Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -54,11 +54,15 @@ ]) dnl If we are building a debug release, enable debugging flags if test "$tcl_nano_debug" = 'true'; then AC_DEFINE(TCLEXT_TCL_NANO_DEBUG, [1], [Enable debugging build]) - AX_CHECK_COMPILE_FLAG([-mmpx -fcheck-pointer-bounds], [CFLAGS="$CFLAGS -mmpx -fcheck-pointer-bounds"]) + AX_CHECK_COMPILE_FLAG([-mmpx -fcheck-pointer-bounds], [ + AX_CHECK_LINK_FLAG([-mmpx -fcheck-pointer-bounds], [ + CFLAGS="$CFLAGS -mmpx -fcheck-pointer-bounds" + ]) + ]) AX_CHECK_COMPILE_FLAG([-g3], [CFLAGS="$CFLAGS -g3"]) AX_CHECK_COMPILE_FLAG([-ggdb3], [CFLAGS="$CFLAGS -ggdb3"]) else dnl If we are not doing debugging disable some of the more annoying warnings AX_CHECK_COMPILE_FLAG([-Wno-unused-value], [CFLAGS="$CFLAGS -Wno-unused-value"])