1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
# enable warnings for the selected compiler
AC_DEFUN([AC_CC_WARNINGS],
[
# enable the --silent option
AC_ARG_ENABLE(silent,
[AC_HELP_STRING(
[--enable-silent],
[disable implicit warnings])])
if test "$enable_silent" != "yes"
then
AC_MSG_CHECKING([for warning flags])
case "$CC" in
gcc* | g++*) ac_wflags="-Wall -Wno-format";;
*) AC_MSG_RESULT(unsupported compiler);;
esac
if test -n "$ac_wflags"
then
AC_MSG_RESULT([$ac_wflags])
CFLAGS="$CFLAGS $ac_wflags"
fi
fi
])
# force supported compilers to be pedantic
AC_DEFUN([AC_CC_PEDANTIC],
[
# enable the --pedantic option
AC_ARG_ENABLE(pedantic,
[AC_HELP_STRING(
[--enable-pedantic],
[enable pedantic flags])])
if test "$enable_pedantic" = "yes"
then
AC_MSG_CHECKING([for pedantic flags])
case "$CC" in
gcc*) ac_pflags="-pedantic";;
*) AC_MSG_RESULT(unsupported compiler);;
esac
if test -z "$ac_pflags"
then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([$ac_pflags])
CFLAGS="$CFLAGS $ac_pflags"
fi
fi
])
# enable production releases by default
AC_DEFUN([AC_CC_DEBUG],
[
# enable the --debug option
AC_ARG_ENABLE(debug,
[AC_HELP_STRING(
[--enable-debug],
[enable debugging flags])])
if test "$enable_debug" != "yes"
then
CPPFLAGS="$CPPFLAGS -DNDEBUG"
fi
])
# check for a size type
# note how I use the returning value of AC_RUN_IFELSE(ac_status),
# as there's NO other way of capturing a test's output.
AC_DEFUN([AC_SIZE_CHECK],
[
AC_MSG_CHECKING([for "$1" size])
AC_RUN_IFELSE(
[
int main() {return (sizeof($1) * 8);}
], [AC_MSG_RESULT([indeterminate])],
[translit($1, ' ', '_')_size="$ac_status"
AC_MSG_RESULT([$ac_status bits])]
)
])
# search for an integral type of a specified size
# usage: AC_SIZE_SEARCH(typedef, bits, [type type ...])
# each type must first be checked with AC_SIZE_CHECK
AC_DEFUN([AC_SIZE_SEARCH],
[
AC_MSG_CHECKING([for a $2 bits type])
unset xtype
for type in $3
do
bits="`echo \"$type\" | tr \" \" \"_\"`_size"
bits="`eval echo \\$$bits`"
if test -n "$bits" -a "$bits" = "$2"
then
xtype="$type"
break
fi
done
if test -n "$xtype"
then
AC_DEFINE_UNQUOTED([$1], $xtype, [$2 bits type])
AC_MSG_RESULT([$xtype])
else
AC_MSG_ERROR([unable to find any suitable type])
fi
unset IFS
])
# creates a new switch (--enable-) with and help string which controls
# the definition of a conditional.
# usage: AC_ARG_EC(command name, variable, define, help string, check string)
AC_DEFUN([AC_ARG_EC],
[
AC_ARG_ENABLE([$1], [AC_HELP_STRING([--enable-$1], [$4])])
AC_MSG_CHECKING([$5])
if test "$enable_$2" = "yes"
then
AC_DEFINE([$3],, [$4])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
|