dnl Process this file with autoconf to produce a configure script.
CFLAGS="-O2"
CXXFLAGS="-O2"

AC_INIT([hark-jsk], [0.0.1], [demo@lists.sourceforge.net])
AM_INIT_AUTOMAKE([foreign])
AM_CONFIG_HEADER([config.h])
LT_INIT

AC_PREREQ(2.53)

HARK_JSK_MAJOR_VERSION=0
HARK_JSK_MINOR_VERSION=0
HARK_JSK_MICRO_VERSION=1
HARK_JSK_VERSION=$HARK_JSK_MAJOR_VERSION.$HARK_JSK_MINOR_VERSION.$HARK_JSK_MICRO_VERSION
HARK_JSK_INTERFACE_AGE=0
HARK_JSK_BINARY_AGE=0


# TAGS VERSION and SVN REVISION
echo 'Searching SVN Revision Recursively ...'
SVN_REVISION=`\`flowdesigner-config --bindir\`/fdmodule_version.pl --printsvn`
AC_DEFINE([SVN_REVISION], ["${SVN_REVISION}"], [SVN REVISION])
AC_DEFINE([TAGS_VERSION], ["${HARK_JSK_VERSION}"], [TAGS REVISION])
echo "Found Revision: ${SVN_REVISION}"
AC_DEFINE([HARK_JSK_VERSION], ["${HARK_JSK_VERSION}"], [HARK JSK REVISION])

AC_SUBST(HARK_JSK_MAJOR_VERSION)
AC_SUBST(HARK_JSK_MINOR_VERSION)
AC_SUBST(HARK_JSK_MICRO_VERSION)
AC_SUBST(HARK_JSK_INTERFACE_AGE)
AC_SUBST(HARK_JSK_BINARY_AGE)
AC_SUBST(HARK_JSK_VERSION)

