-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
286 lines (250 loc) · 11.6 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
AC_PREREQ([2.63])
m4_define([nma_major_version], [1])
m4_define([nma_minor_version], [10])
m4_define([nma_micro_version], [6])
m4_define([nma_version],
[nma_major_version.nma_minor_version.nma_micro_version])
AC_INIT([libnma],
[nma_version],
[https://gitlab.gnome.org/GNOME/libnma/issues],
[libnma])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz -Wno-portability])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
NMA_MAJOR_VERSION=nma_major_version
NMA_MINOR_VERSION=nma_minor_version
NMA_MICRO_VERSION=nma_micro_version
NMA_VERSION=nma_version
AC_SUBST(NMA_MAJOR_VERSION)
AC_SUBST(NMA_MINOR_VERSION)
AC_SUBST(NMA_MICRO_VERSION)
AC_SUBST(NMA_VERSION)
dnl
dnl Require programs
dnl
AC_PROG_CC
AM_PROG_CC_C_O
PKG_PROG_PKG_CONFIG
AC_CHECK_PROG([has_file], file, yes, no)
if test x$has_file = xno ; then
AC_MSG_ERROR(["file" utility not found.])
fi
AC_CHECK_PROG([has_find], find, yes, no)
if test x$has_find = xno ; then
AC_MSG_ERROR(["find" utility not found.])
fi
dnl Define _GNU_SOURCE for various things like strcasestr()
AC_USE_SYSTEM_EXTENSIONS
dnl Initialize libtool
LT_PREREQ([2.2.6])
LT_INIT
GIT_SHA_RECORD(NMA_GIT_SHA)
dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_TYPE_PID_T
dnl
dnl translation support
dnl
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18])
GETTEXT_PACKAGE=libnma
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
# Check for iso-codes for country names translation
AC_MSG_CHECKING([whether to disable iso-codes at build-time])
AC_ARG_ENABLE([iso-codes],
AS_HELP_STRING([--disable-iso-codes],[do not check for iso-codes at build-time]),
[],[disable_iso_codes_check=no])
if test x$disable_iso_codes_check = xno ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
if test x$disable_iso_codes_check = "xno" ; then
AC_MSG_CHECKING([whether iso-codes has iso_3166 domain])
if $PKG_CONFIG --variable=domains iso-codes | grep iso_3166 >/dev/null ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_DEFINE_UNQUOTED([ISO_CODES_DATADIR],["`$PKG_CONFIG --variable=prefix iso-codes`/share"],[ISO codes data directory])
PKG_CHECK_MODULES(ISO_CODES, [iso-codes],
[],
[echo -e "\n$ISO_CODES_PKG_ERRORS.\n"
echo "Consider installing the package or adjusting the PKG_CONFIG_PATH environment variable."
echo "You can also disable build-time check for 'iso-codes' via --disable-iso-codes";
exit 1;])
else
AC_DEFINE_UNQUOTED([ISO_CODES_DATADIR],["$datadir"],[ISO codes data directory])
fi
# Check for mobile-broadband-provider-info for Mobile Broadband wizard
AC_MSG_CHECKING([whether to disable mobile-broadband-provider-info at build-time])
AC_ARG_ENABLE([mobile-broadband-provider-info],
AS_HELP_STRING([--disable-mobile-broadband-provider-info],[do not check for mobile-broadband-provider-info at build-time]),
[],[disable_mobile_broadband_provider_info_check=no])
if test x$disable_mobile_broadband_provider_info_check = xno ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
if test x$disable_mobile_broadband_provider_info_check = "xno" ; then
AC_DEFINE_UNQUOTED([MOBILE_BROADBAND_PROVIDER_INFO_DATABASE],["`$PKG_CONFIG --variable=database mobile-broadband-provider-info`"],[Mobile Broadband Service Provider Information Database location])
PKG_CHECK_MODULES(MOBILE_BROADBAND_PROVIDER_INFO, [mobile-broadband-provider-info],
[],
[echo -e "\n$MOBILE_BROADBAND_PROVIDER_INFO_PKG_ERRORS.\n"
echo "Consider installing the package or adjusting the PKG_CONFIG_PATH environment variable."
echo "You can also disable build-time check for 'mobile-broadband-provider-info' via --disable-mobile-broadband-provider-info";
exit 1;])
else
AC_DEFINE_UNQUOTED([MOBILE_BROADBAND_PROVIDER_INFO_DATABASE],["$datadir/mobile-broadband-provider-info/serviceproviders.xml"],[Mobile Broadband Service Provider Information Database location])
fi
dnl
dnl API documentation
dnl
GTK_DOC_CHECK(1.0)
PKG_CHECK_MODULES(LIBNM, [libnm >= 1.7 gio-2.0 >= 2.38 gmodule-export-2.0])
LIBNM_CFLAGS="$LIBNM_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_8"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_8"
PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.12)
GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_12 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_12"
AC_ARG_WITH(libnma-gtk4, AS_HELP_STRING([--with-libnma-gtk4], [build libnma-gtk4 library for use with GTK4]))
if test "$with_libnma_gtk4" == yes; then
PKG_CHECK_MODULES(GTK4, gtk4 >= 4.0)
GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_0"
else
with_libnma_gtk4=no
fi
AM_CONDITIONAL(WITH_LIBNMA_GTK4, test "$with_libnma_gtk4" != "no")
# Probe if a particular variant of GCR is good enough for us
AC_DEFUN([CHECK_GCR], [
PKG_CHECK_MODULES([$1], [$2], [
[$1]_CFLAGS="$[$1]_CFLAGS -DGCR_API_SUBJECT_TO_CHANGE -DGCK_API_SUBJECT_TO_CHANGE"
dnl GCR API is declared subject to change, do an extensive check of the prototypes
CFLAGS_SAVED="$CFLAGS"
CFLAGS="$CFLAGS $[$1]_CFLAGS"
AC_MSG_CHECKING([for $1 usefulness])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <gck/gck.h>
#if GCK_CHECK_VERSION(3,90,0)
#include <gcr/gcr.h>
#else
#include <gcr/gcr-base.h>
#endif
const GckAttribute *gck_attributes_find (GckAttributes *attrs, gulong attr_type);
gboolean gck_attributes_find_string (GckAttributes *attrs, gulong attr_type, gchar **value);
gboolean gck_attributes_find_ulong (GckAttributes *attrs, gulong attr_type, gulong *value);
GckAttributes *gck_attributes_new_empty (gulong first_type, ...);
void gck_attributes_unref (gpointer attrs);
void gck_builder_add_all (GckBuilder *builder, GckAttributes *attrs);
void gck_builder_add_only (GckBuilder *builder, GckAttributes *attrs, gulong only_type, ...);
GckAttributes *gck_builder_end (GckBuilder *builder);
GckBuilder *gck_builder_new (GckBuilderFlags flags);
void gck_enumerator_next_async (GckEnumerator *self, gint max_objects, GCancellable *cancellable,
GAsyncReadyCallback callback, gpointer user_data);
GList *gck_enumerator_next_finish (GckEnumerator *self, GAsyncResult *result, GError **error);
GList *gck_modules_get_slots (GList *modules, gboolean token_present);
void gck_modules_initialize_registered_async (GCancellable *cancellable, GAsyncReadyCallback callback,
gpointer user_data);
GList *gck_modules_initialize_registered_finish (GAsyncResult *result, GError **error);
void gck_object_get_async (GckObject *self, const gulong *attr_types, guint n_attr_types,
GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
GckAttributes *gck_object_get_finish (GckObject *self, GAsyncResult *result, GError **error);
void gck_session_login_async (GckSession *self, gulong user_type, const guchar *pin,
gsize n_pin, GCancellable *cancellable,
GAsyncReadyCallback callback, gpointer user_data);
gboolean gck_session_login_finish (GckSession *self, GAsyncResult *result, GError **error);
GckSlotInfo *gck_slot_get_info (GckSlot *self);
GckTokenInfo *gck_slot_get_token_info (GckSlot *self);
#if GCR_CHECK_VERSION(3,90,0)
void gck_slot_open_session_async (GckSlot *self, GckSessionOptions options, GTlsInteraction *interaction,
GCancellable *cancellable, GAsyncReadyCallback callback,
gpointer user_data);
gchar *gck_uri_data_build (GckUriData *uri_data, GckUriFlags flags);
GckUriData *gck_uri_data_parse (const gchar *string, GckUriFlags flags, GError **error);
#else
void gck_slot_open_session_async (GckSlot *self, GckSessionOptions options, GCancellable *cancellable,
GAsyncReadyCallback callback, gpointer user_data);
gchar *gck_uri_build (GckUriData *uri_data, GckUriFlags flags);
GckUriData *gck_uri_parse (const gchar *string, GckUriFlags flags, GError **error);
#endif
GckSession *gck_slot_open_session_finish (GckSlot *self, GAsyncResult *result, GError **error);
void gck_token_info_free (GckTokenInfo *token_info);
void gck_uri_data_free (GckUriData *uri_data);
gchar *gcr_certificate_get_issuer_name (GcrCertificate *self);
gchar *gcr_certificate_get_subject_name (GcrCertificate *self);
GcrCertificate *gcr_simple_certificate_new (const guchar *data, gsize n_data);
])],
AC_MSG_RESULT(good)
[$3],
AC_MSG_RESULT(bad)
[$4])
CFLAGS="$CFLAGS_SAVED"
], [$4])
])
dnl GCR for PKCS#11 enabled certificate chooser
AC_ARG_WITH(gcr, AS_HELP_STRING([--with-gcr], [Enable advanced certificate chooser (default: auto)]))
if (test "${with_gcr}" == "no"); then
have_gcr=no
else
CHECK_GCR(GCR, [gcr-4 >= 3.92, gck-2 >= 3.92], have_gcr=yes,
[CHECK_GCR(GCR, [gcr-base-3 >= 3.14, gck-1 >= 3.14], have_gcr=yes, have_gcr=no)])
fi
if (test "${have_gcr}" == "yes"); then
AC_DEFINE(WITH_GCR, 1, [Define if Gcr is available for Gtk3])
else
if (test "${with_gcr}" == "yes"); then
AC_MSG_ERROR([gcr support was requested, but the gcr library is not available.])
fi
AC_DEFINE(WITH_GCR, 0, [Define if Gcr is available for Gtk3])
fi
AM_CONDITIONAL(WITH_GCR, test "${have_gcr}" == "yes")
dnl Check for gobject introspection
GOBJECT_INTROSPECTION_CHECK([0.9.6])
dnl Check for VAPI generator
VAPIGEN_CHECK(0.17.1.24)
GLIB_GSETTINGS
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
NM_COMPILER_WARNINGS(CFLAGS, [yes])
NM_LTO
NM_LD_GC
# Disable extra compiler warning until GTK4 doesn't trigger it via graphene
# https://github.com/ebassi/graphene/issues/134
if test "$with_libnma_gtk4" == yes; then
_CFLAGS_SAVED="$CFLAGS"
CFLAGS="$CFLAGS $GTK4_CFLAGS"
NM_COMPILER_WARNING([_CFLAGS], [float-equal], [#include <gtk/gtk.h>])
CFLAGS="$_CFLAGS_SAVED $_CFLAGS"
fi
AC_ARG_WITH(more-asserts,
AS_HELP_STRING([--with-more-asserts=level], [Enable more assertions for debugging (default: 0)]),
[more_asserts=${with_more_asserts}],
[more_asserts=no])
if test "${more_asserts}" = "no"; then
more_asserts=0
else
if test "${more_asserts}" = "yes"; then
more_asserts=100
fi
fi
AC_DEFINE_UNQUOTED(NM_MORE_ASSERTS, $more_asserts, [Define if more asserts are enabled])
AC_CONFIG_FILES([
Makefile
org.gnome.nm-applet.gschema.xml
org.gnome.nm-applet.eap.gschema.xml
po/Makefile.in
src/libnma-gtk4.pc
src/libnma.pc
src/nma-version.h
])
AC_OUTPUT
echo ""
echo " Build libnma-gtk4 library for use with GTK4: --with-libnma-gtk4=${with_libnma_gtk4}"
echo " GCR: --with-gcr=$have_gcr"
echo " LTO: --enable-lto=$enable_lto"
echo " Linker garbage collection: --enable-ld-gc=$enable_ld_gc"
echo ""