about summary refs log tree commit diff
path: root/m4
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-07-06 03:04:17 +0200
committerMichael Biebl <biebl@debian.org>2014-07-06 03:04:17 +0200
commit3ce667b6ee6b86291bbe60ef93cba7f11a5c5400 (patch)
treeaf3daa7221e898b72f3de26eb2cf0c1b1c8661b0 /m4
parentf02d31d95af29678092d1ff01f714621bc9dcc0f (diff)
parent33491bc4279481db8ae47213e34a6d695a0e8830 (diff)
Merge tag 'upstream/0.9.10.0'
Upstream version 0.9.10.0
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_lib_readline.m4106
-rw-r--r--m4/compiler_warnings.m42
-rw-r--r--m4/gnome-code-coverage.m48
-rw-r--r--m4/gtk-doc.m447
4 files changed, 127 insertions, 36 deletions
diff --git a/m4/ax_lib_readline.m4 b/m4/ax_lib_readline.m4
new file mode 100644
index 00000000..72764fba
--- /dev/null
+++ b/m4/ax_lib_readline.m4
@@ -0,0 +1,106 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_lib_readline.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_LIB_READLINE
+#
+# DESCRIPTION
+#
+#   Searches for a readline compatible library. If found, defines
+#   `HAVE_LIBREADLINE'. If the found library has the `add_history' function,
+#   sets also `HAVE_READLINE_HISTORY'. Also checks for the locations of the
+#   necessary include files and sets `HAVE_READLINE_H' or
+#   `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
+#   'HAVE_HISTORY_H' if the corresponding include files exists.
+#
+#   The libraries that may be readline compatible are `libedit',
+#   `libeditline' and `libreadline'. Sometimes we need to link a termcap
+#   library for readline to work, this macro tests these cases too by trying
+#   to link with `libtermcap', `libcurses' or `libncurses' before giving up.
+#
+#   Here is an example of how to use the information provided by this macro
+#   to perform the necessary includes or declarations in a C file:
+#
+#     #ifdef HAVE_LIBREADLINE
+#     #  if defined(HAVE_READLINE_READLINE_H)
+#     #    include <readline/readline.h>
+#     #  elif defined(HAVE_READLINE_H)
+#     #    include <readline.h>
+#     #  else /* !defined(HAVE_READLINE_H) */
+#     extern char *readline ();
+#     #  endif /* !defined(HAVE_READLINE_H) */
+#     char *cmdline = NULL;
+#     #else /* !defined(HAVE_READLINE_READLINE_H) */
+#       /* no readline */
+#     #endif /* HAVE_LIBREADLINE */
+#
+#     #ifdef HAVE_READLINE_HISTORY
+#     #  if defined(HAVE_READLINE_HISTORY_H)
+#     #    include <readline/history.h>
+#     #  elif defined(HAVE_HISTORY_H)
+#     #    include <history.h>
+#     #  else /* !defined(HAVE_HISTORY_H) */
+#     extern void add_history ();
+#     extern int write_history ();
+#     extern int read_history ();
+#     #  endif /* defined(HAVE_READLINE_HISTORY_H) */
+#       /* no history */
+#     #endif /* HAVE_READLINE_HISTORY */
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([VL_LIB_READLINE], [AX_LIB_READLINE])
+AC_DEFUN([AX_LIB_READLINE], [
+  AC_CACHE_CHECK([for a readline compatible library],
+                 ax_cv_lib_readline, [
+    ORIG_LIBS="$LIBS"
+    for readline_lib in readline edit editline; do
+      # prefer ncurses since we use it for nmtui too
+      for termcap_lib in "" ncurses termcap curses; do
+        if test -z "$termcap_lib"; then
+          TRY_LIB="-l$readline_lib"
+        else
+          TRY_LIB="-l$readline_lib -l$termcap_lib"
+        fi
+        LIBS="$ORIG_LIBS $TRY_LIB"
+        AC_TRY_LINK_FUNC(readline, ax_cv_lib_readline="$TRY_LIB")
+        if test -n "$ax_cv_lib_readline"; then
+          break
+        fi
+      done
+      if test -n "$ax_cv_lib_readline"; then
+        break
+      fi
+    done
+    LIBS="$ORIG_LIBS"
+  ])
+
+  if test -z "$ax_cv_lib_readline"; then
+    AC_MSG_ERROR([readline library with terminfo support is required (one of ncurses, curses, or termcap)])
+  fi
+
+  LIBS="$LIBS $ax_cv_lib_readline"
+  AC_CHECK_HEADERS(readline.h readline/readline.h)
+  AC_CACHE_CHECK([whether readline supports history],
+                 ax_cv_lib_readline_history, [
+    ax_cv_lib_readline_history="no"
+    AC_TRY_LINK_FUNC(add_history, ax_cv_lib_readline_history="yes")
+  ])
+  if test "$ax_cv_lib_readline_history" != "yes"; then
+    AC_MSG_ERROR(readline history support is required)
+  fi
+  AC_CHECK_HEADERS(history.h readline/history.h)
+  READLINE_LIBS="$ax_cv_lib_readline"
+  AC_SUBST(READLINE_LIBS)
+])dnl
diff --git a/m4/compiler_warnings.m4 b/m4/compiler_warnings.m4
index 3037c584..357ff0e7 100644
--- a/m4/compiler_warnings.m4
+++ b/m4/compiler_warnings.m4
@@ -8,7 +8,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
 	CFLAGS="-Wall -std=gnu89 $CFLAGS"
 
 	for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \
