# @(#) configure.in 2.2@(#)
# Configure template for WebStone
# Process this file with autoconf to produce a configure script.
#
############################################################################
#                                                                          #
# The contents of this file are subject to the WebStone Public License     #
# Version 1.0 (the "License"); you may not use this file except in         #
# compliance with the License. You may obtain a copy of the License        #
# at http://www.mindcraft.com/webstone/license10.html                      #
#                                                                          #
# Software distributed under the License is distributed on an "AS IS"      #
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See      #
# the License for the specific language governing rights and limitations   #
# under the License.                                                       #
#                                                                          #
# The Original Code is WebStone 2.5.                                       #
#                                                                          #
# The Initial Developer of the Original Code is Silicon Graphics, Inc.     #
# and Mindcraft, Inc.. Portions created by Silicon Graphics. and           #
# Mindcraft. are Copyright (C) 1995#1998 Silicon Graphics, Inc. and        #
# Mindcraft, Inc. All Rights Reserved.                                     #
#                                                                          #
# Contributor(s): ______________________________________.                  #
#                                                                          #
############################################################################


AC_INIT(webclient.c)
AC_CONFIG_HEADER(config.h)
PRODUCT=webstone
VERSION=2.5b3
AC_DEFINE_UNQUOTED(PRODUCT, "$PRODUCT")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PRODUCT)
AC_SUBST(VERSION)
AC_PREFIX_DEFAULT(bin)

# set system type
AC_CANONICAL_SYSTEM

#
# checks for programs
#
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_AWK

# SSL stuff
AC_ARG_WITH(ssl, path to openSSL)


# We use a path for perl so the #! line in bin/wscollect.pl will work.
AC_PATH_PROG(PERL, perl, no)
AC_SUBST(PERL)
AC_SUBST(PERL_SCRIPTS)
if test "$PERL" != no; then
  PERL_SCRIPTS="bin/wscollect.pl"
else
  AC_MSG_WARN(Some functions may work correctly, since perl was not found)
fi


#
# Check for waitpid(), if it is available then we don't need to look
# for wait3() in the ucb library.
#
AC_CHECK_FUNCS(waitpid)

if test "${ac_cv_func_waitpid}" != 'yes'
then
	AC_FUNC_WAIT3
	AC_CHECK_LIB(ucb, wait3)
fi

#
# checks for libraries
#
# Replace `main' with a function in -lm:
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(compat, rexec)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, connect, AC_SUBST(LIBS), , -lnsl)

#
# checks for header files
#
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h sgtty.h sys/time.h unistd.h)

#
# checks for typedefs, structures, and compiler characteristics
#
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_HEADER_TIME
AC_STRUCT_TIMEZONE
AC_TRY_COMPILE([#include <sys/time.h>], 
	[struct timeval thetime; struct timezone thezone; 
	gettimeofday(&thetime, &thezone); ],
	AC_DEFINE(USE_TIMEZONE), )

#
# checks for library functions
#
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname gettimeofday select socket strerror strncasecmp)

#
# checks for system services
#

case "$host_os" in
solaris* )
NSAPICFLAGS="-DSOLARIS"
LD_SHAREDCMD="ld -G"
;;
irix* )
NSAPICFLAGS="-DIRIX"
LD_SHAREDCMD="ld -shared"
;;
osf* )
NSAPICFLAGS="-DOSF1"
LD_SHAREDCMD="ld -shared"
;;
* )
NSAPICFLAGS=""
LD_SHAREDCMD="ld -shared"
;;
esac
AC_SUBST(NSAPICFLAGS)
AC_SUBST(LD_SHAREDCMD)

#
# all done
#
AC_OUTPUT(Makefile API-test/Makefile )
#
# end
