forked from rockdaboot/libpsl
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfigure.ac
More file actions
654 lines (573 loc) · 20.4 KB
/
configure.ac
File metadata and controls
654 lines (573 loc) · 20.4 KB
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
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
AC_INIT([libpsl],[m4_normalize(m4_include(version.txt))],[tim.ruehsen@gmx.de],[libpsl],[https://github.com/rockdaboot/libpsl])
AC_PREREQ([2.59])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.10 no-define foreign dist-lzip])
# Generate two configuration headers; one for building the library itself with
# an autogenerated template, and a second one that will be installed alongside
# the library.
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
#LT_INIT([disable-static])
LT_INIT([win32-dll])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_SYS_LARGEFILE
dnl Check that compiler understands inline
AC_C_INLINE
dnl Check for visibility support
gl_VISIBILITY
dnl Solaris has socket in libsocket and inet_ntop in libnsl, but also needs
dnl libsocket, so the order is important here
AC_CHECK_LIB([socket], [socket], [
AC_CHECK_LIB([nsl], [inet_ntop], [:], [:])
], [:])
dnl AM_ICONV sets @LIBICONV@ and @LTLIBICONV@ for use in Makefile.am
dnl libunistring may depend on libiconv, so invoke it before gl_LIBUNISTRING
AM_ICONV
dnl Unicode support
gl_LIBUNISTRING
#
# Generate version defines for include file
#
AC_SUBST([LIBPSL_VERSION_MAJOR], [`echo $VERSION|cut -d'.' -f1`])
AC_SUBST([LIBPSL_VERSION_MINOR], [`echo $VERSION|cut -d'.' -f2`])
AC_SUBST([LIBPSL_VERSION_PATCH], [`echo $VERSION|cut -d'.' -f3`])
AC_SUBST([LIBPSL_VERSION_NUMBER], [`printf '0x%02x%02x%02x' $LIBPSL_VERSION_MAJOR $LIBPSL_VERSION_MINOR $LIBPSL_VERSION_PATCH`])
AC_CONFIG_FILES([include/libpsl.h])
#
# Gettext
#
AM_GNU_GETTEXT([external],[need-ngettext])
AM_GNU_GETTEXT_VERSION([0.19.3])
AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.3])
#
# check for gtk-doc
#
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
# needed for some older versions of gtk-doc
m4_ifdef([GTK_DOC_USE_LIBTOOL], [], [
AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], false)
])
if test x"$have_gtk_doc" = xyes -a x"$enable_gtk_doc" = xyes; then
AC_SUBST([LIBPSL_DOCS], [docs/libpsl])
fi
#
# enable creation of man pages
#
AC_ARG_ENABLE([man],
[AS_HELP_STRING([--enable-man], [generate man pages [default=auto]])],
[
if test "$enable_man" = yes; then
AC_PATH_PROG([XSLTPROC], [xsltproc])
AS_IF([test -z "$XSLTPROC"], [
AC_MSG_ERROR([xsltproc is required for --enable-man])
enable_man="no (xsltproc not found)"
])
fi
], [ enable_man=no ])
AM_CONDITIONAL(ENABLE_MAN, test x$enable_man = xyes)
# src/psl-make-dafsa needs python 2.7+
AS_IF([! test -f src/suffixes_dafsa.h -a -f tests/psl.dafsa -a -f tests/psl_ascii.dafsa],
[
AM_PATH_PYTHON([2.7],, [AC_MSG_ERROR([python 2.7+ is required to convert the PSL data])])
])
PKG_PROG_PKG_CONFIG
AC_ARG_ENABLE([fuzzing],
[AS_HELP_STRING([--enable-fuzzing], [Turn on fuzzing build (for developers)])],
[enable_fuzzing=yes;
AC_SUBST([LIB_FUZZING_ENGINE])
AC_DEFINE([FUZZING], 1, [Define to 1 if this is a fuzzing build])
], [enable_fuzzing=no; LIB_FUZZING_ENGINE=""])
AM_CONDITIONAL([FUZZING], [test "$enable_fuzzing" = "yes"])
AC_ARG_ENABLE([cfi],
[AS_HELP_STRING([--enable-cfi], [Turn on clang's Control Flow Integrity (CFI)])],
[
if test "$enable_cfi" = yes; then
CFLAGS=$CFLAGS" -B/usr/bin/gold -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-trap=all"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([], [])
], [], [
AC_MSG_ERROR([clang 3.7+ and the 'gold' linker are required for --enable-cfi])
])
fi
], [ enable_cfi=no ])
AC_ARG_ENABLE([ubsan],
[AS_HELP_STRING([--enable-ubsan], [Turn on Undefined Behavior Sanitizer (UBSan)])],
[
if test "$enable_ubsan" = yes; then
# Set basic UBSAN compiler flags. Add your own to CFLAGS.
CFLAGS=$CFLAGS" -fsanitize=undefined -fno-sanitize-recover=undefined"
fi
], [ enable_ubsan=no ])
AC_ARG_ENABLE([asan],
[AS_HELP_STRING([--enable-asan], [Turn on Address Sanitizer (ASan)])],
[
if test "$enable_asan" = yes; then
# Set basic ASAN compiler flags. Add your own to CFLAGS.
CFLAGS=$CFLAGS" -fsanitize=address -fno-omit-frame-pointer"
AX_CHECK_COMPILE_FLAG([-fsanitize-address-use-after-scope], [CFLAGS="$CFLAGS -fsanitize-address-use-after-scope"])
fi
], [ enable_asan=no ])
# Define these substitutions here to keep all version information in one place.
# For information on how to properly maintain the library version information,
# refer to the libtool manual, section "Updating library version information":
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
# 1. Start with version information of ‘0:0:0’ for each libtool library.
# 2. Update the version information only immediately before a public release of your software. More frequent updates are unnecessary, and only guarantee that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
# 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then increment age.
# 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0.
AC_SUBST([LIBPSL_SO_VERSION], m4_normalize(m4_include([libtool_version_info.txt])))
AC_SUBST([LIBPSL_VERSION], $VERSION)
# Check for enable/disable runtime PSL data
AC_ARG_ENABLE(runtime,
[
--enable-runtime[[=IDNA library]]
Specify the IDNA library used for libpsl run-time conversions:
libidn2 [[default]]: IDNA2008 library (also needs libunistring)
libicu: IDNA2008 UTS#46 library
libidn: IDNA2003 library (also needs libunistring)
--disable-runtime Do not link runtime IDNA functionality
], [
if test "$enableval" = "libidn2" -o "$enableval" = "yes"; then
enable_runtime=libidn2
AC_DEFINE([WITH_LIBIDN2], [1], [generate PSL data using libidn2])
elif test "$enableval" = "libicu"; then
enable_runtime=libicu
AC_DEFINE([WITH_LIBICU], [1], [generate PSL data using libicu])
elif test "$enableval" = "libidn"; then
enable_runtime=libidn
AC_DEFINE([WITH_LIBIDN], [1], [generate PSL data using libidn])
elif test "$enableval" = "no"; then
enable_runtime=no
else
AC_MSG_ERROR([Unknown value $enableval for --enable-runtime])
fi
], [
# this is the default if neither --enable-runtime nor --disable-runtime were specified
enable_runtime=auto
])
# Check for enable/disable builtin PSL data
AC_ARG_ENABLE(builtin,
[
--enable-builtin Generate built-in PSL data
--disable-builtin Do not generate built-in PSL data
], [
if test "$enableval" = "yes"; then
enable_builtin=yes
elif test "$enableval" = "libidn" -o "$enableval" = "libidn2" -o "$enableval" = "libicu"; then
AC_MSG_WARN([--enable-builtin=$enableval is deprecated, use --enable-builtin (enabled by default)])
enable_builtin=yes
elif test "$enableval" = "no"; then
enable_builtin=no
else
AC_MSG_ERROR(Unknown value $enableval)
fi
], [
# this is the default if neither --enable-builtin nor --disable-builtin were specified
enable_builtin=yes
])
if test "$enable_builtin" = "yes"; then
AC_DEFINE([ENABLE_BUILTIN], [1], [Generate built-in PSL data])
fi
dnl Global project-specific compiler and linker flags.
dnl
dnl We should not use plain *FLAGS since they belong to the user.
dnl We can temporary modify them for configuration checks, but then we need to
dnl restore them to their original values.
AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include"
AM_CFLAGS=
AM_LDFLAGS=
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])
dnl If we are building only static libraries, we need to define PSL_STATIC
dnl when building psl executable; this is required on Windows since libpsl
dnl uses __declspec(dllimport) by default.
AS_IF([test "x${enable_shared}" = "xno"],
[AS_VAR_APPEND([AM_CPPFLAGS], [" -DPSL_STATIC"])])
dnl We use pkg-config/pkgconf to find dependencies. We want to ensure that we
dnl are able to find them even if they are installed as static libraries only.
dnl
dnl If we were able to locate package using PKG_CHECK_MODULES, try to do a
dnl link test to ensure that we can link against it. This may fail because only
dnl static library is available but we did not add private libraries
dnl (Libs.private) or compiler flags (Cflags.private).
dnl
dnl If we failed to link against library found with PKG_CHECK_MODULES, try
dnl to use PKG_CHECK_MODULES_STATIC to obtain compiler and linker flags
dnl required to link against static library.
dnl Compiler flags required to use $enable_runtime (when != "no")
runtime_CFLAGS=
dnl Libraries required to use $enable_runitme (when != "no")
runtime_LIBS=
AC_SUBST([runtime_CFLAGS])
AC_SUBST([runtime_LIBS])
dnl Check for libidn2
if test "$enable_runtime" = "libidn2" -o "$enable_runtime" = "auto"; then
HAVE_LIBIDN2=no
# Save CFLAGS and LIBS so we can restore them later
__save_CFLAGS=$CFLAGS
__save_LIBS=$LIBS
m4_define([LIBIDN2_LINK_TEST], [AC_LANG_PROGRAM(
[extern char idn2_lookup_u8 (void);],
[idn2_lookup_u8();]
)])
PKG_CHECK_MODULES([LIBIDN2], [libidn2], [HAVE_LIBIDN2=maybe], [HAVE_LIBIDN2=no])
# Check if we can link against libidn2
AS_IF([test "x$HAVE_LIBIDN2" = xmaybe], [
CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
LIBS="$LIBIDN2_LIBS $LIBS"
AC_LINK_IFELSE([
LIBIDN2_LINK_TEST
], [
HAVE_LIBIDN2=yes
], [
AC_MSG_NOTICE([located libidn2 but cannot link... trying static linking])
LIBIDN2_CFLAGS=
LIBIDN2_LIBS=
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
])
])
# If we cannot link against found libidn2, try static linking
AS_IF([test "x$HAVE_LIBIDN2" = xmaybe], [
PKG_CHECK_MODULES_STATIC([LIBIDN2], [libidn2], [
CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
LIBS="$LIBIDN2_LIBS $LIBS"
AC_LINK_IFELSE([
LIBIDN2_LINK_TEST
], [
HAVE_LIBIDN2=yes
AC_MSG_NOTICE([using static libidn2])
], [
HAVE_LIBIDN2=no
AC_MSG_NOTICE([libidn2 is installed but unusable])
LIBIDN2_CFLAGS=
LIBIDN2_LIBS=
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
])
], [
HAVE_LIBIDN2=no
])
])
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
if test "x$HAVE_LIBIDN2" = "xyes"; then
runtime_CFLAGS=$LIBIDN2_CFLAGS
runtime_LIBS=$LIBIDN2_LIBS
if test "$enable_runtime" = "auto"; then
enable_runtime=libidn2
AC_DEFINE([WITH_LIBIDN2], [1], [generate PSL data using libidn2])
fi
else
if test "$enable_runtime" = "libidn2"; then
AC_MSG_ERROR([You requested libidn2 but it is not installed or usable.])
fi
fi
fi
dnl Check for libicu
if test "$enable_runtime" = "libicu" -o "$enable_runtime" = "auto"; then
HAVE_LIBICU=no
# Whether we found libicu using pkg-config
HAVE_LIBICU_PC=no
# Save CFLAGS and LIBS so we can restore them later
__save_CFLAGS=$CFLAGS
__save_LIBS=$LIBS
m4_define([ICU_LINK_TEST], [AC_LANG_PROGRAM(
[[#include <unicode/ustring.h>]],
[[u_strToUTF8(NULL, 0, NULL, NULL, 0, NULL);]]
)])
# using pkg-config won't work on older systems like Ubuntu 12.04 LTS Server Edition 64bit
# using AC_SEARCH_LIBS also don't work since functions have the library version appended
PKG_CHECK_MODULES([LIBICU], [icu-uc], [
HAVE_LIBICU_PC=yes
HAVE_LIBICU=maybe
], [
HAVE_LIBICU=no
])
# Check if we can link against libicu
AS_IF([test "x$HAVE_LIBICU" = xmaybe], [
CFLAGS="$LIBICU_CFLAGS $CFLAGS"
LIBS="$LIBICU_LIBS $LIBS"
AC_LINK_IFELSE([
ICU_LINK_TEST
], [
HAVE_LIBICU=yes
], [
AC_MSG_NOTICE([located libicu but cannot link... trying static linking])
LIBICU_CFLAGS=
LIBICU_LIBS=
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
])
])
# If we cannot link against found libicu, try static linking
AS_IF([test "x$HAVE_LIBICU" = xmaybe], [
PKG_CHECK_MODULES_STATIC([LIBICU], [icu-uc], [
CFLAGS="$LIBICU_CFLAGS $CFLAGS"
LIBS="$LIBICU_LIBS $LIBS"
AC_LINK_IFELSE([
ICU_LINK_TEST
], [
HAVE_LIBICU=yes
AC_MSG_NOTICE([using static libicu])
], [
HAVE_LIBICU_PC=no
HAVE_LIBICU=no
AC_MSG_NOTICE([libicu is installed but unusable])
LIBICU_CFLAGS=
LIBICU_LIBS=
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
])
], [
HAVE_LIBICU=no
])
])
# Try -licuuc
AS_IF([test "x$HAVE_LIBICU" = xno], [
AC_MSG_CHECKING([for ICU unicode library])
LIBS="-licuuc $LIBS"
AC_LINK_IFELSE([
ICU_LINK_TEST
], [
HAVE_LIBICU=yes
LIBICU_LIBS='-licuuc'
], [
HAVE_LIBICU=no
LIBS=$__save_LIBS
])
AC_MSG_RESULT([$HAVE_LIBICU])
])
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
if test "x$HAVE_LIBICU" = "xyes"; then
runtime_CFLAGS=$LIBICU_CFLAGS
runtime_LIBS=$LIBICU_LIBS
if test "$enable_runtime" = "auto"; then
enable_runtime=libicu
AC_DEFINE([WITH_LIBICU], [1], [generate PSL data using libicu])
fi
else
if test "$enable_runtime" = "libicu"; then
AC_MSG_ERROR([You requested libicu but it is not installed or usable.])
fi
fi
fi
dnl Checl for libidn
if test "$enable_runtime" = "libidn" -o "$enable_runtime" = "auto"; then
HAVE_LIBIDN=no
# Save CFLAGS and LIBS so we can restore them later
__save_CFLAGS=$CFLAGS
__save_LIBS=$LIBS
m4_define([LIBIDN_LINK_TEST], [AC_LANG_PROGRAM(
[extern char idna_to_ascii_8z (void);],
[idna_to_ascii_8z();]
)])
PKG_CHECK_MODULES([LIBIDN], [libidn], [HAVE_LIBIDN=maybe], [HAVE_LIBIDN=no])
# Check if we can link against libidn
AS_IF([test "x$HAVE_LIBIDN" = xmaybe], [
CFLAGS="$LIBIDN_CFLAGS $CFLAGS"
LIBS="$LIBIDN_LIBS $LIBS"
AC_LINK_IFELSE([
LIBIDN_LINK_TEST
], [
HAVE_LIBIDN=yes
], [
AC_MSG_NOTICE([located libidn but cannot link... trying static linking])
LIBIDN_CFLAGS=
LIBIDN_LIBS=
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
])
])
# If we cannot link against found libidn, try static linking
AS_IF([test "x$HAVE_LIBIDN" = xmaybe], [
PKG_CHECK_MODULES_STATIC([LIBIDN], [libidn], [
CFLAGS="$LIBIDN_CFLAGS $CFLAGS"
LIBS="$LIBIDN_LIBS $LIBS"
AC_LINK_IFELSE([
LIBIDN_LINK_TEST
], [
HAVE_LIBIDN=yes
AC_MSG_NOTICE([using static libidn])
], [
HAVE_LIBIDN=no
AC_MSG_NOTICE([libidn is installed but unusable])
LIBIDN_CFLAGS=
LIBIDN_LIBS=
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
])
], [
HAVE_LIBIDN=no
])
])
CFLAGS=$__save_CFLAGS
LIBS=$__save_LIBS
if test "x$HAVE_LIBIDN" = "xyes"; then
runtime_CFLAGS=$LIBIDN_CFLAGS
runtime_LIBS=$LIBIDN_LIBS
if test "$enable_runtime" = "auto"; then
enable_runtime=libidn
AC_DEFINE([WITH_LIBIDN], [1], [generate PSL data using libidn])
fi
else
if test "$enable_runtime" = "libidn"; then
AC_MSG_ERROR([You requested libidn but it is not installed or usable.])
fi
fi
fi
# last fallback is noruntime/nobuiltin
if test "$enable_runtime" = "auto"; then
enable_runtime=no
fi
dnl If we use libidn or libidn2, we also need libiconv and libunistring
if test "x$enable_runtime" = "xlibidn2" -o "x$enable_runtime" = "xlibidn"; then
__save_LIBS=$LIBS
LIBS=$LIBICONV
AC_LINK_IFELSE([
AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open ("", "");])
], [:], [
AC_MSG_ERROR([You requested libidn2|libidn but libiconv is not installed.])
])
LIBS=$__save_LIBS
LIBS=$LIBUNISTRING
AC_LINK_IFELSE([
AC_LANG_PROGRAM([char u8_tolower (void);], [u8_tolower ();])
], [:], [
AC_MSG_ERROR([You requested libidn2|libidn but libunistring is not installed.])
])
LIBS=$__save_LIBS
runtime_LIBS="$runtime_LIBS $LTLIBUNISTRING $LTLIBICONV"
fi
AM_CONDITIONAL([WITH_LIBICU], test "x$enable_runtime" = "xlibicu")
AM_CONDITIONAL([WITH_LIBIDN2], test "x$enable_runtime" = "xlibidn2")
AM_CONDITIONAL([WITH_LIBIDN], test "x$enable_runtime" = "xlibidn")
AM_CONDITIONAL([ENABLE_BUILTIN], test "x$enable_builtin" = "xyes")
dnl libpsl.pc
libpsl_pc_Cflags=
libpsl_pc_Cflags_private=
libpsl_pc_Libs=
libpsl_pc_Libs_private=
libpsl_pc_Requires=
libpsl_pc_Requires_private=
if test "$enable_runtime" = libidn2; then
libpsl_pc_Libs_private="$LTLIBUNISTRING $LTLIBICONV $LIBS"
libpsl_pc_Requires_private=libidn2
elif test "$enable_runtime" = libidn; then
libpsl_pc_Libs_private="$LTLIBUNISTRING $LTLIBICONV $LIBS"
libpsl_pc_Requires_private=libidn
elif test "$enable_runtime" = libicu; then
if test "x$HAVE_LIBICU_PC" = xyes; then
libpsl_pc_Libs_private="$LIBS"
libpsl_pc_Requires_private=icu-uc
else
libpsl_pc_Libs_private="$LIBICU_LIBS $LIBS"
fi
fi
dnl On Windows we use pkgconf-specific Cflags.private to pass -DPSL_STATIC
AS_CASE([${host}],
[*-mingw32 | *-mingw64 | *-windows], [
libpsl_pc_Cflags_private='Cflags.private: -DPSL_STATIC'
libpsl_pc_Requires='pkgconf'])
AC_SUBST([libpsl_pc_Cflags])
AC_SUBST([libpsl_pc_Cflags_private])
AC_SUBST([libpsl_pc_Libs])
AC_SUBST([libpsl_pc_Libs_private])
AC_SUBST([libpsl_pc_Requires])
AC_SUBST([libpsl_pc_Requires_private])
# Check for clock_gettime() used for performance measurement
AC_SEARCH_LIBS(clock_gettime, rt)
# Check for valgrind
ac_enable_valgrind=no
AC_ARG_ENABLE(valgrind-tests,
AS_HELP_STRING([--enable-valgrind-tests], [enable using Valgrind for tests]),
[ac_enable_valgrind=$enableval],
[ac_enable_valgrind=no])
if test "${ac_enable_valgrind}" = "yes" ; then
AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
if test "$HAVE_VALGRIND" = "yes" ; then
VALGRIND_ENVIRONMENT="valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-origins=yes"
AC_SUBST(VALGRIND_ENVIRONMENT)
TESTS_INFO="Test suite will be run under Valgrind"
else
TESTS_INFO="Valgrind not found"
fi
else
TESTS_INFO="Valgrind testing not enabled"
fi
dnl Normally, tests/psl.dafsa and tests/psl_ascii.dafsa are distributed with
dnl source code. When doing out-of-tree build from git checkout, they will be
dnl generated in builddir. Make sure we support both cases.
PSL_DAFSA=$srcdir/tests/psl.dafsa
PSL_ASCII_DAFSA=$srcdir/tests/psl_ascii.dafsa
AS_IF([test ! -f "$PSL_DAFSA"], [
PSL_DAFSA="\$(top_builddir)/tests/psl.dafsa]")
AS_IF([test ! -f "$PSL_ASCII_DAFSA"], [
PSL_ASCII_DAFSA="\$(top_builddir)/tests/psl_ascii.dafsa"])
AC_SUBST([PSL_DAFSA])
AC_SUBST([PSL_ASCII_DAFSA])
# Check for distribution-wide PSL file
AC_ARG_WITH(psl-distfile,
AS_HELP_STRING([--with-psl-distfile=[PATH]], [path to distribution-wide PSL file]),
PSL_DISTFILE=$withval AC_SUBST(PSL_DISTFILE))
# Check for custom PSL file
AC_ARG_WITH(psl-file,
AS_HELP_STRING([--with-psl-file=[PATH]], [path to PSL file]),
PSL_FILE=$withval,
PSL_FILE="\$(top_srcdir)/list/public_suffix_list.dat")
AC_SUBST(PSL_FILE)
# Check for custom PSL test file
AC_ARG_WITH(psl-testfile,
AS_HELP_STRING([--with-psl-testfile=[PATH]], [path to PSL test file]),
PSL_TESTFILE=$withval,
PSL_TESTFILE="\$(top_srcdir)/list/tests/tests.txt")
AC_SUBST(PSL_TESTFILE)
AC_CHECK_FUNCS([clock_gettime fmemopen nl_langinfo])
AC_CHECK_DECLS([localtime_r])
# check for dirent.h
AC_HEADER_DIRENT
# Override the template file name of the generated .pc file, so that there
# is no need to rename the template file when the API version changes.
AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile
tools/Makefile
po/Makefile.in
fuzz/Makefile
tests/Makefile
docs/libpsl/Makefile docs/libpsl/version.xml
libpsl.pc:libpsl.pc.in
msvc/Makefile
msvc/config.h.win32
msvc/config-msvc.mak])
AC_OUTPUT
AC_MSG_NOTICE([Summary of build options:
Version: ${PACKAGE_VERSION}
Host OS: ${host_os}
Install prefix: ${prefix}
Compiler: ${CC}
CFlags: ${CFLAGS} ${CPPFLAGS}
LDFlags: ${LDFLAGS}
Libs: ${LIBS}
Runtime: ${enable_runtime}
Builtin: ${enable_builtin}
PSL Dist File: ${PSL_DISTFILE}
PSL File: ${PSL_FILE}
PSL Test File: ${PSL_TESTFILE}
Sanitizers: UBSan $enable_ubsan, ASan $enable_asan, CFI $enable_cfi
Docs: $enable_gtk_doc
Man pages: $enable_man
Tests: ${TESTS_INFO}
Fuzzing build: $enable_fuzzing, $LIB_FUZZING_ENGINE
])