dnl Process this file with autoconf to produce a configure script. dnl Every `configure' script must call `AC_INIT' dnl $package is the name of the program dnl $version is its number dnl $bugreport is an email dnl $tarname is used to call the directories, ... related to the program AC_INIT([V_Sim stable branch], [3.3.1], [dcaliste AT free D fr], [v_sim]) dnl Some variables vsim_interface=1 lib_nanoquanta_version=$vsim_interface":1:0" lib_openbabel_version=$vsim_interface":1:0" need_cpp_compiler="no" dnl Save this value here, since automake will set cflags later cflags_set=${CFLAGS} cxxflags_set=${CXXFLAGS} dnl Initialize automake with same $package and $version AM_INIT_AUTOMAKE([$PACKAGE_TARNAME], [$PACKAGE_VERSION]) dnl Use a config.h file to store macro definitions AM_CONFIG_HEADER(config.h) dnl Outputing some informations date="2007-11-15" AC_MSG_NOTICE([Compiling $PACKAGE_NAME]) AC_MSG_NOTICE([$PACKAGE_TARNAME $PACKAGE_VERSION $date]) dnl Set the default prefix AC_PREFIX_DEFAULT([/usr/local]) AC_MSG_CHECKING([for instalation directory]) AC_MSG_RESULT([$prefix]) dnl Required for distclean AM_MAINTAINER_MODE dnl Starting of consistency checks dnl ------------------------------ dnl cherche un compilateur C dnl set the CC variable AC_PROG_CC dnl set the CXX variable AC_PROG_CXX dnl Ar and ranlib are checked by libtool dnl Look for ranlib and canonicalize it with the $host variable dnl AC_CHECK_TOOL(RANLIB, ranlib, :) dnl if test "$ranlib" = ":" ; then dnl AC_MSG_ERROR(["No 'ranlib' program found."]) dnl fi dnl Look for ar and canonicalize it with the $host variable dnl AC_CHECK_TOOL(AR, ar, :) dnl if test "$ar" = ":" ; then dnl AC_MSG_ERROR(["No 'ar' program found."]) dnl fi dnl check for platform AC_MSG_CHECKING([for target architecture]) case x"$target" in xNONE | x) target_or_host="$host" ;; *) target_or_host="$target" ;; esac AC_MSG_RESULT(['$target_or_host']) AC_MSG_CHECKING([for some Win32 platform]) define_win32=0 define_X11=1 case "$target_or_host" in *-mingw* | *-*-cygwin*) platform_win32=yes define_win32=1 define_X11=0 EXEEXT=.exe FONT_NORMAL="Sans" FONT_BOLD="Sans bold" V_SIM_SKIN=None WIN32_EXTRA_LDFLAGS="-no-undefined" WIN32_EXTRA_CFLAGS="-mms-bitfields -mno-cygwin" EXTRA_LIBS="-lopengl32 -lglu32 -lintl" ;; *) platform_win32=no define_X11=1 define_win32=0 EXEEXT= FONT_NORMAL="Nimbus normal" FONT_BOLD="Nimbus bold" V_SIM_SKIN=V_Sim WIN32_EXTRA_LDFLAGS= WIN32_EXTRA_CFLAGS= EXTRA_LIBS="-lGL -lGLU" ;; esac AC_MSG_RESULT([$platform_win32]) AC_SUBST(FONT_NORMAL) AC_SUBST(FONT_BOLD) AC_SUBST(V_SIM_SKIN) AC_SUBST(WIN32_EXTRA_LDFLAGS) AC_SUBST(WIN32_EXTRA_CFLAGS) AC_SUBST(EXTRA_LIBS) AC_SUBST(EXEEXT) AM_CONDITIONAL(PLATFORM_X11, test "$define_X11" = "1") AM_CONDITIONAL(PLATFORM_WIN32, test "$define_win32" = "1") AM_CONDITIONAL(BUILD_STATIC_BINARY, test "$define_X11" = "1") AM_CONDITIONAL(BUILD_SHARED_BINARY, test "$define_win32" = "1") dnl Using libtool to handle libraries AC_CHECK_TOOL(LIBTOOL, libtool, :) if test "$libtool" = ":" ; then AC_MSG_ERROR(["No 'libtool' program found."]) fi AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL dnl Standards headers are checked by libtool dnl cherche entre autre stdlib string dnl AC_HEADER_STDC dnl cherche si le système propose unistd dnl AC_UNISTD_H dnl Checks for header files. dnl AC_CHECK_HEADERS([stdio.h]) dnl cherche les headers pour OpenGl OPENGL_SEARCH_PATH="" AC_ARG_WITH(opengl_path, AS_HELP_STRING([--with-opengl-path], [give the path to the OpenGL include files gl.h and glu.h.]), [OPENGL_SEARCH_PATH=$withval], [OPENGL_SEARCH_PATH=""]) if test -n "$OPENGL_SEARCH_PATH" ; then AC_MSG_NOTICE([OpenGL search path is "$OPENGL_SEARCH_PATH"]) CFLAGS_SVG=$CFLAGS CFLAGS="$CFLAGS -I${OPENGL_SEARCH_PATH}" CPPFLAGS_SVG=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I${OPENGL_SEARCH_PATH}" fi AC_CHECK_HEADER([GL/gl.h], [glh="yes"], [glh="no"]) if test "$glh" = "no" ; then AC_MSG_ERROR(["No 'GL/gl.h' header file."]) fi AC_CHECK_HEADER([GL/glu.h], [gluh="yes"], [gluh="no"]) if test "$gluh" = "no" ; then AC_MSG_ERROR(["No 'GL/glu.h' header file."]) fi if test "$platform_win32" = "no" ; then AC_CHECK_HEADER([GL/glx.h], [glxh="yes"], [glxh="no"]) if test "$glxh" = "no" ; then AC_MSG_ERROR(["No 'GL/glx.h' header file."]) fi fi if test -n "$OPENGL_SEARCH_PATH" ; then CFLAGS=$CFLAGS_SVG CPPFLAGS=$CPPFLAGS_SVG OPENGL_INCLUDE_PATH="-I"$OPENGL_SEARCH_PATH else OPENGL_INCLUDE_PATH= fi dnl Export the include path for OpenGL AC_SUBST(OPENGL_INCLUDE_PATH) AC_CHECK_HEADER([GL/gl.h], [glh="yes"], [glh="no"]) if test "$glh" = "no" ; then AC_MSG_ERROR(["No 'gl.h' header file."]) fi AC_CHECK_HEADER([GL/glu.h], [gluh="yes"], [gluh="no"]) if test "$gluh" = "no" ; then AC_MSG_ERROR(["No 'glu.h' header file."]) fi dnl Add the languages which your application supports here. ALL_LINGUAS="fr" AM_GLIB_GNU_GETTEXT XGETTEXT=${XGETTEXT}" --from-code=UTF-8" AC_SUBST(XGETTEXT) GETTEXT_PACKAGE=$PACKAGE_TARNAME AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.]) dnl Set CFLAGS if not already set by user dnl Setting CFLAGS or not to avoid the -g appended by AC_PROG_CC if test x"$cflags_set" = "x" ; then CFLAGS="-O2" fi if test x"$cxxflags_set" = "x" ; then CXXFLAGS="-O2" fi dnl AC_PROG_CC set the CC variable and detect if we use the GNU compiler dnl We now append some various CFLAGS depending on platform and choice dnl of the user. AC_ARG_WITH(strict-cflags, AS_HELP_STRING([--with-strict-cflags], [if set or absent some correctness cflags are appended to the CFLAGS variable. Appended values dependent on the platform and code branch (default on Unix for development is Wall Wno-unused W Werror ansi pedantic-errors).]), [STRICT_CFLAGS=$withval], [STRICT_CFLAGS="yes"]) if test "$GCC" = "yes" -a "$STRICT_CFLAGS" = "yes"; then dnl Used flags for V_Sim. if test "$PACKAGE" = "v_sim-dev" ; then if test "$platform_win32" = "yes" ; then flags='Wall Wno-unused' flags_cpp='Wall Wno-unused' else flags='Wall Wno-unused W Werror ansi pedantic-errors' flags_cpp='Wall Wno-unused W Werror ansi pedantic-errors' fi else flags='Wall ansi' flags_cpp='Wall ansi' fi for fl in $flags ; do case " $CFLAGS " in *[\ \ ]-$fl[\ \ ]*) ;; *) CFLAGS="$CFLAGS -$fl" ;; esac done for fl in $flags_cpp ; do case " $CXXFLAGS " in *[\ \ ]-$fl[\ \ ]*) ;; *) CXXFLAGS="$CXXFLAGS -$fl" ;; esac done fi AC_MSG_CHECKING([for CFLAGS used]) AC_MSG_RESULT([$CFLAGS]) AC_MSG_CHECKING([for CXXFLAGS used]) AC_MSG_RESULT([$CXXFLAGS]) dnl checking for glib and gtk if test $platform_win32 = yes ; then export PKG_CONFIG_PATH=/usr/i586-mingw32msvc/lib/pkgconfig/ fi PKG_CHECK_MODULES(PACKAGE_GLIB, glib-2.0 >= 2.2.0) PKG_CHECK_MODULES(PACKAGE_GTK, gtk+-2.0 >= 2.4.0) PACKAGE_GMODULE_LIBS=`pkg-config --libs gmodule-2.0` AC_SUBST(PACKAGE_GMODULE_LIBS) dnl Customization of V_Sim AC_MSG_CHECKING([for debug message]) with_debug_messages=no define_debug=0 AC_ARG_ENABLE(debug-messages, AS_HELP_STRING([--enable-debug-messages], [compile V_Sim with all the debug strings, it is very verbose (default=no).]), with_debug_messages=$enableval, with_debug_messages=no) AC_MSG_RESULT([$with_debug_messages]) if test "$with_debug_messages" = "yes" ; then define_debug=1 AC_MSG_WARN([--enable-debug-messages... are you sure, this is very verbose?]) fi dnl Test for plug-ins compilation dnl ----------------------------- dnl Nanoquanta netcdf format NQ_SEARCH_PATH="/usr" AC_ARG_WITH(nanoquanta_path, AS_HELP_STRING([--with-nanoquanta-path], [give the path to the NetCDF library and include file (default is /usr).]), [NQ_SEARCH_PATH=$withval], [NQ_SEARCH_PATH="/usr"]) AC_MSG_NOTICE([NetCDF search path is "$NQ_SEARCH_PATH"]) AC_MSG_CHECKING([for nanoquanta support]) have_nanoquanta=no AC_ARG_WITH(nanoquanta, AS_HELP_STRING([--with-nanoquanta], [compile plug-in support for files that follow the Nanoquanta specifications for structural positions and densities (default=no).]), [have_nanoquanta=yes], [have_nanoquanta=no]) AC_MSG_RESULT([$have_nanoquanta]) if test "$have_nanoquanta" = "yes" ; then dnl Looking for a sub directory in /usr/include NETCDF_PATH=`find "$NQ_SEARCH_PATH/include" -name netcdf.h | tail -1 | sed "s,$NQ_SEARCH_PATH/include/\(.*\)netcdf.h,\1,"` CFLAGS_SVG=$CFLAGS CFLAGS="$CFLAGS -I${NQ_SEARCH_PATH}/include/${NETCDF_PATH}" CPPFLAGS_SVG=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I${NQ_SEARCH_PATH}/include/${NETCDF_PATH}" AC_CHECK_HEADER([netcdf.h], [netcdf="yes"], [netcdf="no"]) if test "$netcdf" = "yes" ; then AC_SUBST(NETCDF_PATH) AC_SUBST(NQ_SEARCH_PATH) AC_SUBST(lib_nanoquanta_version) have_nanoquanta="yes" else AC_MSG_WARN(["No 'netcdf.h' header file, libnanoquanta.so will not be built."]) have_nanoquanta="no" fi CFLAGS=$CFLAGS_SVG CPPFLAGS=$CPPFLAGS_SVG fi AM_CONDITIONAL(HAVE_NANOQUANTA, test x"$have_nanoquanta" = x"yes") dnl OpenBabel wrapper dnl Defining C++ language for tests. AC_LANG(C++) dnl begin by looking for a user given path. OB_SEARCH_PATH="/usr" AC_ARG_WITH(openbabel_path, AS_HELP_STRING([--with-openbabel-path], [give the path to the OpenBabel library and include file (default is /usr).]), [OB_SEARCH_PATH=$withval], [OB_SEARCH_PATH="/usr"]) AC_MSG_NOTICE([OpenBabel search path is "$OB_SEARCH_PATH"]) AC_MSG_CHECKING([for OpenBabel support]) have_openbabel=no AC_ARG_WITH(openbabel, AS_HELP_STRING([--with-openbabel], [compile plug-in support for a wrapper around the OpenBabel library (default=no).]), [have_openbabel=yes], [have_openbabel=no]) AC_MSG_RESULT([$have_openbabel]) if test "$have_openbabel" = "yes" ; then OPENBABEL_PATH=`find $OB_SEARCH_PATH/include -name obmolecformat.h | tail -1 | sed "s,$OB_SEARCH_PATH/include/\(.*\)openbabel/obmolecformat.h,\1,"` CXXFLAGS_SVG=$CXXFLAGS CXXFLAGS="$CXXFLAGS -I${OB_SEARCH_PATH}/include/${OPENBABEL_PATH}" CPPFLAGS_SVG=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I${OB_SEARCH_PATH}/include/${OPENBABEL_PATH}" AC_CHECK_HEADER([openbabel/obmolecformat.h], [ob="yes"], [ob="no"]) if test "$ob" = "yes" ; then AC_SUBST(OPENBABEL_PATH) AC_SUBST(OB_SEARCH_PATH) AC_SUBST(lib_openbabel_version) have_openbabel="yes" need_cpp_compiler="yes" else AC_MSG_WARN(["No 'obmolecformat.h' header file, libobloader.so will not be built."]) AC_MSG_WARN(["Maybe OpenBabel is not installed or version is to old (>=2.0 required)."]) have_openbabel="no" fi CXXFLAGS=$CXXFLAGS_SVG CPPFLAGS=$CPPFLAGS_SVG fi AM_CONDITIONAL(HAVE_OPENBABEL, test x"$have_openbabel" = x"yes") dnl Set back language for tests to C. AC_LANG(C) #AC_MSG_CHECKING([for rendering window backend]) #rendering_window_backend=GTK #AC_ARG_WITH(GTK-backend, [ --with-GTK-backend use GTK to rule the rendering window (This is the default)], rendering_window_backend=GTK) #AC_ARG_WITH(X11-backend, [ --with-X11-backend use pure X to rule the rendering window.], rendering_window_backend=X11) #AC_MSG_RESULT([$rendering_window_backend]) #AM_CONDITIONAL(BACKEND_X11, test "$rendering_window_backend" = "X11") #libwindowBackend="libvisu_window"$rendering_window_backend".a" #AC_SUBST(libwindowBackend) dnl Checks for gtk-doc and docbook-tools, taken from gimp configure.in m4_define([gtkdoc_required_version], [1.3]) AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir], [path to installed docs (default is $datadir/doc/$TARNAME/APIreference).])) if test "x$with_html_dir" = "x" ; then HTML_DIR="${datadir}/doc/$PACKAGE_TARNAME/APIreference" else HTML_DIR=$with_html_dir fi AC_SUBST(HTML_DIR) dnl Make people enable the gtk-doc stuff explicitely. AC_ARG_ENABLE(gtk-doc, AS_HELP_STRING([--enable-gtk-doc], [use gtk-doc to build the API documentation (default=no).]), enable_gtk_doc="$enableval", enable_gtk_doc=no) AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) if ! $GTKDOC ; then if test x$enable_gtk_doc = xyes ; then AC_MSG_WARN([--enable-gtk-doc... but gtkdoc is not present, documentation will not be built.]) enable_gtk_doc=no fi fi dnl to make this work with the tarballs. AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test x$enable_gtk_doc = xyes) dnl Building the doc | boring if gtk-doc is not available dnl GTK_DOC_CHECK(1.0) dnl default installation directories v_simexedir="$bindir" AC_SUBST(v_simexedir) v_simconfdir="$datadir/$PACKAGE" AC_SUBST(v_simconfdir) v_simresourcesdir="$datadir/$PACKAGE" AC_SUBST(v_simresourcesdir) v_simpixmapsdir="$datadir/$PACKAGE/pixmaps" AC_SUBST(v_simpixmapsdir) v_simiconsdir="$datadir/pixmaps" AC_SUBST(v_simiconsdir) v_simlegaldir="$datadir/doc/$PACKAGE" AC_SUBST(v_simlegaldir) v_simexamplesdir="$datadir/doc/$PACKAGE/examples" AC_SUBST(v_simexamplesdir) v_simpluginsdir="$libdir/$PACKAGE/plug-ins" AC_SUBST(v_simpluginsdir) dnl Official plugins nanoquantadir=$v_simpluginsdir AC_SUBST(nanoquantadir) openbabeldir=$v_simpluginsdir AC_SUBST(openbabeldir) dnl Values of flags AC_DEFINE_UNQUOTED(DEBUG, $define_debug, [Compile V_Sim in debug mode, very verbose.]) AC_DEFINE_UNQUOTED(INSTALL_DIR, "$prefix", [Where V_sim is installed.]) AC_DEFINE_UNQUOTED(SYSTEM_WIN32, $define_win32, [Target platform.]) AC_DEFINE_UNQUOTED(SYSTEM_X11, $define_X11, [Target platform.]) AC_DEFINE_UNQUOTED(V_SIM_RELEASE_DATE, "$date", [Date of version release.]) AC_OUTPUT([ Makefile src/Makefile src/renderingBackend/Makefile src/OSOpenGL/Makefile src/coreTools/Makefile src/dumpModules/Makefile src/extensions/Makefile src/pairsModeling/Makefile src/renderingMethods/Makefile src/panelModules/Makefile src/openGLFunctions/Makefile src/extraFunctions/Makefile src/extraGtkFunctions/Makefile src/plug-ins/Makefile src/plug-ins/nanoquanta-netcdf/Makefile src/plug-ins/OpenBabel-wrapper/Makefile lib/Makefile etc/Makefile etc/v_sim.rc etc/v_sim.par pixmaps/Makefile examples/Makefile po/Makefile.in Documentation/Makefile Documentation/reference/Makefile Documentation/reference/version ]) echo " Configuration: Source code location: ${srcdir} Destination path prefix: ${prefix} Compiler: ${CC} CFLAGS: ${CFLAGS} LDFLAGS: ${LDFLAGS} Enable debug messages: ${with_debug_messages} Enable gtk-doc: ${enable_gtk_doc} Plug-ins: With Nanoquanta support: ${have_nanoquanta} With OpenBabel support: ${have_openbabel} Plug-ins options: Need a C++ compiler: ${need_cpp_compiler}" if test "$need_cpp_compiler" = "yes" ; then echo \ " | compiler: ${CXX} | CXXFLAGS: ${CXXFLAGS} " fi