dnl $Id: configure.in,v 1.554 2009/08/04 23:34:01 pfkeb Exp $
dnl Process this file with autoconf to produce a configure script.
dnl Initially generated by autoscan.
dnl
dnl Author Paul F. Kunz <Paul_Kunz@slac.stanford.edu
dnl
AC_REVISION($Revision: 1.554 $)

AC_INIT(plotters/PlotterBase.cxx)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM

AM_INIT_AUTOMAKE(HippoDraw, 1.22.0)
AM_CONFIG_HEADER(config.h)


dnl Do compilation tests in C++.
AC_LANG_CPLUSPLUS

AC_PROG_CXX

dnl Force libtool to use C++ compiler when checking for PIC
CC=$CXX

dnl Need to have this early otherwise some other macro causes these
dnl macro to think that shared libraries can not be built.
AM_DISABLE_STATIC
AM_PROG_LIBTOOL

dnl Get the path to the standard C++ library
PFK_CXX_LIB_PATH

AC_CHECK_PROG(GMAKE, gmake, gmake, make)
AC_SUBST(GMAKE)

dnl look for converting latex to png image
PFK_HAVE_TEX_UTILS

dnl Look for Python install area
PFK_PYTHON_ROOT

dnl Look of optional location of boost
PFK_HAVE_BOOST

dnl Option to disable Boost.Python build
AC_ARG_ENABLE(boostbuild,
[  --enable-boostbuild     do build with Boost.Python (default = yes)],
[case "${enableval}" in
  yes) boostbuild=true ;;
  no)  boostbuild=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-boostbuild) ;;
esac],[boostbuild=true])
AM_CONDITIONAL(BOOSTBUILD, test x$boostbuild = xtrue )

dnl Option to enable SIP build
AC_ARG_ENABLE(sipbuild,
[  --enable-sipbuild       do build with SIP (default = no)
                          see sip/INSTALL],
[case "${enableval}" in
  yes) sipbuild=true ;;
  no)  sipbuild=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-sipbuild) ;;
esac],[sipbuild=false])
AM_CONDITIONAL(SIPBUILD, test x$sipbuild = xtrue )
if test x$sipbuild = xtrue; then
  AC_DEFINE(HAVE_SIP, 1,
    Define to 1 if building with SIP )
fi

dnl check for Minuit2
PFK_HAVE_MINUIT2

dnl check for Minuit
PFK_HAVE_MINUIT

dnl Check for ROOT and if found check for Minuit2 in there
PFK_HAVE_ROOT
AM_CONDITIONAL(MINUITBUILD2, test x$have_minuit2 = xyes )
AM_CONDITIONAL(MINUITBUILD, test x$have_minuit = xyes)
AM_CONDITIONAL(ROOTBUILD, test x$have_root = xyes )

dnl Option to enable numpy build and use numpy if found else Numeric
AC_ARG_ENABLE(numpybuild,
[  --enable-numarraybuild  do build with numpy (default = yes)],
[case "${enableval}" in
  yes) numpybuild=true ;;
  no)  numpybuild=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-numpybuild) ;;
esac],[numpybuild=true])

if test x$numpybuild != xfalse; then
  PFK_HAVE_NUMPY
  if test x$have_numpy != xyes; then
    PFK_HAVE_NUMERIC
    if test x$have_numeric != xyes; then
      numpybuild=false
    fi
  fi
fi

AC_ARG_ENABLE(numericbuild,
[  --enable-numericbuild   do build with Numeric (default = no)],
[case "${enableval}" in
  yes) numericbuild=true ;;
  no)  numericybuild=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-numarraybuild) ;;
esac],[numericbuild=false])

if test x$numericbuild != xfalse; then
  numarraybuild=true
  PFK_HAVE_NUMERIC
  if test x$have_numeric != xyes; then
    numarraybuild=false
  fi
fi

