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