-AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
-#AC_WITH_LTDL # not needed ?
-AM_INIT_AUTOMAKE(lttv,0.12.17-01072009)
-AM_CONFIG_HEADER(config.h)
-AM_PROG_LIBTOOL
-
-AM_PATH_GLIB_2_0(2.4.0, ,AC_MSG_ERROR([glib is required in order to compile LinuxTraceToolkit - download it from ftp://ftp.gtk.org/pub/gtk]) , gmodule)
-
-AM_PATH_GTK_2_0(2.4.0, ,AC_MSG_ERROR([gtk is required in order to compile GUI - download it from ftp://ftp.gtk.org/pub/gtk]) , gmodule)
+AC_INIT([lttv], [0.12.38-21032011], [yannick.brosseau@gmail.com])
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_MACRO_DIR([config])
+AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
+AM_SILENT_RULES([yes])
+AC_CONFIG_HEADERS([config.h])
+LT_INIT
+
+# If requested, only build the ltt trace reading library
+AC_ARG_WITH(lttv,
+ AS_HELP_STRING([--with-lttv],
+ [build whole LTTV system, as opposd to only the trace reading library [[default=yes]]]),
+ [with_lttv="$withval"],
+ [with_lttv="yes"])
+
+# If we've requested the lib only, turn off the lttv-gui building as well
+AS_IF([test "x$with_lttv" = "xno"], [with_lttv_gui="no"])
+
+AM_CONDITIONAL([BUILD_LIB_ONLY], [ test "x$with_lttv" = "xno" ])
+
+
+# If requested, avoid building LTTV part
+AC_ARG_WITH(lttv-gui,
+ AS_HELP_STRING([--with-lttv-gui],
+ [build LTTV gui, as opposed to only build textmode LTTV [[default=yes]]]),
+ [with_lttv_gui="$withval"],
+ [with_lttv_gui="yes"])
+#TODO ybrosseau 2012-03-13: Remove this when babeltrace port is complete
+#Force GUI disabling while we port babeltrace
+with_lttv_gui="no"
+
+AM_CONDITIONAL([BUILD_LTTV_GUI], [ test "x$with_lttv_gui" = "xyes" ])
+
+AM_PATH_GLIB_2_0(2.4.0, , AC_MSG_ERROR([glib is required in order to compile LTTV]) , gmodule)
+
+# GTK is only needed by the GUI
+AS_IF([test "x$with_lttv_gui" = "xyes"],[
+ AM_PATH_GTK_2_0(2.4.0, , AC_MSG_ERROR([GTK 2 is required in order to compile the LTTV GUI]) , gmodule)
+])