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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
dnl Many of the following macros courtesy of:
dnl http://www.gnu.org/software/ac-archive/
dnl
dnl The Following macros courtesy of:
dnl Installed_Packages/check_gnu_make.html
dnl
dnl Copyrights are by the individual authors, as listed.
dnl License: GPL
dnl
dnl CHECK_GNU_MAKE()
dnl
dnl This macro searches for a GNU version of make. If a match is found, the
dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
dnl set to "#". This is useful for including a special features in a Makefile,
dnl which cannot be handled by other versions of make. The variable
dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
dnl the empty string otherwise.
dnl
dnl Here is an example of its use:
dnl
dnl Makefile.in might contain:
dnl
dnl # A failsafe way of putting a dependency rule into a makefile
dnl $(DEPEND):
dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
dnl
dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
dnl @ifGNUmake@ include $(DEPEND)
dnl @ifGNUmake@ endif
dnl
dnl Then configure.in would normally contain:
dnl
dnl CHECK_GNU_MAKE()
dnl AC_OUTPUT(Makefile)
dnl
dnl Then perhaps to cause gnu make to override any other make, we could do
dnl something like this (note that GNU make always looks for GNUmakefile first):
dnl
dnl if ! test x$_cv_gnu_make_command = x ; then
dnl mv Makefile GNUmakefile
dnl echo .DEFAULT: > Makefile ;
dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
dnl fi
dnl
dnl Then, if any (well almost any) other make is called, and GNU make also exists,
dnl then the other make wraps the GNU make.
dnl
dnl John Darrington <j.darrington@elvis.murdoch.edu.au>
dnl 1.3 (2002/01/04)
dnl
dnl Modified 18 Sep 2002 by Jon Nelson <jnelson@boa.org>
AC_DEFUN([CHECK_GNU_MAKE],
[ AC_CACHE_CHECK( for GNU make, _cv_gnu_make_command,
[_cv_gnu_make_command=''
dnl Search all the common names for GNU make
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ); then
_cv_gnu_make_command=$a
break;
fi
done
if test "x$_cv_gnu_make_command" = "x"; then
_cv_gnu_make_command="Not found"
fi
])
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
if test "$_cv_gnu_make_command" != "Not found"; then
ifGNUmake='';
else
ifGNUmake='#';
_cv_gnu_make_command='';
fi
AC_SUBST(ifGNUmake)
])
dnl AC_CHECK_STRUCT_FOR(INCLUDES,STRUCT,MEMBER,DEFINE,[no])
dnl 1.1 (2000/09/19)
dnl Wes Hardaker <wjhardaker@ucdavis.edu>
dnl ----------------------------------------------------------
AC_DEFUN([AC_CHECK_STRUCT_FOR],[
ac_safe_struct=`echo "$2" | sed 'y%./+-%__p_%'`
ac_safe_member=`echo "$3" | sed 'y%./+-%__p_%'`
ac_safe_all="ac_cv_struct_${ac_safe_struct}_has_${ac_safe_member}"
changequote(, )dnl
ac_uc_define=STRUCT_`echo "${ac_safe_struct}_HAS_${ac_safe_member}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
changequote([, ])dnl
AC_MSG_CHECKING([for $2.$3])
AC_CACHE_VAL($ac_safe_all,
[
if test "x$4" = "x"; then
defineit="= 0"
elif test "x$4" = "xno"; then
defineit=""
else
defineit="$4"
fi
AC_TRY_COMPILE([
$1
],[
struct $2 testit;
testit.$3 $defineit;
], eval "${ac_safe_all}=yes", eval "${ac_safe_all}=no" )
])
if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED($ac_uc_define)
else
AC_MSG_RESULT(no)
fi
])
dnl @synopsis AC_C_VAR_FUNC
dnl
dnl This macro tests if the C complier supports the C9X standard
dnl __func__ indentifier.
dnl
dnl The new C9X standard for the C language stipulates that the
dnl identifier __func__ shall be implictly declared by the compiler
dnl as if, immediately following the opening brace of each function
dnl definition, the declaration
dnl
dnl static const char __func__[] = "function-name";
dnl
dnl appeared, where function-name is the name of the function where
dnl the __func__ identifier is used.
dnl
dnl @author Christopher Currie <christopher@currie.com>
AC_DEFUN([AC_C_VAR_FUNC],
[AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
AC_TRY_COMPILE(,
[int main() {
char *s = __func__;
}],
AC_DEFINE(HAVE_FUNC,,
[Define if the C complier supports __func__]) ac_cv_c_var_func=yes,
ac_cv_c_var_func=no) )
])dnl
dnl Exports one of ac_cv_func_poll or ac_cv_func_select
dnl Author - Jon Nelson <jnelson@boa.org>
dnl Copyright 2002
AC_DEFUN([POLL_OR_SELECT],
[
AC_MSG_CHECKING(whether to use poll or select)
AC_ARG_WITH(poll,
[ --with-poll Use poll],
[
if test "$withval" = "yes" ; then
AC_MSG_RESULT(trying poll)
ac_x=1
else
AC_MSG_RESULT(trying select)
ac_x=0
fi
],
[
AC_MSG_RESULT(trying select)
ac_x=0
])
if test $ac_x = 1; then
AC_CHECK_HEADERS(sys/poll.h)
AC_CHECK_FUNCS(poll)
if test "x$ac_cv_func_poll" = "x"; then
AC_MSG_ERROR(We attempted to find poll but could not. Please try again with --without-poll)
fi
BOA_ASYNC_IO="poll"
else
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_FUNCS(select)
if test "x$ac_cv_func_select" = "x"; then
AC_MSG_ERROR(We attempted to find select but could not. Please try again with --with-poll)
fi
BOA_ASYNC_IO="select"
fi
]
)
|