libcruft-util/m4/nc_append_one_compile_flag.m4

26 lines
713 B
Plaintext
Raw Normal View History

2015-02-03 00:15:28 +11:00
# SYNOPSIS
#
# NC_APPEND_ONE_COMPILE_FLAG([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# Append the first valid compilation flag in the provided list to FLAGS-VARIABLE
AC_DEFUN([NC_APPEND_ONE_COMPILE_FLAG], [
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for __dummy in "1"; do
for flag in $1; do
AX_CHECK_COMPILE_FLAG([$flag],
[AX_APPEND_FLAG([$flag], [$2])
break 2],
[],
[$3])
done
AC_MSG_ERROR([unable to find a valid compilation flag in '$1'])
done
])