dnl ****************************************************************************
dnl
dnl  The following code is derived, directly or indirectly, from the SystemC
dnl  source code Copyright (c) 1996-2002 by all Contributors.
dnl  All Rights reserved.
dnl
dnl  The contents of this file are subject to the restrictions and limitations
dnl  set forth in the SystemC Open Source License Version 2.3 (the "License");
dnl  You may not use this file except in compliance with such restrictions and
dnl  limitations. You may obtain instructions on how to receive a copy of the
dnl  License at http://www.systemc.org/. Software distributed by Contributors
dnl  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
dnl  ANY KIND, either express or implied. See the License for the specific
dnl  language governing rights and limitations under the License.
dnl  
dnl ****************************************************************************
dnl
dnl  configure.in --
dnl  Process this file with autoconf to produce a configure script.
dnl 
dnl ****************************************************************************
dnl
dnl  Original Authors:
dnl  Norris Ip, Dean Shea, John Rose, Jasvinder Singh, William Paulsen,
dnl  John Pierce, Rachida Kebichi, Ted Elkind, David Bailey,
dnl  Cadence Design Systems, Inc., 2002-09-23
dnl
dnl ****************************************************************************
dnl  
dnl  
dnl  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
dnl  changes you are making here.
dnl
dnl      Name, Affiliation, Date:
dnl  Description of Modification:
dnl
dnl ****************************************************************************

AC_INIT(src/scv.h)
#AC_CONFIG_AUX_DIR(config)

cfgdir=`dirname $0`
CFGDIR=`cd $cfgdir; pwd`

dnl
dnl If dangerous option selected, print warning early, before lots of messages are printed out.
dnl
AC_ARG_ENABLE(compiler-check, [  --disable-compiler-check  set to override the check for supported compilers.  Default is off.],
[case "$enableval" in
no)
	AC_MSG_WARN([Not checking for a supported compiler.  Try this at your own risk.])
	CHECK_COMPILER=no;;
*)
	CHECK_COMPILER=yes;;
esac]
,
CHECK_COMPILER=yes)

AC_ARG_ENABLE(overwrite, [  --disable-overwrite     set to avoid overwriting files which already exist.  Default is to overwrite.],
[case "$enableval" in
no)
	overwrite_files=no;;
*)
	overwrite_files=yes;;
esac]
,
overwrite_files=yes)

AC_ARG_ENABLE(scv_report, [  --disable-scv-report     set to use sc_report in place of scv_report via typedef.  Default is to use sc_report for OSCI SC 2.1 and above only.],
[case "$enableval" in
no)
	use_scv_report=no;;
*)
	use_scv_report=yes;;
esac]
,
use_scv_report=maybe)

dnl
dnl setup relocate option for Beach-head kit
default_beach_dir=/tmp/SCV
AC_ARG_ENABLE(relocate, [  --enable-relocate       enable relocation by placing in /tmp/SCV. Default is off. ],
[case "$enableval" in
yes)
    PATH=${default_beach_dir}:$PATH
    export PATH
    relocate=yes;;
*)
    relocate="";;
esac]
,
relocate="")

dnl
dnl Determine location of extra documentation to be copied into the kit.
dnl
if test "${with_external_documents:-no}" = "no"; then
  pdfDocSrcDir=`pwd`/docs/scv;
else
  pdfDocSrcDir=${with_external_documents}
fi

dnl
dnl Determine location of extra examples to be copied into the kit.
dnl
if test "${with_external_examples:-no}" = "no"; then
  extraExamples="";
else
  extraExamples=${with_external_examples}
fi

dnl
dnl Work around bug in config.guess in automake 1.4 with HP 9000/800.
dnl The test is overconstrained and fails for 9000/800.
dnl This macro sets the variable HP_ARCH so that config.guess doesn't need to determine it.
dnl
SCV_HP_CHECK()

dnl
dnl This will create in $target something like:
dnl sparc-sun-solaris2.5.1
dnl Currently inca has these directories:  tools.hppa tools.hppa11 tools.sun4v tools.ibmrs
dnl This macro has to be called before AM_INIT_AUTOMAKE
dnl
AC_CANONICAL_SYSTEM

AC_DEFINE_UNQUOTED(TARGET, "${target}")
MAJ=`cat ${srcdir}/majorrev.txt`
MIN=`cat ${srcdir}/minorrev.txt`
KIT=`cat ${srcdir}/kitnumber.txt`
TYPE=`cat ${srcdir}/kittype.txt`
REL=`cat ${srcdir}/relnumber.txt`

MAJPADDED=`echo $MAJ | awk '{printf("%.2d",$1)}'`
KITPADDED=`echo $KIT | awk '{printf("%.3d",$1)}'`
RELPADDED=`echo $REL | awk '{printf("%.3d",$1)}'`

if test "$TYPE" = "d"; then
  VERSION="${MAJPADDED}.${MIN}0-${TYPE}${KITPADDED}"
else
  VERSION="${MAJPADDED}.${MIN}0-${TYPE}${RELPADDED}"
fi

AM_INIT_AUTOMAKE(scv,${VERSION})

DEF_GNU_OPT=-O2
DEF_SUN_CC_OPT=-xO1
DEF_HP_ACC_OPT=+O2

DEF_GNU_DBG="-O0 -g"
DEF_SUN_CC_DBG="-xs -g"
DEF_HP_ACC_DBG=-g0

if test "$target_os" = "hpux11.11"; then DEF_HP_ACC_OPT=+O1; fi

dnl
dnl Parameters used in the definition of CXXFLAGS
dnl
dnl The default for DEBUG is -g (for GNU and HP's aCC compiler.)
dnl HP's aCC has -g0, but I can't see what advantage it has, perhaps with instances of objects declared in external libraries
dnl not compiled with -g...
dnl -g on HP aCC is the same as -g1.
dnl
AC_ARG_ENABLE(debug, [  --enable-debug          set to enable debug symbol table production by the C++ compiler.  Default is on.], 
[case "$enableval" in
yes)
	GNU_DBG="$DEF_GNU_DBG"
	SUN_CC_DBG="$DEF_SUN_CC_DBG"
	HP_ACC_DBG="$DEF_HP_ACC_DBG";;
no)
	GNU_DBG=
	SUN_CC_DBG=
	HP_ACC_DBG=;;
*)
	GNU_DBG="$enableval"
	SUN_CC_DBG="$enableval"
	HP_ACC_DBG="$enableval";;
esac]
,
dnl defaults if nothing is specified on the configure command line
GNU_DBG="-g"
SUN_CC_DBG="-xs -g"
HP_ACC_DBG="-g"
)

