File: configure.ac

package info (click to toggle)
gtkhash 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,132 kB
  • sloc: ansic: 6,711; sh: 4,249; xml: 2,413; makefile: 392
file content (577 lines) | stat: -rw-r--r-- 16,963 bytes parent folder | download
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
AC_PREREQ([2.61])
AC_INIT([GtkHash], [1.2])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 check-news dist-xz foreign subdir-objects])

AC_PROG_CC_C99
AM_PROG_CC_C_O
LT_INIT

GTKHASH_CFLAGS=""

for opt in \
	-Werror=unknown-warning-option \
	-Werror=implicit-function-declaration \
	-fno-common \
	-fvisibility=hidden \
	-pedantic \
	-Wall \
	-Wextra \
	-Waggregate-return \
	-Wbad-function-cast \
	-Wcast-align \
	-Winit-self \
	-Wfloat-equal \
	-Wlogical-op \
	-Wmissing-declarations \
	-Wmissing-noreturn \
	-Wredundant-decls \
	-Wshadow \
	-Wswitch-default \
	-Wwrite-strings \
	-Wno-parentheses-equality
do
	AC_MSG_CHECKING([whether ${CC} accepts option ${opt}])
	ac_save_CFLAGS="${CFLAGS}"
	CFLAGS="${GTKHASH_CFLAGS} ${opt} ${CFLAGS}"
	AC_COMPILE_IFELSE(
		[AC_LANG_PROGRAM([], [])],
		[AC_MSG_RESULT([yes]) ; GTKHASH_CFLAGS="${GTKHASH_CFLAGS} ${opt}"],
		[AC_MSG_RESULT([no])])
	CFLAGS="${ac_save_CFLAGS}"
done

AC_SUBST([GTKHASH_CFLAGS])

# check for pkg-config
PKG_PROG_PKG_CONFIG

# check for glib/gio {{{
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.36])
AC_SUBST([GLIB_CFLAGS])
AC_SUBST([GLIB_LIBS])

PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36])
AC_SUBST([GIO_CFLAGS])
AC_SUBST([GIO_LIBS])

m4_ifdef([PKG_CHECK_VAR],
	[PKG_CHECK_VAR([GLIB_COMPILE_RESOURCES], [gio-2.0], [glib_compile_resources])],
	[AC_CHECK_PROGS([GLIB_COMPILE_RESOURCES], [glib-compile-resources])])
AC_SUBST([GLIB_COMPILE_RESOURCES])

GLIB_GSETTINGS
# }}}

# check for gtk+ {{{
AC_MSG_CHECKING([which GTK+ version to use])
AC_ARG_WITH([gtk],
	[AS_HELP_STRING([--with-gtk=2.0|3.0], [GTK+ version to use [default=3.0]])],
	[with_gtk="${withval}"], [with_gtk="3.0"])
AC_MSG_RESULT([${with_gtk}])

PKG_CHECK_MODULES([GTK], ["gtk+-${with_gtk}" >= 2.24])
AC_SUBST([GTK_CFLAGS])
AC_SUBST([GTK_LIBS])

AM_CONDITIONAL([WITH_GTK2], [test "${with_gtk}" = "2.0"])
AM_CONDITIONAL([WITH_GTK3], [test "${with_gtk}" = "3.0"])
# }}}

# debug option {{{
AC_MSG_CHECKING([whether to enable debugging])
AC_ARG_ENABLE([debug],
	[AS_HELP_STRING([--enable-debug], [enable debugging])],
	[enable_debug="${enableval}"], [enable_debug="no"])
AC_MSG_RESULT([${enable_debug}])

if test "${enable_debug}" = "yes" ; then
	AC_DEFINE([G_DISABLE_DEPRECATED], [1], [disable glib deprecated])
	AC_DEFINE([GDK_DISABLE_DEPRECATED], [1], [disable gdk deprecated])
	AC_DEFINE([GTK_DISABLE_DEPRECATED], [1], [disable gtk+ deprecated])
else
	AC_DEFINE([G_DISABLE_ASSERT], [1], [disable glib assert])
	AC_DEFINE([G_DISABLE_CAST_CHECKS], [1], [disable glib cast checks])
fi
# }}}

# blake2 option {{{
AC_MSG_CHECKING([whether to use libb2])
AC_ARG_ENABLE([blake2],
	[AS_HELP_STRING([--disable-blake2], [do not use libb2])],
	[enable_blake2="${enableval}"], [enable_blake2="yes"])
