]> git.ipfire.org Git - thirdparty/util-linux.git/blame - m4/compiler.m4
last: do not use non-standard __UT_NAMESIZE
[thirdparty/util-linux.git] / m4 / compiler.m4
CommitLineData
0e60bc9b
KZ
1dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
2dnl This file is free software; the Free Software Foundation
3dnl gives unlimited permission to copy and/or distribute it,
4dnl with or without modifications, as long as this notice is preserved.
5
6dnl From Simon Josefsson
bdf5f542 7dnl -- derivated from coreutils m4/warnings.m4
0e60bc9b
KZ
8
9# UL_AS_VAR_APPEND(VAR, VALUE)
10# ----------------------------
11# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
12m4_ifdef([AS_VAR_APPEND],
13[m4_copy([AS_VAR_APPEND], [UL_AS_VAR_APPEND])],
14[m4_define([UL_AS_VAR_APPEND],
15[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
16
7697771d 17# UL_ADD_WARN(COMPILER_OPTION [, VARNAME])
4e806975 18# ------------------------
7697771d 19# Adds parameter to WARN_CFLAGS (or to $VARNAME) if the compiler supports it.
4e806975 20AC_DEFUN([UL_WARN_ADD], [
7697771d 21 m4_define([warnvarname], m4_default([$2],WARN_CFLAGS))
55eec264
KZ
22 AS_VAR_PUSHDEF([ul_Warn], [ul_cv_warn_$1])dnl
23 AC_CACHE_CHECK([whether compiler handles $1], m4_defn([ul_Warn]), [
e85e8720
RM
24 # store AC_LANG_WERROR status, then turn it on
25 save_ac_[]_AC_LANG_ABBREV[]_werror_flag="${ac_[]_AC_LANG_ABBREV[]_werror_flag}"
26 AC_LANG_WERROR
27
55eec264 28 ul_save_CPPFLAGS="$CPPFLAGS"
4e806975 29 CPPFLAGS="-Werror ${CPPFLAGS} $1"
55eec264
KZ
30 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
31 [AS_VAR_SET(ul_Warn, [yes])],
32 [AS_VAR_SET(ul_Warn, [no])])
e85e8720
RM
33 # restore AC_LANG_WERROR
34 ac_[]_AC_LANG_ABBREV[]_werror_flag="${save_ac_[]_AC_LANG_ABBREV[]_werror_flag}"
35
55eec264
KZ
36 CPPFLAGS="$ul_save_CPPFLAGS"
37 ])
7697771d 38 AS_VAR_IF(ul_Warn, [yes], [UL_AS_VAR_APPEND(warnvarname, [" $1"])])
0e60bc9b 39])
55eec264 40