AC_ARG_ENABLE(v2, [  --enable-v2       enable v2 standard library for HP. Default is off. ],
[case "$enableval" in
yes)
    scv_enable_v2="yes";;
*)
    scv_enable_v2="no";;
esac]
,
scv_enable_v2="no"
)

dnl
dnl I think for gcc the default is -O0 (minimal)
dnl For aCC the default is +O0 (minimal)
dnl
AC_ARG_ENABLE(opt, [  --enable-opt            set to no (O0), O1, yes (O2), etc.  Default is O2.],
[case "$enableval" in
yes)
	GNU_OPT="$DEF_GNU_OPT"
	SUN_CC_OPT="$DEF_SUN_CC_OPT"
	HP_ACC_OPT="$DEF_HP_ACC_OPT";;
no)    
        GNU_OPT=-O0
	SUN_CC_OPT=
	HP_ACC_OPT=;;
*)
        GNU_OPT="$enableval"
	SUN_CC_OPT="$enableval"
	HP_ACC_OPT="$enableval";;
esac]
,
dnl defaults if nothing is specified on the configure command line
GNU_OPT="$DEF_GNU_OPT"
SUN_CC_OPT="$DEF_SUN_CC_OPT"
HP_ACC_OPT="$DEF_HP_ACC_OPT"
)

dnl
dnl Handle option to turn on using insure for program analysis
dnl 
AC_ARG_ENABLE(insure, [  --enable-insure         set to enable the insure run-time analysis system from Parasoft.  Default is off.],
if test "$enableval" = yes; then
	CXX=insure
fi
,
)