AC_MSG_RESULT([${enable_blake2}])
AM_CONDITIONAL([ENABLE_BLAKE2], [test "${enable_blake2}" = "yes"])
AC_DEFINE([ENABLE_BLAKE2], [0], [Use libb2])

if test "${enable_blake2}" = "yes" ; then
	AC_CHECK_HEADER([blake2.h], [:], [AC_MSG_ERROR([blake2 header not found])])
	AC_CHECK_LIB([b2], [blake2sp_init], [:], [AC_MSG_ERROR([blake2 library not found])])
	BLAKE2_LIBS="-lb2"
	AC_SUBST([BLAKE2_LIBS])
	AC_DEFINE([ENABLE_BLAKE2], [1])
fi
# }}}

# gcrypt option {{{
AC_MSG_CHECKING([whether to use Libgcrypt])
AC_ARG_ENABLE([gcrypt],
	[AS_HELP_STRING([--disable-gcrypt], [do not use Libgcrypt])],
	[enable_gcrypt="${enableval}"], [enable_gcrypt="yes"])
AC_MSG_RESULT([${enable_gcrypt}])
AM_CONDITIONAL([ENABLE_GCRYPT], [test "${enable_gcrypt}" = "yes"])
AC_DEFINE([ENABLE_GCRYPT], [0], [Use Libgcrypt])

gcrypt_funcs=

HASH_LIB_GCRYPT_MIN_VER="1.6.0"
AC_DEFINE_UNQUOTED([HASH_LIB_GCRYPT_MIN_VER], ["${HASH_LIB_GCRYPT_MIN_VER}"], [required gcrypt version])

