dnl $USAGI: configure.in,v 1.34.2.3 2001/11/29 07:04:17 yoshfuji Exp $

dnl Copyright (C) 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.
dnl Process this file with autoconf to produce a configure script.

AC_INIT(libinet6/usagi.c)
AC_PREFIX_DEFAULT(/usr/local/v6)

dnl =============================
BUILD_LIBS_LIST=""
BUILD_APPS_LIST=""

dnl =============================
dnl ---------
dnl libraries
dnl ---------
AC_MSG_CHECKING([for libraries])

BUILD_LIBS_LIST="${BUILD_LIBS_LIST} libinet6"

BUILD_LIBS=libinet6
AC_MSG_RESULT([$BUILD_LIBS])
AC_SUBST(BUILD_LIBS)

dnl ---------------------
dnl userland applications
dnl ---------------------
AC_MSG_CHECKING([for userland applications])

BUILD_APPS_LIST="${BUILD_APPS_LIST} atm-tools"
AC_ARG_ENABLE(atm-tools,
[  --enable-atm-tools      build atm-tools],,enable_atm_tools=no)

BUILD_APPS_LIST="${BUILD_APPS_LIST} bindtest"
AC_ARG_ENABLE(bindtest,
[  --enable-bindtest       build bindtest],,enable_bindtest=no)

BUILD_APPS_LIST="${BUILD_APPS_LIST} comsat"
AC_ARG_ENABLE(comsat,
[  --enable-comsat         build comsat (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} finger"
AC_ARG_ENABLE(finger,
[  --enable-finger         build finger (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} fingerd"
AC_ARG_ENABLE(fingerd,
[  --enable-fingerd        build fingerd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} ftp"
AC_ARG_ENABLE(ftp,
[  --enable-ftp            build ftp (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} ftpd"
AC_ARG_ENABLE(ftpd,
[  --enable-ftpd           build ftpd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} inetd"
AC_ARG_ENABLE(inetd, 
[  --enable-inetd          build inetd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} iptunnel"
AC_ARG_ENABLE(iptunnel,
[  --enable-iptunnel       build iptunnel (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} libnet-tools"
AC_ARG_ENABLE(libnet-tools,
[  --enable-libnet-tools   build libnet-tools (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} mipdiag"
AC_ARG_ENABLE(iptunnel,
[  --enable-mipdiag        build mipdiag (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} ping6"
AC_ARG_ENABLE(ping6,
[  --enable-ping6          build ping6 (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} radvd"
AC_ARG_ENABLE(radvd,
[  --enable-radvd          build radvd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rcp"
AC_ARG_ENABLE(rcp,
[  --enable-rcp            build rcp (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rexec"
AC_ARG_ENABLE(rexec,
[  --enable-rexec          build rexec (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rexecd"
AC_ARG_ENABLE(rexecd,
[  --enable-rexecd         build rexecd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rlogin"
AC_ARG_ENABLE(rlogin,
[  --enable-rlogin         build rlogin (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rlogind"
AC_ARG_ENABLE(rlogind,
[  --enable-rlogind        build rlogind (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rsh"
AC_ARG_ENABLE(rsh,
[  --enable-rsh            build rsh (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rshd"
AC_ARG_ENABLE(rshd,
[  --enable-rshd           build rshd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} rwhod"
AC_ARG_ENABLE(rwhod,
[  --enable-rwhod          build rwhod (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} syslogd"
AC_ARG_ENABLE(syslogd,
[  --enable-syslogd        build syslogd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} talk"
AC_ARG_ENABLE(talk,
[  --enable-talk           build talk (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} talkd"
AC_ARG_ENABLE(talkd,
[  --enable-talkd          build talkd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} tcp_wrappers"
AC_ARG_ENABLE(tcp_wrappers,
[  --enable-tcp_wrappers   build tcp_wrappers (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} telnet"
AC_ARG_ENABLE(telnet,
[  --enable-telnet         build telnet (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} telnetd"
AC_ARG_ENABLE(telnetd,
[  --enable-telnetd        build telnetd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} tftp"
AC_ARG_ENABLE(tftp,
[  --enable-tftp           build tftp (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} tftpd"
AC_ARG_ENABLE(tftpd,
[  --enable-tftpd          build tftpd (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} tracepath6"
AC_ARG_ENABLE(tracepath6,
[  --enable-tracepath6     build tracepath6 (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} traceroute6"
AC_ARG_ENABLE(traceroute6,
[  --enable-traceroute6    build traceroute6 (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} v6p"
AC_ARG_ENABLE(v6p,
[  --enable-v6p            build v6p],,enable_v6p=no)

BUILD_APPS_LIST="${BUILD_APPS_LIST} write"
AC_ARG_ENABLE(write,
[  --enable-write          build write (default)])

BUILD_APPS_LIST="${BUILD_APPS_LIST} writed"
AC_ARG_ENABLE(writed,
[  --enable-writed         build writed (default)])

AC_ARG_ENABLE(iptables,
[  --enable-iptables       build ip6tables (This need a linux24 source.)],
BUILD_APPS_LIST="${BUILD_APPS_LIST} iptables",
enable_iptables=no)

for i in $BUILD_APPS_LIST; do
	j=`echo $i | sed -e 's/-/_/g'`
	eval enableval=\$enable_$j
	if test x"$enableval" != x"no"; then
		if test x"$BUILD_APPS" != x""; then
			BUILD_APPS="$BUILD_APPS $i"
		else
			BUILD_APPS="$i"
		fi
	fi
done
AC_MSG_RESULT([$BUILD_APPS])
AC_SUBST(BUILD_APPS)

dnl -------
dnl subdirs
dnl -------
SUBDIRS="$BUILD_LIBS_LIST $BUILD_APPS_LIST"
AC_SUBST(SUBDIRS)

dnl =============================
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
INSTALL_LIB="\${INSTALL_DATA}"
AC_SUBST(INSTALL_LIB)
INSTALL_DIR="\${INSTALL} -d"
AC_SUBST(INSTALL_DIR)

dnl =============================
AC_CONFIG_SUBDIRS($BUILD_LIBS $BUILD_APPS)

AC_OUTPUT(Makefile)