dnl
dnl Handle option to turn on using Rational analysis tools (doesn't work for NC)
dnl 
purify_enab=no
quantify_enab=no
purecov_enab=no

AC_ARG_ENABLE(purify, [  --enable-purify         set to enable the purify run-time memory analysis system from Rational.  Default is off.],
  if test "$enableval" = yes; then
    AC_MSG_CHECKING(purify version) 
    purify_ver=`purify -version | tail -1 | sed -e 's/Purify//' |sed -e 's/Version//' |awk '{print $1}' | awk -F. '{print $1"."$2}'`
    if test -z "$purify_ver"; then
      AC_MSG_ERROR(purify executable not found check your path)
    else
dnl NOTE - newer Rational tool versions will result in purify_ver=2001a.04
dnl Allow purify_ver string starting with "200" without further checking.
      new_ver_check=`echo $purify_ver | sed -e 's/^200.*$//'`
      if test -z "$new_ver_check"; then
        AC_MSG_RESULT(yes)
        purify_enab=$enableval
      else
        purify_ok=`echo "{if ($purify_ver >= 5.0) 1;}" | bc`
        if test -n "$purify_ok" -a "$purify_ok" = "1" ; then
          AC_MSG_RESULT(yes)
          purify_enab=$enableval
        else
          AC_MSG_ERROR(purify version later than 5.0 necessary for SCV - version found is $purify_ver)
        fi
      fi
    fi
  fi
,
)
AC_ARG_ENABLE(quantify, [  --enable-quantify       set to enable the quantify run-time memory analysis system from Rational.  Default is off.],
  if test "$enableval" = yes; then
    AC_MSG_CHECKING(quantify version) 
    quantify_ver=`quantify -version | tail -1 | sed -e 's/Quantify//' | sed -e 's/Version//' |awk '{print $1}' | awk -F. '{print $1"."$2}'`
    if test -z "$quantify_ver"; then
      AC_MSG_ERROR(quantify executable not found check your path)
    else
dnl NOTE - newer Rational tool versions will result in quantify_ver=2001a.04
dnl Allow quantify_ver string starting with "200" without further checking.
      new_ver_check=`echo $quantify_ver | sed -e 's/^200.*$//'`
      if test -z "$new_ver_check"; then
        AC_MSG_RESULT(yes)
        quantify_enab=$enableval
      else
        quantify_ok=`echo "{if ($quantify_ver >= 5.0) 1;}" | bc`
        if test -n "$quantify_ok" -a "$quantify_ok" = "1" ; then
          AC_MSG_RESULT(yes)
          quantify_enab=$enableval
        else
          AC_MSG_ERROR(quantify version later than 5.0 necessary for SCV - version found is $quantify_ver)
        fi
      fi
    fi
  fi
,
)

AC_ARG_ENABLE(purecov, [  --enable-purecov        set to enable the purecov run-time memory analysis system from Rational.  Default is off.],
  if test "$enableval" = yes; then
    AC_MSG_CHECKING(purecov version) 
    purecov_ver=`purecov -version | tail -1 | sed -e 's/PureCoverage//' | sed -e 's/Version//' |awk '{print $1}' | awk -F. '{print $1"."$2}'`
    if test -z "$purecov_ver"; then
      AC_MSG_ERROR(purecov executable not found check your path)
    else
dnl NOTE - newer Rational tool versions will result in purecov_ver=2001a.04
dnl Allow purecov_ver string starting with "200" without further checking.
      new_ver_check=`echo $purecov_ver | sed -e 's/^200.*$//'`
      if test -z "$new_ver_check"; then
        AC_MSG_RESULT(yes)
        purecov_enab=$enableval
      else
        purecov_ok=`echo "{if ($purecov_ver >= 5.0) 1;}" | bc`
        if test -n "$purecov_ok" -a "$purecov_ok" = "1" ; then
          AC_MSG_RESULT(yes)
          purecov_enab=$enableval
        else
          AC_MSG_ERROR(purecov version later than 5.0 necessary for SCV - version found is $purecov_ver)
        fi
      fi
    fi
  fi
,
)

GNU_PIC=-fPIC
SUN_CC_PIC=-KPIC
HP_ACC_PIC=+Z

AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB

dnl
dnl setup Rational linker options, do this after AC_PROG_CXX because program may be changed
dnl
purecache=`pwd`/purecache
if test "$purify_enab" = "yes" -o "$quantify_enab" = "yes" -o "$purecov_enab" = "yes"; then
  if test "$ac_cv_prog_gxx" = "yes" -a "$CXX" != "g++"; then
dnl rational only understand g++ as the gnu compiler
    AC_MSG_WARN(Rational tools do not understand $CXX as a gnu compiler - setting CXX=g++)
    CXX=g++
  fi
  mkdir -p $purecache
fi
if test -n "$collector"; then
  pure_ld_opts="-best-effort -always-use-cache-dir -thread_stack_change=0x4000 -max-threads=200 -collector=$collector -cache-dir=$purecache"
else
  pure_ld_opts="-best-effort -always-use-cache-dir -thread_stack_change=0x4000 -max-threads=200 -cache-dir=$purecache"
fi

dnl
dnl Set the proper linker switch to get dlopen/dlsym to work with the
dnl GNU linker.  Sun's /usr/ccs/bin/ld does not need a switch.  HP's 
dnl /usr/ccs/bin/ld does need a switch: -E
dnl
dnl Also, need to set the proper option for allowing undefined symbols
dnl in the executable. For aCC the option is -B nonfatal, for
dnl gnu_ld the option is -noinhibit-exec
dnl
dnl On Solaris if /usr/ccs/bin/ld is used with g++, then -shared doesn't
dnl work.  You get messages like:
dnl Text relocation remains                 	referenced
dnl    against symbol		    offset	in file
dnl istream::get(char *, int, char)     0x237c    	/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.1/libstdc++.a(iostream.o)
dnl ...
dnl Use -G instead.  Note that the man page for gcc recommends using -shared instead of -G if possible.
dnl

dnl if MAKE set then check its version; else if make version OK
dnl then set MAKE=make; else if gmake version OK then set
dnl MAKE=gmake

if test -n "$MAKE"; then
  AC_MSG_CHECKING(MAKE for GNU make)
  dnl Extract GNU make version number
  gnumakeversion=`${MAKE} --version 2>&1 | grep GNU | sed -e 's/[[^0-9]]*\([[0-9.]]*\).*/\1/'`
  gnumakemajorrev=`echo "$gnumakeversion" | sed -e 's/\./ /g' | awk '{print $1}'`
  gnumakeminorrev=`echo "$gnumakeversion" | sed -e 's/\./ /g' | awk '{print $2}'`
  version_error=""
  dnl For non-GNU makes, version string won't contain GNU, so 
  dnl gnumakeversion will be zero-length.
  if test -z "$gnumakeversion"; then
    version_error="non-GNU make"
  else
    if test $gnumakemajorrev -lt 3; then
      version_error="$gnumakeversion"
    elif test $gnumakemajorrev -eq 3 -a $gnumakeminorrev -lt 76; then
      version_error="$gnumakeversion"
    fi
  fi
  if test -z "$version_error"; then
    AC_MSG_RESULT(found $gnumakeversion which is OK)
  else
    AC_MSG_RESULT(found $version_error)
    AC_MSG_ERROR(GNU make 3.76.1 or higher required to build TestBuilder)
  fi
fi

if test -z "$MAKE"; then
  AC_MSG_CHECKING(make for GNU make)
  gnumakeversion=`make --version 2>&1 | grep GNU | sed -e 's/[[^0-9]]*\([[0-9.]]*\).*/\1/'`
  gnumakemajorrev=`echo "$gnumakeversion" | sed -e 's/\./ /g' | awk '{print $1}'`
  gnumakeminorrev=`echo "$gnumakeversion" | sed -e 's/\./ /g' | awk '{print $2}'`
  version_error=""
  if test -z "$gnumakeversion"; then
    version_error="non-GNU make"
  else
    if test $gnumakemajorrev -lt 3; then
      version_error="$gnumakeversion"
    elif test $gnumakemajorrev -eq 3 -a $gnumakeminorrev -lt 76; then
      version_error="$gnumakeversion"
    fi
  fi
  if test -z "$version_error"; then
    AC_MSG_RESULT(found $gnumakeversion which is OK)
    MAKE=make
  else
    AC_MSG_RESULT(found $version_error)
  fi
fi

if test -z "$MAKE"; then
  AC_MSG_CHECKING(gmake for GNU make)
  gnumakeversion=`gmake --version 2>&1 | grep GNU | sed -e 's/[[^0-9]]*\([[0-9.]]*\).*/\1/'`
  gnumakemajorrev=`echo "$gnumakeversion" | sed -e 's/\./ /g' | awk '{print $1}'`
  gnumakeminorrev=`echo "$gnumakeversion" | sed -e 's/\./ /g' | awk '{print $2}'`
  version_error=""
  if test -z "$gnumakeversion"; then
    version_error="non-GNU make"
  else
    if test $gnumakemajorrev -lt 3; then
      version_error="$gnumakeversion"
    elif test $gnumakemajorrev -eq 3 -a $gnumakeminorrev -lt 76; then
      version_error="$gnumakeversion"
    fi
  fi
  if test -z "$version_error"; then
    AC_MSG_RESULT(found $gnumakeversion which is OK)
    MAKE=gmake
  else
    AC_MSG_RESULT(found $version_error)
    AC_MSG_ERROR(GNU make 3.76.1 or higher required to build TestBuilder)
  fi
fi

dnl
dnl Set architecture flags
dnl
is_hppa="no"
is_linux="no"
is_sparc="no"
case "$target_cpu" in
sparc)
	is_sparc="yes";;
hppa*)
	is_hppa="yes";;
i[[3456]]86*)
	is_linux="yes";;
*)
	AC_MSG_ERROR(Target CPU type not supported: "$target_cpu");;
esac

AC_MSG_CHECKING(for GNU ld)
if test "$ac_cv_prog_gxx" = "yes"; then
  gxx_archive_lib=`$CXX -print-file-name=libstdc++.a`
  gcclib=`$CXX -print-libgcc-file-name`
  gxx_lib_dirs=`$CXX -print-search-dirs | grep libraries: | sed -e 's/libraries: //'`
  ld_cmd=`$CXX -print-prog-name=ld`
  ld_cmd_out=`$ld_cmd -v 2>&1`
else
  if test "$is_hppa" = "yes"; then
    dnl
    dnl We would only get to here on HP using aCC.
    dnl
    ld_cmd_out=`$CXX -Wl,-v 2>&1`
    ld_cmd=/usr/ccs/bin/ld
  else
    touch foo.o
    ld_cmd_out=`$CXX -Qoption ld -v foo.o 2>&1`
    rm foo.o
  fi
fi

if echo $ld_cmd_out | egrep '(GNU|with BFD)' >/dev/null; then
  AC_MSG_RESULT(yes)
  EXPORT_DYNAMIC=-export-dynamic
  UNDEF_SYMBOLS="-Wl,-noinhibit-exec"
  gnu_ld=yes
else
  AC_MSG_RESULT(no)
  gnu_ld=no
  if test "$is_hppa" = "yes"; then
    UNDEF_SYMBOLS="-Wl,-B,nonfatal"
    EXPORT_DYNAMIC="-Wl,-E"
  else
    EXPORT_DYNAMIC=""
    UNDEF_SYMBOLS=""
  fi
