dnl Process this file with autoconf to produce a configure script.
AC_INIT(bonnie++.cpp)
AC_SUBST(version)
version="1.00f"

AC_ARG_ENABLE(stripping,
      [  --disable-stripping  disables stripping of installed binaries],
      STRIPPING=$strippingval, STRIPPING=no)
AC_SUBST(stripping)
if [[ ! "$STRIPPING" = "no" ]]; then
  stripping=""
else
  stripping="-s"
fi

dnl Checks for programs.
AC_LANG_CPLUSPLUS
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL

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

AC_SUBST(semun)
AC_TRY_COMPILE(#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
    , union semun sem; , semun="yes")
if [[ -n "$semun" ]]; then
   semun="#define SEMUN_IN_SEM_H"
fi
AC_SUBST(bool)
AC_TRY_COMPILE([], [bool var;] , , bool="typedef bool char;")
AC_SUBST(true_false)
AC_TRY_COMPILE(, [char c = true; char d = false;
] , true_false="0", true_false="1")

AC_SUBST(exes)
AC_SUBST(man8)
exes="bonnie++"
man8="bonnie++.8"
AC_CHECK_HEADERS(vector.h, exes="$exes zcav" man8="$man8 zcav.8", echo "STL not installed so no ZCAV!")

dnl AC_SUBST(o_large_file)
dnl AC_TRY_COMPILE([#include <sys/types.h>
dnl #include <sys/stat.h>
dnl #include <fcntl.h>
dnl ] , [ int fd = open("foo", O_WRONLY | O_LARGEFILE);
dnl ] , o_large_file="yes")
dnl 
dnl if [[ "$o_large_file" = "yes" ]] ; then
dnl   o_large_file="#define USE_LARGE_FILE | O_LARGEFILE"
dnl else
dnl   o_large_file="#define USE_LARGE_FILE"
dnl fi


dnl Checks for library functions.

AC_OUTPUT(Makefile bonnie.h port.h bonnie++.spec bon_csv2html bon_csv2txt sun/pkginfo)