AC_ARG_ENABLE(numarraybuild,
[  --enable-numarraybuild     do build with numarray (default = no)],
[case "${enableval}" in
  yes) numpybuild=true ;;
  no)  numpybuild=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-numarraybuild) ;;
esac],[numarraybuild=false])

if test x$numarraybuild != xfalse; then
  numpybuild=true
  PFK_HAVE_NUMPY
  if test x$have_numpy != xyes; then
    numarraybuild=false
  fi
fi

AM_CONDITIONAL(NUMARRAYBUILD, test x$numpybuild = xtrue )


dnl Look for Qt libraries and binaries
BNV_HAVE_QT
AM_CONDITIONAL(QTBUILD, test x$have_qt = xyes)

dnl Test for Qt 4
PFK_HAVE_QT4
AM_CONDITIONAL(QT4MAKE, test x$have_qt4 = xyes)
AM_CONDITIONAL(QTBUILD, test x$have_qt4 = xyes || test x$have_qt = xyes )

if test x$have_qt = xyes || test x$have_qt4 = xyes; then
  AC_DEFINE(HAVE_QT_APP, 1, Define to 1 if building Qt application )
else
  AC_MSG_WARN(Not using Qt)
fi

dnl check for WCSlib
PFK_HAVE_WCSLIB
AM_CONDITIONAL(WCSLIBBUILD, test x$have_wcslib = xyes )


dnl Look for cfitsio libraries
PFK_HAVE_CFITSIO

AM_CONDITIONAL(FITSBUILD, test x$have_cfitsio = xyes )


dnl Enable or disable built-in help
PFK_ENABLE_HELP
AM_CONDITIONAL(HELPBUILD, test x$pfk_enable_help = xyes )

dnl Option to enable OpenGL build
AC_ARG_ENABLE(openglbuild,
[  --enable-openglbuild    do build with OpenGL (default = no)],
 [case "${enableval}" in
  yes) openglbuild=true ;;
  no)  openglbuild=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-openglbuild) ;;
  esac],[openglbuild=false])
AM_CONDITIONAL(OPENGLBUILD, test x$openglbuild = xtrue )
if test x$openglbuild != xfalse; then
   MDL_HAVE_OPENGL
fi

dnl Use standard <sstream> if found; otherwise it uses the older <strstream>.
dnl Note: There's AC_CXX_HAVE_SSTREAM at 
dnl http://autoconf-archive.cryp.to/ac_cxx_have_sstream.html
dnl that could replace the following
AC_CHECK_HEADER(sstream,
 [],
 [AC_CHECK_HEADER(strstream,
   AC_DEFINE(SSTREAM_DEFECT, 1,
    Define to 1 if you have the <strstream> header file instead of <sstream>),
   AC_MSG_ERROR(You have neither the <sstream> or <strstream> header file)
 )])

dnl Defect in std::distance function like Sun CC 5.1
AC_CXX_DISTANCE

dnl Defect in std::string::clear() function like gcc 2.95.3
AC_CXX_STRING_CLEAR

AC_CXX_MEM_FUN1

AC_CONFIG_LINKS(OpenGL/tests/aptuple.tnt:examples/aptuple.tnt)