if test "${enable_gcrypt}" = "yes" ; then
	AM_PATH_LIBGCRYPT(["${HASH_LIB_GCRYPT_MIN_VER}"], [:], [AC_MSG_ERROR([Libgcrypt not found])])
	AC_DEFINE([ENABLE_GCRYPT], [1])

	ac_save_CFLAGS="${CFLAGS}"
	CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS} ${LIBGCRYPT_LIBS}"

	AC_CHECK_DECL([GCRY_MD_BLAKE2B_512],
		[gcrypt_funcs="${gcrypt_funcs} BLAKE2b BLAKE2s"], [:],
		[#include <gcrypt.h>])
	AC_CHECK_DECL([GCRY_MD_SHA3_512],
		[gcrypt_funcs="${gcrypt_funcs} SHA3-224 SHA3-256 SHA3-384 SHA3-512"], [:],
		[#include <gcrypt.h>])

	CFLAGS="${ac_save_CFLAGS}"
fi
# }}}

# glib checksums option {{{
AC_MSG_CHECKING([whether to use the Glib Data Checksums API])
AC_ARG_ENABLE([glib-checksums],
	[AS_HELP_STRING([--enable-glib-checksums], [use the Glib Data Checksums API])],
	[enable_glib_checksums="${enableval}"], [enable_glib_checksums="no"])
AC_MSG_RESULT([${enable_glib_checksums}])
AM_CONDITIONAL([ENABLE_GLIB_CHECKSUMS], [test "${enable_glib_checksums}" = "yes"])
AC_DEFINE([ENABLE_GLIB_CHECKSUMS], [0], [Use Glib Checksums])

if test "${enable_glib_checksums}" = "yes" ; then
	AC_DEFINE([ENABLE_GLIB_CHECKSUMS], [1])
fi
# }}}


# internal md6 option {{{
AC_MSG_CHECKING([whether to use the internal MD6 library])
AC_ARG_ENABLE([internal-md6],
	[AS_HELP_STRING([--disable-internal-md6], [do not use the internal MD6 library])],
	[enable_internal_md6="${enableval}"], [enable_internal_md6="yes"])
AC_MSG_RESULT([${enable_internal_md6}])
AM_CONDITIONAL([ENABLE_MD6], [test "${enable_internal_md6}" = "yes"])
AC_DEFINE([ENABLE_MD6], [0], [Use MD6])

if test "${enable_internal_md6}" = "yes" ; then
	AC_DEFINE([ENABLE_MD6], [1])
fi
# }}}

# libcrypto (openssl) option {{{
AC_MSG_CHECKING([whether to use OpenSSL libcrypto])
AC_ARG_ENABLE([libcrypto],
	[AS_HELP_STRING([--enable-libcrypto], [use libcrypto])],
	[enable_libcrypto="${enableval}"], [enable_libcrypto="no"])
AC_MSG_RESULT([${enable_libcrypto}])
AM_CONDITIONAL([ENABLE_LIBCRYPTO], [test "${enable_libcrypto}" = "yes"])
AC_DEFINE([ENABLE_LIBCRYPTO], [0], [Use libcrypto])

if test "${enable_libcrypto}" = "yes" ; then
	PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto >= 1.1])
	AC_SUBST([LIBCRYPTO_CFLAGS])
	AC_SUBST([LIBCRYPTO_LIBS])
	AC_DEFINE([ENABLE_LIBCRYPTO], [1])
fi
# }}}

# linux crypto option {{{
AC_MSG_CHECKING([whether to use the Linux-2.6.38+ hash algorithm interface])
AC_ARG_ENABLE([linux-crypto],
	[AS_HELP_STRING([--enable-linux-crypto], [use the Linux-2.6.38+ hash algorithm interface])],
	[enable_linux_crypto="${enableval}"], [enable_linux_crypto="no"])
AC_MSG_RESULT([${enable_linux_crypto}])
AM_CONDITIONAL([ENABLE_LINUX_CRYPTO], [test "${enable_linux_crypto}" = "yes"])
AC_DEFINE([ENABLE_LINUX_CRYPTO], [0], [Use Linux Crypto])

if test "${enable_linux_crypto}" = "yes" ; then
	AC_CHECK_HEADER([linux/if_alg.h], [:], [AC_MSG_ERROR([linux/if_alg.h not found])])
	AC_DEFINE([ENABLE_LINUX_CRYPTO], [1])
fi
# }}}

# mbedtls option {{{
AC_MSG_CHECKING([whether to use mbed TLS])
AC_ARG_ENABLE([mbedtls],
	[AS_HELP_STRING([--enable-mbedtls], [use mbed TLS])],
	[enable_mbedtls="${enableval}"], [enable_mbedtls="no"])
AC_MSG_RESULT([${enable_mbedtls}])
AM_CONDITIONAL([ENABLE_MBEDTLS], [test "${enable_mbedtls}" = "yes"])
AC_DEFINE([ENABLE_MBEDTLS], [0], [Use mbed TLS])

if test "${enable_mbedtls}" = "yes" ; then
	AC_CHECK_HEADER([mbedtls/md.h], [:], [AC_MSG_ERROR([mbedtls headers not found])])
	AC_CHECK_LIB([mbedcrypto], [mbedtls_md_update], [:], [AC_MSG_ERROR([mbedtls library not found])])
	MBEDTLS_LIBS="-lmbedcrypto"
	AC_SUBST([MBEDTLS_LIBS])
	AC_DEFINE([ENABLE_MBEDTLS], [1])
fi
# }}}

# mhash option {{{
AC_MSG_CHECKING([whether to use the mhash library])
AC_ARG_ENABLE([mhash],
	[AS_HELP_STRING([--enable-mhash], [use the mhash library])],
	[enable_mhash="${enableval}"], [enable_mhash="no"])
AC_MSG_RESULT([${enable_mhash}])
AM_CONDITIONAL([ENABLE_MHASH], [test "${enable_mhash}" = "yes"])
AC_DEFINE([ENABLE_MHASH], [0], [Use mhash])

if test "${enable_mhash}" = "yes" ; then
	AC_CHECK_HEADER([mhash.h], [:], [AC_MSG_ERROR([mhash.h not found])])
	AC_CHECK_LIB([mhash], [mhash], [:], [AC_MSG_ERROR([mhash library not found])])
	MHASH_LIBS="-lmhash"
	AC_SUBST([MHASH_LIBS])
	AC_DEFINE([ENABLE_MHASH], [1])
fi
# }}}

# nettle option {{{
AC_MSG_CHECKING([whether to use Nettle])
AC_ARG_ENABLE([nettle],
	[AS_HELP_STRING([--enable-nettle], [use Nettle])],
	[enable_nettle="${enableval}"], [enable_nettle="no"])
AC_MSG_RESULT([${enable_nettle}])
AM_CONDITIONAL([ENABLE_NETTLE], [test "${enable_nettle}" = "yes"])
AC_DEFINE([ENABLE_NETTLE], [0], [Use Nettle])

if test "${enable_nettle}" = "yes" ; then
	PKG_CHECK_MODULES([NETTLE], [nettle])
	AC_SUBST([NETTLE_CFLAGS])
	AC_SUBST([NETTLE_LIBS])
	AC_DEFINE([ENABLE_NETTLE], [1])
fi
# }}}

# zlib option {{{
AC_MSG_CHECKING([whether to use zlib])
AC_ARG_ENABLE([zlib],
	[AS_HELP_STRING([--disable-zlib], [do not use zlib])],
	[enable_zlib="${enableval}"], [enable_zlib="yes"])
AC_MSG_RESULT([${enable_zlib}])
AM_CONDITIONAL([ENABLE_ZLIB], [test "${enable_zlib}" = "yes"])
AC_DEFINE([ENABLE_ZLIB], [0], [Use zlib])

if test "${enable_zlib}" = "yes" ; then
	PKG_CHECK_MODULES([ZLIB], [zlib])
	AC_SUBST([ZLIB_CFLAGS])
	AC_SUBST([ZLIB_LIBS])
	AC_DEFINE([ENABLE_ZLIB], [1])
fi
# }}}

AC_MSG_CHECKING([whether to build gtkhash binary])
AC_ARG_ENABLE([gtkhash],
	[AS_HELP_STRING([--disable-gtkhash], [do not build gtkhash binary])],
	[enable_gtkhash="${enableval}"], [enable_gtkhash="yes"])
AC_MSG_RESULT([${enable_gtkhash}])
AM_CONDITIONAL([ENABLE_GTKHASH], [test "${enable_gtkhash}" = "yes"])

# appstream option {{{
AC_MSG_CHECKING([whether to install AppStream metadata files])
AC_ARG_ENABLE([appstream],
	[AS_HELP_STRING([--disable-appstream], [do not install AppStream metadata files])],
	[enable_appstream="${enableval}"], [enable_appstream="yes"])
AC_MSG_RESULT([${enable_appstream}])
AM_CONDITIONAL([ENABLE_APPSTREAM], [test "${enable_appstream}" = "yes"])
# }}}

# caja option {{{
AC_MSG_CHECKING([whether to build the Caja extension])
AC_ARG_ENABLE([caja],
	[AS_HELP_STRING([--enable-caja], [build the Caja extension])],
	[enable_caja="${enableval}"], [enable_caja="no"])
AC_MSG_RESULT([${enable_caja}])
AM_CONDITIONAL([ENABLE_CAJA], [test "${enable_caja}" = "yes"])

if test "${enable_caja}" = "yes" ; then
	# Check for caja
	PKG_CHECK_MODULES([CAJA], [libcaja-extension])
	AC_SUBST([CAJA_CFLAGS])
	AC_SUBST([CAJA_LIBS])
	CAJA_EXTENSION_DIR=`${PKG_CONFIG} --variable=extensiondir libcaja-extension`
	AC_SUBST([CAJA_EXTENSION_DIR])
fi
# }}}

# nautilus option {{{
AC_MSG_CHECKING([whether to build the Nautilus extension])
AC_ARG_ENABLE([nautilus],
	[AS_HELP_STRING([--enable-nautilus], [build the Nautilus extension])],
	[enable_nautilus="${enableval}"], [enable_nautilus="no"])
AC_MSG_RESULT([${enable_nautilus}])
AM_CONDITIONAL([ENABLE_NAUTILUS], [test "${enable_nautilus}" = "yes"])

if test "${enable_nautilus}" = "yes" ; then
	# Check for nautilus
	PKG_CHECK_MODULES([NAUTILUS], [libnautilus-extension])
	AC_SUBST([NAUTILUS_CFLAGS])
	AC_SUBST([NAUTILUS_LIBS])
	NAUTILUS_EXTENSION_DIR=`${PKG_CONFIG} --variable=extensiondir libnautilus-extension`
	AC_SUBST([NAUTILUS_EXTENSION_DIR])
fi
# }}}

# nemo option {{{
AC_MSG_CHECKING([whether to build the Nemo extension])
AC_ARG_ENABLE([nemo],
	[AS_HELP_STRING([--enable-nemo], [build the Nemo extension])],
	[enable_nemo="${enableval}"], [enable_nemo="no"])
AC_MSG_RESULT([${enable_nemo}])
AM_CONDITIONAL([ENABLE_NEMO], [test "${enable_nemo}" = "yes"])

if test "${enable_nemo}" = "yes" ; then
	# Check for nemo
	PKG_CHECK_MODULES([NEMO], [libnemo-extension])
	AC_SUBST([NEMO_CFLAGS])
	AC_SUBST([NEMO_LIBS])
	NEMO_EXTENSION_DIR=`${PKG_CONFIG} --variable=extensiondir libnemo-extension`
	AC_SUBST([NEMO_EXTENSION_DIR])
fi
# }}}

# peony option {{{
AC_MSG_CHECKING([whether to build the Peony extension])
AC_ARG_ENABLE([peony],
	[AS_HELP_STRING([--enable-peony], [build the Peony extension])],
	[enable_peony="${enableval}"], [enable_peony="no"])
AC_MSG_RESULT([${enable_peony}])
AM_CONDITIONAL([ENABLE_PEONY], [test "${enable_peony}" = "yes"])

if test "${enable_peony}" = "yes" ; then
	# Check for peony
	PKG_CHECK_MODULES([PEONY], [libpeony-extension])
	AC_SUBST([PEONY_CFLAGS])
	AC_SUBST([PEONY_LIBS])
	PEONY_EXTENSION_DIR=`${PKG_CONFIG} --variable=extensiondir libpeony-extension`
	AC_SUBST([PEONY_EXTENSION_DIR])
fi
# }}}

# thunar option {{{
AC_MSG_CHECKING([whether to build the Thunar extension])
AC_ARG_ENABLE([thunar],
	[AS_HELP_STRING([--enable-thunar], [build the Thunar extension])],
	[enable_thunar="${enableval}"], [enable_thunar="no"])
AC_MSG_RESULT([${enable_thunar}])
AM_CONDITIONAL([ENABLE_THUNAR], [test "${enable_thunar}" = "yes"])

AC_MSG_CHECKING([which Thunarx version to use])
AC_ARG_WITH([thunarx],
	[AS_HELP_STRING([--with-thunarx=2|3], [Thunarx version to use [default=3]])],
	[with_thunar="${withval}"], [with_thunarx="3"])
AC_MSG_RESULT([${with_thunarx}])

if test "${enable_thunar}" = "yes" ; then
	# Check for thunar
	PKG_CHECK_MODULES([THUNAR], ["thunarx-${with_thunarx}"])
	AC_SUBST([THUNAR_CFLAGS])
	AC_SUBST([THUNAR_LIBS])
	THUNAR_EXTENSION_DIR=`${PKG_CONFIG} --variable=extensionsdir "thunarx-${with_thunarx}"`
	AC_SUBST([THUNAR_EXTENSION_DIR])
fi
# }}}

AM_CONDITIONAL([ENABLE_NAUTILUS_DATA], [
	test "${enable_caja}" = "yes" ||
	test "${enable_nautilus}" = "yes" ||
	test "${enable_nemo}" = "yes" ||
	test "${enable_peony}" = "yes" ||
	test "${enable_thunar}" = "yes"])

# nls option {{{
AM_CONDITIONAL([ENABLE_NLS], [test "${enable_nls}" != "no"])

if test "${enable_nls}" = "no" ; then
	AC_DEFINE([ENABLE_NLS], [0])
else
	GETTEXT_PACKAGE="${PACKAGE}"
	AC_SUBST([GETTEXT_PACKAGE])
	AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [Define the gettext package])
	IT_PROG_INTLTOOL([0.40.6])
	AM_GLIB_GNU_GETTEXT
fi
# }}}

AC_DEFINE_UNQUOTED([G_LOG_DOMAIN], ["${PACKAGE_NAME}"], [Define the Glib log domain])
AC_DEFINE([HASH_FILE_BUFFER_SIZE], [131072], [Define file read buffer size (bytes)])
AC_DEFINE([HASH_FILE_REPORT_INTERVAL], [166], [Define progress report interval (milliseconds)])

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([data/Makefile])
AC_CONFIG_FILES([data/appdata/Makefile])
AC_CONFIG_FILES([data/caja/Makefile])
AC_CONFIG_FILES([data/caja/libgtkhash-properties-caja.caja-extension.in])
AC_CONFIG_FILES([data/icons/Makefile])
AC_CONFIG_FILES([data/nautilus/Makefile])
AC_CONFIG_FILES([data/peony/Makefile])
AC_CONFIG_FILES([data/peony/libgtkhash-properties-peony.peony-extension.in])
AC_CONFIG_FILES([po/Makefile.in])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/hash/Makefile])
AC_CONFIG_FILES([src/nautilus/Makefile])
AC_CONFIG_FILES([src/util/Makefile])
AC_OUTPUT