fi

if test "$gnu_ld" = "yes"; then
  SHARED="-shared"
else
  if test "$ac_cv_prog_gxx" = "yes"; then
    if test "$is_hppa" = "yes"; then
      SHARED="-shared -fPIC"
    else
      SHARED="-Wl,-G"
    fi
  else
    if test "$is_hppa" = "yes"; then
      SHARED=-b
    else
      SHARED=-G
    fi
  fi
fi


dnl
dnl  An assembler (as) must be found in the PATH
dnl

AC_MSG_CHECKING(for assembler)

dnl Search for assembler
assemblerfound=`as --version 2>&1`

if test -z "$assemblerfound"; then
  AC_MSG_ERROR(GNU or system assembler is required in PATH)
else
  AC_MSG_RESULT(Assembler found)
fi

dnl get compiler versions
rh_gxx_prog=no
case "`basename $CXX`" in
  aCC)
    cxx_version=`$CXX -V 2>&1 | head | awk '{print $6;}'`;;
  g++* | c++*)
    cxx_version=`$CXX -dumpversion`
    if test "$is_linux" = "yes"; then
       rh_version=`/usr/bin/g++ -dumpversion`
       if test "$cxx_version" = "$rh_version"; then
         rh_gxx_prog=yes;
       fi
    fi
    ;;
  CC*)
    cxx_version=`$CXX -V 2>&1 | sed "s/CC:.*C++ \([[0-9]]*\.[[0-9]]*\).*/\1/"`;;
  *)
    AC_MSG_WARN(Unrecognized C++ compiler $CXX);;
esac
case "`basename $CC`" in
  gcc*)
    cc_version=`$CC -dumpversion`;;
  cc|acc)
    cc_version=`$CC -V 2>&1 | sed "s/cc:.*C \([[0-9]]*\.[[0-9]]*\).*/\1/"`;;
  *)
    AC_MSG_WARN(Unrecognized C compiler $CC);;
esac

CXX_VERSION=""
compiler_prefix=""
if test "$CHECK_COMPILER" = "yes"; then
  AC_MSG_CHECKING("for supported C++ compiler")
  case "`basename $CXX`" in
  aCC|insure)
    dnl
    dnl double square brackets are required since one gets eaten by autoconf
    dnl
    SUPPORTED_CXX_VERSIONS="(A.03.39)"
    CXX_VERSION=`$CXX -V 2>&1 | head | sed 's/.*\(A\.[[0-9]]*\.[[0-9]]*\).*/\1/'`
    compiler_prefix="acc"
    ;;
  g++*|c++)
    dnl
    dnl Use $CXX here instead of g++ or c++ in case -V2.95.2 or other options are set in the
    dnl environment variable CXX.
    dnl
    SUPPORTED_CXX_VERSIONS="(2.95|2.96|3.2)"
    CXX_VERSION=`$CXX -v 2>&1 | grep "gcc version" | sed "s/gcc version \([[0-9]]*\.[[0-9]]*\).*/\1/"`
    compiler_prefix="gcc"
    ;;
  CC)
    SUPPORTED_CXX_VERSIONS="(5.2|5.4)"
    CXX_VERSION=`$CXX -V 2>&1 | sed "s/CC:.*C++ \([[0-9]]*\.[[0-9]]*\).*/\1/"`
    compiler_prefix="sunw"
    ;;
  *)
    AC_MSG_WARN(CXX set to $CXX which is not a supported compiler.  Beware.);;
  esac
fi

if test "$CXX_VERSION" != ""; then
  if `echo $CXX_VERSION | egrep "$SUPPORTED_CXX_VERSIONS" > /dev/null`; then
    AC_MSG_RESULT($compiler_prefix $CXX_VERSION is supported)
  else
    AC_MSG_WARN($compiler_prefix $CXX_VERSION is not a supported version (i.e. $SUPPORTED_CXX_VERSIONS).  Beware.)
  fi
fi

dnl
dnl We support:
dnl   Solaris 2.5, 2.6, 2.7, 2.8
dnl   HP 11
dnl   Linux
dnl
AC_MSG_CHECKING("for supported operating system")
case "$target_os" in
solaris2.5*|solaris2.6|solaris2.7|solaris2.8|hpux11*|linux-gnu)
  AC_MSG_RESULT($target_os is supported);;
*)
  AC_MSG_ERROR($target_os is not supported);;
esac

dnl
dnl We must have dlfcn.h.
dnl It should be available on HPUX, Solaris and Linux
dnl
AC_CHECK_HEADERS(dlfcn.h,,set FOUND_DLFCN=t)
if test "$FOUND_DLFCN" = "t"; then
AC_MSG_ERROR(Could not find /usr/include/dlfcn.h)
fi

dnl
dnl -ldl must be set in LIBS on Linux before the test for libiberty
dnl
AC_CHECK_LIB(dl, dlopen, , set DLNOTFOUND=t)
AC_CHECK_LIB(dld, shl_load, , set DLDNOTFOUND=t)
if test "$DLNOTFOUND" = "t" && test "$DLDNOTFOUND" = "t"; then
AC_MSG_ERROR(Could not find either dlopen or shl_load)
fi

case "$target_cpu" in
  sparc) 
    if test "$GXX" != "yes"; then
      dnl
      dnl For the SunWorks Forte C++ compiler use /usr/lib/libdemangle.so to get cplus_demangle
      dnl since this compiler mangles differently from g++ and aCC.
      dnl	
      LIBIBERTY=-ldemangle
      AC_CHECK_LIB(demangle, cplus_demangle, , LIBIBERTY=)
    else
      dnl
      dnl The variable LIBIBERTY is left set if the library if found.  If not, the
      dnl variable is cleared.  libiberty.a is provided by the GNU binutils package.
      dnl -liberty must come after -lbfd on the link command line
      dnl
      LIBIBERTY=-liberty
      AC_CHECK_LIB(iberty, cplus_demangle, , LIBIBERTY=)
    fi
    ;;
  hppa*)
    dnl
    dnl HP can't use libiberty.a since it's not PIC.  There's a workaround for
    dnl aCC, but for gcc we just report mangled names.
    dnl
    ;;
  *)
    dnl
    dnl The variable LIBIBERTY is left set if the library if found.  If not, the
    dnl variable is cleared.  libiberty.a is provided by the GNU binutils package.
    dnl -liberty must come after -lbfd on the link command line
    dnl
    LIBIBERTY=-liberty
    AC_CHECK_LIB(iberty, cplus_demangle, , LIBIBERTY=)
    ;;