AC_OUTPUT(Makefile HippoDraw.spec  \
           axes/Makefile \
	   colorreps/Makefile \
	   controllers/Makefile \
	   datareps/Makefile \
	   datasrcs/Makefile \
	   doc/Doxyfile \
	   doc/Doxylib \
	   doc/footer.html \
	   doc/header.html \
	   doc/headerlib.html \
	   doc/Makefile \
	   doc/images/Makefile \
	   binners/Makefile \
	   examples/Makefile \
	   fits/Makefile \
	   functions/Makefile \
	   graphics/Makefile \
	   images/Makefile \
           lib/Makefile \
	   minimizers/Makefile \
	   msdevstudio/Makefile \
	   numarray/Makefile \
	   pattern/Makefile \
	   plotters/Makefile \
	   projectors/Makefile \
	   python/Makefile  \
	   reps/Makefile \
	   root/Makefile  \
	   sip/Makefile \
	   std/Makefile \
	   qt/Makefile  \
	   qt/app/Makefile qt/app/HippoDraw.desktop \
	   qt/examples/Makefile \
	   qtui/Makefile \
	   qtxml/Makefile \
	   OpenGL/Makefile \
	   OpenGL/tests/Makefile \
	   OpenGL/tests/test.py \
	   sip/Doxyfile \
	   sip/autoscale.py sip/autoscale2.py sip/image.py sip/negative.py \
	   sip/axis.py sip/axisgen.py sip/stest.py sip/updates.py \
	   sip/customaxis.py sip/fitting.py sip/static.py  \
	   sip/testwidget.py \
	   sip/testwindow.py \
	   sip/testxyplot.py \
	   transforms/Makefile  \
	   xml/Makefile \
	   vs.net/Makefile \
	   vs.net2003/Makefile \
	   vs.net2003/hippo/Makefile \
	   vs.net2003/pyhippo/Makefile \
	   vs.net2003/qt/Makefile \
	   vs.net2003/qtapp/Makefile \
	   vs.net2003/setup/Makefile \
	   vs.net2003/sihippo/Makefile \
	   vs.net2005/Makefile \
	   vs.net2005/hippo/Makefile \
	   vs.net2005/pyhippo/Makefile \
	   vs.net2005/qtui/Makefile \
	   vs.net2005/qtapp/Makefile \
	   vs.net2005/setup/Makefile \
	   vs.net2005/sihippo/Makefile \
	   testsuite/Makefile \
	   testsuite/README \
	   testsuite/.gdbinit \
	   testsuite/set_hippo.sh \
	   testsuite/ConstantModelFit.py \
	   testsuite/Output.py \
	   testsuite/Output2.py \
	   testsuite/accesstuple.py \
	   testsuite/autoscale.py \
	   testsuite/autotuple.py \
	   testsuite/auto_xytuple.py \
           testsuite/axisBug.py \
	   testsuite/baddata1.py \
	   testsuite/baddata2.py \
	   testsuite/batchmode.py \
	   testsuite/bugs.py \
	   testsuite/canvas.py \
	   testsuite/canvas_crash.py \
	   testsuite/cern_pi_1.py \
	   testsuite/cern_pi_4.py \
	   testsuite/chi2bug.py \
	   testsuite/chi2Dists.py \
	   testsuite/circbuff.py \
	   testsuite/column.py \
	   testsuite/colors.py \
	   testsuite/contour_over.py \
	   testsuite/createNTuple.py \
	   testsuite/cuts.py \
	   testsuite/cutId.py \
	   testsuite/cuts_export.py \
	   testsuite/datareps.py \
	   testsuite/data_array.py \
	   testsuite/displays.py \
	   testsuite/documents.py \
	   testsuite/earth.py \
	   testsuite/egret_numarray.py \
	   testsuite/egret_old.py \
	   testsuite/egret.py \
	   testsuite/empty.py \
	   testsuite/eps_exp_bug.py \
	   testsuite/errorContours.py \
	   testsuite/errorContours_2.py \
	   testsuite/extreme.py \
	   testsuite/fitBug.py \
	   testsuite/fitExample.py \
	   testsuite/fitTestData.py \
	   testsuite/fittingLimits.py \
	   testsuite/fitting2.py \
	   testsuite/fluxes.py \
	   testsuite/function.py \
	   testsuite/function2d.py \
	   testsuite/function2i.py \
	   testsuite/function_empty.py \
	   testsuite/function_ntuple.py \
	   testsuite/function_py.py \
	   testsuite/function_rep.py \
	   testsuite/gui_lockup.py \
	   testsuite/hammer.py \
	   testsuite/integers.py \
           testsuite/lambert.py \
	   testsuite/glast_twotower.py \
	   testsuite/histogram.py \
	   testsuite/histexceptions.py \
           testsuite/hist_bug.py \
	   testsuite/hist_comp.py \
	   testsuite/hist_ntuple.py \
	   testsuite/hsimple.py \
	   testsuite/hsimple_array.py \
	   testsuite/large_range.py \
           testsuite/load_hippo.py \
	   testsuite/log.py \
           testsuite/logAxisBug.py \
	   testsuite/logerror.py \
           testsuite/manipulateDisplays.py \
           testsuite/minuitfit.py \
           testsuite/m51.py \
	   testsuite/normalize.py \
	   testsuite/ntuple.py \
	   testsuite/observer.py \
	   testsuite/odd.py \
	   testsuite/overplot.py \
	   testsuite/pl_exp_test.py \
	   testsuite/plotboundary.py \
	   testsuite/plot_circle.py \
	   testsuite/plot_function.py \
	   testsuite/poorFit.py \
	   testsuite/scatter_hist.py \
	   testsuite/ranges.py \
	   testsuite/rebin.py \
	   testsuite/regressionFit.py \
           testsuite/run_root_scripts.py \
           testsuite/run_test_scripts.py \
           testsuite/runninghist.py \
           testsuite/setPath.py \
           testsuite/SciPy_demo.py \
	   testsuite/scatter_func.py \
	   testsuite/statichists.py \
	   testsuite/static_hists.py \
           testsuite/svac.py \
	   testsuite/test_addText.py \
	   testsuite/test_addAbsText.py \
	   testsuite/test_ConstantModelFit.py \
	   testsuite/test_autoscale.py \
	   testsuite/test_DataArray.py \
	   testsuite/test_FitsController.py \
	   testsuite/test_FitsWrite.py \
	   testsuite/test_FitsImage.py \
	   testsuite/test_fft.py
	   testsuite/test_getNTuple.py \
	   testsuite/test_getNTuple2.py \
	   testsuite/test_listtuple.py \
	   testsuite/test_numarray.py \
	   testsuite/test_numeric.py \
	   testsuite/test_root.py \
	   testsuite/test_root_array.py \
	   testsuite/towercut.py \
	   testsuite/two_roots.py \
	   testsuite/useBinner.py \
	   testsuite/weighted_pl.py \
	   testsuite/weighted2_pl.py \
	   testsuite/width_before_range.py \
           testsuite/zplot_pixel_offset.py \
	   testsuite/isoc_bugs.py )

