rosfran@253: #                                               -*- Autoconf -*-
rosfran@253: # Process this file with autoconf to produce a configure script.
rosfran@253: 
rosfran@253: AC_PREREQ(2.50)
rosfran@253: 
rosfran@253: AC_INIT([gmyth],[0.1])
rosfran@253: 
rosfran@253: dnl AC_CONFIG_SRCDIR([src/mmyth_main.c])
rosfran@253: AC_CONFIG_HEADER(config.h)
rosfran@253: 
rosfran@253: dnl when going to/from release please set the nano (fourth number) right !
rosfran@253: dnl releases only do Wall, SVN and prerelease does Werror too
rosfran@253: AS_VERSION(gmyth, GMYTH, 0, 1, 0, 3, GMYTH_SVN="no", GMYTH_SVN="yes")
rosfran@253: 
rosfran@253: GMYTH_MAJORMINOR=$GMYTH_MAJOR_VERSION.$GMYTH_MINOR_VERSION
rosfran@253: 
rosfran@253: AC_SUBST(GMYTH_MAJORMINOR)
rosfran@253: 
rosfran@253: dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode
rosfran@253: AM_MAINTAINER_MODE
rosfran@253: dnl make aclocal work in maintainer mode
rosfran@253: AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
rosfran@253: 
rosfran@253: # Checks for programs.
rosfran@253: # check for tools
rosfran@253: # Make sure CFLAGS is defined to stop AC_PROC_CC adding -g
rosfran@253: CFLAGS="$CFLAGS -Wall"
rosfran@253: AC_PROG_CC
rosfran@253: AC_PROG_LIBTOOL
rosfran@253: 
rosfran@253: dnl Generate doxygen documentation
rosfran@253: DX_HTML_FEATURE(ON)
rosfran@253: DX_CHM_FEATURE(OFF)
rosfran@253: DX_CHI_FEATURE(OFF)
rosfran@253: DX_MAN_FEATURE(OFF)
rosfran@253: DX_RTF_FEATURE(OFF)
rosfran@253: DX_XML_FEATURE(OFF)
rosfran@253: DX_PDF_FEATURE(OFF)
rosfran@253: DX_PS_FEATURE(OFF)
rosfran@253: DX_INIT_DOXYGEN(gmyth, doxygen.cfg, docs)
rosfran@253: 
rosfran@253: 
rosfran@253: # Checks for libraries.
rosfran@253: 
rosfran@253: # Checks for header files.
rosfran@253: AC_HEADER_STDC
rosfran@253: AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])
rosfran@253: 
rosfran@253: # Checks for typedefs, structures, and compiler characteristics.
rosfran@253: AC_C_CONST
rosfran@253: AC_TYPE_PID_T
rosfran@253: AC_STRUCT_TM
rosfran@253: 
rosfran@253: # Checks for library functions.
rosfran@253: AC_FUNC_FORK
rosfran@253: AC_PROG_GCC_TRADITIONAL
rosfran@253: AC_FUNC_MALLOC
rosfran@253: AC_FUNC_MKTIME
rosfran@253: AC_FUNC_VPRINTF
rosfran@253: AC_CHECK_FUNCS([memset socket stime strstr strtoul])
rosfran@253: 
rosfran@253: AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
rosfran@253: 
rosfran@253: # Checks required packages
rosfran@253: 
rosfran@253: dnl Test if --disable-debug given
rosfran@253: AC_ARG_ENABLE(debug,
rosfran@253: 	[AC_HELP_STRING([--disable-debug], [disable debugging mode])],
rosfran@253: 	enable_debug="$enableval",
rosfran@253: 	enable_debug=yes)
rosfran@253: 
rosfran@253: if test "x$enable_debug" = "xyes" ; then
rosfran@253:       CFLAGS="$CFLAGS -g"
rosfran@253: else
rosfran@253:       AC_DEFINE( NDEBUG, 1, [disable debug messages] )
rosfran@253:       CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS -DNDEBUG"
rosfran@253: fi          
rosfran@253: 
rosfran@253: AM_CONDITIONAL( NDEBUG, test "x$enable_debug" = "xyes" )
rosfran@253: 
rosfran@253: # Check for pkgconfig
rosfran@253: AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
rosfran@253: # Give error and exit if we don't have pkgconfig
rosfran@253: if test "x$HAVE_PKGCONFIG" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need to have pkgconfig installed !)
rosfran@253: fi
rosfran@253: 
rosfran@253: # Check for Glib2.0
rosfran@253: PKG_CHECK_MODULES(GLIB, glib-2.0, HAVE_GLIB=yes,HAVE_GLIB=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have glib
rosfran@253: if test "x$HAVE_GLIB" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need glib-2.0 installed)
rosfran@253: fi
rosfran@253: 
rosfran@253: # make GLIB_CFLAGS and GLIB_LIBS available
rosfran@253: AC_SUBST(GLIB_CFLAGS)
rosfran@253: AC_SUBST(GLIB_LIBS)
rosfran@253: 
rosfran@253: # Check for GObject2.0
rosfran@253: PKG_CHECK_MODULES(GOBJECT,
rosfran@253:   gobject-2.0,
rosfran@253:   HAVE_GOBJECT=yes, HAVE_GOBJECT=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have gobject
rosfran@253: if test "x$HAVE_GOBJECT" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need gobject-2.0 installed)
rosfran@253: fi
rosfran@253: 
rosfran@253: # make GOBJECT_CFLAGS and GOBJECT_LIBS available
rosfran@253: AC_SUBST(GOBJECT_CFLAGS)
rosfran@253: AC_SUBST(GOBJECT_LIBS)
rosfran@253: 
rosfran@253: # Check for GTK+-2.0
rosfran@253: PKG_CHECK_MODULES(GTK, gtk+-2.0, HAVE_GTK=yes,HAVE_GTK=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have gtk
rosfran@253: if test "x$HAVE_GTK" = "xyes"; then
rosfran@253:   AC_DEFINE(WITH_GTK, 1, [build with GTK+ related stuff])
rosfran@253:   dnl AC_MSG_ERROR(you need gtk+-2.0 installed)
rosfran@253: else
rosfran@253:   AC_MSG_RESULT(no)
rosfran@253: fi
rosfran@253: 
rosfran@253: AM_CONDITIONAL(WITH_GTK, test "x$HAVE_GTK" = "xyes" )
rosfran@253: 
rosfran@253: # make GTK_CFLAGS and GTK_LIBS available
rosfran@253: AC_SUBST(GTK_CFLAGS)
rosfran@253: AC_SUBST(GTK_LIBS)
rosfran@253: 
rosfran@253: dnl ========== Check for Hildon Libraries
rosfran@253: PKG_CHECK_MODULES(HILDON,
rosfran@253:   hildon-lgpl libosso hildon-status-bar-lib libhildonmenu hildon-base-lib hildon-control-panel hildon-libs,
rosfran@253:   HAVE_HILDON=yes, HAVE_HILDON=no)
rosfran@253: 
rosfran@253: if test "x$HAVE_HILDON" = "xyes"; then
rosfran@253:   AC_DEFINE(MAEMO_PLATFORM, 1, [build with hildon libs])
rosfran@253:   HILDON_CFLAGS="$HILDON_CFLAGS -DMAEMO_PLATFORM=1"
rosfran@253: else
rosfran@253:   AC_MSG_RESULT(no)
rosfran@253: fi
rosfran@253: 
rosfran@253: AM_CONDITIONAL(MAEMO_PLATFORM, test "x$HAVE_HILDON" = "xyes")
rosfran@253: 
rosfran@253: dnl make HILDON_CFLAGS and HILDON_LIBS available
rosfran@253: AC_SUBST(HILDON_CFLAGS)
rosfran@253: AC_SUBST(HILDON_LIBS)
rosfran@253: 
rosfran@253: # Check for libxml-2.0
rosfran@253: PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML=yes,HAVE_LIBXML=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have libxml
rosfran@253: if test "x$HAVE_LIBXML" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need libxml-2.0 installed)
rosfran@253: fi
rosfran@253: 
rosfran@253: # make LIBXML_CFLAGS and LIBXML_LIBS available
rosfran@253: AC_SUBST(LIBXML_CFLAGS)
rosfran@253: AC_SUBST(LIBXML_LIBS)
rosfran@253: 
rosfran@253: 
rosfran@253: # check for gstreamer development files
rosfran@253: GST_REQUIRED=0.10
rosfran@253: GST_MAJORMINOR=0.10
rosfran@253: PKG_CHECK_MODULES(GST, \
rosfran@253:   gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED,
rosfran@253:   HAVE_GST=yes, HAVE_GST=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have gstreamer
rosfran@253: if test "x$HAVE_GST" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need gstreamer development packages installed !)
rosfran@253: fi
rosfran@253: 
rosfran@253: # make GST_CFLAGS and GST_LIBS available
rosfran@253: AC_SUBST(GST_CFLAGS)
rosfran@253: AC_SUBST(GST_LIBS)
rosfran@253: 
rosfran@253: # check for gstreamer-base plugins (xoverlay interface)
rosfran@253: GSTBASE_REQUIRED=0.10
rosfran@253: GSTBASE_MAJORMINOR=0.10
rosfran@253: PKG_CHECK_MODULES(GSTBASE, \
rosfran@253:   gstreamer-base-$GSTBASE_MAJORMINOR >= $GSTBASE_REQUIRED,
rosfran@253:   HAVE_GSTBASE=yes, HAVE_GSTBASE=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have gstreamer base libraries
rosfran@253: if test "x$HAVE_GSTBASE" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need gstreamer base development packages installed !)
rosfran@253: fi
rosfran@253: 
rosfran@253: # make GSTBASE_CFLAGS and GSTBASE_LIBS available
rosfran@253: AC_SUBST(GSTBASE_CFLAGS)
rosfran@253: AC_SUBST(GSTBASE_LIBS)
rosfran@253: 
rosfran@253: 
rosfran@253: # make GST_MAJORMINOR available in Makefile.am
rosfran@253: AC_SUBST(GST_MAJORMINOR)
rosfran@253: 
rosfran@253: #
rosfran@253: # mysql libraries
rosfran@253: #
rosfran@253: AC_CHECK_PROG(MYSQL_CFLAGS,mysql_config,`mysql_config --cflags`)
rosfran@253: if test -z "$MYSQL_CFLAGS"; then 
rosfran@253:         AC_MSG_ERROR([Could not find mysql_config script. Make sure the mysql client libraries are installed])
rosfran@253: fi
rosfran@253: AC_SUBST(MYSQL_CFLAGS)
rosfran@253: 
rosfran@253: 
rosfran@253: AC_CHECK_PROG(MYSQL_LIBS,mysql_config,`mysql_config --libs`)
rosfran@253: if test -z "$MYSQL_LIBS"; then 
rosfran@253:         AC_MSG_ERROR([Could not find mysql_config script. Make sure the mysql client libraries are installed])
rosfran@253: fi
rosfran@253: AC_SUBST(MYSQL_LIBS)
rosfran@253: 
rosfran@253: ## Check for gmyth-0.1
rosfran@253: 
rosfran@253: PKG_CHECK_MODULES(LIBGMYTH, gmyth-0.1, HAVE_LIBGMYTH=yes,HAVE_LIBGMYTH=no)
rosfran@253: 
rosfran@253: # Give error and exit if we don't have gmyth-0.1
rosfran@253: if test "x$HAVE_LIBGMYTH" = "xno"; then
rosfran@253:   AC_MSG_ERROR(you need gmyth-0.1 installed)
rosfran@253: fi
rosfran@253: 
rosfran@253: # make LIBXML_CFLAGS and LIBXML_LIBS available
rosfran@253: AC_SUBST(LIBGMYTH_CFLAGS)
rosfran@253: AC_SUBST(LIBGMYTH_LIBS)
rosfran@253: 
rosfran@253: #dnl Enable gtk-doc
rosfran@253: #GTK_DOC_CHECK(1.4)
rosfran@253: 
rosfran@253: 
rosfran@253: AC_CONFIG_FILES([Makefile
rosfran@253:                 src/Makefile
rosfran@253:                 pixmaps/Makefile])
rosfran@253: AC_OUTPUT