aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-05-26 23:42:52 +0000
committerng0 <ng0@n0.is>2019-05-26 23:42:52 +0000
commited495e4214e7e81e004bd48d49e4c56cad287101 (patch)
treebdc2ce9c15cde87bb29638a440ccad3099887a28
parent4e586659d146fd7d571d22cf066445a7679016f4 (diff)
downloadgnunet-ed495e4214e7e81e004bd48d49e4c56cad287101.tar.gz
gnunet-ed495e4214e7e81e004bd48d49e4c56cad287101.zip
configure: improvements (mainly: detects libzbar with passing --with-libzbar).
The m4 scripts so far originated from gst-plugins-bad.
-rw-r--r--configure.ac44
-rw-r--r--m4/as-auto-alt.m450
-rw-r--r--m4/check-libheader.m440
3 files changed, 108 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 753c77924..18f38155a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ AC_CANONICAL_TARGET
37AC_CANONICAL_HOST 37AC_CANONICAL_HOST
38AC_CANONICAL_SYSTEM 38AC_CANONICAL_SYSTEM
39AM_INIT_AUTOMAKE 39AM_INIT_AUTOMAKE
40m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 40m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)])
41AC_CONFIG_HEADERS([gnunet_config.h]) 41AC_CONFIG_HEADERS([gnunet_config.h])
42AH_TOP([#define _GNU_SOURCE 1]) 42AH_TOP([#define _GNU_SOURCE 1])
43AC_CONFIG_MACRO_DIR([m4]) 43AC_CONFIG_MACRO_DIR([m4])
@@ -53,6 +53,9 @@ AM_PROG_CC_C_O
53LT_INIT([disable-static dlopen win32-dll]) 53LT_INIT([disable-static dlopen win32-dll])
54AC_SUBST(MKDIR_P) 54AC_SUBST(MKDIR_P)
55 55
56# allow for different autotools
57AS_AUTOTOOLS_ALTERNATE
58
56# large file support 59# large file support
57AC_SYS_LARGEFILE 60AC_SYS_LARGEFILE
58AC_FUNC_FSEEKO 61AC_FUNC_FSEEKO
@@ -576,7 +579,7 @@ AC_LANG_POP(C)
576 579
577# check for bluetooth library 580# check for bluetooth library
578bluetooth=0 581bluetooth=0
579AC_CHECK_LIB(bluetooth, ba2str,[AC_CHECK_HEADER([bluetooth/bluetooth.h],bluetooth=1)]) 582CHECK_LIBHEADER(BLUETOOTH, bluetooth, ba2str, bluetooth/bluetooth.h,bluetooth=1,)
580AS_IF([test "$build_target" = "mingw"], 583AS_IF([test "$build_target" = "mingw"],
581 [bluetooth=1]) 584 [bluetooth=1])
582AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1]) 585AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1])
@@ -592,11 +595,8 @@ AC_ARG_WITH(zbar,
592 [AC_MSG_RESULT([$with_zbar]) 595 [AC_MSG_RESULT([$with_zbar])
593 AS_CASE([$with_zbar], 596 AS_CASE([$with_zbar],
594 [no],[], 597 [no],[],
595 [yes],[ 598 [yes],[CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)],
596 AC_CHECK_HEADERS(zbar.h, 599 [
597 AC_CHECK_LIB([zbar], [zbar_processor_create],
598 zbar=1))
599 ],[
600 LDFLAGS="-L$with_zbar/lib $LDFLAGS" 600 LDFLAGS="-L$with_zbar/lib $LDFLAGS"
601 CPPFLAGS="-I$with_zbar/include $CPPFLAGS" 601 CPPFLAGS="-I$with_zbar/include $CPPFLAGS"
602 AC_CHECK_HEADERS(zbar.h, 602 AC_CHECK_HEADERS(zbar.h,
@@ -606,9 +606,7 @@ AC_ARG_WITH(zbar,
606 ]) 606 ])
607 ], 607 ],
608 [AC_MSG_RESULT([--with-zbar not specified]) 608 [AC_MSG_RESULT([--with-zbar not specified])
609 AC_CHECK_HEADERS(zbar.h, 609 CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)])
610 AC_CHECK_LIB([zbar], [zbar_processor_create],
611 zbar=1))])
612AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1]) 610AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1])
613AS_IF([test "x$zbar" = x1], 611AS_IF([test "x$zbar" = x1],
614 [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])], 612 [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
@@ -618,14 +616,12 @@ AS_IF([test "x$zbar" = x1],
618jansson=0 616jansson=0
619AC_MSG_CHECKING(for libjansson) 617AC_MSG_CHECKING(for libjansson)
620AC_ARG_WITH(jansson, 618AC_ARG_WITH(jansson,
621 [ --with-jansson=PFX base of libjansson installation], 619 [--with-jansson=PREFIX (base of libjansson installation)],
622 [AC_MSG_RESULT([$with_jansson]) 620 [AC_MSG_RESULT([$with_jansson])
623 AS_CASE([$with_jansson], 621 AS_CASE([$with_jansson],
624 [no],[], 622 [no],[],
625 [yes],[ 623 [yes],[
626 AC_CHECK_HEADERS(jansson.h, 624 CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)
627 AC_CHECK_LIB([jansson], [json_loads],
628 jansson=1))
629 ],[ 625 ],[
630 LDFLAGS="-L$with_jansson/lib $LDFLAGS" 626 LDFLAGS="-L$with_jansson/lib $LDFLAGS"
631 CPPFLAGS="-I$with_jansson/include $CPPFLAGS" 627 CPPFLAGS="-I$with_jansson/include $CPPFLAGS"
@@ -636,9 +632,7 @@ AC_ARG_WITH(jansson,
636 ]) 632 ])
637 ], 633 ],
638 [AC_MSG_RESULT([--with-jansson not specified]) 634 [AC_MSG_RESULT([--with-jansson not specified])
639 AC_CHECK_HEADERS(jansson.h, 635 CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)])
640 AC_CHECK_LIB([jansson], [json_loads],
641 jansson=1))])
642AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1]) 636AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1])
643AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1]) 637AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
644AS_IF([test "x$jansson" = x1], 638AS_IF([test "x$jansson" = x1],
@@ -648,8 +642,7 @@ AS_IF([test "x$jansson" = x1],
648 642
649# check for libpulse(audio) library 643# check for libpulse(audio) library
650pulse=0 644pulse=0
651AC_CHECK_LIB(pulse,pa_stream_peek, 645CHECK_LIBHEADER(LIBPULSE, pulse, pa_stream_peek, pulse/simple.h,jansson=1,)
652 [AC_CHECK_HEADER([pulse/simple.h],pulse=1)])
653AS_IF([test "$build_target" = "mingw"], 646AS_IF([test "$build_target" = "mingw"],
654 [pulse=0]) 647 [pulse=0])
655AS_IF([test "$pulse" = 1], 648AS_IF([test "$pulse" = 1],
@@ -657,12 +650,11 @@ AS_IF([test "$pulse" = 1],
657 650
658# check for libopus(audio) library 651# check for libopus(audio) library
659opus=0 652opus=0
660AC_CHECK_LIB(opus,opus_decode_float, 653CHECK_LIBHEADER(LIBOPUS,
661 [AC_CHECK_HEADER([opus/opus.h], 654 opus,
662 [AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]] 655 opus_decode_float,
663 )] 656 opus/opus.h,
664 )] 657 AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]]))
665)
666AS_IF([test "x$opus" = x1], 658AS_IF([test "x$opus" = x1],
667 [AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])]) 659 [AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])])
668 660
@@ -1992,7 +1984,7 @@ AS_IF([test "$extractor" != 1],
1992 [AC_MSG_WARN([ERROR: libextractor not found, but various file-sharing functions require it])], 1984 [AC_MSG_WARN([ERROR: libextractor not found, but various file-sharing functions require it])],
1993 [libextractor_msg="yes"]) 1985 [libextractor_msg="yes"])
1994# -- libzbar 1986# -- libzbar
1995AS_IF([test "$have_zbar" = 1], 1987AS_IF([test "x$zbar" = "x1"],
1996 [libzbar_msg="yes" 1988 [libzbar_msg="yes"
1997 features_msg="$features_msg gnunet-qr"], 1989 features_msg="$features_msg gnunet-qr"],
1998 [AC_MSG_NOTICE([WARNING: zbar not found, gnunet-qr will not be built.]) 1990 [AC_MSG_NOTICE([WARNING: zbar not found, gnunet-qr will not be built.])
diff --git a/m4/as-auto-alt.m4 b/m4/as-auto-alt.m4
new file mode 100644
index 000000000..3f7920dd2
--- /dev/null
+++ b/m4/as-auto-alt.m4
@@ -0,0 +1,50 @@
1dnl as-auto-alt.m4 0.0.2
2dnl autostars m4 macro for supplying alternate autotools versions to configure
3dnl thomas@apestaart.org
4dnl
5dnl AS_AUTOTOOLS_ALTERNATE()
6dnl
7dnl supplies --with arguments for autoconf, autoheader, automake, aclocal
8
9AC_DEFUN([AS_AUTOTOOLS_ALTERNATE],
10[
11 dnl allow for different autoconf version
12 AC_ARG_WITH(autoconf,
13 AC_HELP_STRING([--with-autoconf],
14 [use a different autoconf for regeneration of Makefiles]),
15 [
16 unset AUTOCONF
17 AM_MISSING_PROG(AUTOCONF, ${withval})
18 AC_MSG_NOTICE([Using $AUTOCONF as autoconf])
19 ])
20
21 dnl allow for different autoheader version
22 AC_ARG_WITH(autoheader,
23 AC_HELP_STRING([--with-autoheader],
24 [use a different autoheader for regeneration of Makefiles]),
25 [
26 unset AUTOHEADER
27 AM_MISSING_PROG(AUTOHEADER, ${withval})
28 AC_MSG_NOTICE([Using $AUTOHEADER as autoheader])
29 ])
30
31 dnl allow for different automake version
32 AC_ARG_WITH(automake,
33 AC_HELP_STRING([--with-automake],
34 [use a different automake for regeneration of Makefiles]),
35 [
36 unset AUTOMAKE
37 AM_MISSING_PROG(AUTOMAKE, ${withval})
38 AC_MSG_NOTICE([Using $AUTOMAKE as automake])
39 ])
40
41 dnl allow for different aclocal version
42 AC_ARG_WITH(aclocal,
43 AC_HELP_STRING([--with-aclocal],
44 [use a different aclocal for regeneration of Makefiles]),
45 [
46 unset ACLOCAL
47 AM_MISSING_PROG(ACLOCAL, ${withval})
48 AC_MSG_NOTICE([Using $ACLOCAL as aclocal])
49 ])
50])
diff --git a/m4/check-libheader.m4 b/m4/check-libheader.m4
new file mode 100644
index 000000000..1e24d8a97
--- /dev/null
+++ b/m4/check-libheader.m4
@@ -0,0 +1,40 @@
1dnl
2dnl CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME,
3dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
4dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS)
5dnl
6dnl FEATURE-NAME - feature name; library and header files are treated
7dnl as feature, which we look for
8dnl LIB-NAME - library name as in AC_CHECK_LIB macro
9dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro
10dnl HEADER-NAME - header file name as in AC_CHECK_HEADER
11dnl ACTION-IF-FOUND - when feature is found then execute given action
12dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
13dnl EXTRA-LDFLAGS - extra linker flags (-L or -l)
14dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include
15dnl
16dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1.
17dnl
18AC_DEFUN([CHECK_LIBHEADER],
19[
20 AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7])
21 check_libheader_feature_name=translit([$1], A-Z, a-z)
22
23 if test "x$HAVE_[$1]" = "xyes"; then
24 check_libheader_save_CPPFLAGS=$CPPFLAGS
25 CPPFLAGS="[$8] $CPPFLAGS"
26 AC_CHECK_HEADER([$4], :, HAVE_[$1]=no)
27 CPPFLAGS=$check_libheader_save_CPPFLAGS
28 fi
29
30 if test "x$HAVE_[$1]" = "xyes"; then
31 ifelse([$5], , :, [$5])
32 AC_MSG_NOTICE($check_libheader_feature_name was found)
33 else
34 ifelse([$6], , :, [$6])
35 AC_MSG_WARN($check_libheader_feature_name not found)
36 fi
37 AC_SUBST(HAVE_[$1])
38]
39)
40