diff options
-rw-r--r-- | contrib/Makefile.am | 4 | ||||
-rw-r--r-- | contrib/gnunet.m4 | 63 |
2 files changed, 67 insertions, 0 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index f42fb684d..150e47ff0 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -53,6 +53,7 @@ EXTRA_DIST = \ | |||
53 | conf/gnunet/gnunet-user.conf \ | 53 | conf/gnunet/gnunet-user.conf \ |
54 | conf/nss/nssswitch.conf \ | 54 | conf/nss/nssswitch.conf \ |
55 | conf/wireshark/wireshark.lua \ | 55 | conf/wireshark/wireshark.lua \ |
56 | gnunet.m4 \ | ||
56 | $(PACKAGES_FILES) \ | 57 | $(PACKAGES_FILES) \ |
57 | $(INITD_FILES) \ | 58 | $(INITD_FILES) \ |
58 | Makefile.inc \ | 59 | Makefile.inc \ |
@@ -77,3 +78,6 @@ test_gnunet_prefix_LDADD = \ | |||
77 | $(LTLIBICONV) \ | 78 | $(LTLIBICONV) \ |
78 | $(GN_LIBINTL) \ | 79 | $(GN_LIBINTL) \ |
79 | $(LIBLTDL) -lunistring $(XLIB) | 80 | $(LIBLTDL) -lunistring $(XLIB) |
81 | |||
82 | aclocaldir = $(datadir)/aclocal | ||
83 | aclocal_DATA = gnunet.m4 | ||
diff --git a/contrib/gnunet.m4 b/contrib/gnunet.m4 new file mode 100644 index 000000000..fe70fbde1 --- /dev/null +++ b/contrib/gnunet.m4 | |||
@@ -0,0 +1,63 @@ | |||
1 | # Autoconf macro for working with GNUnet | ||
2 | # This file is in the public domain. | ||
3 | # | ||
4 | # AM_PATH_GNUNET([MINIMUM-VERSION = 0.14.2, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) | ||
5 | # Find the GNUnet installation, either automatically or through the | ||
6 | # --with-gnunet-prefix flag | ||
7 | # | ||
8 | # This macro runs the pkg-config and, if needed, the gnunet-config tool | ||
9 | # provided by GNUnet itself. | ||
10 | # | ||
11 | # The gnunet-config tool can be overridden by setting the GNUNET_CONFIG | ||
12 | # variable before executing the configure script. | ||
13 | # | ||
14 | # The variables GNUNET_CFLAGS and GNUNET_LIBS will be set to appropriate | ||
15 | # values and are made available to Automake. | ||
16 | AC_DEFUN([AM_PATH_GNUNET], | ||
17 | [AC_ARG_WITH([gnunet-prefix], | ||
18 | [AS_HELP_STRING([--with-gnunet-prefix=PATH], | ||
19 | [PATH to the GNUnet installation])], | ||
20 | [gnunet_prefix="$withval"], | ||
21 | [gnunet_prefix=""]) | ||
22 | AC_ARG_VAR([GNUNET_CONFIG],[The gnunet-config tool]) | ||
23 | min_gnunet_version=m4_if([$1], ,0.14.2,$1) | ||
24 | # Make sure the specified version is at least the version with | ||
25 | # the features required to use this macro | ||
26 | AS_VERSION_COMPARE([$min_gnunet_version],[0.14.2], | ||
27 | [AC_MSG_WARN([The specified GNUnet version $min_gnunet_version is too old.]) | ||
28 | AC_MSG_WARN([The minimum version has been set to 0.14.2]) | ||
29 | min_gnunet_version="0.14.2"]) | ||
30 | AS_IF([test "x${GNUNET_CONFIG+set}" != "xset"], | ||
31 | [PKG_CHECK_MODULES([GNUNET],[gnunetutil >= $min_gnunet_version], | ||
32 | [gnunet_pkgconfig=yes],[gnunet_pkgconfig=no]) | ||
33 | AS_IF([test "x$gnunet_pkgconfig" = "xno" && test "x$gnunet_prefix" != "x"], | ||
34 | [gnunet_PATH="$PATH" | ||
35 | AS_IF([test "x$prefix" != "xNONE"], | ||
36 | [gnunet_PATH="$prefix/bin${PATH_SEPARATOR}$prefix/usr/bin"]) | ||
37 | AC_PATH_PROG([GNUNET_CONFIG],[gnunet-config],[no],[$gnunet_PATH]) | ||
38 | AS_UNSET([gnunet_PATH])], | ||
39 | [GNUNET_CONFIG="pkg-config gnunetutil"])]) | ||
40 | AC_MSG_CHECKING([if GNUnet version is >= $min_gnunet_version]) | ||
41 | gnunet_result=no | ||
42 | AS_IF([test "x$GNUNET_CONFIG" != "xno" && test -n "$GNUNET_CONFIG"], | ||
43 | [gnunet_version=`$GNUNET_CONFIG --version | tr ' ' '\n' | sed -n '2p'` | ||
44 | AS_VERSION_COMPARE([$gnunet_version],[$min_gnunet_version], | ||
45 | [gnunet_result=no], | ||
46 | [gnunet_result=yes], | ||
47 | [gnunet_result=yes]) | ||
48 | AS_UNSET([gnunet_version])]) | ||
49 | AS_IF([test "x$gnunet_result" != "xyes"], | ||
50 | [AC_MSG_RESULT([no]) | ||
51 | m4_if([$3], ,:,[$3])], | ||
52 | [AC_MSG_RESULT([yes]) | ||
53 | m4_if([$2], ,:,[$2]) | ||
54 | AC_CHECK_HEADERS([sys/socket.h netinet/in.h byteswap.h]) | ||
55 | AS_IF([test "x${GNUNET_CFLAGS+set}" != "xset"], | ||
56 | [GNUNET_CFLAGS=`$GNUNET_CONFIG --cflags` | ||
57 | AC_SUBST([GNUNET_CFLAGS])]) | ||
58 | AS_IF([test "x${GNUNET_LIBS+set}" != "xset"], | ||
59 | [GNUNET_LIBS=`$GNUNET_CONFIG --libs` | ||
60 | AC_SUBST([GNUNET_LIBS])])]) | ||
61 | AS_UNSET([gnunet_result]) | ||
62 | AS_UNSET([min_gnunet_version]) | ||
63 | ]) | ||