esac
if test -n "$LIBIBERTY"; then IBERTY=iberty; else IBERTY=""; fi

LIBELF=-lelf
AC_CHECK_LIB(elf, elf_begin, , LIBELF=)

LIBBFD=-lbfd
AC_CHECK_LIB(bfd, bfd_init, , LIBBFD=)

if test -n "$LIBELF"; then ELF="elf"; fi
if test -n "$LIBBFD"; then if test -n "$ELF"; then ELF="$ELF:bfd"; fi; fi

if test "$scv_enable_v2" = "yes"; then
  AA_OPT="-AA"
else
  AA_OPT=""
fi

dnl
dnl The switch -mv8 is really Sparc related, not Solaris related, since
dnl Solaris be run on X86 cpus.
dnl
HPPA_ACC_CXXFLAGS="-ext ${AA_OPT} -Aa -z"
HPPA_GNU_CXXFLAGS="-Wall -mlong-load-store"
LINUX_GNU_CXXFLAGS="-Wall"
SPARC_CC_CXXFLAGS="-pto"
SPARC_GNU_CXXFLAGS="-mv8 -Wall"

dnl
dnl In the Bourne shell ;; means "jump to the esac", like "break" in C
dnl
case "$target_cpu" in
sparc) 
	AC_CHECK_HEADERS(unistd.h)
	AC_CHECK_HEADERS(ucontext.h)
	AC_CHECK_HEADERS(libgen.h)
	AC_CHECK_HEADERS(stddef.h)
	AC_CHECK_HEADERS(sys/reg.h)
	AC_CHECK_HEADERS(sys/regset.h)
	AC_CHECK_HEADERS(sys/frame.h)
	AC_CHECK_HEADERS(sys/link.h)
	AC_DEFINE(SHLIB_EXT,".so")
	AC_DEFINE(_REENTRANT,)
	SHLIB_EXT=.so
	SH_LIB_EXT=so
	echo 'setting compiler flags for sparc'
	muldefs="-Wl,-z,muldefs"
	case "$GXX" in
	yes) echo 'setting compiler flags for g++'
	     CXXFLAGS="$SPARC_GNU_CXXFLAGS $GNU_OPT $GNU_DBG"
	     CXXFLAGS_DEBUG="$SPARC_GNU_CXXFLAGS $DEF_GNU_DBG"
	     CXXFLAGS_OPT="$SPARC_GNU_CXXFLAGS $DEF_GNU_OPT"
	     CFLAGS="$GNU_OPT $GNU_DBG"
	     CFLAGS_DEBUG="$DEF_GNU_DBG"
	     CFLAGS_OPT="$DEF_GNU_OPT"
	     OPTFLAGS="$GNU_OPT"
	     DBGFLAGS="$GNU_DBG"
	     PICFLAGS="$GNU_PIC"
	     scvCXXopts="$SPARC_GNU_CXXFLAGS $GNU_DBG $GNU_PIC"
	     cxxDepFlags="-M -MMD"
	     scvLinkerOpts="$SHARED $EXPORT_DYNAMIC $UNDEF_SYMBOLS"
	     CXX_NAME=gcc
	     CXX_FULL_VER=`$CXX -dumpversion`
	     CXX_VER=`echo $CXX_FULL_VER | awk -F. '{print $1"."$2}'`
	     collector=`$CXX -print-prog-name=collect2`
	     echo 'setting library options for g++ on Solaris'
	     ;;
	'')  echo 'setting compiler flags for NOT g++'
	     dnl
	     dnl Use -xs to get the stabs (debug symbols) in the object libraries and executables instead of 
	     dnl just in the object files, so that gdb and stack traces work.  dbx uses .stab.index to look 
	     dnl up .stab in the object files and therefore doesn't need this switch (unless you move or 
	     dnl delete your objects!)
	     dnl
	     CXXFLAGS="$SPARC_CC_CXXFLAGS $SUN_CC_OPT $SUN_CC_DBG"
	     CXXFLAGS_DEBUG="$SPARC_CC_CXXFLAGS $DEF_SUN_CC_DBG"
	     CXXFLAGS_OPT="$SPARC_CC_CXXFLAGS $DEF_SUN_CC_OPT"
	     CFLAGS="$SUN_CC_OPT $SUN_CC_DBG"
	     CFLAGS_DEBUG="$DEF_SUN_CC_DBG"
	     CFLAGS_OPT="$DEF_SUN_CC_OPT"
	     OPTFLAGS="$SUN_CC_OPT"
	     DBGFLAGS="$SUN_CC_DBG"
	     PICFLAGS="$SUN_CC_PIC"
	     scvCXXopts="$SPARC_CC_CXXFLAGS $SUN_CC_DBG $SUN_CC_PIC"
	     cxxDepFlags=""
	     scvLinkerOpts="$SHARED -library=Cstd -library=Crun $EXPORT_DYNAMIC $UNDEF_SYMBOLS"
	     CXX_NAME=sunw
	     CXX_VER=5.2
             collector=""
	     ;;
        esac;;
