dnl @(#)configure.in	1.5 00/03/29 Copyright 1998 J. Schilling
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision$)dnl

AC_INIT(xconfig.h.in)
AC_CONFIG_HEADER(xconfig.h)
AC_CANONICAL_HOST

dnl Checks for programs.
AC_EXEEXT
AC_PROG_CPP
dnl AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_MAKE_SET

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_INTTYPES
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(varargs.h stdarg.h stdlib.h string.h strings.h unistd.h fcntl.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(a.out.h aouthdr.h elf.h)
AC_CHECK_HEADERS(malloc.h termios.h termio.h)
AC_CHECK_HEADERS(shadow.h syslog.h)
AC_CHECK_HEADERS(sys/time.h utime.h sys/ioctl.h sys/param.h sys/systeminfo.h)
AC_CHECK_HEADERS(mntent.h sys/mntent.h sys/mnttab.h sys/mount.h)
AC_CHECK_HEADERS(wait.h sys/resource.h sys/procfs.h)
AC_CHECK_HEADERS(sys/utsname.h sys/priocntl.h sys/rtpriocntl.h)
AC_CHECK_HEADERS(sys/mtio.h sys/mman.h linux/pg.h camlib.h)
AC_CHECK_HEADERS(sys/dkio.h sys/dklabel.h sun/dkio.h sun/dklabel.h)
AC_CHECK_HEADERS(poll.h sys/poll.h)
AC_CHECK_HEADERS(ieeefp.h fp.h)
AC_CHECK_HEADERS(values.h float.h)

dnl from aclocal.m4 (uses AC_TRY_COMPILE)
AC_HEADER_MAKEDEV

dnl don't use GNU original
dnl from GNU acspecific.m4 (uses AC_CHECK_HEADER)
dnl AC_HEADER_MAJOR

AC_CHECK_MINOR_BITS
AC_CHECK_MINOR_NONCONTIG

AC_HEADER_USG_STDIO
AC_HEADER_ERRNO_DEF

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_C_BITFIELDS
AC_TYPE_SIGNAL
AC_TYPE_GETGROUPS
AC_TYPE_LONGLONG
AC_TYPE_PROTOTYPES

AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_MODE_T

AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short int)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long int)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(char *)

AC_CHECK_SIZEOF(unsigned char)
AC_CHECK_SIZEOF(unsigned short int)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long int)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned char *)

dnl # AC_TYPE_SIZE_T_		# Defines HAVE_SIZE_T / NO_SIZE_T
AC_TYPE_CHAR
AC_TYPE_VA_LIST
AC_STRUCT_MTGET_DSREG
AC_STRUCT_MTGET_RESID
AC_STRUCT_MTGET_FILENO
AC_STRUCT_MTGET_BLKNO
AC_STRUCT_RUSAGE
AC_STRUCT_UNION_SEMUN
AC_STRUCT_UNION_WAIT
AC_STRUCT_ST_SPARE1
AC_STRUCT_ST_NSEC
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV

dnl Checks for library functions.
AC_FUNC_WAIT3
AC_FUNC_MLOCKALL
AC_FUNC_VA_COPY
AC_FUNC__VA_COPY
AC_FUNC_ECVT
AC_FUNC_FCVT
AC_FUNC_GCVT
AC_FUNC_DTOA
AC_FUNC_MMAP
AC_FUNC_SMMAP
AC_FUNC_QUOTAIOCTL
AC_FUNC_UNAME
AC_FUNC_VFORK
AC_FUNC_SYS_SIGLIST
AC_CHECK_FUNCS(brk sbrk strerror nice memmove flock fchdir statvfs quotactl)
AC_CHECK_FUNCS(getcwd shmat semget)
AC_CHECK_FUNCS(lstat readlink link rename mkfifo mknod)
AC_CHECK_FUNCS(setreuid setresuid seteuid setuid)
AC_CHECK_FUNCS(setregid setresgid setegid setgid)
AC_CHECK_FUNCS(sync fsync fork wait4 waitid waitpid getrusage)
AC_CHECK_FUNCS(gethostid gethostname getdomainname getpagesize)
AC_CHECK_FUNCS(poll select lchown utimes)
dnl AC_CHECK_FUNCS(ecvt fcvt gcvt)
AC_CHECK_FUNCS(ecvt_r fcvt_r gcvt_r)
AC_CHECK_FUNCS(econvert fconvert gconvert)
AC_CHECK_FUNCS(isinf isnan)
AC_CHECK_FUNCS(rand drand48)
AC_CHECK_FUNCS(setpriority DosSetPriority)
AC_CHECK_FUNCS(DosAllocSharedMem)
AC_CHECK_FUNCS(seekdir)
AC_CHECK_FUNCS(strsignal str2sig sig2str)
AC_CHECK_FUNCS(killpg sigrelse)
AC_CHECK_FUNCS(nanosleep usleep)
AC_CHECK_FUNCS(putenv setenv strcasecmp)

AC_DEFINE_UNQUOTED_STRING(HOST_ALIAS,$host_alias)
AC_DEFINE_UNQUOTED_STRING(HOST_SUB,$host)
AC_DEFINE_UNQUOTED_STRING(HOST_CPU,$host_cpu)
AC_DEFINE_UNQUOTED_STRING(HOST_VENDOR,$host_vendor)
AC_DEFINE_UNQUOTED_STRING(HOST_OS,$host_os)

dnl AC_CHECK_LIB(crypt, crypt, lib_crypt="-lcrypt")

AC_CHECK_LIB(c, crypt, lib_crypt="",
  [AC_CHECK_LIB(crypt, crypt, lib_crypt="-lcrypt")])

if test $ac_cv_header_camlib_h = yes; then
  scsi_lib=-lcam
fi

AC_SUBST(lib_crypt)
AC_SUBST(scsi_lib)

AC_OUTPUT(rules.cnf)
