-AC_CHECK_LIB([popt], [poptGetNextOpt], POPT_LIBS="-lpopt",AC_MSG_ERROR([libpopt is required in order to compile LinuxTraceToolkit]) )
-#AC_CHECK_LIB([m], [round], M_LIBS="-lm",AC_MSG_ERROR([Mathematical libraries are missing.]) )
+AC_CHECK_LIB([popt], [poptGetNextOpt], [],
+ AC_MSG_ERROR([libpopt is required in order to compile LTTV])
+)
+AC_CHECK_LIB([m], [round], [],
+ AC_MSG_ERROR([Mathematical libraries are missing.])
+)
+AC_CHECK_LIB([util], [forkpty], [],
+ AC_MSG_ERROR([libutil is required in order to compile LTTV])
+)
+
+# Trace synchronization feature, which requires libglpk
+AC_ARG_WITH([trace-sync],
+ AS_HELP_STRING([--with-trace-sync],
+ [support trace synchronization accuracy calculation (needs libglpk) [default=no]]),
+ [with_trace_sync="$withval"],
+ [with_trace_sync="no"])
+
+AS_IF([test "x$with_trace_sync" = "xyes"],[
+ AC_CHECK_LIB([glpk], [glp_create_prob], [], [
+ AC_MSG_ERROR([The trace synchronization feature requires libglpk, please install it first.])
+ ])
+ AC_DEFINE([HAVE_LIBGLPK], [1], [Define if you have libglpk]),
+])