echo
echo "Interfaces:"
echo "  gtkhash:            ${enable_gtkhash} (gtk+-${with_gtk})"
echo "  gtkhash-caja:       ${enable_caja}"
echo "  gtkhash-nautilus:   ${enable_nautilus}"
echo "  gtkhash-nemo:       ${enable_nemo}"
echo "  gtkhash-peony:      ${enable_peony}"
echo "  gtkhash-thunar:     ${enable_thunar} (thunarx-${with_thunarx})"

blake2_funcs="
	BLAKE2b BLAKE2s BLAKE2bp BLAKE2sp"
gcrypt_funcs="${gcrypt_funcs}
	GOST
	MD4
	MD5
	RIPEMD160
	SHA1
	SHA224 SHA256 SHA384 SHA512
	TIGER192
	WHIRLPOOL"
glib_checksums_funcs="
	MD5
	SHA1
	SHA256 SHA512"
internal_md6_funcs="
	MD6-224 MD6-256 MD6-384 MD6-512"
libcrypto_funcs="
	BLAKE2b BLAKE2s
	MD2
	MD4
	MD5
	MDC2
	RIPEMD160
	SHA1
	SHA224 SHA256 SHA384 SHA512
	WHIRLPOOL"
linux_crypto_funcs="
	MD4
	MD5
	RIPEMD128 RIPEMD160 RIPEMD256 RIPEMD320
	SHA1
	SHA224 SHA256 SHA384 SHA512
	SHA3-224 SHA3-256 SHA3-384 SHA3-512
	TIGER192
	WHIRLPOOL"
