Blame m4/ax_append_flag.m4

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