[lttng-dev] [LTTV PATCH 1/4] Modernize configure.ac

Yannick Brosseau yannick.brosseau at gmail.com
Fri Feb 10 22:17:12 EST 2012


All 4 patchs merged. Thank you,

Yannick

On 2012-02-08 16:34, Alexandre Montplaisir wrote:
> Replace the old, very long autogen.sh with a 3-line bootstrap.
> Use Autoconf portable macros where applicable.
>
> This also makes the bootstrap fail right away when trying to compile on
> a system without libgtk/glib, instead of throwing an obscure error at
> configure time.
>
> Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at gmail.com>
> ---
>  Makefile.am  |    2 +
>  autogen.sh   |  174 -----------------------------------------------
>  bootstrap    |    8 ++
>  configure.ac |  213 +++++++++++++++++++++++++++-------------------------------
>  4 files changed, 108 insertions(+), 289 deletions(-)
>  delete mode 100755 autogen.sh
>  create mode 100755 bootstrap
>
> diff --git a/Makefile.am b/Makefile.am
> index 9f81796..fd556a5 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,3 +1,5 @@
> +ACLOCAL_AMFLAGS = -I config
> +
>  # WARNING : ltt must come before lttv, so that the traceread library is
>  # up to date
>  
> diff --git a/autogen.sh b/autogen.sh
> deleted file mode 100755
> index cc7edfd..0000000
> --- a/autogen.sh
> +++ /dev/null
> @@ -1,174 +0,0 @@
> -#!/bin/sh
> -# Run this to generate all the initial makefiles, etc.
> -
> -srcdir=`dirname $0`
> -test -z "$srcdir" && srcdir=.
> -
> -DIE=0
> -
> -if [ -n "$GNOME2_DIR" ]; then
> -	ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
> -	LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
> -	PATH="$GNOME2_DIR/bin:$PATH"
> -	export PATH
> -	export LD_LIBRARY_PATH
> -fi
> -
> -(test -f $srcdir/configure.ac) || {
> -    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
> -    echo " top-level package directory"
> -    exit 1
> -}
> -
> -(autoconf --version) < /dev/null > /dev/null 2>&1 || {
> -  echo
> -  echo "**Error**: You must have \`autoconf' installed."
> -  echo "Download the appropriate package for your distribution,"
> -  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
> -  DIE=1
> -}
> -
> -(grep "^AC_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
> -  (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
> -    echo 
> -    echo "**Error**: You must have \`intltool' installed."
> -    echo "You can get it from:"
> -    echo "  ftp://ftp.gnome.org/pub/GNOME/"
> -    DIE=1
> -  }
> -}
> -
> -(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
> -  (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
> -    echo
> -    echo "**Error**: You must have \`xml-i18n-toolize' installed."
> -    echo "You can get it from:"
> -    echo "  ftp://ftp.gnome.org/pub/GNOME/"
> -    DIE=1
> -  }
> -}
> -
> -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
> -  (libtool --version) < /dev/null > /dev/null 2>&1 || {
> -    echo
> -    echo "**Error**: You must have \`libtool' installed."
> -    echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
> -    DIE=1
> -  }
> -}
> -
> -(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
> -  (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
> -  (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
> -    echo
> -    echo "**Error**: You must have \`glib' installed."
> -    echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
> -    DIE=1
> -  }
> -}
> -
> -(automake --version) < /dev/null > /dev/null 2>&1 || {
> -  echo
> -  echo "**Error**: You must have \`automake' installed."
> -  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
> -  DIE=1
> -  NO_AUTOMAKE=yes
> -}
> -
> -
> -# if no automake, don't bother testing for aclocal
> -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
> -  echo
> -  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
> -  echo "installed doesn't appear recent enough."
> -  echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
> -  DIE=1
> -}
> -
> -if test "$DIE" -eq 1; then
> -  exit 1
> -fi
> -
> -if test -z "$*"; then
> -  echo "**Warning**: I am going to run \`configure' with no arguments."
> -  echo "If you wish to pass any to it, please specify them on the"
> -  echo \`$0\'" command line."
> -  echo
> -fi
> -
> -case $CC in
> -xlc )
> -  am_opt=--include-deps;;
> -esac
> -
> -for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
> -do 
> -  dr=`dirname $coin`
> -  if test -f $dr/NO-AUTO-GEN; then
> -    echo skipping $dr -- flagged as no auto-gen
> -  else
> -    echo processing $dr
> -    ( cd $dr
> -
> -      aclocalinclude="$ACLOCAL_FLAGS"
> -
> -      if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
> -	echo "Creating $dr/aclocal.m4 ..."
> -	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
> -	echo "Running glib-gettextize...  Ignore non-fatal messages."
> -	echo "no" | glib-gettextize --force --copy
> -	echo "Making $dr/aclocal.m4 writable ..."
> -	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
> -      fi
> -      if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then
> -        echo "Running intltoolize..."
> -	intltoolize --copy --force --automake
> -      fi
> -      if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
> -        echo "Running xml-i18n-toolize..."
> -	xml-i18n-toolize --copy --force --automake
> -      fi
> -      if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
> -	if test -z "$NO_LIBTOOLIZE" ; then 
> -	  echo "Running libtoolize..."
> -	  libtoolize --force --copy
> -	fi
> -      fi
> -      echo "Running aclocal $aclocalinclude ..."
> -      aclocal $aclocalinclude
> -      if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
> -	echo "Running autoheader..."
> -	autoheader
> -      fi
> -      echo "Running automake --gnu $am_opt ..."
> -      automake --add-missing --gnu $am_opt
> -      echo "Running autoconf ..."
> -      autoconf
> -    )
> -  fi
> -done
> -
> -#if [ -a "$srcdir/include" ]; then
> -#	echo -n Removing old system include behavior emulation... 
> -#	rm -rf $srcdir/include
> -#	echo done.
> -#fi
> -#echo -n Creating the system include behavior emulation... 
> -#mkdir $srcdir/include
> -#mkdir $srcdir/include/ltt
> -#ln -sf ../../LibLTT/ltt.h $srcdir/include/ltt/ltt.h
> -#mkdir $srcdir/include/lttv
> -#ln -sf ../../lttv/module.h $srcdir/include/lttv/module.h
> -#ln -sf ../../lttv/hook.h $srcdir/include/lttv/hook.h
> -#ln -sf ../../lttv/traceWindow.h $srcdir/include/lttv/traceWindow.h
> -#echo done.
> -
> -
> -
> -if test x$NOCONFIGURE = x; then
> -  echo Running $srcdir/configure $conf_flags "$@" ...
> -  $srcdir/configure $conf_flags "$@" \
> -  && echo Now type \`make\' to compile. || exit 1
> -else
> -  echo Skipping configure process.
> -fi
> diff --git a/bootstrap b/bootstrap
> new file mode 100755
> index 0000000..ddf4314
> --- /dev/null
> +++ b/bootstrap
> @@ -0,0 +1,8 @@
> +#! /bin/sh
> +
> +set -x
> +if [ ! -e config ]; then
> +	mkdir config
> +fi
> +autoreconf -i
> +
> diff --git a/configure.ac b/configure.ac
> index 92ba917..2e9c039 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -20,42 +20,42 @@
>  #                                               -*- Autoconf -*-
>  # Process this file with autoconf to produce a configure script.
>  
> -AC_PREREQ(2.57)
> -AC_INIT([lttv], [0.12.38-21032011], [ltt-dev at lists.casi.polymtl.ca])
> -AM_INIT_AUTOMAKE
> +AC_INIT([lttv],[0.12.38-21032011],[lttng-dev at lists.lttng.org])
> +AC_CONFIG_AUX_DIR([config])
> +AC_CONFIG_MACRO_DIR([config])
> +AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
>  AM_SILENT_RULES([yes])
> -AM_CONFIG_HEADER(config.h)
> -AM_PROG_LIBTOOL
> -
> -# If requested, only build LTT library part
> -AC_ARG_WITH(lttv, [  --with-lttv             build whole LTTV system, as opposd to only the trace reading library
> -			  [[default=yes]]])
> -if test -z "$with_lttv"; then
> -        with_lttv=${with_lttv_default-yes}
> -else
> -	if test "$with_lttv" = "no"; then
> -	        # Requesting lib-only turn off the lttv-gui building as well
> -        	with_lttv_gui="no"
> -	fi
> -fi
> -AM_CONDITIONAL(BUILD_LIB_ONLY, test "$with_lttv" = "no")
> +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, [  --with-lttv-gui         build LTTV gui, as opposed to only build textmode LTTV
> -			  [[default=yes]]])
> +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"])
>  
> -if test -z "$with_lttv_gui"; then
> -        with_lttv_gui=${with_lttv_gui_default-yes}
> -fi
> -AM_CONDITIONAL(BUILD_LTTV_GUI, test "$with_lttv_gui" = "yes")
> +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 LinuxTraceToolkit - download it from ftp://ftp.gtk.org/pub/gtk]) , gmodule)
> +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
> -if test "$with_lttv_gui" = "yes" ; then
> -        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)
> -fi
> +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)
> +])
>  
>  AC_PATH_PROGS(BASH, bash)
>  
> @@ -65,103 +65,90 @@ AC_SYS_LARGEFILE
>  AC_PROG_CC
>  
>  # Checks for libraries.
> -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([util], [forkpty], UTIL_LIBS="-lutil",
> -	AC_MSG_ERROR([libutil is required in order to compile LinuxTraceToolkit]))
> -
> -AC_ARG_WITH([glpk],
> -	[AS_HELP_STRING([--with-glpk@<:@=DIR@:>@],
> -		[support trace synchronization accuracy calculation (needs glpk)
> -			@<:@default=check@:>@])],
> -	[],
> -	[with_glpk=check])
> -
> -GLPK_LIBS=
> -	AS_IF([test "x$with_glpk" != xno],
> -		[if test "x$with_glpk" != xyes -a -d "$with_glpk"; then
> -			LDFLAGS="$LDFLAGS -L$with_glpk"
> -		fi
> -		AC_CHECK_LIB([glpk], [glp_create_prob],
> -			[AC_SUBST([GLPK_LIBS], ["-lglpk"])
> -			AC_DEFINE([HAVE_LIBGLPK], [1], [Define if you have libglpk])],
> -			[if test "x$with_glpk" != xcheck; then
> -				AC_MSG_FAILURE(
> -					[--with-glpk was given, but test for glpk failed])
> -			fi],
> -		-lm)])
> -
> -# pthread for gdb with dlopen().
> -AC_CHECK_LIB(pthread, pthread_join, [], AC_MSG_ERROR([LinuxThreads is required in order to make sure gdb works fine with lttv-gui]))
> +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]),
> +])
> +
>  
>  # Checks for header files.
>  AC_HEADER_STDC
>  AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h pthread.h])
>  
>  # Set compile flags to java include files if given
> -AC_ARG_WITH(java_jdk, [  --with-java-jdk=DIR     use java jdk from DIR. Ex : $JAVA_HOME.], JAVA_SDK=$withval,)
> -if test $JAVA_SDK; then
> -        if test -d $JAVA_SDK; then
> -                AC_MSG_RESULT([using java include in $JAVA_SDK])
> -                SUBDIRS=`find $JAVA_SDK/include -type d`
> +AC_ARG_WITH([java-jdk],
> +	AS_HELP_STRING([--with-java-jdk=DIR],
> +	[use java jdk from DIR. Ex : $JAVA_HOME.]),
> +	[JAVA_SDK=$withval],
> +	[])
> +
> +AS_IF([test $JAVA_SDK],[
> +	AS_IF([test -d $JAVA_SDK],[
> +		AC_MSG_RESULT([using java include in $JAVA_SDK])
> +		SUBDIRS=`find $JAVA_SDK/include -type d`
>  		CFLAGS+=" "
> -                CFLAGS+=`for x in $SUBDIRS; do echo -n "-I$x "; done`
> +		CFLAGS+=`for x in $SUBDIRS; do echo -n "-I$x "; done`
>  		CFLAGS+=" "
> -        else
> -                AC_MSG_ERROR(Unable to find java include file in $JAVA_JDK)
> -        fi
> -fi
> +        ],[
> +                AC_MSG_ERROR([Unable to find Java include files in $JAVA_JDK])
> +        ])
> +])
>  
>  
>  # Check for JNI header files if requested
> -AC_ARG_WITH(jni-interface, [  --with-jni-interface    build JNI interface between C and java. Need java include files.
> -			  [[default=no]]])
> -
> -if test -z "$with_jni_interface"; then
> -        with_jni_interface=${with_jni_interface_default-no}
> -fi
> -
> -if test "$with_jni_interface" = "yes"; then
> -        AC_CHECK_HEADERS([jni.h],,AC_MSG_ERROR([
> -missing jni.h
> +AC_ARG_WITH(jni-interface,
> +	AS_HELP_STRING([--with-jni-interface],
> +	[build JNI interface between C and Java. Needs JNI header file. [[default=no]]]),
> +	[with_jni_interface="$withval"],
> +	[with_jni_interface="no"])
> +
> +AS_IF([test "x$with_jni_interface" = "xyes"],[
> +        AC_CHECK_HEADERS([jni.h], [], AC_MSG_ERROR([missing jni.h
>  Make sure Sun Java or OpenJDK or GCJ is installed and that this header file exists in the system path.
> -Use --with-java-jdk=DIR flag to point to your java include files or desactivate the JNI interface.]))
> -fi
> -AM_CONDITIONAL(BUILD_JNI_INTERFACE, test "$with_jni_interface" = "yes")
> +Use --with-java-jdk=DIR flag to point to your java include files or deactivate the JNI interface.]))
> +])
> +AM_CONDITIONAL([BUILD_JNI_INTERFACE], [ test "$with_jni_interface" = "yes" ] )
>  
>  
> -AC_ISC_POSIX
> -AC_PROG_CC
> -AM_PROG_CC_STDC
> -AC_HEADER_STDC
> -
>  # If we want the gui, we need additionnal flags for GTK
> -if test "$with_lttv_gui" = "yes" ; then
> -        pkg_modules="gtk+-2.0 >= 2.0.0"
> -        PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
> -        PACKAGE_CFLAGS="-Wall -Wformat"
> -        AC_SUBST(PACKAGE_CFLAGS)
> -        AC_SUBST(PACKAGE_LIBS)
> -# Else, we still have a dependency on gmodule
> -# We will add flags for gmodule alone
> -else
> -        pkg_modules="gmodule-2.0 >= 2.0.0"
> -        PKG_CHECK_MODULES(GMODULE, [$pkg_modules])
> -        PACKAGE_CFLAGS="-Wall -Wformat"
> -        AC_SUBST(PACKAGE_CFLAGS)
> -        AC_SUBST(PACKAGE_LIBS)
> -fi
> +AS_IF([test "x$with_lttv_gui" = "xyes"],[
> +	pkg_modules="gtk+-2.0 >= 2.0.0"
> +	PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
> +],[
> +	# Else, we still have a dependency on gmodule
> +	# We will add flags for gmodule alone
> +	pkg_modules="gmodule-2.0 >= 2.0.0"
> +	PKG_CHECK_MODULES(GMODULE, [$pkg_modules])
> +])
>  
>  pkg_modules="gobject-2.0 >= 2.0.0"
>  PKG_CHECK_MODULES(GOBJECT, [$pkg_modules])
>  
> -LIBS="$LIBS $M_LIBS $GTK_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
> -PACKAGE_CFLAGS="$GTK_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -Wall -Wformat"
> +LIBS="$LIBS $GTK_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
> +PACKAGE_CFLAGS="$GTK_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -Wall -Wformat-security"
>  MODULE_CFLAGS="$PACKAGE_CFLAGS -fvisibility=hidden"
>  MODULE_LDFLAGS="-module -avoid-version"
>  AC_SUBST([PACKAGE_CFLAGS])
> +AC_SUBST(PACKAGE_LIBS)
>  AC_SUBST([MODULE_CFLAGS])
>  AC_SUBST([MODULE_LDFLAGS])
>  
> @@ -175,18 +162,16 @@ AC_HEADER_TIME
>  
>  # Checks for library functions.
>  AC_FUNC_ERROR_AT_LINE
> -#AC_FUNC_MALLOC
>  AC_FUNC_SELECT_ARGTYPES
>  AC_CHECK_FUNCS([select])
>  
> -#CPPFLAGS="$CPPFLAGS -I"
> -
>  AC_ARG_ENABLE(lttvstatic,
> -	AC_HELP_STRING( [--enable-lttvstatic],
> -		[build a statically linked executable @<:@default=no@:>@]),
> -		[with_lttvstatic="yes"],
> -		[with_lttvstatic="no"])
> -AM_CONDITIONAL(LTTVSTATIC, test "x$with_lttvstatic" = "xyes")
> +	AS_HELP_STRING([--enable-lttvstatic],
> +	[build a statically linked executable [[default=no]]]),
> +	[with_lttvstatic="$withval"],
> +	[with_lttvstatic="no"])
> +AM_CONDITIONAL([LTTVSTATIC], [ test "x$with_lttvstatic" = "xyes" ] )
> +
>  lttvlibdir="${libdir}/lttv"
>  lttvplugindir="${lttvlibdir}/plugins"
>  #lttlibdir="${libdir}/ltt"
> @@ -200,8 +185,6 @@ lttvincludedir="${includedir}/lttv"
>  lttvwindowincludedir="${includedir}/lttvwindow"
>  lttctlincludedir="${includedir}/liblttctl"
>  
> -AC_SUBST([POPT_LIBS])
> -AC_SUBST([UTIL_LIBS])
>  AC_SUBST(lttvlibdir)
>  AC_SUBST(lttvplugindir)
>  #AC_SUBST(lttlibdir)
> @@ -213,8 +196,6 @@ AC_SUBST(lttvincludedir)
>  AC_SUBST(lttvwindowincludedir)
>  AC_SUBST(lttctlincludedir)
>  
> -		 #lttv/modules/gui/tutorial/Makefile
> -		 #lttv/modules/gui/diskperformance/Makefile
>  AC_CONFIG_FILES([Makefile
>  	lttv/Makefile
>  	lttv/lttv/Makefile
> @@ -243,4 +224,6 @@ AC_CONFIG_FILES([Makefile
>  	doc/user/user_guide/Makefile
>  	doc/user/user_guide/docbook/Makefile
>  	doc/user/user_guide/html/Makefile])
> +
>  AC_OUTPUT
> +




More information about the lttng-dev mailing list