[gnome-dictionary] build: Modernize autotools usage



commit e5eb61831a59059ae7d7660c08f50f4ed2b7831a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Feb 23 12:37:36 2015 +0000

    build: Modernize autotools usage
    
    While not really bleeding edge, at least we have something adequate for
    this century.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745022

 autogen.sh           |   58 +++++++++++++++++++++------
 configure.ac         |   22 +++++++----
 libgdict/Makefile.am |  107 ++++++++++++++++++++++---------------------------
 3 files changed, 107 insertions(+), 80 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index 61a9200..c251e84 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,21 +1,53 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
 
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+
+olddir=`pwd`
+cd $srcdir
 
 PKG_NAME="GNOME Dictionary"
 
-(test -f $srcdir/configure.ac \
-  && test -d $srcdir/libgdict) || {
-    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
-    echo " top-level gnome-dictionary directory"
-    exit 1
-}
+rm -rf autom4te.cache
+
+mkdir -p m4
+
+GTKDOCIZE=$(which gtkdocize 2>/dev/null)
+if test -z $GTKDOCIZE; then
+        echo "*** You don't have gtk-doc installed, and thus won't be able to generate the documentation. 
***"
+        rm -f gtk-doc.make
+        cat > gtk-doc.make <<EOF
+EXTRA_DIST =
+CLEANFILES =
+EOF
+else
+        gtkdocize || exit $?
+fi
+
+INTLTOOLIZE=$(which intltoolize 2>/dev/null)
+if test -z $INTLTOOLIZE; then
+        echo "*** No intltoolize found, please install intltool ***"
+        exit 1
+else
+        intltoolize --force --copy --automake || exit $?
+fi
+
+AUTORECONF=$(which autoreconf 2>/dev/null)
+if test -z $AUTORECONF; then
+        echo "*** No autoreconf found, please install it ***"
+        exit 1
+else
+        autoreconf --verbose --force --install -Wno-portability || exit $?
+fi
 
-which gnome-autogen.sh || {
-    echo "You need to install gnome-common package"
-    exit 1
-}
+# NOCONFIGURE is used by gnome-common
+if test -z "$NOCONFIGURE"; then
+        if test -z "$*"; then
+                echo "I am going to run ./configure with no arguments - if you wish "
+                echo "to pass any to it, please specify them on the $0 command line."
+        fi
+fi
 
-USE_GNOME2_MACROS=1 . gnome-autogen.sh
+cd "$olddir"
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
index 49f4eeb..62810cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,25 +6,30 @@ AC_INIT([gnome-dictionary], [3.15.91],
        [http://live.gnome.org/GnomeUtils])
 
 AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_SRCDIR([src])
 AC_CONFIG_MACRO_DIR([m4])
 
 AC_CANONICAL_TARGET
 
-# require automake 1.10
-AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip foreign])
+AM_INIT_AUTOMAKE([1.14 subdir-objects tar-ustar dist-xz no-dist-gzip foreign])
 AM_SILENT_RULES([yes])
+AM_MAINTAINER_MODE([enable])
 
-GETTEXT_PACKAGE=AC_PACKAGE_NAME
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
-IT_PROG_INTLTOOL(0.40.0)
-PKG_PROG_PKG_CONFIG([0.22])
+AC_USE_SYSTEM_EXTENSIONS
 
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
-AC_ISC_POSIX
 AC_HEADER_STDC
+PKG_PROG_PKG_CONFIG([0.22])
+
+IT_PROG_INTLTOOL([0.40])
+
+GETTEXT_PACKAGE=AC_PACKAGE_NAME
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
+AC_SUBST(GETTEXT_PACKAGE)
+
+AM_GLIB_GNU_GETTEXT
 
 AC_PATH_PROG(GLIB_GENMARSHAL, [glib-genmarshal])
 AC_PATH_PROG(GLIB_MKENUMS, [glib-mkenums])
@@ -39,6 +44,7 @@ AC_PATH_PROG(GLIB_MKENUMS, [glib-mkenums])
 
 LT_PREREQ([2.2.6])
 LT_INIT([disable-static win32-dll])
+LT_LIB_M
 
 ## don't rerun to this point if we abort
 AC_CACHE_SAVE
diff --git a/libgdict/Makefile.am b/libgdict/Makefile.am
index bc09bea..652c659 100644
--- a/libgdict/Makefile.am
+++ b/libgdict/Makefile.am
@@ -1,6 +1,8 @@
 NULL =
 
 AM_CPPFLAGS = \
+       -I$(top_srcdir)/libgdict                                \
+       -I$(top_builddir)/libgdict                              \
        -DG_LOG_DOMAIN=\"Gdict\"                                \
        -DDATADIR=\""$(datadir)"\"                              \
        -DLIBDIR=\""$(libdir)"\"                                \
@@ -17,78 +19,66 @@ AM_CPPFLAGS = \
        -DGTK_DISABLE_SINGLE_INCLUDES                           \
        $(NULL)
 
-sources_h =    \
-       $(srcdir)/gdict-context.h               \
-       $(srcdir)/gdict-client-context.h        \
-       $(srcdir)/gdict-database-chooser.h      \
-       $(srcdir)/gdict-defbox.h                \
-       $(srcdir)/gdict-source-chooser.h        \
-       $(srcdir)/gdict-source-loader.h         \
-       $(srcdir)/gdict-source.h                \
-       $(srcdir)/gdict-speller.h               \
-       $(srcdir)/gdict-strategy-chooser.h      \
-       $(srcdir)/gdict-utils.h                 \
+sources_h = \
+       gdict-context.h                 \
+       gdict-client-context.h          \
+       gdict-database-chooser.h        \
+       gdict-defbox.h                  \
+       gdict-source-chooser.h          \
+       gdict-source-loader.h           \
+       gdict-source.h                  \
+       gdict-speller.h                 \
+       gdict-strategy-chooser.h        \
+       gdict-utils.h                   \
        $(NULL)
 
-sources_h_priv =       \
-       $(srcdir)/gdict-context-private.h       \
-       $(srcdir)/gdict-debug.h                 \
-       $(srcdir)/gdict-private.h               \
+sources_h_priv = \
+       gdict-context-private.h         \
+       gdict-debug.h                   \
+       gdict-private.h                 \
        $(NULL)
 
-sources_c =    \
-       $(srcdir)/gdict-context.c               \
-       $(srcdir)/gdict-client-context.c        \
-       $(srcdir)/gdict-database-chooser.c      \
-       $(srcdir)/gdict-defbox.c                \
-       gdict-enum-types.c                      \
-       gdict-marshal.c                         \
-       $(srcdir)/gdict-source-chooser.c        \
-       $(srcdir)/gdict-source-loader.c         \
-       $(srcdir)/gdict-source.c                \
-       $(srcdir)/gdict-speller.c               \
-       $(srcdir)/gdict-strategy-chooser.c      \
-       $(srcdir)/gdict-utils.c                 \
+sources_c = \
+       gdict-context.c                 \
+       gdict-client-context.c          \
+       gdict-database-chooser.c        \
+       gdict-defbox.c                  \
+       gdict-source-chooser.c          \
+       gdict-source-loader.c           \
+       gdict-source.c                  \
+       gdict-speller.c                 \
+       gdict-strategy-chooser.c        \
+       gdict-utils.c                   \
        $(NULL)
 
+BUILT_SOURCES = \
+       gdict-enum-types.h      \
+       gdict-enum-types.c      \
+       gdict-marshal.h         \
+       gdict-marshal.c
+
 lib_LTLIBRARIES = libgdict-1.0.la
 
 # GNOME Dictionary shared library
-libgdict_1_0_la_SOURCES = \
-       $(sources_h)            \
-       $(sources_h_priv)       \
-       $(sources_c)
-
-libgdict_1_0_la_CFLAGS = \
-       $(GDICT_CFLAGS)         \
-       $(GDICT_DEBUG_CFLAGS)   \
-       $(MAINTAINER_CFLAGS)
-
-libgdict_1_0_la_LIBADD = \
-       $(GDICT_LIBS)
-
-libgdict_1_0_la_LDFLAGS  = \
-       -version-info $(LIBGDICT_LT_VERSION)    \
-       -export-dynamic                         \
-       -no-undefined
+libgdict_1_0_la_SOURCES = $(BUILT_SOURCES) $(sources_h)        $(sources_h_priv) $(sources_c)
+libgdict_1_0_la_CFLAGS = $(GDICT_CFLAGS) $(GDICT_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS)
+libgdict_1_0_la_LIBADD = $(GDICT_LIBS)
+libgdict_1_0_la_LDFLAGS = -version-info $(LIBGDICT_LT_VERSION) -export-dynamic -no-undefined
 
 libgdict_includedir = $(includedir)/gdict-1.0/gdict
 libgdict_include_HEADERS =     \
        $(sources_h)            \
-       gdict-enum-types.h      \
-       gdict-version.h         \
        $(srcdir)/gdict.h       \
        $(NULL)
 
-gdict_built_files =            \
+nodist_libgdict_include_HEADERS = \
        gdict-enum-types.h      \
-       gdict-enum-types.c      \
-       gdict-marshal.h         \
-       gdict-marshal.c
+       gdict-version.h         \
+       $(NULL)
 
 stamp_files = stamp-gdict-enum-types.h stamp-gdict-marshal.h
 
-CLEANFILES = $(stamp_files) $(gdict_built_files)
+CLEANFILES = $(stamp_files) $(BUILT_SOURCES)
 DISTCLEANFILES = gdict-version.h
 MAINTAINERCLEANFILES = $(stamp_files) $(gdict_built_files) gdict-version.h
 
@@ -100,8 +90,6 @@ EXTRA_DIST =                         \
        gdict-1.0.pc.in         \
        $(NULL)
 
-BUILT_SOURCES = $(gdict_built_files) 
-
 # Introspection
 include $(INTROSPECTION_MAKEFILE)
 INTROSPECTION_GIRS =
@@ -130,14 +118,16 @@ endif
 gdict-marshal.h: stamp-gdict-marshal.h
        @true
 stamp-gdict-marshal.h: gdict-marshal.list $(GLIB_GENMARSHAL) Makefile
-       $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=gdict_marshal > xgen-gmh \
+       $(AM_V_GEN)$(GLIB_GENMARSHAL) \
+         $(srcdir)/gdict-marshal.list --header --prefix=gdict_marshal >> xgen-gmh \
        && ( cmp -s xgen-gmh gdict-marshal.h || cp xgen-gmh gdict-marshal.h ) \
        && rm -f xgen-gmh \
        && echo timestamp > $@
 
 gdict-marshal.c: gdict-marshal.list $(GLIB_GENMARSHAL) Makefile
        $(AM_V_GEN)( echo "#include \"gdict-marshal.h\""; echo; \
-         $(GLIB_GENMARSHAL) $< --body --prefix=gdict_marshal ) > xgen-gmc \
+         $(GLIB_GENMARSHAL) \
+         $(srcdir)/gdict-marshal.list --body --prefix=gdict_marshal ) >> xgen-gmc \
        && cp xgen-gmc gdict-marshal.c \
        && rm -f xgen-gmc
 
@@ -145,14 +135,14 @@ gdict-enum-types.h: stamp-gdict-enum-types.h
        @true
 stamp-gdict-enum-types.h: $(sources_h) gdict-enum-types.h.in Makefile
        $(AM_V_GEN) $(GLIB_MKENUMS) --template $(srcdir)/gdict-enum-types.h.in \
-         $(sources_h) > xgen-ceth \
+         $(addprefix $(srcdir)/,$(sources_h)) >> xgen-ceth \
        && ( cmp -s xgen-ceth gdict-enum-types.h || cp xgen-ceth gdict-enum-types.h ) \
        && rm -f xgen-ceth \
        && echo timestamp > $@
 
 gdict-enum-types.c: gdict-enum-types.h gdict-enum-types.c.in Makefile
        $(AM_V_GEN) $(GLIB_MKENUMS) --template $(srcdir)/gdict-enum-types.c.in \
-         $(sources_h) > xgen-cetc \
+         $(addprefix $(srcdir)/,$(sources_h)) >> xgen-cetc \
        && cp xgen-cetc gdict-enum-types.c \
        && rm -f xgen-cetc
 
@@ -164,5 +154,4 @@ distclean-local:
                rm -f $(MAINTAINERCLEANFILES); \
        fi
 
-
 -include $(top_srcdir)/git.mk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]