1dnl The copyright in this software is being made available under the BSD License, 2dnl included below. This software may be subject to other third party and 3dnl contributor rights, including patent rights, and no such rights are granted 4dnl under this license. 5dnl 6dnl Copyright (c) Intel Corporation 7dnl 8dnl All rights reserved. 9dnl 10dnl BSD License 11dnl 12dnl Redistribution and use in source and binary forms, with or without modification, 13dnl are permitted provided that the following conditions are met: 14dnl 15dnl Redistributions of source code must retain the above copyright notice, this list 16dnl of conditions and the following disclaimer. 17dnl 18dnl Redistributions in binary form must reproduce the above copyright notice, this 19dnl list of conditions and the following disclaimer in the documentation and/or 20dnl other materials provided with the distribution. 21dnl 22dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" 23dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25dnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 26dnl ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29dnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 33dnl ADD_COMPILER_FLAG: 34dnl A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will 35dnl check to be sure the compiler supprts the flag. Flags can be made 36dnl mandatory (configure will fail). 37dnl $1: C compiler flag to add to EXTRA_CFLAGS. 38dnl $2: Set to "required" to cause configure failure if flag not supported.. 39AC_DEFUN([ADD_COMPILER_FLAG],[ 40 AX_CHECK_COMPILE_FLAG([$1],[ 41 EXTRA_CFLAGS="$EXTRA_CFLAGS $1" 42 AC_SUBST([EXTRA_CFLAGS])],[ 43 AS_IF([test x$2 != xrequired],[ 44 AC_MSG_WARN([Optional CFLAG "$1" not supported by your compiler, continuing.])],[ 45 AC_MSG_ERROR([Required CFLAG "$1" not supported by your compiler, aborting.])] 46 )],[ 47 -Wall -Werror] 48 )] 49) 50dnl ADD_PREPROC_FLAG: 51dnl Add the provided preprocessor flag to the EXTRA_CFLAGS variable. This 52dnl macro will check to be sure the preprocessor supports the flag. 53dnl The flag can be made mandatory by provideing the string 'required' as 54dnl the second parameter. 55dnl $1: Preprocessor flag to add to EXTRA_CFLAGS. 56dnl $2: Set to "required" t ocause configure failure if preprocesor flag 57dnl is not supported. 58AC_DEFUN([ADD_PREPROC_FLAG],[ 59 AX_CHECK_PREPROC_FLAG([$1],[ 60 EXTRA_CFLAGS="$EXTRA_CFLAGS $1" 61 AC_SUBST([EXTRA_CFLAGS])],[ 62 AS_IF([test x$2 != xrequired],[ 63 AC_MSG_WARN([Optional preprocessor flag "$1" not supported by your compiler, continuing.])],[ 64 AC_MSG_ERROR([Required preprocessor flag "$1" not supported by your compiler, aborting.])] 65 )],[ 66 -Wall -Werror] 67 )] 68) 69dnl ADD_LINK_FLAG: 70dnl A macro to add a LDLAG to the EXTRA_LDFLAGS variable. This macro will 71dnl check to be sure the linker supprts the flag. Flags can be made 72dnl mandatory (configure will fail). 73dnl $1: linker flag to add to EXTRA_LDFLAGS. 74dnl $2: Set to "required" to cause configure failure if flag not supported. 75AC_DEFUN([ADD_LINK_FLAG],[ 76 AX_CHECK_LINK_FLAG([$1],[ 77 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $1" 78 AC_SUBST([EXTRA_LDFLAGS])],[ 79 AS_IF([test x$2 != xrequired],[ 80 AC_MSG_WARN([Optional LDFLAG "$1" not supported by your linker, continuing.])],[ 81 AC_MSG_ERROR([Required LDFLAG "$1" not supported by your linker, aborting.])] 82 )] 83 )] 84) 85