configure.ac 7.07 KB
Newer Older
1
2
3
# Copyright (C) 2015 Richard Hughes <richard@hughsie.com>
AC_PREREQ(2.63)

4
5
m4_define([fwupd_major_version], [0])
m4_define([fwupd_minor_version], [1])
6
m4_define([fwupd_micro_version], [6])
7
8
9
10
m4_define([fwupd_version],
          [fwupd_major_version.fwupd_minor_version.fwupd_micro_version])

AC_INIT([fwupd],[fwupd_version],[https://github.com/hughsie/fwupd])
11
12
13
14
15
16
17
18
19
20
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar foreign])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LIBTOOL

m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [GOBJECT_INTROSPECTION_CHECK([0.9.8])])
AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = xyes)
GLIB_GSETTINGS

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# use this in fu-version.h
FWUPD_MAJOR_VERSION=fwupd_major_version
FWUPD_MINOR_VERSION=fwupd_minor_version
FWUPD_MICRO_VERSION=fwupd_micro_version
AC_SUBST(VERSION)
AC_SUBST(FWUPD_MAJOR_VERSION)
AC_SUBST(FWUPD_MINOR_VERSION)
AC_SUBST(FWUPD_MICRO_VERSION)

# libtool versioning - this applies to libfwupd
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
# increment;
# CURRENT	If the API or ABI interface has changed (reset REVISION to 0)
# REVISION	If the API and ABI remains the same, but bugs are fixed.
# AGE		Don't use.
LT_CURRENT=1
Richard Hughes's avatar
Richard Hughes committed
39
LT_REVISION=1
40
41
42
43
44
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

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
115
116
117
118
119
120
# enable nice build output on automake1.11
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

AS_ALL_LINGUAS
AC_PROG_CC
AC_PROG_INSTALL
LT_INIT
AM_PROG_CC_C_O
IT_PROG_INTLTOOL([0.35.0])
AC_PATH_PROG(XSLTPROC, xsltproc)

dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------

if test "$GCC" = "yes"; then
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wuninitialized"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
else
	WARNINGFLAGS_C=""
fi
AC_SUBST(WARNINGFLAGS_C)

dnl ---------------------------------------------------------------------------
dnl - gettext stuff
dnl ---------------------------------------------------------------------------
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])

GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [foo])

# check for PIE (position independent executable) support
if test x$with_pic != xno; then
	AX_CHECK_COMPILE_FLAG([-fPIE],
			      [AX_CHECK_LINK_FLAG([-fPIE -pie],
						  [PIE_CFLAGS="-fPIE" PIE_LDFLAGS="-pie"])])
	AC_SUBST(PIE_CFLAGS)
	AC_SUBST(PIE_LDFLAGS)
fi

# check for full RELRO (relocation read-only) support
AX_CHECK_LINK_FLAG([-Wl,-z,relro,-z,now],
		   [RELRO_LDFLAGS="-Wl,-z,relro,-z,now"])
AC_SUBST([RELRO_LDFLAGS])

dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.36.0 gobject-2.0 gthread-2.0 gio-2.0 >= 2.25.9 gio-unix-2.0)
PKG_CHECK_MODULES(GUDEV, gudev-1.0)
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= 0.103)
121
PKG_CHECK_MODULES(GCAB, libgcab-1.0)
122
PKG_CHECK_MODULES(APPSTREAM_GLIB, appstream-glib >= 0.5.0)
123
PKG_CHECK_MODULES(GUSB, gusb >= 0.2.2)
124
PKG_CHECK_MODULES(SQLITE, sqlite3)
125
PKG_CHECK_MODULES(ARCHIVE, libarchive)
126
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42)
127
128
AC_PATH_PROG(DOCBOOK2MAN, docbook2man)

129
130
131
132
133
AC_PATH_PROG(GCAB, [gcab], [no])
if test x$GCAB = "xno" ; then
	AC_MSG_ERROR([gcab program not found])
fi

134
135
136
137
# ColorHug support
AC_ARG_ENABLE(colorhug, AS_HELP_STRING([--enable-colorhug],[Enable ColorHug support]),
	      enable_colorhug=$enableval, enable_colorhug=yes)
if test x$enable_colorhug != xno; then
138
	PKG_CHECK_MODULES(COLORHUG, colorhug >= 1.2.9)
139
140
141
142
	AC_DEFINE(HAVE_COLORHUG,1,[Use ColorHug support])
fi
AM_CONDITIONAL(HAVE_COLORHUG, test x$enable_colorhug = xyes)

143
144
145
146
147
148
149
150
151
152
153
154
155
156
# gpgme support
AC_MSG_CHECKING([for gpgme])
if ! test -x "/usr/bin/gpgme-config"; then
	AC_MSG_ERROR([Cannot locate gpgme])
else
	AC_MSG_RESULT([yes])
	GPGME_CFLAGS="`\"/usr/bin/gpgme-config\" --cflags`"
	GPGME_LIBS="`\"/usr/bin/gpgme-config\" --libs`"
	GPGME_CFLAGS+=" `\"/usr/bin/gpg-error-config\" --cflags`"
	GPGME_LIBS+=" `\"/usr/bin/gpg-error-config\" --libs`"
	AC_SUBST([GPGME_CFLAGS])
	AC_SUBST([GPGME_LIBS])
fi

157
# UEFI support
158
AC_ARG_ENABLE(uefi, AS_HELP_STRING([--enable-uefi],[Enable UEFI support]),
159
160
	      enable_uefi=$enableval, enable_uefi=yes)
if test x$enable_uefi != xno; then
161
	PKG_CHECK_MODULES(UEFI, fwup >= 0.5)
162
163
164
165
	AC_DEFINE(HAVE_UEFI,1,[Use ColorHug support])
fi
AM_CONDITIONAL(HAVE_UEFI, test x$enable_uefi = xyes)

Richard Hughes's avatar
Richard Hughes committed
166
# systemd support
167
168
AC_ARG_WITH([systemdunitdir],
            AS_HELP_STRING([--with-systemdunitdir=DIR], [Directory for systemd service files]),
Richard Hughes's avatar
Richard Hughes committed
169
            [],
170
171
            [with_systemdunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
AC_SUBST([systemdunitdir], [$with_systemdunitdir])
Richard Hughes's avatar
Richard Hughes committed
172

Richard Hughes's avatar
Richard Hughes committed
173
174
175
176
177
178
179
# udev rules
AC_ARG_WITH([udevrulesdir],
            AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules files]),
            [],
            [with_udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)/rules.d])
AC_SUBST([udevrulesdir], [$with_udevrulesdir])

180
181
182
183
184
dnl ---------------------------------------------------------------------------
dnl - Makefiles, etc.
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES([
Makefile
185
186
187
libfwupd/fwupd-version.h
libfwupd/fwupd.pc
libfwupd/Makefile
188
data/Makefile
189
data/pki/Makefile
190
data/tests/Makefile
191
data/tests/rpiupdate/Makefile
192
data/tests/colorhug/Makefile
193
194
docs/Makefile
docs/man/Makefile
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
policy/Makefile
po/Makefile.in
src/Makefile
])
AC_OUTPUT

dnl ==========================================================================
echo "
                    fwupd $VERSION
                  =================

        prefix:                    ${prefix}
        datadir:                   ${datadir}
        compiler:                  ${CC}
        cflags:                    ${CFLAGS}
        cppflags:                  ${CPPFLAGS}
"