dnl $USAGI: configure.in,v 1.12 2001/06/12 05:36:41 yoshfuji Exp $

dnl Copyright (C) 2000-2001 USAGI/WIDE Project.
dnl All rights reserved.
dnl 
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl 1. Redistributions of source code must retain the above copyright
dnl    notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl    notice, this list of conditions and the following disclaimer in the
dnl    documentation and/or other materials provided with the distribution.
dnl 3. Neither the name of the project nor the names of its contributors
dnl    may be used to endorse or promote products derived from this software
dnl    without specific prior written permission.
dnl 
dnl THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
dnl ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl SUCH DAMAGE.

AC_INIT(getaddrinfo.c)
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr/local/v6)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PATH_PROGS(perl, perl perl5)
AC_PATH_PROGS(lorder, lorder, ./scripts/lorder.pl)
AC_PATH_PROGS(tsort, tsort)

INSTALL_LIBRARY="\${INSTALL_DATA}"
AC_SUBST(INSTALL_LIBRARY)
INSTALL_DIR="\${INSTALL} -d"
AC_SUBST(INSTALL_DIR)

dnl Checks for libraries.

dnl Checks for header files.
dnl AC_HEADER_STDC
dnl AC_CHECK_HEADERS(fcntl.h malloc.h sys/time.h unistd.h)

AC_MSG_CHECKING([for glibc version])
AC_EGREP_CPP(%%%yes%%%, [dnl
#include <features.h>
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 1
%%%yes%%%
#endif
],[
	glibc_version=2.1
	usagi_libc=21
],[
	AC_EGREP_CPP(%%%yes%%%, [dnl
#include <features.h>
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 2
%%%yes%%%
#endif
	],[
		glibc_version=2.2
		usagi_libc=22
	],[
		glibc_version=unknown
		usagi_libc=unknown
	])
])
AC_MSG_RESULT($glibc_version)
if test x"$glibc_version" = x"unknown"; then
	echo "Fatal, abort."
	exit 1
fi
AC_SUBST(usagi_libc)

dnl Checks for typedefs, structures, and compiler characteristics.
dnl AC_C_CONST
dnl AC_TYPE_PID_T
dnl AC_TYPE_SIZE_T
dnl AC_HEADER_TIME

dnl Checks for library functions.
dnl AC_CHECK_FUNCS(socket strstr strtoul uname)
AC_CHECK_FUNCS(open64)

dnl Output
dnl AC_SUBST(lorder)

AC_OUTPUT(Makefile include_glibc21/Makefile include_glibc22/Makefile)
