# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/configure.ac 3896 2022-04-13 13:24:17Z depa $

AC_INIT([shins],[17.09.29],[marco.depascale@inaf.it])
AC_SUBST(INSROOT)
AC_SUBST(PACKAGE_RELEASE, 1)

AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([config/m4])
m4_define([serial_tests], [
    m4_esyscmd([automake --version |
                head -1 |
                awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
    ])
])
AM_INIT_AUTOMAKE([subdir-objects foreign dist-bzip2 tar-pax ] foreign serial_tests)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],[AC_SUBST(V, 1)])

#AM_MAINTAINER_MODE
LT_INIT([disable-static])

AM_CONFIG_HEADER([config.h])

#AC_PREFIX_DEFAULT($PWD)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_INSTALL
AM_PROG_CC_C_O

#AM_PROG_LEX
#AC_PROG_YACC
AM_PATH_PYTHON

AC_DISABLE_STATIC
AC_ENABLE_SHARED
AC_PROG_LIBTOOL
#AC_PROG_RANLIB

#AC_DISABLE_FAST_INSTALL

# Checks for libraries.
AC_CHECK_LIB(m, sin)

# Checks for header files.
AC_HEADER_STDC

# Checks for typedefs, structures, and compiler characteristics.

# Checks for programs

AC_PROG_SED

AC_CHECK_PROGS([INSTALLPRG],[ginstall install],)
AC_CHECK_PROGS([COPYPRG],[gcp cp],)
AC_CHECK_PROGS([MVPRG],[gmv mv],)
AC_CHECK_PROGS([TAIL],[gtail tail],)
AC_CHECK_PROGS([SED],[gsed sed],)
AC_CHECK_PROGS([DEBMAKE],[dh_make],)
AC_CHECK_PROGS([DPKGBUILDPKG],[dpkg-buildpackage],)
AC_CHECK_PROGS([RMPRG],[grm rm],)
AC_CHECK_PROGS([UNSETPRG],[unset],)
AC_CHECK_PROGS([TARPRG],[gtar tar],)
AC_CHECK_PROGS([BCPRG],[gbc bc],)

# Checks for toolkits.

AC_SUBST(TIMESTAMP, `date "+%F %X"`)
AB_SPLIT_VERSION

#AC_DEBIAN_CHECK


AC_CHECK_LIB([xerces-c], [main],[XERCES_C_LIB="-lxerces-c" AC_SUBST(XERCES_C_LIB)],
                    [AC_MSG_ERROR([xerces-lib not found ])])
AC_CHECK_HEADER([xercesc/util/XercesVersion.hpp],
                [XERCES_C_CXXFLAGS="-I/usr/include"  AC_SUBST(XERCES_C_CXXFLAGS)],
                    [AC_MSG_ERROR([xerces-includes not found ])])

ACX_PTHREAD
AC_SEARCH_CFITSIO
AC_SEARCH_BASDA
AC_SEARCH_BASDA_EXTRA(Vino,VINO,[-lBasdaVino -lBasdaVinoImage_NiceType])

AC_SEARCH_NICE

AC_SEARCH_ICE

#AC_SEARCH_QT
#AC_SEARCH_QWT

AC_SEARCH_QT4
AC_SEARCH_QT4_DESIGNER

#AC_SEARCH_QT4_EXTRA(Qt3Support)
#AC_SEARCH_QT4_EXTRA(QtDBus)
#AC_SEARCH_QT4_EXTRA(QtAssistant)
#AC_SEARCH_QT4_EXTRA(QtNetwork)
#AC_SEARCH_QT4_EXTRA(QtOpenGL)
#AC_SEARCH_QT4_EXTRA(QtSql)
#AC_SEARCH_QT4_EXTRA(QtSvg)
#AC_SEARCH_QT4_EXTRA(QtTest)
#AC_SEARCH_QT4_EXTRA(QtUiTools)
#AC_SEARCH_QT4_EXTRA(QtXml)

#AC_SEARCH_QWT4

#AX_BOOST_BASE([1.33])

AX_BOOST_FILESYSTEM
#AX_BOOST_DATE_TIME
#AX_BOOST_IOSTREAMS
#AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_PYTHON
#AX_BOOST_SERIALIZATION
#AX_BOOST_REGEX
#AX_BOOST_SIGNALS
AX_BOOST_THREAD
AX_BOOST_UNIT_TEST_FRAMEWORK
#AX_BOOST_XPRESSIVE

#if test "x$BOOST_SIGNALS_LIB" = "x"; then
#  echo "Sorry, we need the Signal-Lib from Boost."
#  echo "Please install from http://www.boost.org"
#  exit 1
#fi

AC_SUBST([INDIPATH])
AM_CONDITIONAL([INDIPATH_SET], [test ! -z "$INDIPATH"])


#AM_PATH_TERMCAP
#AC_CHECK_XPM
#AC_CHECK_XM

AB_DOCU
AB_EXTRA_PATH
AB_DEBUG
AB_STLFILTER
AB_USELIBONLY

