summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Steinert <mike.steinert@gmail.com>2012-05-15 17:39:33 -0600
committerMichael Steinert <mike.steinert@gmail.com>2012-05-17 11:44:45 -0600
commitbf4b5d647d3280cf021d89adc7879218dfe64000 (patch)
tree6713e2cc39223ffdc0a4e86d9ac4e0ee8173ec6b
parent2b5c7f8538ff6c59f343c0c4d50c97246ed6be6c (diff)
downloadrabbitmq-c-github-ask-bf4b5d647d3280cf021d89adc7879218dfe64000.tar.gz
Make configure options more sensible
`--disable-tools` will disable the AMQP tools. `--disable-docs` will disable the AMQP tools documentation. The `XMLTO` environment variable can be used to override the location of the `xmlto` command at configure time. The `POPT_CFLAGS` & `POPT_LIBS` environment variables can be used to influence Libpopt configuration. Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
-rw-r--r--configure.ac68
-rw-r--r--m4/popt.m473
2 files changed, 99 insertions, 42 deletions
diff --git a/configure.ac b/configure.ac
index 4ad4608..4591403 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,48 +133,30 @@ AS_IF([test "x$windows" = xyes],
AC_SUBST(EXTRA_LIBS)
AM_CONDITIONAL(USE_MSINTTYPES, test "x$USE_MSINTTYPES" != "x")
-dnl Check for libpopt, which we need to build the tools
-AC_ARG_WITH([popt],
- [AS_HELP_STRING([--with-popt], [use the popt library. Needed for tools.])],
- [],
- [with_popt=check])
-
-LIBPOPT=
-AS_IF([test "x$with_popt" != xno],
- [AC_CHECK_LIB([popt], [poptGetContext],
- [AC_SUBST([LIBPOPT], ["-lpopt"])
- AC_DEFINE([HAVE_LIBPOPT], [1], [Define if you have libpopt])
- ],
- [if test "x$with_popt" != xcheck; then
- AC_MSG_FAILURE([--with-popt was given, but test for libpopt failed])
- fi
- ])])
-
-AS_IF([test "x$LIBPOPT" != "x"],
- [AC_CHECK_HEADER([popt.h], [],
- [AC_MSG_FAILURE([You have libpopt, but could not find the popt.h header])])
- ])
-
-POPT_CFLAGS=
-POPT_LIBS=-lpopt
-AC_SUBST([POPT_CFLAGS])
-AC_SUBST([POPT_LIBS])
-
-AM_CONDITIONAL(TOOLS, test "x$LIBPOPT" != "x")
-
-AC_ARG_WITH([xmlto],
- [AS_HELP_STRING([--with-xmlto], [use the xmlto toolchain. Needed for tools man pages.])],
- [],
- [with_xmlto=check])
-
-XMLTO=
-AS_IF([test "x$with_xmlto" != xno],
- [AC_CHECK_PROG([XMLTO], [xmlto], [xmlto])
- if test "x$with_xmlto" != xcheck; then
- AC_MSG_FAILURE([--with-xmlto was given, but xmlto not found])
- fi])
-
-AM_CONDITIONAL(DOCS, test "x$XMLTO" != "x")
+# Configure AMQP command-line tools
+AC_ARG_ENABLE([tools],
+ [AS_HELP_STRING([--enable-tools],
+ [build AMQP command-line tools @<:@auto@:>@])],,
+ [enable_tools=auto])
+AS_IF([test "x$enable_tools" != "xno"],
+ [AX_LIB_POPT([enable_tools=yes], [enable_tools=no])])
+AM_CONDITIONAL([TOOLS], [test "x$enable_tools" = "xyes"])
+
+# Configure command-line tool documentation
+AC_ARG_ENABLE([docs],
+ [AS_HELP_STRING([--enable-docs],
+ [build command-line tool documentation @<:@auto@:>@])],,
+ [AS_IF([test "x$enable_tools" = "xno"],
+ [enable_docs=no],
+ [enable_docs=auto])])
+AC_ARG_VAR([XMLTO], [xmlto command])
+AS_IF([test "x$enable_docs" != "xno"],
+ [AS_IF([test "x$XMLTO" = "x"],
+ [AC_CHECK_PROGS([XMLTO], [xmlto])])
+ AS_IF([test "x$XMLTO" != "x"],
+ [enable_docs=yes],
+ [enable_docs=no])])
+AM_CONDITIONAL([DOCS], [test "x$enable_docs" = "xyes"])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
@@ -183,4 +165,6 @@ AC_MSG_RESULT([
$PACKAGE_NAME build options:
Host: $host
Version: $VERSION
+ Tools: $enable_tools
+ Documentation: $enable_docs
])
diff --git a/m4/popt.m4 b/m4/popt.m4
new file mode 100644
index 0000000..c5b79d8
--- /dev/null
+++ b/m4/popt.m4
@@ -0,0 +1,73 @@
+# popt.m4 - Check for Popt
+#
+# Copyright 2012 Michael Steinert
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+# SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#serial 1
+
+# _AX_LIB_POPT
+# ------------
+# Check for the Popt library and header file. If found the cache variable
+# ax_cv_have_popt will be set to yes.
+AC_DEFUN([_AX_LIB_POPT],
+[dnl
+ax_cv_have_popt=no
+_ax_popt_h=no
+_ax_popt_lib=no
+AC_ARG_VAR([POPT_CFLAGS], [C compiler flags for Popt, overriding defaults])
+AC_ARG_VAR([POPT_LIBS], [linker flags for Popt, overriding defaults])
+AC_CHECK_HEADERS([popt.h],
+ [_ax_popt_h=yes],,
+ [$POPT_CFLAGS])
+AS_IF([test "x$POPT_LIBS" = "x"],
+ [AC_SEARCH_LIBS([poptGetContext], [popt],
+ [POPT_LIBS=-lpopt
+ _ax_popt_lib=yes])],
+ [_ax_popt_cflags=$CFLAGS
+ CFLAGS="$POPT_CFLAGS $CFLAGS"
+ _ax_popt_ldflags=$LDFLAGS
+ LDFLAGS="$POPT_LIBS $LDFLAGS"
+ AC_MSG_CHECKING([for libpopt])
+ AC_TRY_LINK([#include <popt.h>],
+ [poptFreeContext(NULL)],
+ [AC_MSG_RESULT([$POPT_LIBS])
+ _ax_popt_lib=yes],
+ [AC_MSG_RESULT([no])])
+ CFLAGS=$_ax_popt_cflags
+ LDFLAGS=$_ax_popt_ldflags])
+AS_IF([test "x$_ax_popt_h" = "xyes" && \
+ test "x$_ax_popt_lib" = "xyes"],
+ [ax_cv_have_popt=yes])
+])dnl
+
+# AX_LIB_POPT([ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# ------------------------------------------------
+# Check is installed. If found the variable ax_have_popt will be set to yes.
+# ACTION-IF-TRUE: commands to execute if Popt is installed
+# ACTION-IF-FALSE: commands to execute if Popt is not installed
+AC_DEFUN([AX_LIB_POPT],
+[dnl
+AC_CACHE_VAL([ax_cv_have_popt], [_AX_LIB_POPT])
+ax_have_popt=$ax_cv_have_popt
+AS_IF([test "x$ax_have_popt" = "xyes"],
+ [AC_DEFINE([HAVE_POPT], [1], [Define to 1 if Popt is available.])
+ $1], [$2])
+])dnl