AC_MSG_RESULT([
HippoDraw successfully configured...])

if test x"$have_minuit" = xyes; then
  AC_MSG_RESULT( with Minuit )
else
  AC_MSG_RESULT( without option Minuit )
fi

if test x"$have_minuit2" = xyes; then
  AC_MSG_RESULT( with Minuit2 )
else
  AC_MSG_RESULT( without option Minuit2 )
fi

if test x"$have_root" = xyes; then
  AC_MSG_RESULT( with ROOT )
else
  AC_MSG_RESULT( without option ROOT )
fi

if test x"$have_cfitsio" = xyes; then
  AC_MSG_RESULT( with FITS )
else
  AC_MSG_RESULT( without option FITS )
fi

if test x$numarraybuild != xfalse; then
  AC_MSG_RESULT( with numarray )
else
  AC_MSG_RESULT( without option numarray )
fi

if test x$numpybuild != xfalse; then
  AC_MSG_RESULT( with numpy )
else
  AC_MSG_RESULT( without option numpy )
fi

if test x"$have_wcslib" = xyes; then
  AC_MSG_RESULT( with wcslib )
else
  AC_MSG_RESULT( without option wcslib )
fi

if test x"$pfk_enable_help" = xyes; then
  AC_MSG_RESULT( with built-in help )
else
  AC_MSG_RESULT( without option built-in help )
fi

if ! test x$pfk_have_boost = xyes; then
  AC_MSG_WARN([
     One or more errors occured in testing Boost installation
     ] )
fi

AC_MSG_RESULT([If this is Ok, type make to build])
