Initial import for deb package work, version 0.0.1-1
[mim] / configure.ac
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..d716c9b
--- /dev/null
@@ -0,0 +1,177 @@
+dnl This is the rtcom-messaging-ui configure script template
+AC_PREREQ([2.59])
+AC_INIT(mim-pinyin, 0.0.1)
+AM_INIT_AUTOMAKE([foreign 1.9])
+AM_CONFIG_HEADER(config.h)
+
+AC_ISC_POSIX
+AC_PROG_CC
+AM_PROG_CC_STDC
+AC_HEADER_STDC
+AM_PROG_LIBTOOL
+
+AC_CONFIG_MACRO_DIR(m4)
+
+dnl Debugging options to enable debug macros and dmalloc
+DEBUG_FLAGS=
+LD_DMALLOC_FLAGS=
+AC_ARG_ENABLE(debug,       [  --enable-debug           compile with DEBUG],,enable_debug=no)
+AC_ARG_ENABLE(stdout,      [  --enable-stdout          compile with DEBUG to stdout],,enable_stdout=no)
+AC_ARG_ENABLE(stderr,      [  --enable-stderr          compile with DEBUG to stderr],,enable_stderr=no)
+AC_ARG_ENABLE(dmalloc,     [  --enable-dmalloc         compile with DMALLOC],,enable_dmalloc=no)
+AC_ARG_ENABLE(profiling,    [  --enable-profiling      compile with profiling],,enable_profiling=no)
+AC_ARG_ENABLE(coverage,            [  --enable-coverage        compile with coverage info],,enable_coverage=no)
+AC_ARG_ENABLE(maemo_launcher, [         --enable-maemo-launcher        compile with maemo-launcher],,enable_maemo_launcher=no)
+AC_ARG_ENABLE(tests,        [  --enable-tests          compile with tests support],,enable_tests=no)
+
+if test "x$enable_debug" = "xyes"; then
+       DEBUG_FLAGS="-DDEBUG"
+fi
+if test "x$enable_stdout" = "xyes"; then
+       DEBUG_FLAGS="-DDEBUG -DOSSOLOG_STDOUT"
+fi
+if test "x$enable_stderr" = "xyes"; then
+       DEBUG_FLAGS="-DDEBUG -DOSSOLOG_STDERR"
+fi
+if test "x$enable_dmalloc" = "xyes"; then
+       DEBUG_FLAGS="$DEBUG_FLAGS -DDMALLOC"
+       LD_DMALLOC_FLAGS="-ldmallocth"
+fi
+if test "x$enable_profiling" = "xyes"; then
+       DEBUG_FLAGS="$DEBUG_FLAGS -pg"
+       PACKAGE_LDFLAGS="$PACKAGE_LDFLAGS -pg"
+fi
+if test "x$enable_coverage" = "xyes"; then
+       DEBUG_FLAGS="$DEBUG_FLAGS -g -fprofile-arcs -ftest-coverage"
+       PACKAGE_LDFLAGS="$PACKAGE_LDFLAGS -fprofile-arcs -ftest-coverage"
+fi
+
+dnl Check for debug flags
+AC_MSG_CHECKING([for debug flags])
+if test "x$DEBUG_FLAGS" = "x"; then
+       AC_MSG_RESULT(none)
+else
+       AC_MSG_RESULT($DEBUG_FLAGS)
+fi
+
+dnl Check for dmalloc flags
+AC_MSG_CHECKING([for dmalloc flags])
+if test "x$LD_DMALLOC_FLAGS" = "x"; then
+       AC_MSG_RESULT(none)
+else
+       AC_MSG_RESULT($LD_DMALLOC_FLAGS)
+fi
+
+CFLAGS="$CFLAGS -DGCONF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -Wall -Werror -Wmissing-declarations -Wmissing-prototypes"
+
+GTK_DOC_CHECK(1.5)
+
+dnl Check for tests
+AC_MSG_CHECKING([for tests])
+if test "x$enable_tests" = "xyes"; then
+       AC_MSG_RESULT(yes)
+       PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [have_check=yes], [have_check=no])
+       AC_SUBST(CHECK_CFLAGS)
+       AC_SUBST(CHECK_LDFLAGS)
+       AC_SUBST(CHECK_LIBS)
+else
+       AC_MSG_RESULT(no)
+fi     
+AM_CONDITIONAL(HAVE_CHECK, test x$have_check != xno && test x$enable_tests != xno)
+
+dnl Localisation support
+GETTEXT_PACKAGE=$PACKAGE
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Define gettext package])
+
+dnl Supported languages below
+dnl ALL_LINGUAS="en_GB"
+AM_GLIB_GNU_GETTEXT
+
+dnl Set PACKAGE_LOCALE_DIR in config.h
+if test "x${prefix}" = "xNONE"; then
+       AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], ["${ac_default_prefix}/${DATADIRNAME}/locale"],[Locale directory])
+else
+       AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], ["${prefix}/${DATADIRNAME}/locale"], [Locale directory])
+fi
+
+dnl MIME-type registration check (2.6 / 2.8 version)
+dnl AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database, no)
+dnl AM_CONDITIONAL(HAVE_26_MIME, test x$UPDATE_MIME_DATABASE != xno)
+
+AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, update-desktop-database, no)
+AM_CONDITIONAL(HAVE_28_MIME, test x$UPDATE_DESKTOP_DATABASE != xno)
+
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test x$GCONFTOOL != xno)
+
+if test x"$GCONFTOOL" = xno; then
+       AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+fi
+AM_GCONF_SOURCE_2
+
+if test "x${prefix}" = "xNONE"; then
+       PACKAGE_HTML_DIR="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/html"
+       AC_DEFINE_UNQUOTED([PACKAGE_HTML_DIR], ["${PACKAGE_HTML_DIR}"],[HTML directory])
+else
+       PACKAGE_HTML_DIR="${prefix}/${DATADIRNAME}/${PACKAGE}/html"
+       AC_DEFINE_UNQUOTED([PACKAGE_HTML_DIR], ["${PACKAGE_HTML_DIR}"], [HTML directory])
+fi
+
+dnl Check that we have the libtime dev package installed
+AC_CHECK_HEADERS([time.h clockd/libtime.h], [], [],
+     [[#ifdef HAVE_TIME_H
+     #include <time.h>
+     #endif
+     ]])
+
+dnl Packages and versions to be checked
+PKG_CHECK_MODULES(PACKAGE, [
+       dbus-glib-1 >= 0.61
+       hildon-1
+       gtk+-2.0
+])
+
+dnl Messaging ui lib specific
+PKG_CHECK_MODULES(RTCOM_MSG_UI, [
+       gconf-2.0
+])
+
+dnl hildonmime
+PKG_CHECK_MODULES(HILDONMIME, [
+       libhildonmime
+])
+
+dnl Maemo launcher
+AC_MSG_CHECKING([for maemo-launcher usage])
+if test "x$enable_maemo_launcher" = "xyes"; then
+       PKG_CHECK_MODULES(MAEMO_LAUNCHER, [maemo-launcher-app])
+       AC_SUBST(MAEMO_LAUNCHER_CFLAGS)
+       AC_SUBST(MAEMO_LAUNCHER_LDFLAGS)
+       AC_SUBST(MAEMO_LAUNCHER_LIBS)
+else
+       AC_MSG_RESULT(no)
+fi
+
+dnl "Export" flags
+AC_SUBST(DEBUG_FLAGS)
+AC_SUBST(LD_MALLOC_FLAGS)
+
+dnl Export package wide parameters
+AC_SUBST(PACKAGE_CFLAGS)
+AC_SUBST(PACKAGE_LIBS)
+AC_SUBST(PACKAGE_LDFLAGS)
+AC_SUBST(PACKAGE_HTML_DIR)
+
+AC_OUTPUT([
+       mim-pinyin.pc
+       Makefile
+       m4/Makefile
+       src/Makefile
+       util/Makefile
+       data/Makefile
+       data/org.ifanr.MiM.service
+       data/mim-pinyin.desktop
+       test/Makefile
+       docs/Makefile
+])