~ubuntu-branches/ubuntu/trusty/patch/trusty-security

« back to all changes in this revision

Viewing changes to m4/warnings.m4

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2013-01-03 17:34:45 UTC
  • mto: (6.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20130103173445-5vf8qmnfgd7ug67h
Tags: upstream-2.7.1
ImportĀ upstreamĀ versionĀ 2.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# warnings.m4 serial 2
2
 
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 
1
# warnings.m4 serial 7
 
2
dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
14
14
[m4_define([gl_AS_VAR_APPEND],
15
15
[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
16
16
 
17
 
# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS])
18
 
# ------------------------------------------------
19
 
# Adds parameter to WARN_CFLAGS if the compiler supports it.  For example,
20
 
# gl_WARN_ADD([-Wparentheses]).
21
 
AC_DEFUN([gl_WARN_ADD],
22
 
[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
23
 
AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
24
 
  save_CPPFLAGS="$CPPFLAGS"
25
 
  CPPFLAGS="${CPPFLAGS} $1"
26
 
  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
27
 
                    [AS_VAR_SET([gl_Warn], [yes])],
28
 
                    [AS_VAR_SET([gl_Warn], [no])])
29
 
  CPPFLAGS="$save_CPPFLAGS"
 
17
 
 
18
# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
 
19
#                       [PROGRAM = AC_LANG_PROGRAM()])
 
20
# -----------------------------------------------------------------
 
21
# Check if the compiler supports OPTION when compiling PROGRAM.
 
22
#
 
23
# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
 
24
# 2.64 or newer.
 
25
AC_DEFUN([gl_COMPILER_OPTION_IF],
 
26
[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
 
27
AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
 
28
AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
 
29
  gl_save_compiler_FLAGS="$gl_Flags"
 
30
  gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"])
 
31
  AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
 
32
                    [AS_VAR_SET(gl_Warn, [yes])],
 
33
                    [AS_VAR_SET(gl_Warn, [no])])
 
34
  gl_Flags="$gl_save_compiler_FLAGS"
30
35
])
31
 
AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
32
 
AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
 
36
AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
33
37
AS_VAR_POPDEF([gl_Flags])dnl
34
38
AS_VAR_POPDEF([gl_Warn])dnl
35
 
m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
36
 
])
 
39
])
 
40
 
 
41
 
 
42
# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
 
43
#             [PROGRAM = AC_LANG_PROGRAM()])
 
44
# ---------------------------------------------
 
45
# Adds parameter to WARN_CFLAGS if the compiler supports it when
 
46
# compiling PROGRAM.  For example, gl_WARN_ADD([-Wparentheses]).
 
47
#
 
48
# If VARIABLE is a variable name, AC_SUBST it.
 
49
AC_DEFUN([gl_WARN_ADD],
 
50
[gl_COMPILER_OPTION_IF([$1],
 
51
  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
 
52
  [],
 
53
  [$3])
 
54
m4_ifval([$2],
 
55
         [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
 
56
         [AC_SUBST([WARN_CFLAGS])])dnl
 
57
])
 
58
 
 
59
# Local Variables:
 
60
# mode: autoconf
 
61
# End: