AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADER(sys/socket.h,
- AC_DEFINE(SOCKET_AVAIL)
- AC_DEFINE(HAVE_SYS_SOCKET_H))
+ AC_DEFINE(SOCKET_AVAIL)
+ AC_DEFINE(HAVE_SYS_SOCKET_H)
+ AC_EGREP_HEADER(socklen_t,
+ sys/socket.h,
+ AC_DEFINE_UNQUOTED(SOCKLEN_T, socklen_t),
+ AC_DEFINE_UNQUOTED(SOCKLEN_T, uint))
+)
AC_HEADER_DIRENT
# This must be after CXXCPP
# Checking for functions/libs
# ===========================================================================
-
-AC_DEFUN(AC_CHECK_FUNC_NOCACHE,
-[AC_MSG_CHECKING([for $1])
-AC_TRY_LINK(
-dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
-dnl which includes <sys/select.h> which contains a prototype for
-dnl select. Similarly for bzero.
-[/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $1(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
-extern "C"
-#endif
-])dnl
-[/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $1();
-], [
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$1) || defined (__stub___$1)
-choke me
-#else
-$1();
-#endif
-], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")
-if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
-else
- AC_MSG_RESULT(no)
-ifelse([$3], , , [$3
-])dnl
-fi
-])
-
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,xdr_short)
AC_CHECK_LIB(panel,panel_above,
AC_SUBST(CURSES_LIBS)
AC_FUNC_VPRINTF
-dnl Do not cache the result of the vasprintf test.
-dnl This is because vasprintf is defined in the C++ runtime
-dnl for egcs, but not in the C runtime. Thus, caching the result
-dnl of this test (which is done with C++) will cause later C
-dnl based tests to falsely conclude that vasprintf is available
-dnl to C programs.
-dnl It's a bloody stupid function anyway.
-AC_CHECK_FUNC_NOCACHE(vasprintf)
+AC_CHECK_FUNCS(vsnprintf vasprintf)
AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
-AC_CHECK_FUNCS(vsnprintf strchr memcpy)
+AC_CHECK_FUNCS(strchr memcpy)
dnl AC_CHECK_FUNCS(getline)
dnl AC_CHECK_FUNCS(getdelim)
AC_CHECK_FUNCS(fgets)
AC_DEFINE(GNU_GETCWD)
fi
+AC_DEFUN(s51_ACCEPT_LENGTH_T,
+ [AC_CACHE_CHECK([for type of length pointer parameter of accept],
+ s51_cv_accept_length_type,
+ [ac_save_CPPFLAGS="$CPPFLAGS"
+ s51_cv_accept_length_type=no
+ for ac_val in int size_t socklen_t; do
+ CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val"
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>],
+ [struct sockaddr a; $ac_val len; accept (0, &a, &len);],
+ [s51_cv_accept_length_type=$ac_val; break])
+ done
+ CPPFLAGS="$ac_save_CPPFLAGS"])
+
+ if test $s51_cv_accept_length_type != no; then
+ AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $s51_cv_accept_length_type,
+ [Define to be the type of length parameter of accept (without the \*').])
+ fi
+ ]
+)
+
+s51_ACCEPT_LENGTH_T
# Macro definitions
###################