1#http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_linker_flags.m4 2# =========================================================================== 3# http://www.gnu.org/software/autoconf-archive/ax_check_linker_flags.html 4# =========================================================================== 5# 6# SYNOPSIS 7# 8# AX_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) 9# 10# DESCRIPTION 11# 12# Check whether the given linker FLAGS work with the current language's 13# linker, or whether they give an error. 14# 15# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 16# success/failure. 17# 18# NOTE: Based on AX_CHECK_COMPILER_FLAGS. 19# 20# LICENSE 21# 22# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org> 23# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> 24# Copyright (c) 2009 Matteo Frigo 25# 26# This program is free software: you can redistribute it and/or modify it 27# under the terms of the GNU General Public License as published by the 28# Free Software Foundation, either version 3 of the License, or (at your 29# option) any later version. 30# 31# This program is distributed in the hope that it will be useful, but 32# WITHOUT ANY WARRANTY; without even the implied warranty of 33# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 34# Public License for more details. 35# 36# You should have received a copy of the GNU General Public License along 37# with this program. If not, see <http://www.gnu.org/licenses/>. 38# 39# As a special exception, the respective Autoconf Macro's copyright owner 40# gives unlimited permission to copy, distribute and modify the configure 41# scripts that are the output of Autoconf when processing the Macro. You 42# need not follow the terms of the GNU General Public License when using 43# or distributing such scripts, even though portions of the text of the 44# Macro appear in them. The GNU General Public License (GPL) does govern 45# all other use of the material that constitutes the Autoconf Macro. 46# 47# This special exception to the GPL applies to versions of the Autoconf 48# Macro released by the Autoconf Archive. When you make and distribute a 49# modified version of the Autoconf Macro, you may extend this special 50# exception to the GPL to apply to your modified version as well. 51 52#serial 6 53 54AC_DEFUN([AX_CHECK_LINKER_FLAGS], 55[AC_MSG_CHECKING([whether the linker accepts $1]) 56dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: 57AS_LITERAL_IF([$1], 58 [AC_CACHE_VAL(AS_TR_SH(ax_cv_linker_flags_[$1]), [ 59 ax_save_FLAGS=$LDFLAGS 60 LDFLAGS="$1" 61 AC_LINK_IFELSE([AC_LANG_PROGRAM()], 62 AS_TR_SH(ax_cv_linker_flags_[$1])=yes, 63 AS_TR_SH(ax_cv_linker_flags_[$1])=no) 64 LDFLAGS=$ax_save_FLAGS])], 65 [ax_save_FLAGS=$LDFLAGS 66 LDFLAGS="$1" 67 AC_LINK_IFELSE([AC_LANG_PROGRAM()], 68 eval AS_TR_SH(ax_cv_linker_flags_[$1])=yes, 69 eval AS_TR_SH(ax_cv_linker_flags_[$1])=no) 70 LDFLAGS=$ax_save_FLAGS]) 71eval ax_check_linker_flags=$AS_TR_SH(ax_cv_linker_flags_[$1]) 72AC_MSG_RESULT($ax_check_linker_flags) 73if test "x$ax_check_linker_flags" = xyes; then 74 m4_default([$2], :) 75else 76 m4_default([$3], :) 77fi 78])dnl AX_CHECK_LINKER_FLAGS 79