# libtool versioning
LT_RELEASE=$HARK_JSK_MAJOR_VERSION.$HARK_JSK_MINOR_VERSION
LT_CURRENT=`expr $HARK_JSK_MICRO_VERSION - $HARK_JSK_INTERFACE_AGE`
LT_REVISION=$HARK_JSK_INTERFACE_AGE
LT_AGE=`expr $HARK_JSK_BINARY_AGE - $HARK_JSK_INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

VERSION=$HARK_JSK_VERSION
PACKAGE=hark-jsk


dnl Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_CANONICAL_HOST
AC_DISABLE_STATIC
AC_ENABLE_SHARED
AM_PROG_LIBTOOL
AC_LANG_CPLUSPLUS

AC_ARG_PROGRAM

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

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_CHECK_FUNCS(getcwd getwd putenv strdup)

dnl overflow-config test (Yannick Brosseau & Dominic Letourneau)

AC_PATH_PROG(AWK_PROG,awk,no,$PATH:$prefix/bin)
if test "$AWK_PROG" = no; then
	AC_MSG_ERROR(awk is required to configure $PACKAGE properly, please install it and try again.)
	exit
fi	


AC_PATH_PROG(FLOWDESIGNER_CONFIG,flowdesigner-config,no,$PATH:$FLOWDESIGNER_HOME/bin:$prefix/bin)
if test "$FLOWDESIGNER_CONFIG" = no; then
	AC_MSG_ERROR( Cannot find flowdesigner-config )
fi


AC_PATH_PROG(PKG_CONFIG,pkg-config,no,$PATH)
if test "$PKG_CONFIG" = no; then
	AC_MSG_ERROR( Cannot find pkg-config)
	exit
fi


VERSION=$HARK_JSK_VERSION
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
AM_MAINTAINER_MODE
 
dnl Additional includes & libraries

FLOWDESIGNER_LIB=`$FLOWDESIGNER_CONFIG --libs libflow`
FLOWDESIGNER_INCLUDE=`$FLOWDESIGNER_CONFIG --cflags config libflow | sed 's/\"/\\\"/g'`
FLOWDESIGNER_DATA=`$FLOWDESIGNER_CONFIG  --datadir`
FLOWDESIGNER_BIN=`$FLOWDESIGNER_CONFIG --bindir`


dnl Look for prefix, if not specified, use FlowDesigner default toolbox prefix
if test "x$prefix" = "xNONE"; then
  prefix=$FLOWDESIGNER_DATA/$PACKAGE                      
else
  dnl this will work, but we should maybe change the variable name
  FLOWDESIGNER_DATA=$prefix
fi


AC_SUBST(FLOWDESIGNER_LIB)
AC_SUBST(FLOWDESIGNER_INCLUDE)
AC_SUBST(FLOWDESIGNER_DATA)
AC_SUBST(FLOWDESIGNER_BIN)

dnl AM_PATH_GTK_2_0(2.0.0,,AC_MSG_ERROR([GTK+ is required.]))
PKG_CHECK_MODULES(GTK,gtk+-2.0)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

dnl add HARK include path
AC_ARG_WITH(hark-inc,
[  --with-hark-inc=DIR          location of HARK include files],
[CPPFLAGS="${CPPFLAGS} -I ${withval}"])

# for libharkio1
AC_ARG_ENABLE(harkio1,
[  --enable-harkio1         Enable harkio1 library],
[case "${enableval}" in
	yes) harkio1=true ;;
	no)  harkio1=false ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --enable-harkio1) ;;
esac],[harkio1=false])
AM_CONDITIONAL(ENABLE_HARKIO1, test x$harkio1 = xtrue)
if test "$enable_harkio1" = "yes"; then
	AC_DEFINE([ENABLE_HARKIO1],[],[use harkio1])
	AC_DEFINE([ENABLE_HARKIO],[],[use harkio])
fi

AC_ARG_WITH(harkio1-inc,
[  --with-harkio1-inc=DIR      location of libharkio1 include files],
[CPPFLAGS="${CPPFLAGS} -I ${withval}"])

AC_ARG_WITH(harkio1-lib,
[  --with-harkio1-lib=DIR      location of libharkio1 library files],
[LDFLAGS="${LDFLAGS} -L${withval}"])

# for libharkio2
AC_ARG_ENABLE(harkio2,
[  --enable-harkio2        Enable harkio2 library],
[case "${enableval}" in
	yes) harkio2=true ;;
	no)  harkio2=false ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --enable-harkio2) ;;
esac],[harkio2=false])
AM_CONDITIONAL(ENABLE_HARKIO2, test x$harkio2 = xtrue)
if test "$enable_harkio2" = "yes"; then
	AC_DEFINE([ENABLE_HARKIO2],[],[use harkio2])
	AC_DEFINE([ENABLE_HARKIO],[],[use harkio])
fi

AC_ARG_WITH(harkio2-inc,
[  --with-harkio2-inc=DIR      location of libharkio2 include files],
[CPPFLAGS="${CPPFLAGS} -I ${withval}"])

AC_ARG_WITH(harkio2-lib,
[  --with-harkio2-lib=DIR      location of libharkio2 library files],
[LDFLAGS="${LDFLAGS} -L${withval}"])

# for checking the existence of pkg-config
if test "$enable_harkio1" != "yes" -a "$enable_harkio2" != "yes"; then
   AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   if test x"$PKG_CONFIG" == "xno"; then
      AC_MSG_ERROR([You have to install pkg-config])
   fi
fi

# load libharkio1 by pkg-config
if test "$enable_harkio1" != "yes"; then
   PKG_CHECK_MODULES([LIBHARKIO], [libharkio],
   [
      have_libharkio=yes
      AC_DEFINE([ENABLE_HARKIO1],[],[use harkio1])
      AC_DEFINE([ENABLE_HARKIO],[],[use harkio])
      AM_CONDITIONAL(ENABLE_HARKIO1, test x$have_libharkio = xyes)
      CPPFLAGS="${CPPFLAGS} `pkg-config libharkio --cflags-only-I`"      
      LDFLAGS="${LDFLAGS} `pkg-config libharkio --libs-only-L`"      
      echo "Enable  have_libharkio=$have_libharkio"
   ],
   [ 
      have_libharkio=no
      echo "Disable  have_libharkio=$have_libharkio"
   ])
fi

# load libharkio2 by pkg-config
if test "$enable_harkio2" != "yes"; then
   PKG_CHECK_MODULES([LIBHARKIO2], [libharkio2],
   [
      have_libharkio2=yes
      AC_DEFINE([ENABLE_HARKIO2],[],[use harkio2])
      AC_DEFINE([ENABLE_HARKIO],[],[use harkio])
      AM_CONDITIONAL(ENABLE_HARKIO2, test x$have_libharkio2 = xyes)
      CPPFLAGS="${CPPFLAGS} `pkg-config libharkio2 --cflags-only-I`"      
      LDFLAGS="${LDFLAGS} `pkg-config libharkio2 --libs-only-L`"      
      echo "Enable  have_libharkio2=$have_libharkio2"
   ],
   [ 
      have_libharkio2=no
      echo "Disable  have_libharkio2=$have_libharkio2"
   ])
fi

dnl add ROS include path
AC_ARG_ENABLE(ros,
[  --enable-ros         enable ROS],
[case "${enableval}" in
      yes) ros=true ;;
      no)  ros=false ;;
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-ros) ;;
esac],[ros=false])
AM_CONDITIONAL(ENABLE_ROS, test x$ros = xtrue)
if test "$enable_ros" = "yes"; then

   AC_DEFINE([ENABLE_ROS],[],[use ros])

   if echo "`rosstack find ros`" | grep "cturtle"; then
      echo "ros cturtle cflags found"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp`/include -I`rospack find roscpp`/srv/cpp -I`rospack find roscpp`/msg/cpp -I`rospack find roscpp`/msg_gen/cpp/include -I`rospack find roscpp`/srv_gen/cpp/include"   
      CPPFLAGS="${CPPFLAGS} -I`rospack find xmlrpcpp`/src"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rosconsole`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roslib`/msg/cpp -I`rospack find roslib`/include -I`rospack find roslib`/msg_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rospack` -I`rospack find rospack`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find std_msgs`/include -I`rospack find std_msgs`/msg/cpp -I`rospack find std_msgs`/srv/cpp -I`rospack find std_msgs`/msg_gen/cpp/include -I`rospack find std_msgs`/srv_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find dynamic_reconfigure`/include -I`rospack find dynamic_reconfigure`/srv/cpp -I`rospack find dynamic_reconfigure`/msg/cpp -I`rospack find dynamic_reconfigure`/msg_gen/cpp/include -I`rospack find dynamic_reconfigure`/srv_gen/cpp/include"
   fi
   if echo "`rosstack find ros`" | grep "diamondback"; then
      echo "ros diamondback cflags found"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp`/include -I`rospack find roscpp`/srv/cpp -I`rospack find roscpp`/msg/cpp -I`rospack find roscpp`/msg_gen/cpp/include -I`rospack find roscpp`/srv_gen/cpp/include"   
      CPPFLAGS="${CPPFLAGS} -I`rospack find rostime`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find cpp_common`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp_serialization`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp_traits`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rosgraph_msgs`/msg_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find xmlrpcpp`/src"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rosconsole`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roslib`/msg/cpp -I`rospack find roslib`/include -I`rospack find roslib`/msg_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rospack` -I`rospack find rospack`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find std_msgs`/include -I`rospack find std_msgs`/msg/cpp -I`rospack find std_msgs`/srv/cpp -I`rospack find std_msgs`/msg_gen/cpp/include -I`rospack find std_msgs`/srv_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find dynamic_reconfigure`/include -I`rospack find dynamic_reconfigure`/srv/cpp -I`rospack find dynamic_reconfigure`/msg/cpp -I`rospack find dynamic_reconfigure`/msg_gen/cpp/include -I`rospack find dynamic_reconfigure`/srv_gen/cpp/include"
   fi
   if echo "`rosstack find ros`" | grep "electric"; then
      echo "ros electric cflags found"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp`/include -I`rospack find roscpp`/srv/cpp -I`rospack find roscpp`/msg/cpp -I`rospack find roscpp`/msg_gen/cpp/include -I`rospack find roscpp`/srv_gen/cpp/include"   
      CPPFLAGS="${CPPFLAGS} -I`rospack find rostime`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find cpp_common`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp_serialization`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roscpp_traits`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rosgraph_msgs`/msg_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find xmlrpcpp`/src"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rosconsole`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find roslib`/msg/cpp -I`rospack find roslib`/include -I`rospack find roslib`/msg_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find rospack` -I`rospack find rospack`/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find std_msgs`/include -I`rospack find std_msgs`/msg/cpp -I`rospack find std_msgs`/srv/cpp -I`rospack find std_msgs`/msg_gen/cpp/include -I`rospack find std_msgs`/srv_gen/cpp/include"
      CPPFLAGS="${CPPFLAGS} -I`rospack find dynamic_reconfigure`/include -I`rospack find dynamic_reconfigure`/srv/cpp -I`rospack find dynamic_reconfigure`/msg/cpp -I`rospack find dynamic_reconfigure`/msg_gen/cpp/include -I`rospack find dynamic_reconfigure`/srv_gen/cpp/include"
   fi
   if echo "`rosstack find ros`" | grep "fuerte"; then
      echo "ros fuerte cflags found"
      CPPFLAGS="${CPPFLAGS} `pkg-config roscpp --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config rostime --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config cpp_common --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config roscpp_serialization --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config roscpp_traits --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config rosgraph_msgs --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config xmlrpcpp --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config rosconsole --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config roslib --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config rospack --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config std_msgs --cflags`"
      CPPFLAGS="${CPPFLAGS} -I`rospack find dynamic_reconfigure`/include -I`rospack find dynamic_reconfigure`/srv/cpp -I`rospack find dynamic_reconfigure`/msg/cpp -I`rospack find dynamic_reconfigure`/msg_gen/cpp/include -I`rospack find dynamic_reconfigure`/srv_gen/cpp/include"
   fi
   if echo "`rosversion -d`" | grep "groovy"; then
      echo "ros groovy cflags found"
      CPPFLAGS="${CPPFLAGS} `pkg-config roscpp --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config rostime --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config cpp_common --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config roscpp_serialization --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config roscpp_traits --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config rosgraph_msgs --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config xmlrpcpp --cflags`"      
      CPPFLAGS="${CPPFLAGS} `pkg-config rosconsole --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config roslib --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config rospack --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config std_msgs --cflags`"
      CPPFLAGS="${CPPFLAGS} `pkg-config dynamic_reconfigure --cflags`"
   fi
   CPPFLAGS="${CPPFLAGS} -I`rospack find hark_msgs`/msg/cpp -I`rospack find hark_msgs`/srv/cpp -I`rospack find hark_msgs`/msg_gen/cpp/include -I`rospack find hark_msgs`/srv_gen/cpp/include -I`rospack find jsk_hark_msgs`/msg_gen/cpp/include -I`rospack find jsk_hark_msgs`/build/devel/include"
   CPPFLAGS="${CPPFLAGS} -I`rospack find hark_params`/include -I`rospack find hark_params`/srv/cpp -I`rospack find hark_params`/msg/cpp -I`rospack find hark_params`/msg_gen/cpp/include -I`rospack find hark_params`/srv_gen/cpp/include -I`rospack find hark_params`/cfg/cpp"

   if echo "`rosstack find ros`" | grep "cturtle"; then
      echo "ros cturtle libs found"
      LDFLAGS="${LDFLAGS} -L`rospack find roscpp`/lib -lros -Wl,-rpath,`rospack find roscpp`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find xmlrpcpp`/lib -lXmlRpc -Wl,-rpath,`rospack find xmlrpcpp`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rosconsole`/lib -lrosconsole -Wl,-rpath,`rospack find rosconsole`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find roslib`/lib -lroslib -Wl,-rpath,`rospack find roslib`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rospack`/lib -lrospack -lrosstack -Wl,-rpath,`rospack find rospack`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find dynamic_reconfigure`/lib -ldynamic_reconfigure_config_init_mutex -Wl,-rpath,`rospack find dynamic_reconfigure`/lib"
   fi
   if echo "`rosstack find ros`" | grep "diamondback"; then
      echo "ros diamondback libs found"
      LDFLAGS="${LDFLAGS} -L`rospack find roscpp`/lib -lros -Wl,-rpath,`rospack find roscpp`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rostime`/lib -lrostime -Wl,-rpath,`rospack find rostime`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find cpp_common`/lib -lcpp_common -Wl,-rpath,`rospack find cpp_common`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find roscpp_serialization`/lib -lroscpp_serialization -Wl,-rpath,`rospack find roscpp_serialization`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find xmlrpcpp`/lib -lXmlRpc -Wl,-rpath,`rospack find xmlrpcpp`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rosconsole`/lib -lrosconsole -Wl,-rpath,`rospack find rosconsole`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find roslib`/lib -lroslib -Wl,-rpath,`rospack find roslib`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rospack`/lib -lrospack -lrosstack -Wl,-rpath,`rospack find rospack`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find dynamic_reconfigure`/lib -ldynamic_reconfigure_config_init_mutex -Wl,-rpath,`rospack find dynamic_reconfigure`/lib"
   fi
   if echo "`rosstack find ros`" | grep "electric"; then
      echo "ros electric libs found"
      LDFLAGS="${LDFLAGS} -L`rospack find roscpp`/lib -lros -Wl,-rpath,`rospack find roscpp`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rostime`/lib -lrostime -Wl,-rpath,`rospack find rostime`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find cpp_common`/lib -lcpp_common -Wl,-rpath,`rospack find cpp_common`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find roscpp_serialization`/lib -lroscpp_serialization -Wl,-rpath,`rospack find roscpp_serialization`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find xmlrpcpp`/lib -lXmlRpc -Wl,-rpath,`rospack find xmlrpcpp`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rosconsole`/lib -lrosconsole -Wl,-rpath,`rospack find rosconsole`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find roslib`/lib -lroslib -Wl,-rpath,`rospack find roslib`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find rospack`/lib -lrospack -lrosstack -Wl,-rpath,`rospack find rospack`/lib"
      LDFLAGS="${LDFLAGS} -L`rospack find dynamic_reconfigure`/lib -ldynamic_reconfigure_config_init_mutex -Wl,-rpath,`rospack find dynamic_reconfigure`/lib"
   fi
   if echo "`rosstack find ros`" | grep "fuerte"; then
      echo "ros fuerte libs found"
      LDFLAGS="${LDFLAGS} `pkg-config roscpp --libs`"      
      LDFLAGS="${LDFLAGS} `pkg-config rostime --libs`"      
      LDFLAGS="${LDFLAGS} `pkg-config cpp_common --libs`"      
      LDFLAGS="${LDFLAGS} `pkg-config roscpp_serialization --libs`"
      LDFLAGS="${LDFLAGS} `pkg-config xmlrpcpp --libs`"
      LDFLAGS="${LDFLAGS} `pkg-config rosconsole --libs`"
      LDFLAGS="${LDFLAGS} `pkg-config roslib --libs`"
      LDFLAGS="${LDFLAGS} `pkg-config rospack --libs`"
      LDFLAGS="${LDFLAGS} -L`rospack find dynamic_reconfigure`/lib -ldynamic_reconfigure_config_init_mutex -Wl,-rpath,`rospack find dynamic_reconfigure`/lib"
      LDFLAGS="${LDFLAGS} -Wl,-rpath,/opt/ros/fuerte/lib"
   fi
   if echo "`rosversion -d`" | grep "groovy"; then
      echo "ros groovy libs found"
      LDFLAGS="${LDFLAGS} `pkg-config roscpp --libs-only-L` -lroscpp"      
      LDFLAGS="${LDFLAGS} `pkg-config rostime --libs-only-L` -lrostime"      
      LDFLAGS="${LDFLAGS} `pkg-config cpp_common --libs-only-L` -lcpp_common"      
      LDFLAGS="${LDFLAGS} `pkg-config roscpp_serialization --libs-only-L` -lroscpp_serialization"
      LDFLAGS="${LDFLAGS} `pkg-config xmlrpcpp --libs-only-L` -lxmlrpcpp"
      LDFLAGS="${LDFLAGS} `pkg-config rosconsole --libs-only-L` -lrosconsole"
      LDFLAGS="${LDFLAGS} `pkg-config roslib --libs-only-L` -lroslib"
      LDFLAGS="${LDFLAGS} `pkg-config rospack --libs-only-L` -lrospack -ltinyxml"
      LDFLAGS="${LDFLAGS} -lpython2.7 -lboost_filesystem-mt -lboost_program_options-mt -lboost_system-mt"
      LDFLAGS="${LDFLAGS} `pkg-config dynamic_reconfigure --libs-only-L` -ldynamic_reconfigure_config_init_mutex -lroscpp_serialization -lrostime"
      LDFLAGS="${LDFLAGS} -lboost_date_time-mt -lboost_system-mt -lboost_thread-mt -lpthread"
      LDFLAGS="${LDFLAGS} -Wl,-rpath,/opt/ros/groovy/lib"
   fi
   LDFLAGS="${LDFLAGS} -lboost_thread-mt -lboost_signals-mt -lboost_thread-mt -llog4cxx"

fi

dnl Output Files (makefiles)
AC_OUTPUT(Makefile src/Makefile)


dnl Notification message for the user to know which flags will be used for compilation
dnl should use AC_MSG_NOTICE(), but that's apparently not defined in autoconf 2.13
AC_MSG_RESULT([])
AC_MSG_RESULT([*************************************************************])
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE will be built on a $build system to run])
AC_MSG_RESULT([on a $host system, with the following options:])
AC_MSG_RESULT([])

AC_MSG_RESULT([$PACKAGE will be installed in : $prefix])

