1# Copyright (c) 2015 Lucas De Marchi <lucas.de.marchi@gmail.com> 2# 3# This program is free software: you can redistribute it and/or modify it 4# under the terms of the GNU General Public License as published by the 5# Free Software Foundation, either version 2 of the License, or (at your 6# option) any later version. 7# 8# This program is distributed in the hope that it will be useful, but 9# WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 11# Public License for more details. 12# 13# You should have received a copy of the GNU General Public License along 14# with this program. If not, see <http://www.gnu.org/licenses/>. 15# 16# As a special exception, the respective Autoconf Macro's copyright owner 17# gives unlimited permission to copy, distribute and modify the configure 18# scripts that are the output of Autoconf when processing the Macro. You 19# need not follow the terms of the GNU General Public License when using 20# or distributing such scripts, even though portions of the text of the 21# Macro appear in them. The GNU General Public License (GPL) does govern 22# all other use of the material that constitutes the Autoconf Macro. 23# 24# This special exception to the GPL applies to versions of the Autoconf 25# Macro released by the Autoconf Archive. When you make and distribute a 26# modified version of the Autoconf Macro, you may extend this special 27# exception to the GPL to apply to your modified version as well. 28# 29# CC_FEATURE_APPEND([FLAGS], [ENV-TO-CHECK], [FLAG-NAME]) 30AC_DEFUN([CC_FEATURE_APPEND], [ 31 AS_VAR_PUSHDEF([FLAGS], [$1])dnl 32 AS_VAR_PUSHDEF([ENV_CHECK], [$2])dnl 33 AS_VAR_PUSHDEF([FLAG_NAME], [$3])dnl 34 35 AS_CASE([" AS_VAR_GET(FLAGS) " ], 36 [*" FLAG_NAME "*], [AC_RUN_LOG([: FLAGS already contains FLAG_NAME])], 37 [ 38 AS_IF([test "x$FLAGS" != "x"], [AS_VAR_APPEND(FLAGS, " ")]) 39 AS_IF([test "x$ENV_CHECK" = "xyes"], 40 [AS_VAR_APPEND(FLAGS, "+FLAG_NAME")], 41 [AS_VAR_APPEND(FLAGS, "-FLAG_NAME")]) 42 ] 43 ) 44 45 AS_VAR_POPDEF([FLAG_NAME])dnl 46 AS_VAR_POPDEF([ENV_CHECK])dnl 47 AS_VAR_POPDEF([FLAGS])dnl 48]) 49