hppa*) 
	AC_CHECK_HEADERS(a.out.h)
	AC_DEFINE(SHLIB_EXT,".sl")
	SHLIB_EXT=.sl
        SH_LIB_EXT=sl
	echo 'setting compiler flags for hppa*'
        muldefs=""
	case "$GXX" in
        yes) echo 'setting compiler flags for g++'
	     AC_DEFINE(RWSTD_MULTI_THREAD,)
	     AC_DEFINE(RW_MULTI_THREAD,)
	     AC_DEFINE(_REENTRANT,)
	     AC_DEFINE(__HPACC_THREAD_SAFE_RB_TREE,)
	     AC_DEFINE(HP_THREAD_SAFE,)
	     AC_DEFINE(_THREAD_SAFE,)
	     AC_DEFINE(_POSIX_C_SOURCE, 199506L)
	     AC_DEFINE(hp_hpux11,)
	     CXXFLAGS="$HPPA_GNU_CXXFLAGS $GNU_PIC $GNU_OPT $GNU_DBG"
	     CXXFLAGS_DEBUG="$HPPA_GNU_CXXFLAGS $GNU_PIC $DEF_GNU_DBG"
	     CXXFLAGS_OPT="$HPPA_GNU_CXXFLAGS $GNU_PIC $DEF_GNU_OPT"
	     CFLAGS="$GNU_PIC $GNU_OPT $GNU_DBG"
	     CFLAGS_DEBUG="$GNU_PIC $DEF_GNU_DBG"
	     CFLAGS_OPT="$GNU_PIC $DEF_GNU_OPT"
             OPTFLAGS="$GNU_OPT"
             DBGFLAGS="$GNU_DBG"
             PICFLAGS="$GNU_PIC"
             scvCXXopts="$HPPA_GNU_CXXFLAGS $GNU_PIC $GNU_DBG"
	     scvLinkerOpts="$HPPA_GNU_CXXFLAGS $GNU_PIC $SHARED $EXPORT_DYNAMIC $UNDEF_SYMBOLS -Wl,-B,nonfatal -Wl,+s"
             cxxDepFlags="-M -MMD"
	     CXX_NAME=gcc
             collector=`$CXX -print-prog-name=collect2`
	     CXX_FULL_VER=`$CXX -dumpversion`
	     CXX_VER=`echo $CXX_FULL_VER | awk -F. '{print $1"."$2}'`
	     ;;
        '')  echo 'setting compiler flags and defines for HP aCC'
	     AC_DEFINE(RWSTD_MULTI_THREAD,)
	     AC_DEFINE(RW_MULTI_THREAD,)
	     AC_DEFINE(_REENTRANT,)
	     AC_DEFINE(__HPACC_THREAD_SAFE_RB_TREE,)
	     AC_DEFINE(HP_THREAD_SAFE,)
	     AC_DEFINE(_THREAD_SAFE,)
	     AC_DEFINE(_POSIX_C_SOURCE, 199506L)
	     AC_DEFINE(hp_hpux11,)
	     AC_DEFINE(_HPUX_SOURCE,)
	     CXXFLAGS="$HPPA_ACC_CXXFLAGS $HP_ACC_PIC $HP_ACC_OPT $HP_ACC_DBG"
	     CXXFLAGS_DEBUG="$HPPA_ACC_CXXFLAGS $HP_ACC_PIC $DEF_HP_ACC_DBG"
	     CXXFLAGS_OPT="$HPPA_ACC_CXXFLAGS $HP_ACC_PIC $DEF_HP_ACC_OPT"
	     CFLAGS="$HP_ACC_PIC $HP_ACC_OPT $HP_ACC_DBG"
	     CFLAGS_DEBUG="$HP_ACC_PIC $DEF_HP_ACC_DBG"
	     CFLAGS_OPT="$HP_ACC_PIC $DEF_HP_ACC_OPT"
             OPTFLAGS=
             DBGFLAGS="$HP_ACC_DBG"
             PICFLAGS="$HP_ACC_PIC"
             HP_EXT_OPT="-ext ${AA_OPT} -Aa"
             scvCXXopts="$HPPA_ACC_CXXFLAGS $HP_ACC_PIC $HP_ACC_DBG"
             cxxDepFlags="+md -P"
	     scvLinkerOpts="$SHARED $EXPORT_DYNAMIC $UNDEF_SYMBOLS -Wl,+s"
	     CXX_NAME=acc
             collector=""
	     CXX_VER=`$CXX -V 2> ver.txt; cat ver.txt | awk '{print $6}' | awk -F. '{print $2"."$3}'; rm ver.txt`
	     if test "$scv_enable_v2" = "no"; then
	       AC_DEFINE(SCV_USE_IOSTREAM_H,)
	     fi
	     echo 'setting library options for HP aCC'
	     ;;
	esac;;
i[[3456]]86*) 
	AC_DEFINE(SHLIB_EXT,".so")
	SHLIB_EXT=.so
	SH_LIB_EXT=so
	echo 'setting compiler flags for Intel (Linux)'
        muldefs="-Wl,-z,muldefs"
	case "$GXX" in
        yes) echo 'setting compiler flags for g++'
	     AC_DEFINE(_USE_FRIEND_FOR_EQUAL,)
	     AC_DEFINE(ARCH_IS_X86,)
	     AC_CHECK_HEADERS(bfd.h)
	     CXXFLAGS="$LINUX_GNU_CXXFLAGS $GNU_OPT $GNU_DBG"
	     CXXFLAGS_DEBUG="$LINUX_GNU_CXXFLAGS $DEF_GNU_DBG"
	     CXXFLAGS_OPT="$LINUX_GNU_CXXFLAGS $DEF_GNU_OPT"
	     CFLAGS="$GNU_OPT $GNU_DBG"
	     CFLAGS_DEBUG="$DEF_GNU_DBG"
	     CFLAGS_OPT="$DEF_GNU_OPT"
             OPTFLAGS="$GNU_OPT"
             DBGFLAGS="$GNU_DBG"
             PICFLAGS="$GNU_PIC"
             scvCXXopts="$LINUX_GNU_CXXFLAGS $GNU_DBG $GNU_PIC"
             cxxDepFlags="-M -MMD"
	     scvLinkerOpts="$SHARED $EXPORT_DYNAMIC $UNDEF_SYMBOLS"
	     CXX_NAME=gcc
	     CXX_FULL_VER=`$CXX -dumpversion`
	     CXX_VER=`echo $CXX_FULL_VER | awk -F. '{print $1"."$2}'`
	     echo 'setting library options for g++ on Intel Linux'
	     ;;
        '')  echo 'setting compiler flags for NOT g++'
	     CXXFLAGS="$LINUX_GNU_CXXFLAGS $GNU_OPT $GNU_DBG"
	     CXXFLAGS_DEBUG="$LINUX_GNU_CXXFLAGS $DEF_GNU_DBG"
	     CXXFLAGS_OPT="$LINUX_GNU_CXXFLAGS $DEF_GNU_OPT"
	     CFLAGS="$GNU_OPT $GNU_DBG"
	     CFLAGS_DEBUG="$DEF_GNU_DBG"
	     CFLAGS_OPT="$DEF_GNU_OPT"
             OPTFLAGS="$GNU_OPT"
             DBGFLAGS="$GNU_DBG"
             PICFLAGS="$GNU_PIC"
	     scvCXXopts="$LINUX_GNU_CXXFLAGS $GNU_DBG $GNU_PIC"
             cxxDepFlags=""
	     scvLinkerOpts="-G $EXPORT_DYNAMIC $UNDEF_SYMBOLS"
	     CXX_NAME=gcc
	     CXX_VER=`$CXX -dumpversion | awk -F. '{print $1"."$2}'`
	     ;;
        esac;;
*)
	AC_MSG_ERROR(Target CPU type not supported: "$target_cpu");;
esac

scvCompiler="${CXX_NAME}_$CXX_VER"

