AC_CANONICAL_HOST
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)])
AC_CONFIG_HEADERS([gnunet_config.h])
AH_TOP([#define _GNU_SOURCE 1])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT([disable-static dlopen win32-dll])
AC_SUBST(MKDIR_P)
+# allow for different autotools
+AS_AUTOTOOLS_ALTERNATE
+
# large file support
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
# check for bluetooth library
bluetooth=0
-AC_CHECK_LIB(bluetooth, ba2str,[AC_CHECK_HEADER([bluetooth/bluetooth.h],bluetooth=1)])
+CHECK_LIBHEADER(BLUETOOTH, bluetooth, ba2str, bluetooth/bluetooth.h,bluetooth=1,)
AS_IF([test "$build_target" = "mingw"],
[bluetooth=1])
AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1])
[AC_MSG_RESULT([$with_zbar])
AS_CASE([$with_zbar],
[no],[],
- [yes],[
- AC_CHECK_HEADERS(zbar.h,
- AC_CHECK_LIB([zbar], [zbar_processor_create],
- zbar=1))
- ],[
+ [yes],[CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)],
+ [
LDFLAGS="-L$with_zbar/lib $LDFLAGS"
CPPFLAGS="-I$with_zbar/include $CPPFLAGS"
AC_CHECK_HEADERS(zbar.h,
])
],
[AC_MSG_RESULT([--with-zbar not specified])
- AC_CHECK_HEADERS(zbar.h,
- AC_CHECK_LIB([zbar], [zbar_processor_create],
- zbar=1))])
+ CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)])
AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1])
AS_IF([test "x$zbar" = x1],
[AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
jansson=0
AC_MSG_CHECKING(for libjansson)
AC_ARG_WITH(jansson,
- [ --with-jansson=PFX base of libjansson installation],
+ [--with-jansson=PREFIX (base of libjansson installation)],
[AC_MSG_RESULT([$with_jansson])
AS_CASE([$with_jansson],
[no],[],
[yes],[
- AC_CHECK_HEADERS(jansson.h,
- AC_CHECK_LIB([jansson], [json_loads],
- jansson=1))
+ CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)
],[
LDFLAGS="-L$with_jansson/lib $LDFLAGS"
CPPFLAGS="-I$with_jansson/include $CPPFLAGS"
])
],
[AC_MSG_RESULT([--with-jansson not specified])
- AC_CHECK_HEADERS(jansson.h,
- AC_CHECK_LIB([jansson], [json_loads],
- jansson=1))])
+ CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)])
AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1])
AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
AS_IF([test "x$jansson" = x1],
# check for libpulse(audio) library
pulse=0
-AC_CHECK_LIB(pulse,pa_stream_peek,
- [AC_CHECK_HEADER([pulse/simple.h],pulse=1)])
+CHECK_LIBHEADER(LIBPULSE, pulse, pa_stream_peek, pulse/simple.h,jansson=1,)
AS_IF([test "$build_target" = "mingw"],
[pulse=0])
AS_IF([test "$pulse" = 1],
# check for libopus(audio) library
opus=0
-AC_CHECK_LIB(opus,opus_decode_float,
- [AC_CHECK_HEADER([opus/opus.h],
- [AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]]
- )]
- )]
-)
+CHECK_LIBHEADER(LIBOPUS,
+ opus,
+ opus_decode_float,
+ opus/opus.h,
+ AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]]))
AS_IF([test "x$opus" = x1],
[AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])])
[AC_MSG_WARN([ERROR: libextractor not found, but various file-sharing functions require it])],
[libextractor_msg="yes"])
# -- libzbar
-AS_IF([test "$have_zbar" = 1],
+AS_IF([test "x$zbar" = "x1"],
[libzbar_msg="yes"
features_msg="$features_msg gnunet-qr"],
[AC_MSG_NOTICE([WARNING: zbar not found, gnunet-qr will not be built.])
--- /dev/null
+dnl as-auto-alt.m4 0.0.2
+dnl autostars m4 macro for supplying alternate autotools versions to configure
+dnl thomas@apestaart.org
+dnl
+dnl AS_AUTOTOOLS_ALTERNATE()
+dnl
+dnl supplies --with arguments for autoconf, autoheader, automake, aclocal
+
+AC_DEFUN([AS_AUTOTOOLS_ALTERNATE],
+[
+ dnl allow for different autoconf version
+ AC_ARG_WITH(autoconf,
+ AC_HELP_STRING([--with-autoconf],
+ [use a different autoconf for regeneration of Makefiles]),
+ [
+ unset AUTOCONF
+ AM_MISSING_PROG(AUTOCONF, ${withval})
+ AC_MSG_NOTICE([Using $AUTOCONF as autoconf])
+ ])
+
+ dnl allow for different autoheader version
+ AC_ARG_WITH(autoheader,
+ AC_HELP_STRING([--with-autoheader],
+ [use a different autoheader for regeneration of Makefiles]),
+ [
+ unset AUTOHEADER
+ AM_MISSING_PROG(AUTOHEADER, ${withval})
+ AC_MSG_NOTICE([Using $AUTOHEADER as autoheader])
+ ])
+
+ dnl allow for different automake version
+ AC_ARG_WITH(automake,
+ AC_HELP_STRING([--with-automake],
+ [use a different automake for regeneration of Makefiles]),
+ [
+ unset AUTOMAKE
+ AM_MISSING_PROG(AUTOMAKE, ${withval})
+ AC_MSG_NOTICE([Using $AUTOMAKE as automake])
+ ])
+
+ dnl allow for different aclocal version
+ AC_ARG_WITH(aclocal,
+ AC_HELP_STRING([--with-aclocal],
+ [use a different aclocal for regeneration of Makefiles]),
+ [
+ unset ACLOCAL
+ AM_MISSING_PROG(ACLOCAL, ${withval})
+ AC_MSG_NOTICE([Using $ACLOCAL as aclocal])
+ ])
+])
--- /dev/null
+dnl
+dnl CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME,
+dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
+dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS)
+dnl
+dnl FEATURE-NAME - feature name; library and header files are treated
+dnl as feature, which we look for
+dnl LIB-NAME - library name as in AC_CHECK_LIB macro
+dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro
+dnl HEADER-NAME - header file name as in AC_CHECK_HEADER
+dnl ACTION-IF-FOUND - when feature is found then execute given action
+dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
+dnl EXTRA-LDFLAGS - extra linker flags (-L or -l)
+dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include
+dnl
+dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1.
+dnl
+AC_DEFUN([CHECK_LIBHEADER],
+[
+ AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7])
+ check_libheader_feature_name=translit([$1], A-Z, a-z)
+
+ if test "x$HAVE_[$1]" = "xyes"; then
+ check_libheader_save_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="[$8] $CPPFLAGS"
+ AC_CHECK_HEADER([$4], :, HAVE_[$1]=no)
+ CPPFLAGS=$check_libheader_save_CPPFLAGS
+ fi
+
+ if test "x$HAVE_[$1]" = "xyes"; then
+ ifelse([$5], , :, [$5])
+ AC_MSG_NOTICE($check_libheader_feature_name was found)
+ else
+ ifelse([$6], , :, [$6])
+ AC_MSG_WARN($check_libheader_feature_name not found)
+ fi
+ AC_SUBST(HAVE_[$1])
+]
+)
+