mbedtls_funcs="
	MD2
	MD4
	MD5
	RIPEMD160
	SHA1
	SHA224 SHA256 SHA384 SHA512"
mhash_funcs="
	GOST
	HAVAL128-3 HAVAL160-3 HAVAL192-3 HAVAL224-3 HAVAL256-3
	MD2
	MD4
	MD5
	RIPEMD128 RIPEMD160 RIPEMD256 RIPEMD320
	SHA1
	SHA224 SHA256 SHA384 SHA512
	SNEFRU128 SNEFRU256
	TIGER192
	WHIRLPOOL"
nettle_funcs="
	GOST
	MD2
	MD4
	MD5
	RIPEMD160
	SHA1
	SHA224 SHA256 SHA384 SHA512
	SHA3-224 SHA3-256 SHA3-384 SHA3-512"
zlib_funcs="
	ADLER32
	CRC32"

echo
printf "%-20s%s\n" "Hash Function" "Preferred Implementation"

have_libs=""

for func in \
	ADLER32 \
	BLAKE2b BLAKE2s BLAKE2bp BLAKE2sp \
	CRC32 \
	GOST \
	HAVAL128-3 HAVAL160-3 HAVAL192-3 HAVAL224-3 HAVAL256-3 \
	MD2 \
	MD4 \
	MD5 \
	MD6-224 MD6-256 MD6-384 MD6-512 \
	MDC2 \
	RIPEMD128 RIPEMD160 RIPEMD256 RIPEMD320 \
	SHA1 \
	SHA224 SHA256 SHA384 SHA512 \
	SHA3-224 SHA3-256 SHA3-384 SHA3-512 \
	SNEFRU128 SNEFRU256 \
	TIGER192 \
	WHIRLPOOL
do
	printf "  %-20s" "${func}"
	enabled=""
	# Matches preferred order from src/hash/hash-lib.c
	for lib in \
		zlib \
		blake2 \
		gcrypt \
		libcrypto \
		mbedtls \
		nettle \
		linux_crypto \
		glib_checksums \
		mhash \
		internal_md6
	do
		eval test \${enable_${lib}} = "yes" || continue

		if eval echo \${${lib}_funcs} | tr ' ' '\n' \
			| grep -q "^${func}$"
		then
			test -n "${enabled}" && printf ","
			printf "${lib}"
			enabled="yes"
			have_libs="yes"

			test "${lib}" = "linux_crypto" && printf "*"
		fi
	done
	test -n "${enabled}" && echo || echo "_"
done

if test "${enable_linux_crypto}" = "yes" ; then
	echo
	echo "* linux_crypto support depends on kernel module availability - check /proc/crypto"
fi

echo

test -z "${have_libs}" && AC_MSG_ERROR([No hash libraries enabled])

# Exit status
true