Blame m4/ax_append_flag.m4

Packit 130fc8
# ===========================================================================
Packit 130fc8
#      http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
Packit 130fc8
# ===========================================================================
Packit 130fc8
#
Packit 130fc8
# SYNOPSIS
Packit 130fc8
#
Packit 130fc8
#   AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
Packit 130fc8
#
Packit 130fc8
# DESCRIPTION
Packit 130fc8
#
Packit 130fc8
#   FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
Packit 130fc8
#   added in between.
Packit 130fc8
#
Packit 130fc8
#   If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
Packit 130fc8
#   CFLAGS) is used.  FLAGS-VARIABLE is not changed if it already contains
Packit 130fc8
#   FLAG.  If FLAGS-VARIABLE is unset in the shell, it is set to exactly
Packit 130fc8
#   FLAG.
Packit 130fc8
#
Packit 130fc8
#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
Packit 130fc8
#
Packit 130fc8
# LICENSE
Packit 130fc8
#
Packit 130fc8
#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
Packit 130fc8
#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
Packit 130fc8
#
Packit 130fc8
#   This program is free software: you can redistribute it and/or modify it
Packit 130fc8
#   under the terms of the GNU General Public License as published by the
Packit 130fc8
#   Free Software Foundation, either version 3 of the License, or (at your
Packit 130fc8
#   option) any later version.
Packit 130fc8
#
Packit 130fc8
#   This program is distributed in the hope that it will be useful, but
Packit 130fc8
#   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 130fc8
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Packit 130fc8
#   Public License for more details.
Packit 130fc8
#
Packit 130fc8
#   You should have received a copy of the GNU General Public License along
Packit 130fc8
#   with this program. If not, see <http://www.gnu.org/licenses/>.
Packit 130fc8
#
Packit 130fc8
#   As a special exception, the respective Autoconf Macro's copyright owner
Packit 130fc8
#   gives unlimited permission to copy, distribute and modify the configure
Packit 130fc8
#   scripts that are the output of Autoconf when processing the Macro. You
Packit 130fc8
#   need not follow the terms of the GNU General Public License when using
Packit 130fc8
#   or distributing such scripts, even though portions of the text of the
Packit 130fc8
#   Macro appear in them. The GNU General Public License (GPL) does govern
Packit 130fc8
#   all other use of the material that constitutes the Autoconf Macro.
Packit 130fc8
#
Packit 130fc8
#   This special exception to the GPL applies to versions of the Autoconf
Packit 130fc8
#   Macro released by the Autoconf Archive. When you make and distribute a
Packit 130fc8
#   modified version of the Autoconf Macro, you may extend this special
Packit 130fc8
#   exception to the GPL to apply to your modified version as well.
Packit 130fc8
Packit 130fc8
#serial 6
Packit 130fc8
Packit 130fc8
AC_DEFUN([AX_APPEND_FLAG],
Packit 130fc8
[dnl
Packit 130fc8
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
Packit 130fc8
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
Packit 130fc8
AS_VAR_SET_IF(FLAGS,[
Packit 130fc8
  AS_CASE([" AS_VAR_GET(FLAGS) "],
Packit 130fc8
    [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
Packit 130fc8
    [
Packit 130fc8
     AS_VAR_APPEND(FLAGS,[" $1"])
Packit 130fc8
     AC_RUN_LOG([: FLAGS="$FLAGS"])
Packit 130fc8
    ])
Packit 130fc8
  ],
Packit 130fc8
  [
Packit 130fc8
  AS_VAR_SET(FLAGS,[$1])
Packit 130fc8
  AC_RUN_LOG([: FLAGS="$FLAGS"])
Packit 130fc8
  ])
Packit 130fc8
AS_VAR_POPDEF([FLAGS])dnl
Packit 130fc8
])dnl AX_APPEND_FLAG