dnl AC_SUBST(IIF_CXXFLAGS, "-I\$(top_srcdir)/src/iif/Interface/Ltcs/Iif/ -I\$(top_srcdir)/src/lbto/")
dnl AC_SUBST(IIF_LDFLAGS, "-L\$(top_builddir)/src/iif/Interface/Ltcs/Iif/ -L\$(top_builddir)/src/lbto/")
AC_SUBST(IIF_CXXFLAGS, "-I\$(includedir)/shins/ -I\$(includedir)/shins/lbto/")
# AC_SUBST(IIF_LDFLAGS, "-L\$(top_builddir)/src/iif/Interface -L\$(top_builddir)/src/lbto/")
AC_SUBST(IIF_LDFLAGS, "-L\$(libdir)/shins")
AC_SUBST(IIF_LIBS, "-lLbtoIIFIceInterface -lLtcsIifStar_NiceType")

AC_SUBST(SHARKNIR_DROT_CXXFLAGS,  "-I\$(top_srcdir)/src/track_ctrl/drot/Interface/")
AC_SUBST(SHARKNIR_DROT_LDFLAGS, "-L\$(top_builddir)/src/track_ctrl/drot/Interface/")
AC_SUBST(SHARKNIR_DROT_LIBS, "-lSharknirDrotService_NiceType")

dnl AC_SUBST(SHARKNIR_UTIL_LIB, "\$(top_builddir)/src/util/libShinsUtil_SharknirType.la \$(LIBCURL)")
dnl AC_SUBST(SHARKNIR_UTIL_CPPFLAGS, "\$(LIBCURL_CPPFLAGS)")

AC_SUBST(SHARKNIR_UTIL_LIB, "\$(top_srcdir)/src/tiptilt_ctrl/bcu/util/libSharknirUtil.la")


# AC_SUBST(BASDA_MISDA_CXXFLAGS, "-I\$(INSROOT)/include/Basda/Microgate")

AC_SUBST(INDIPATH)
AC_SUBST(INDI_CXXFLAGS, "-I\$(INDIPATH)/include/libcppindi -I\$(INDIPATH)/include/libcommon -I\$(INDIPATH)/include/liblilxml")
AC_SUBST(INDI_LDFLAGS, "-L\$(INDIPATH)/lib")
AC_SUBST(INDI_SHARED_LDFLAGS, "-L\$(INDIPATH)/lib -L\$(INDIPATH)/lib")
AC_SUBST(INDI_LIBS, "-lcppindi -llilxml -lcommon -lz -lpthread")

AC_SUBST(EIGEN_CXXFLAGS, "-I/usr/local/include/eigen3")

AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(config/Makefile)
AC_CONFIG_FILES(config/templates/Makefile)
AC_CONFIG_FILES(etc/Makefile)
AC_CONFIG_FILES(src/Makefile)
AC_CONFIG_FILES(src/lbto/Makefile)
AC_CONFIG_FILES(src/iif/Makefile)
AC_CONFIG_FILES(src/iif/Interface/Makefile)
AC_CONFIG_FILES(src/iif/Service/Makefile)
AC_CONFIG_FILES(src/tcs_iif/Makefile)
AC_CONFIG_FILES(src/util/Makefile)
AC_CONFIG_FILES(src/motion_ctrl/Makefile)
AC_CONFIG_FILES(src/track_ctrl/Makefile)
AC_CONFIG_FILES(src/track_ctrl/drot/Makefile)
AC_CONFIG_FILES(src/track_ctrl/drot/Interface/Makefile)
AC_CONFIG_FILES(src/track_ctrl/drot/Service/Makefile)
AC_CONFIG_FILES(src/calunit_ctrl/Makefile)
AC_CONFIG_FILES(src/scicam_ctrl/Makefile)
dnl AC_CONFIG_FILES(src/seq/Makefile)
dnl AC_CONFIG_FILES(src/seq/Interface/Makefile)
dnl AC_CONFIG_FILES(src/seq/Interface/Seq/Makefile)
dnl AC_CONFIG_FILES(src/seq/Interface/Seq/Qt/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/util/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/Interface/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/Interface/Sharknir/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/Interface/Sharknir/Bcu/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/Interface/Sharknir/Qt/Makefile)
AC_CONFIG_FILES(src/tiptilt_ctrl/bcu/Service/Makefile)
AC_CONFIG_FILES(src/data_mgr/Makefile)
AC_CONFIG_FILES(src/obs_ctrl/Makefile)
AC_CONFIG_FILES(src/obs_ctrl/panels/Makefile)

AC_CONFIG_FILES(src/scripts/Makefile)
AC_CONFIG_FILES(src/scripts/eng_gui/Makefile)
dnl AC_CONFIG_FILES(src/scripts/saved/Makefile)
AC_CONFIG_FILES(src/scripts/apis/Makefile)
dnl AC_CONFIG_FILES(src/scripts/panel/Makefile)
AC_CONFIG_FILES(src/scripts/templates/Makefile)
dnl AC_CONFIG_FILES(src/scripts/templates/seq/Makefile)
AC_CONFIG_FILES(src/scripts/templates/tpl/Makefile)
AC_CONFIG_FILES(src/scripts/templates/util/Makefile)
AC_CONFIG_FILES(src/scripts/templates/alignment/Makefile)
AC_CONFIG_FILES(src/scripts/templates/SHINS_SW_TEST/Makefile)
dnl AC_CONFIG_FILES(src/scripts/commissioning/Makefile)
dnl AC_CONFIG_FILES(etc/data/Makefile)
AC_OUTPUT