-		      -Wdeclaration-after-statement \
+		      -Wdeclaration-after-statement -Wformat-security \
 		      -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \
 		      -fno-strict-aliasing -Wno-unused-but-set-variable \
 		      -Wundef -Wimplicit-function-declaration \
diff --git a/m4/gnome-code-coverage.m4 b/m4/gnome-code-coverage.m4
index 618ccbec..62375e61 100644
--- a/m4/gnome-code-coverage.m4
+++ b/m4/gnome-code-coverage.m4
@@ -44,7 +44,7 @@ AC_DEFUN([GNOME_CODE_COVERAGE],[
 		])
 
 		# List of supported lcov versions.
-		lcov_version_list="1.6 1.7 1.8 1.9"
+		lcov_version_list="1.6 1.7 1.8 1.9 1.10"
 
 		AC_CHECK_PROG([LCOV], [lcov], [lcov])
 		AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
@@ -120,7 +120,7 @@ code_coverage_quiet_0 = --quiet
 
 # Use recursive makes in order to ignore errors during check
 check-code-coverage:
-ifdef CODE_COVERAGE_ENABLED
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
 	-$(MAKE) $(AM_MAKEFLAGS) -k check
 	$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
 else
@@ -129,7 +129,7 @@ endif
 
 # Capture code coverage data
 code-coverage-capture: code-coverage-capture-hook
-ifdef CODE_COVERAGE_ENABLED
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
 	$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS)
 	$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)"
 	-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
@@ -142,11 +142,13 @@ endif
 # Hook rule executed before code-coverage-capture, overridable by the user
 code-coverage-capture-hook:
 
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
 clean: code-coverage-clean
 code-coverage-clean:
 	-$(LCOV) --directory $(top_builddir) -z
 	-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
 	-find . -name "*.gcda" -o -name "*.gcov" -delete
+endif
 
 GITIGNOREFILES ?=
 GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
diff --git a/m4/gtk-doc.m4 b/m4/gtk-doc.m4
index 36755432..ac2eccb4 100644
--- a/m4/gtk-doc.m4
+++ b/m4/gtk-doc.m4
@@ -1,6 +1,6 @@
 dnl -*- mode: autoconf -*-
 
-# serial 2
+# serial 1
 
 dnl Usage:
 dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
@@ -10,24 +10,8 @@ AC_DEFUN([GTK_DOC_CHECK],
   AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
   AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
 
-  ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
-  AC_MSG_CHECKING([for gtk-doc])
-  PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
-  AC_MSG_RESULT($have_gtk_doc)
-
-  if test "$have_gtk_doc" = "no"; then
-      AC_MSG_WARN([
-  You will not be able to create source packages with 'make dist'
-  because $gtk_doc_requires is not found.])
-  fi
-
   dnl check for tools we added during development
-  dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
-  dnl may not be writable by the user. Currently, automake requires that the
-  dnl test name must end in '.test'.
-  dnl https://bugzilla.gnome.org/show_bug.cgi?id=701638
-  AC_CHECK_PROG([GTKDOC_CHECK],[gtkdoc-check],[gtkdoc-check.test])
-  AC_PATH_PROG([GTKDOC_CHECK_PATH],[gtkdoc-check])
+  AC_PATH_PROG([GTKDOC_CHECK],[gtkdoc-check])
   AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
   AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
 
@@ -44,21 +28,21 @@ AC_DEFUN([GTK_DOC_CHECK],
                    [use gtk-doc to build documentation [[default=no]]]),,
     [enable_gtk_doc=no])
 
-  AC_MSG_CHECKING([whether to build gtk-doc documentation])
-  AC_MSG_RESULT($enable_gtk_doc)
-
-  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
-    AC_MSG_ERROR([
-  You must have $gtk_doc_requires installed to build documentation for
-  $PACKAGE_NAME. Please install gtk-doc or disable building the
-  documentation by adding '--disable-gtk-doc' to '[$]0'.])
+  if test x$enable_gtk_doc = xyes; then
+    ifelse([$1],[],
+      [PKG_CHECK_EXISTS([gtk-doc],,
+                        AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
+      [PKG_CHECK_EXISTS([gtk-doc >= $1],,
+                        AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build $PACKAGE_NAME]))])
+    dnl don't check for glib if we build glib
+    if test "x$PACKAGE_NAME" != "xglib"; then
+      dnl don't fail if someone does not have glib
+      PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
+    fi
   fi
 
-  dnl don't check for glib if we build glib
-  if test "x$PACKAGE_NAME" != "xglib"; then
-    dnl don't fail if someone does not have glib
-    PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
-  fi
+  AC_MSG_CHECKING([whether to build gtk-doc documentation])
+  AC_MSG_RESULT($enable_gtk_doc)
 
   dnl enable/disable output formats
   AC_ARG_ENABLE([gtk-doc-html],
@@ -79,7 +63,6 @@ AC_DEFUN([GTK_DOC_CHECK],
   fi
   AC_SUBST([AM_DEFAULT_VERBOSITY])
 
-  AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
   AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
   AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
   AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])