if test "$scvCompiler" = "gcc_3.2"; then
  AC_DEFINE(_USE_FMTFLAGS_TYPE,)
  AC_DEFINE(_USE_FRIEND_FOR_EQUAL,)
elif test "$GXX" = "yes"; then
  AC_DEFINE(_USE_PADDING_ON_STRUCTS,)
  AC_DEFINE(_USE_HASH_MAP,)
fi

dnl
dnl Check for basic C++ sanity (hello world in several forms)
dnl
SCV_TEST_CC_SANITY([$scvCXXopts])

dnl
dnl Check whether we need to build support for cout << ull
dnl Sets scv_have_ull_write
dnl
SCV_TEST_ULL_WRITE([$scvCXXopts])
if test "$scv_have_ull_write" = "no"; then
  AC_DEFINE(_USE_UINT64_WRITE,)
fi

dnl
dnl This trick with AC_DEFINE -- having a 3rd argument and nothing in acconfig.h
dnl doesn't work on Solaris.  But that is ok.  These aren't symbols that should
dnl be defined there anyway.
dnl
dnl if `echo $target_cpu | egrep "i[[3456]]86" > /dev/null`; then
dnl  AC_DEFINE(ARCH_IS_X86,,[cpu variable matched x86])
dnl fi

dnl
dnl Check for ability to dlopen a library and see
dnl data objects. There is a bug in old versions Sun's ld.so.1
dnl and there could be generic linking problems that cause this.
dnl
SCV_TEST_LD_SO([$scvCXXopts], [$scvLinkerOpts])

dnl
dnl determine which simulators to build for
dnl

case "${with_systemc:-}" in
  "no")  systemc_enab="no";    systemc_path="";;
  "yes") systemc_enab="yes";   systemc_path="";;
  "")    systemc_enab="maybe"; systemc_path="";;
  *)     systemc_enab="yes";   systemc_path="${with_systemc}";;
esac

dnl it is required for the user to configure with --with-systemc
dnl otherwise, will look at the directory above the configure dir
if test -z "$systemc_path"; then
  AC_MSG_CHECKING(for systemc directory)
  if test -d "`pwd`/systemc"; then
    builddir=`pwd`;
    systemc_path=`cd $builddir/systemc; pwd`
  elif test -d "`pwd`/../systemc"; then
    builddir=`pwd`;
    systemc_path=`cd $builddir/../systemc; pwd`
  elif test -d "$CFGDIR/../systemc"; then
    systemc_path=`cd $CFGDIR/../systemc; pwd`
  fi
  if test -z "$systemc_path"; then
    AC_MSG_WARN(SystemC directory was not found)
    AC_MSG_RESULT(searched `pwd`/systemc)
    AC_MSG_RESULT(searched `pwd`/../systemc)
    AC_MSG_RESULT(searched $CFGDIR/../systemc)
    AC_MSG_RESULT(unable to find systemc directory. use --with-systemc=<systemc_dir>)
  else
    AC_MSG_RESULT($systemc_path)
  fi
fi

dnl
dnl Make sure path to SystemC installation exists and is absolute.
dnl

if test "$systemc_enab" != "no"; then
  if test -r "$systemc_path"; then
    systemc_path=`cd $systemc_path;pwd`;
  else
    AC_MSG_ERROR(SystemC installation root directory does not exist.
       Was systemC installed correctly?)
  fi
fi

dnl
dnl Check for correct SystemC installation
dnl

EXTRA_GNU_DIR=""
SYSC_TARGET=""
case "$target" in 
  sparc-sun-solaris*)
    case "$CXX" in
      CC) SYSC_TARGET="sparcOS5";;
      c++ | g++*) SYSC_TARGET="gccsparcOS5"; EXTRA_GNU_DIR="/gnu";;
      *) SYSC_TARGET="gccsparcOS5";;
    esac
    ;;
  *linux*)
    if test "$rh_gxx_prog" = "no"; then EXTRA_GNU_DIR="/gnu"; fi
    SYSC_TARGET="linux";;
  *cygwin*)
    SYSC_TARGET="cygwin";;
  *hpux11*)
    case "$CXX" in
      aCC) SYSC_TARGET="hpux11";;
      *) SYSC_TARGET="gcchpux11"; EXTRA_GNU_DIR="/gnu";;
    esac
    ;;
esac

if test "$systemc_enab" != "no"; then
  SYSC_SRC_PREFIX=$systemc_path/src
  lib_found=0
  header_found=0
  if test "SYSC_TARGET" = ""; then
    AC_MSG_ERROR(Unable to determine the systemC target architecture from $target)
  fi
  if test $lib_found = 0; then
    SYSC_LIB_PREFIX="$systemc_path/lib-$SYSC_TARGET"
    AC_MSG_CHECKING("for $SYSC_LIB_PREFIX/libsystemc.a")
    if test -r "$SYSC_LIB_PREFIX/libsystemc.a"; then
      lib_found=1
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
  if test $lib_found = 0; then
    SYSC_LIB_PREFIX="$systemc_path/lib$EXTRA_GNU_DIR"
    AC_MSG_CHECKING("for $SYSC_LIB_PREFIX/libsystemc.a")
    if test -r "$SYSC_LIB_PREFIX/libsystemc.a"; then
      lib_found=1
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
  if test $header_found = 0; then
    SYSC_INC_PREFIX="$systemc_path/include"
    AC_MSG_CHECKING("for $SYSC_INC_PREFIX/systemc.h")
    if test -r "$SYSC_INC_PREFIX/systemc.h"; then
      header_found=1
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
  if test $header_found = 0; then
    SYSC_INC_PREFIX=`cd $systemc_path/../include; pwd`
    AC_MSG_CHECKING("for $SYSC_INC_PREFIX/systemc.h")
    if test -r "$SYSC_INC_PREFIX/systemc.h"; then
      header_found=1
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
  if test $lib_found = 0 -o $header_found = 0; then
    AC_MSG_ERROR(Could not find all required files for SystemC. 
       Was systemC installed correctly?)
  fi
fi

SC_VERSION_CHECK($CXXFLAGS, $SYSC_INC_PREFIX, $SYSC_LIB_PREFIX)
if test "$sc_version" = "unknown" -o -z "$sc_version"; then
  sc_version=2000001
fi
AC_DEFINE_UNQUOTED(SC_VERSION, ${sc_version})
SC_VERSION=$sc_version

