forked from crass/megatools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
114 lines (91 loc) · 3.36 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
AC_PREREQ(2.60)
AC_INIT([megatools],[1.9.92],[megous@megous.com],[megatools])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([foreign -Wno-portability])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_CC
AM_PROG_CC_C_O
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_HEADER_STDC
# Before making a release, the version string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
LIB_MEGA_VERSION=0:0:0
AC_SUBST(LIB_MEGA_VERSION)
# Define requirements
GLIB_VERSION="2.32.0"
GOBJECT_INTROSPECTION_VERSION="1.30"
NETTLE_REQUIRES="nettle >= 2.5 hogweed >= 2.5"
FUSE_REQUIRES="fuse"
MEGA_REQUIRES="gio-2.0 >= $GLIB_VERSION $NETTLE_REQUIRES"
# for libmega.pc
AC_SUBST(MEGA_REQUIRES)
# check for glib/gio
AM_PATH_GLIB_2_0([$GLIB_VERSION],,AC_MSG_ERROR([Glib $GLIB_VERSION or later is required to build megatools]),[gobject gio])
GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
AC_SUBST(GLIB_MAKEFILE)
# check gobject-introspection
AS_IF([test "x$enable_shared" = "xyes"], [
GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_VERSION])
], [
AM_CONDITIONAL([HAVE_INTROSPECTION], [false])
])
# check for gmp
AC_CHECK_LIB(gmp,__gmpz_init,, [AC_MSG_ERROR([GNU MP not found, see http://swox.com/gmp])])
# check nettle
PKG_CHECK_MODULES(NETTLE, [$NETTLE_REQUIRES])
AC_SUBST(NETTLE_CFLAGS)
AC_SUBST(NETTLE_LIBS)
# check fuse
PKG_CHECK_MODULES(FUSE, [$FUSE_REQUIRES], [enable_fuse=yes], [enable_fuse=no])
AM_CONDITIONAL([ENABLE_FUSE], [test x$enable_fuse = xyes])
AC_SUBST(FUSE_CFLAGS)
AC_SUBST(FUSE_LIBS)
# check if we can build tests
PKG_CHECK_MODULES(GLIBTESTS, [glib-2.0 >= 2.34.0], [enable_tests=yes], [enable_tests=no])
AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes])
# enable dev compiler warnings
AC_ARG_ENABLE([warnings], AC_HELP_STRING([--enable-warnings], [Build with compiler warnings enabled.]))
AS_IF([test "x$enable_warnings" = "xyes"], [
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-local-typedefs -Wno-sign-compare -Wno-pointer-sign -Wno-missing-field-initializers"
AS_IF([$CC --version | head -n1 | grep '(GCC) 4\.8' &>/dev/null], [CFLAGS="$CFLAGS -Wno-unused-local-typedefs"])
], [
CFLAGS="$CFLAGS -Wno-pointer-sign -Wno-unused-variable"
enable_warnings=no
])
# enable docs building
AC_ARG_ENABLE([docs-build], AC_HELP_STRING([--enable-docs-build], [Build man pages instead of using bundled ones.]))
AM_CONDITIONAL([ENABLE_DOCS_BUILD], [test "x$enable_docs_build" = xyes])
AS_IF([test "x$enable_docs_build" = "xyes"], [
AC_PATH_PROG([A2X], [a2x], [no])
AS_IF([test "x$A2X" = xno], [
AC_MSG_ERROR([a2x is required to build docs, install asciidoc])
])
], [enable_docs_build=no])
AC_CONFIG_FILES([
Makefile
libmega.pc
sjson/Makefile
mega/Makefile
tools/Makefile
tests/Makefile
docs/Makefile
])
AC_OUTPUT
cat << EOF
Configured features:
docs build: $enable_docs_build
warnings: $enable_warnings
megafs: $enable_fuse (requires fuse)
tests: $enable_tests (requires glib-2.0 >= 2.34.0)
Run make now.
NOTE: On FreeBSD, you need to use GNU make (gmake)
EOF