Commit 5efd1492 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Check for strings.h. Check for a socklen_t type that produces no

warnings.
parent f81b089c
......@@ -19,7 +19,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.16 $)dnl
AC_REVISION($Revision: 1.17 $)dnl
AC_PREREQ(2.53)
AC_INIT(isc, 1.01)
AC_CONFIG_SRCDIR([src/isc_master.c])
......@@ -61,7 +61,7 @@ dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(stdlib.h stdarg.h stddef.h string.h sys/select.h unistd.h)
AC_CHECK_HEADERS(sys/time.h stdint.h)
AC_CHECK_HEADERS(sys/time.h stdint.h strings.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AM_PROG_CC_STDC
......@@ -73,6 +73,7 @@ AC_CHECK_TYPE([socklen_t],AC_DEFINE([HAVE_SOCKLEN_T]),,[
#include <sys/types.h>
#include <sys/socket.h>
])
dnl Low-level networking code on Solaris 2.
AC_CHECK_FUNC(gethostbyname)
[if test $ac_cv_func_gethostbyname = no
......@@ -126,6 +127,57 @@ CMOD_C_ATTRIBUTE_UNUSED
CMOD_CHECK_CC_OPT([-pipe], [pipe])
[fi]
dnl This test is complex. We want to find a type that can be used
dnl as socklen_t and that gives no compiler warnings. There is no
dnl builtin support in autoconf for this. So we peek inside the
dnl config.log file...
dnl FIXME (bug 765): This computation should be cached.
[if test $ac_cv_type_socklen_t = no
then]
AC_MSG_CHECKING([for socklen_t replacement type])
[socklen_found=
socklen_fallback=
for socklen_type in "unsigned int" "size_t" "unsigned long"
do]
echo lyskomd-socklen-test-$socklen_type >&5
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>],
[ struct sockaddr addr; ]
$socklen_type [len;
getsockname(0, &addr, &len);],
[ if sed "1,/lyskomd-socklen-test-$socklen_type/d" config.log | grep -i 'warning.*getsockname' >/dev/null
then
echo warnings found, not using $socklen_type >&5
if test -z "$socklen_fallback"
then
echo retaining $socklen_type as fallback >&5
socklen_fallback=$socklen_type
fi
else
socklen_found=$socklen_type
break
fi],
[echo compilation failed, not using $socklen_type >&5])
[done
if test -z "$socklen_found"
then
if test -z "socklen_fallback"
then
socklen_fallback="unsigned int"
fi]
socklen_found=$socklen_fallback
AC_MSG_RESULT([unknown (using $socklen_found)])
AC_MSG_WARN([the choosen socklen_t may be wrong])
[else]
AC_MSG_RESULT([$socklen_found])
[fi]
AC_DEFINE_UNQUOTED([SOCKLEN_TYPE], $socklen_found, [socklen_t-compatible type])
[fi]
[if test "$use_gcov" = "yes" -a -n "$GCC"; then]
CMOD_CHECK_CC_OPT([-ftest-coverage], [test_coverage])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment