[libgee] Steal vala.m4 from gnome-boxes



commit 7ffff06c2b93d27f1f1a8f571b86e14722e79ec2
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Fri Apr 12 19:15:37 2013 +0200

    Steal vala.m4 from gnome-boxes

 .gitignore      |  6 +++++-
 configure.ac    | 25 ++++++++++++-------------
 gee/Makefile.am |  4 +++-
 m4/vala.m4      | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 15 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index b81fc0b..5b9373a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,6 @@ configure
 depcomp
 libtool
 install-sh
-m4
 missing
 ltmain.sh
 ylwrap
@@ -26,6 +25,11 @@ compile
 stamp-h1
 *.pc
 lcov.info
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
 doc/gee-0.8
 gee/gee-0.8.vapi
 gee/gee-internals-0.8.vapi
diff --git a/configure.ac b/configure.ac
index 2adc994..4ecc014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_INIT([libgee], [0.10.0], [https://bugzilla.gnome.org/enter_bug.cgi?product=li
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([check-news dist-bzip2])
+AM_INIT_AUTOMAKE([1.11 check-news dist-xz no-dist-gzip tar-ustar])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 # Checks for programs.
@@ -16,28 +16,24 @@ AC_SUBST(LIBGEE_LT_VERSION)
 
 GLIB_REQUIRED=2.32
 
-AM_PROG_VALAC([0.17.5])
-AC_SUBST(VALAC)
-
-VALAFLAGS=--target-glib=$GLIB_REQUIRED
-
-AC_SUBST(VALAFLAGS)
+VALA_ADD_CHECKFILE([gee/libgee_0_8_la_vala.stamp])
+VALA_ADD_CHECKFILE([tests/tests_vala.stamp])
+VALA_ADD_VALAFLAGS(--target-glib=$GLIB_REQUIRED)
 
 AC_ARG_ENABLE(doc, AS_HELP_STRING([--enable-doc], [Enable documentation generation]), enable_doc=$enableval, 
enable_doc=no)
 AM_CONDITIONAL(ENABLE_DOC, test x$enable_doc = xyes)
 
 AS_IF([test "x$enable_doc" != xno],
-       [AC_PATH_PROG(VALADOC, valadoc, :)
-        AC_SUBST(VALADOC)
-        AS_IF([test "$VALADOC" = :],
-               [AC_MSG_ERROR([valadoc not found])])])
+      [AC_PATH_PROG(VALADOC, valadoc, :)
+       AC_SUBST(VALADOC)
+       AS_IF([test "$VALADOC" = :],
+             [AC_MSG_ERROR([valadoc not found])])])
 
 AC_ARG_ENABLE(coverage,
        AS_HELP_STRING([--enable-coverage],
        [compile with coverage profiling and debug (gcc only)]),
        enable_coverage=$enableval,enable_coverage=no)
 AM_CONDITIONAL(ENABLE_COVERAGE, test x$enable_coverage != xno)
-
 AS_IF([test "x$enable_coverage" != xno],
        [COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage"
         COVERAGE_VALAFLAGS="-g"
@@ -45,7 +41,6 @@ AS_IF([test "x$enable_coverage" != xno],
         AC_SUBST(COVERAGE_CFLAGS)
         AC_SUBST(COVERAGE_VALAFLAGS)
         AC_SUBST(COVERAGE_LIBS)
-        
         AC_PATH_PROG(LCOV, lcov, :)
         AC_SUBST(LCOV)
         AS_IF([test "$LCOV" = :],
@@ -53,6 +48,8 @@ AS_IF([test "x$enable_coverage" != xno],
 
 AC_ARG_ENABLE(benchmark, AS_HELP_STRING([--enable-benchmark], [Enable benchmark]), 
enable_benchmark=$enableval, enable_benchmark=no)
 AM_CONDITIONAL(ENABLE_BENCHMARK, test x$enable_benchmark = xyes)
+AS_IF([test x$enable_benchmark = xyes],
+      [VALA_ADD_CHECKFILE([benchmark/benchmarks_vala.stamp])])
 
 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
 AC_SUBST(GLIB_CFLAGS)
@@ -60,6 +57,8 @@ AC_SUBST(GLIB_LIBS)
 
 GOBJECT_INTROSPECTION_CHECK([0.9.0])
 
+VALA_CHECK([])
+
 AC_OUTPUT([Makefile
            gee-0.8.pc
            benchmark/Makefile
diff --git a/gee/Makefile.am b/gee/Makefile.am
index f67d58a..a4295a5 100644
--- a/gee/Makefile.am
+++ b/gee/Makefile.am
@@ -133,7 +133,9 @@ endif
 
 Gee-0.8.gir gee-internals-0.8.vapi gee-0.8.vapi: libgee-0.8.la
 
-CLEANFILES = \
+MOSTLYCLEANFILES = \
+       $(libgee_0_8_la_SOURCES:.vala=.c) \
+       src/gnome_news_vala.stamp \
        gee-0.8.vapi \
        gee-internals-0.8.vapi \
        Gee-0.8.typelib \
diff --git a/m4/vala.m4 b/m4/vala.m4
new file mode 100644
index 0000000..96fca8a
--- /dev/null
+++ b/m4/vala.m4
@@ -0,0 +1,48 @@
+AC_DEFUN([VALA_ADD_CHECKFILE],
+[
+    vala_checkfiles="$vala_checkfiles $srcdir/$1"
+])
+
+AC_DEFUN([VALA_ADD_VALAFLAGS],
+[
+    VALAFLAGS="${VALAFLAGS:+$VALAFLAGS }$1"
+])
+
+AC_DEFUN([VALA_CHECK],
+[
+    AC_ARG_ENABLE([vala],
+        [AS_HELP_STRING([--enable-vala],[enable checks for vala])],,
+            [enable_vala=no])
+    AC_ARG_ENABLE([vala-fatal-warnings],
+        [AS_HELP_STRING([--enabla-vala-fatal-warnings],[Treat vala warnings as fatal])],,
+            [enable_vala_fatal_warnings=no])
+    AS_IF([test "x$enable_vala_fatal_warnings" = "xyes"],
+          [VALA_ADD_VALAFLAGS([--fatal-warnings])])
+    AC_SUBST([VALAFLAGS])
+    dnl Enable check for Vala even if not asked to do so if checkfile files are absent.
+    for checkfile in $vala_checkfiles
+    do
+        AS_IF([test ! -e "$checkfile"],
+              [AC_MSG_WARN([Missing checkfile file $[]checkfile. Forcing vala mode])
+               enable_vala=yes
+              ])
+    done
+
+    dnl Vala
+    AS_IF([test x$enable_vala = xyes],
+          [
+           dnl check for vala
+           AM_PROG_VALAC([$1])
+           AS_IF([test x$VALAC = "x"],
+                 [AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH])],
+                 [VALA_CHECK_PACKAGES([$2])])
+
+           dnl check for vapigen
+           AC_PATH_PROG(VAPIGEN, vapigen, no)
+           AS_IF([test x$VAPIGEN = "xno"],
+                 [AC_MSG_ERROR([Cannot find the "vapigen compiler in your PATH])])
+
+           ],
+           []
+    )
+])


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