AC_DEFUN([RADIUSD_NEED_DECLARATION],
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(radius_cv_decl_needed_$1,
[AC_TRY_COMPILE([
$2],
[char *(*pfn) = (char *(*)) $1],
eval "radius_cv_decl_needed_$1=no", eval "radius_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$radius_cv_decl_needed_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
radius_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
AC_DEFINE_UNQUOTED($radius_tr_decl)
else
AC_MSG_RESULT(no)
fi
])
AC_DEFUN([RADIUSD_NEED_DECLARATIONS],
[for ac_func in $1
do
RADIUSD_NEED_DECLARATION($ac_func, $2)
done
])
AC_DEFUN([AC_PROG_CC_SUNPRO],
[AC_CACHE_CHECK(whether we are using SUNPro C, ac_cv_prog_suncc,
[cat > conftest.c <<EOF
yes;
EOF
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_suncc=yes
else
ac_cv_prog_suncc=no
fi])])
AC_DEFUN([FR_CHECK_TYPE_INCLUDE],
[
AC_CACHE_CHECK(for $2, ac_cv_type_$2,
[ ac_cv_type_$2=no
AC_TRY_COMPILE($1,
[$2 foo],
ac_cv_type_$2=yes,
)
]
)
if test "$ac_cv_type_$2" != "yes"; then
AC_DEFINE($2, $3, $4)
fi
])
AC_DEFUN([FR_LOCATE_DIR],
[
if test "x$LOCATE" != "x"; then
DIRS=
file=$2
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$$1 ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "$1=\"\$$1 $DIRS\""
])
AC_DEFUN([FR_SMART_CHECK_LIB], [
sm_lib_safe=`echo "$1" | sed 'y%./+-%__p_%'`
sm_func_safe=`echo "$2" | sed 'y%./+-%__p_%'`
AC_MSG_CHECKING([for $2 in -l$1])
old_LIBS="$LIBS"
smart_lib=
smart_lib_dir=
if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
LIBS="-L$try -l$1 $old_LIBS"
AC_TRY_LINK([extern char $2();],
[ $2()],
smart_lib="-L$try -l$1")
if test "x$smart_lib" != "x"; then
break;
fi
done
LIBS="$old_LIBS"
fi
if test "x$smart_lib" = "x"; then
LIBS="-l$1 $old_LIBS"
AC_TRY_LINK([extern char $2();],
[ $2()],
smart_lib="-l$1")
LIBS="$old_LIBS"
fi
if test "x$smart_lib" = "x"; then
FR_LOCATE_DIR(smart_lib_dir,[lib$1${libltdl_cv_shlibext}])
FR_LOCATE_DIR(smart_lib_dir,[lib$1.a])
for try in $smart_lib_dir /usr/local/lib /opt/lib; do
LIBS="-L$try -l$1 $old_LIBS"
AC_TRY_LINK([extern char $2();],
[ $2()],
smart_lib="-L$try -l$1")
if test "x$smart_lib" != "x"; then
break;
fi
done
LIBS="$old_LIBS"
fi
if test "x$smart_lib" != "x"; then
AC_MSG_RESULT(yes)
eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes"
LIBS="$smart_lib $old_LIBS"
SMART_LIBS="$smart_lib $SMART_LIBS"
else
AC_MSG_RESULT(no)
fi
])
AC_DEFUN([FR_SMART_CHECK_INCLUDE], [
ac_safe=`echo "$1" | sed 'y%./+-%__pm%'`
AC_MSG_CHECKING([for $1])
old_CFLAGS="$CFLAGS"
smart_include=
smart_include_dir=
if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
CFLAGS="$old_CFLAGS -I$try"
AC_TRY_COMPILE([$2
[ int a = 1;],
smart_include="-I$try",
smart_include=)
if test "x$smart_include" != "x"; then
break;
fi
done
CFLAGS="$old_CFLAGS"
fi
if test "x$smart_include" = "x"; then
AC_TRY_COMPILE([$2
[ int a = 1;],
smart_include=" ",
smart_include=)
fi
if test "x$smart_include" = "x"; then
FR_LOCATE_DIR(smart_include_dir,$1)
for try in $smart_include_dir /usr/local/include /opt/include; do
CFLAGS="$old_CFLAGS -I$try"
AC_TRY_COMPILE([$2
[ int a = 1;],
smart_include="-I$try",
smart_include=)
if test "x$smart_include" != "x"; then
break;
fi
done
CFLAGS="$old_CFLAGS"
fi
if test "x$smart_include" != "x"; then
AC_MSG_RESULT(yes)
eval "ac_cv_header_$ac_safe=yes"
CFLAGS="$old_CFLAGS $smart_include"
SMART_CFLAGS="$SMART_CFLAGS $smart_include"
else
AC_MSG_RESULT(no)
fi
])
AC_DEFUN([FR_CHECK_STRUCT_HAS_MEMBER], [
AC_MSG_CHECKING([for $3 in $2])
AC_TRY_COMPILE([
$1
],
[ int foo = offsetof($2, $3) ],
has_element=" ",
has_element=)
ac_safe_type=`echo "$2" | sed 'y% %_%'`
if test "x$has_element" != "x"; then
AC_MSG_RESULT(yes)
eval "ac_cv_type_${ac_safe_type}_has_$3=yes"
else
AC_MSG_RESULT(no)
eval "ac_cv_type_${ac_safe_type}_has_$3="
fi
])
m4_pushdef([AC_OUTPUT],
[
unset ac_cv_env_LIBS_set
unset ac_cv_env_LIBS_value
m4_popdef([AC_OUTPUT])
AC_OUTPUT([$1],[$2],[$3])
])
AC_INCLUDE(aclocal.m4)