dnl
dnl Check whether we need to explicitly define an
dnl operator!= for each operator==.
dnl
SCV_TEST_AUTO_NEQ([$scvCXXopts -I$SYSC_INC_PREFIX])
if test "$scv_have_auto_neq" = "no"; then
  AC_DEFINE(_USE_EXPLICIT_NEQ,)
fi

dnl
dnl determine whether to use sc_report in place of scv_report
dnl use sc_report if set_actions is present and version >=2.1
dnl
if test "$use_scv_report" = "maybe"; then
  file_found=0
  if test $file_found = 0; then
    file=$SYSC_INC_PREFIX/systemc/utils/sc_report_handler.h;
    if test -r $file; then file_found=1; fi
  fi
  if test $file_found = 0; then
    file=$SYSC_INC_PREFIX/systemc/utils/sc_report.h;
    if test -r $file; then file_found=1; fi
  fi
  use_scv_report="yes";
  if test $file_found = 1; then  
    flag=0
    if grep set_actions $file >/dev/null; then flag=1; fi
    if test "$SC_VERSION" -lt "2001000"; then flag=0; fi
    if test $flag = 1; then use_scv_report="no"; fi
  fi
fi
if test "$use_scv_report" = "no"; then
  AC_DEFINE(_SCV_USE_SC_REPORT,)
fi

dummy_install="do_not_install"
actual_install="install"

dnl
dnl set the default prefix and make sure the prefix is absolute
dnl

if test "$prefix" != "NONE"; then
  mkdir -p $prefix
  prefix=`cd $prefix; pwd`
  libdir=$prefix/lib-$SYSC_TARGET
elif test "$systemc_enab" = "no"; then
  prefix=`pwd`
  libdir=$prefix/lib-$SYSC_TARGET
else
  prefix=`cd $systemc_path; pwd`
  libdir=$SYSC_LIB_PREFIX
  includedir=$SYSC_INC_PREFIX
fi

dnl
dnl substitution variables
dnl

AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPT)
AC_SUBST(CXXFLAGS_DEBUG)
AC_SUBST(CXXFLAGS_OPT)
AC_SUBST(DBGFLAGS)
AC_SUBST(EXPORT_DYNAMIC)
AC_SUBST(KIT)
AC_SUBST(LIBIBERTY)
AC_SUBST(MAJ)
AC_SUBST(MIN)
AC_SUBST(OPTFLAGS)
AC_SUBST(SHLIB_EXT)
AC_SUBST(SYSC_INC_PREFIX)
AC_SUBST(SYSC_LIB_PREFIX)
AC_SUBST(SYSC_SRC_PREFIX)
AC_SUBST(UNDEF_SYMBOLS)
AC_SUBST(actual_install)
AC_SUBST(buildBin)
AC_SUBST(buildData)
AC_SUBST(buildInc)
AC_SUBST(buildLib)
AC_SUBST(cxxDepFlags)
AC_SUBST(dummy_install)
AC_SUBST(extraExamples)
AC_SUBST(overwrite_files)
AC_SUBST(pdfDocSrcDir)
AC_SUBST(pure_ld_opts)
AC_SUBST(purecache)
AC_SUBST(relocate)
AC_SUBST(scvLinkerOpts)


dnl
dnl define documentation configuration data
dnl
if test "$prefix" = "NONE"; then
  if test "$relocate" = "yes"; then
    prefixTmp=/tmp/SCV
    if test ! -d $prefixTmp; then mkdir $prefixTmp; fi
  else
    prefixTmp="$ac_default_prefix"
  fi
else
  if test "$relocate" = "yes" -a ! "$default_beach_dir" = "$prefix" ; then
    AC_MSG_ERROR(It is illegal to specify --prefix with --enable-relocate option)
  fi
  AC_MSG_CHECKING(for absolute path prefix and that it exists)
  leading_slash="`echo $prefix | egrep '^/'`"
  if test -z "$leading_slash"; then
    AC_MSG_ERROR(Prefix must be an absolute path)
  else
    if test -d $prefix; then
      if test "`cd $prefix; pwd`" = "`pwd`"; then
	dummy_install="install"
	actual_install="do_not_install"
	AC_MSG_RESULT([yes, install and build dir are same.  No install is needed.])
      else
        AC_MSG_RESULT([yes, OK])
      fi
    else
      AC_MSG_ERROR(Prefix must be an existing directory)
    fi;
  fi;
  prefixTmp="$prefix"
fi

buildBin="`pwd`/bin"
buildInc="`pwd`/include"
buildLib="`pwd`/lib"
buildData="`pwd`/share"

dnl
dnl HP has dlfcn.h but it does not define dl_info.
dnl Linux has Dl_info in dlfcn.h but it is conditionally compiled in
dnl an mode we don't use
dnl
AC_EGREP_HEADER(Dl_info,dlfcn.h,AC_DEFINE(HAVE_DL_INFO))

dnl
dnl Just having dlopen in libdl is not a guarantee that dladdr
dnl is available.  On HP-UX /usr/lib/pa20_64/libdl.so has dlopen,
dnl but NOT dladdr.
dnl
AC_CHECK_LIB(dl,dladdr)

dnl
dnl list generated Makefiles
dnl

AC_OUTPUT( \
  Makefile \
  scripts/Makefile \
  src/Makefile \
  src/cudd/Makefile \
  src/cudd/2.3.0/Makefile \
  src/cudd/2.3.0/cudd/Makefile \
  src/cudd/2.3.0/cudd/doc/Makefile \
  src/cudd/2.3.0/cudd/doc/icons/Makefile \
  src/cudd/2.3.0/dddmp/Makefile \
  src/cudd/2.3.0/dddmp/doc/Makefile \
  src/cudd/2.3.0/mtr/Makefile \
  src/cudd/2.3.0/mtr/doc/Makefile \
  src/cudd/2.3.0/util/Makefile \
  src/cudd/2.3.0/st/Makefile \
  src/cudd/2.3.0/st/doc/Makefile \
  src/cudd/2.3.0/obj/Makefile \
  src/cudd/2.3.0/nanotrav/Makefile \
  src/cudd/2.3.0/nanotrav/doc/Makefile \
  src/cudd/2.3.0/mnemosyne/Makefile \
  src/cudd/2.3.0/sis/Makefile \
  src/scv/Makefile \
  docs/Makefile \
  docs/scv/Makefile \
  docs/scv/scvref/Makefile \
  examples/Makefile
)

dnl
dnl Test for rational tools with quickthreads
dnl
if test "$purify_enab" = "yes" -o "$quantify_enab" = "yes" -o "$purecov_enab" = "yes"; then
  AC_MSG_WARN(Rational tools do not work well with quickthreads)
fi
