Blame m4/ax_append_flag.m4

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