-
Notifications
You must be signed in to change notification settings - Fork 85
/
meson.build
2102 lines (1838 loc) · 50.4 KB
/
meson.build
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
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
project(
'netatalk',
'c',
version: '3.2.0',
license: 'GPLv2',
default_options: ['warning_level=3', 'c_std=c11'],
meson_version: '>=0.61.2',
# Reserved for future use:
# meson_version: '>=0.62.0',
)
cc = meson.get_compiler('c')
# Reserved for future use:
# cc.has_function_attribute('unused', required: false)
####################
# Global variables #
####################
cdata = configuration_data()
fs = import('fs')
prefix = get_option('prefix')
version = meson.project_version()
cpu = host_machine.cpu_family()
host_os = host_machine.system()
target_os = target_machine.system()
#########
# Paths #
#########
prefix = get_option('prefix')
exec_prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir')
includedir = prefix / get_option('includedir')
libdir = prefix / get_option('libdir')
localstatedir = prefix / get_option('localstatedir')
mandir = prefix / get_option('mandir')
pkgconfdir = prefix / get_option('sysconfdir')
sbindir = prefix / get_option('sbindir')
##################
# Compiler flags #
##################
# Global
netatalk_common_flags = [
'-DHAVE_CONFIG_H',
'-D_U_=__attribute__((unused))',
'-Wno-pedantic',
'-Wno-extra',
'-Wno-all',
'-Wno-deprecated-declarations',
]
netatalk_common_link_args = []
add_global_arguments(netatalk_common_flags, language: 'c')
# Per target
ad = '-D_PATH_AD="' + bindir + '/ad"'
afpd = '-D_PATH_AFPD="' + sbindir + '/afpd"'
afpdpwfile = '-D_PATH_AFPDPWFILE="' + pkgconfdir + '/afppasswd"'
cnid_dbd = '-D_PATH_CNID_DBD="' + sbindir + '/cnid_dbd"'
cnid_metad = '-D_PATH_CNID_METAD="' + sbindir + '/cnid_metad"'
confdir = '-D_PATH_CONFDIR="' + pkgconfdir + '/"'
dversion = '-DVERSION="' + version + '"'
messagedir = '-DSERVERTEXT="' + localstatedir + '/netatalk/msg/"'
statedir = '-D_PATH_STATEDIR="' + localstatedir + '/netatalk/"'
uamdir = '-D_PATH_AFPDUAMPATH="' + libdir + '/netatalk/"'
############
# Includes #
############
if host_os in ['dragonfly', 'freebsd', 'openbsd']
root_includes = include_directories(
'.',
'include',
'etc/afpd',
'/usr/local/include',
)
elif host_os == 'netbsd'
root_includes = include_directories(
'.',
'include',
'etc/afpd',
'/usr/pkg/include',
)
elif host_os == 'omnios'
root_includes = include_directories(
'.',
'include',
'etc/afpd',
'/opt/local/include',
)
else
root_includes = include_directories(
'.',
'include',
'etc/afpd',
)
endif
############
# Programs #
############
flex = find_program('flex', required: false)
grep = find_program('grep', required: false)
perl = find_program('perl', required: false)
uname = find_program('uname', required: false)
if host_os == 'darwin'
brew = find_program('brew', required: true)
brew_prefix = run_command(brew, '--prefix', check: true).stdout().strip()
message(brew_prefix)
bison = find_program(brew_prefix / 'opt/bison/bin/bison', required: false)
else
bison = find_program('bison', required: false)
endif
################
# Dependencies #
################
threads = dependency('threads', required: true)
#############
# Libraries #
#############
libsearch_dirs = []
if host_os in ['dragonfly', 'freebsd', 'openbsd']
libsearch_dirs += '/usr/local/lib'
endif
if host_os == 'netbsd'
libsearch_dirs += '/usr/pkg/lib'
endif
if uname.found() and run_command(uname, '-n', check: false).stdout().strip().contains('omnios')
libsearch_dirs += '/opt/local/lib'
endif
socket = cc.find_library('socket', required: false)
if socket.found()
netatalk_common_link_args += '-lsocket'
endif
sendfile = cc.find_library('sendfile', required: false)
if sendfile.found()
netatalk_common_link_args += '-lsendfile'
endif
nsl = cc.find_library('nsl', required: false)
if nsl.found()
netatalk_common_link_args += '-lnsl'
endif
dl = cc.find_library('dl', required: false)
if dl.found()
cdata.set('HAVE_LIBDL', 1)
netatalk_common_link_args += '-ldl'
endif
math = cc.find_library('m', required: true)
if math.found()
netatalk_common_link_args += '-lm'
endif
add_global_link_arguments(netatalk_common_link_args, language: 'c')
#################
# Header checks #
#################
header_dir = []
if host_os in ['dragonfly', 'freebsd', 'openbsd']
header_dir += '/usr/local/include'
endif
check_headers = [
'acl/libacl.h',
'attr/xattr.h',
'dlfcn.h',
'dns_sd.h',
'fcntl.h',
'inttypes.h',
'langinfo.h',
'linux/dqblk/xfs.h',
'linux/xfs/fs.h',
'linux/xqm.h',
'locale.h',
'mntent.h',
'netdb.h',
'pam/pam_appl.h',
'rpc/pmap/prot.h',
'rpc/rpc.h',
'rpcsvc/rquota.h',
'security/pam_appl.h',
'sgtty.h',
'statfs.h',
'stdint.h',
'stdio.h',
'stdlib.h',
'string.h',
'strings.h',
'sys/attr.h',
'sys/attributes.h',
'sys/ea.h',
'sys/extattr.h',
'sys/mnttab.h',
'sys/mount.h',
'sys/param.h',
'sys/stat.h',
'sys/statvfs.h',
'sys/types.h',
'sys/uio.h',
'sys/vfs.h',
'sys/xattr.h',
'termios.h',
'ufs/quota.h',
'unistd.h',
'xfs/libxfs.h',
'xfs/xfs/fs.h',
'xfs/xqm.h',
]
foreach h : check_headers
if cc.has_header(h, include_directories: include_directories(header_dir))
cdata.set('HAVE_' + h.underscorify().to_upper(), 1)
endif
endforeach
###################
# Function checks #
###################
check_functions = [
'asprintf',
'backtrace_symbols',
'dirfd',
'dlclose',
'dlerror',
'dlopen',
'dlsym',
'getpagesize',
'getusershell',
'mmap',
'pread',
'pselect',
'pwrite',
'setlinebuf',
'shl_load',
'splice',
'strlcat',
'strlcpy',
'strnlen',
'utime',
'vasprintf',
]
foreach f : check_functions
if cc.has_function(f)
cdata.set('HAVE_' + f.underscorify().to_upper(), 1)
endif
endforeach
if cc.has_function('mempcpy', prefix: '#include <string.h>')
cdata.set('HAVE_MEMPCPY', 1)
endif
if cc.has_function('getifaddrs', dependencies: socket)
cdata.set('HAVE_GETIFADDRS', 1)
endif
at_functions = [
'openat',
'renameat',
'fstatat',
'unlinkat',
]
foreach f : at_functions
if cc.has_function(f)
cdata.set('HAVE_' + f.underscorify().to_upper(), 1)
cdata.set('_ATFILE_SOURCE', 1)
cdata.set('HAVE_ATFUNCS', 1)
endif
endforeach
##########################
# Type and member checks #
##########################
if cc.has_type('fshare_t', prefix: '#include <fcntl.h>')
cdata.set('HAVE_FSHARE_T', 1)
endif
if cc.has_member('struct tm', 'tm_gmtoff', prefix: '#include <time.h>')
cdata.set('HAVE_STRUCT_TM_TM_GMTOFF', 1)
endif
#################
# Configuration #
#################
#
# Check whether to check for 64_bit libraries
#
run_command(
cc,
'-c', meson.project_source_root() / 'libatalk/dummy.c',
'-o', meson.global_build_root() / 'dummy.o',
check: false,
)
compiler_mode = run_command(
'/usr/bin/file',
meson.global_build_root() / 'dummy.o',
check: true,
).stdout().strip().contains('ELF 64')
if (cpu in ['ppc64', 's390x', 'sparc64', 'x86_64', 'i386'] and compiler_mode)
if target_os in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
atalk_libname = 'lib'
elif target_os == 'sunos'
atalk_libname = 'lib/64'
else
atalk_libname = 'lib64'
endif
else
atalk_libname = 'lib'
endif
message('atalk_libname =', atalk_libname)
#
# Check whether to enable rpath (the default on Solaris and NetBSD)
#
if not get_option('enable-rpath')
enable_rpath = false
elif host_os == 'sunos' or host_os == 'netbsd' or get_option('enable-rpath')
enable_rpath = true
endif
if host_os == 'linux'
enable_dtags = true
else
enable_dtags = false
endif
#
# Check for the Berkeley DB library
#
with_bdb = get_option('with-bdb')
bdb_header = ''
bdb_includes = []
bdb_libdir = []
bdb_link_args = []
bdb_major_version = ''
bdb_minor_version = ''
bdb_version = ''
bdb_dirs = [
'/usr/local',
'/usr/pkg',
'/opt/local',
'/usr',
]
bdb_subdirs = [
'db4.6',
'db4.7',
'db4.8',
'db4',
'db46',
'db47',
'db48',
'db5.0',
'db5.1',
'db5.2',
'db5.3',
'db5',
'db50',
'db51',
'db6.1',
'',
]
if get_option('with-bdb') != ''
foreach subdir : bdb_subdirs
if fs.exists(with_bdb / 'include' / subdir / 'db.h')
bdb_header += with_bdb / 'include' / subdir / 'db.h'
bdb_libdir += with_bdb / 'lib'
bdb_includes += include_directories(
with_bdb / 'include' / subdir,
)
endif
if bdb_header != ''
break
endif
endforeach
else
foreach dir : bdb_dirs
foreach subdir : bdb_subdirs
if fs.exists(dir / 'include' / subdir / 'db.h')
bdb_header += dir / 'include' / subdir / 'db.h'
bdb_libdir += [dir / atalk_libname, dir / 'lib']
bdb_includes += include_directories(
dir / 'include' / subdir,
)
endif
if bdb_header != ''
break
endif
endforeach
if bdb_header != ''
break
endif
endforeach
endif
if enable_rpath
bdb_link_args += '-R' + bdb_libdir
endif
if enable_dtags
bdb_link_args += '-Wl,--enable-new-dtags'
endif
if bdb_header != ''
have_bdb = true
bdb_major_version += run_command(
'grep',
'DB_VERSION_MAJOR',
bdb_header,
check: true,
).stdout().strip().substring(25)
bdb_minor_version += run_command(
'grep',
'DB_VERSION_MINOR',
bdb_header,
check: true,
).stdout().strip().substring(25)
bdb_version += bdb_major_version + '.' + bdb_minor_version
bdb_minimum_version = bdb_version.version_compare('>=4.6')
bdb_libnames = [
'db',
'db' + bdb_major_version,
'db' + bdb_major_version + '.' + bdb_minor_version,
'db' + bdb_major_version + bdb_minor_version,
'db-' + bdb_major_version,
'db-' + bdb_major_version + '.' + bdb_minor_version,
]
foreach name : bdb_libnames
db = cc.find_library(name, dirs: bdb_libdir, required: false)
if db.found()
break
endif
endforeach
else
have_bdb = false
error(
'Berkeley DB library required but not found! Please specify an installation path using the -Dwith-bdb= configure option (must include lib and include dirs)',
)
endif
# To be removed after testing complete:
message('BDB header: ', bdb_header)
message('BDB libdir: ', bdb_libdir)
message('BDB linker arguments: ', bdb_link_args)
message('BDB version: ', bdb_version)
#
# Check for crypt or SSL (for DHX authentication)
#
with_ssl_dir = get_option('with-ssl-dir')
have_embedded_ssl = get_option('with-embedded-ssl')
ssl_deps = []
ssl_link_args = []
ssl_provider = ''
crypt = cc.find_library('crypt', has_headers: 'crypt.h', required: false)
if crypt.found()
cdata.set('HAVE_CRYPT_H', 1)
cdata.set('HAVE_LIBCRYPT', 1)
endif
des = cc.find_library('des', required: false)
if des.found()
cdata.set('HAVE_LIBDES', 1)
endif
crypto = dependency('libcrypto', required: false)
libtls = dependency('libtls', required: false)
if enable_rpath and crypto.found()
ssl_link_args += ['-R' / crypto.get_variable(pkgconfig: 'libdir')]
endif
if enable_dtags
ssl_link_args += '-Wl,--enable-new-dtags'
endif
if have_embedded_ssl or crypto.found()
have_ssl = true
cdata.set('HAVE_LIBCRYPTO', 1)
cdata.set('UAM_DHX', 1)
endif
if have_embedded_ssl
ssl_provider += 'built-in'
cdata.set('EMBEDDED_SSL', 1)
elif crypto.found()
ssl_deps += crypto
cdata.set('OPENSSL_DHX', 1)
if libtls.found()
ssl_provider += 'LibreSSL'
elif not libtls.found()
ssl_provider += 'OpenSSL'
endif
else
have_ssl = false
warning(
'Either LibreSSL or OpenSSL version 1.1 is required for DHX and RANDNUM support',
)
endif
#
# Check for GSSAPI
#
with_gssapi = get_option('with-gssapi')
gssapi_includes = []
gssapi_headers = [
'gssapi.h',
'gssapi/gssapi_generic.h',
'gssapi/gssapi_krb5.h',
'gssapi/gssapi.h',
]
foreach header : gssapi_headers
if cc.has_header(
header,
include_directories: include_directories(
[with_gssapi / 'include', header_dir],
),
)
cdata.set('HAVE_' + header.underscorify().to_upper(), 1)
endif
endforeach
if get_option('with-gssapi') != ''
gss = cc.find_library(
'gssapi',
dirs: with_gssapi / 'lib',
required: false,
)
gssapi_includes += include_directories(with_gssapi / 'include')
else
gss = cc.find_library('gss', dirs: libsearch_dirs, required: false)
if not gss.found()
gss = cc.find_library('gssapi', dirs: libsearch_dirs, required: false)
endif
if not gss.found()
gss = cc.find_library(
'gssapi_krb5',
dirs: libsearch_dirs,
required: false,
)
endif
endif
if not gss.found()
have_gssapi = false
else
have_gssapi = (
gss.found()
and cc.has_function(
'gss_acquire_cred',
dependencies: gss,
)
)
if with_gssapi != '' and not have_gssapi
error('GSSAPI support requested but not found')
endif
endif
if have_gssapi
# Heimdal/MIT compatibility fix
if cc.has_header_symbol('gssapi.h', 'GSS_C_NT_HOSTBASED_SERVICE')
cdata.set('HAVE_GSS_C_NT_HOSTBASED_SERVICE', 1)
endif
cdata.set('HAVE_GSSAPI', 1)
endif
#
# Check for Kerberos V
#
kerberos = cc.find_library('krb5', dirs: libsearch_dirs, required: false)
krb5_config = find_program('krb5-config', required: false)
kerberos_c_args = []
kerberos_headers = [
'kerberosv5/krb5.h',
'krb5.h',
'krb5/krb5.h',
]
foreach header : kerberos_headers
if cc.has_header(
header,
include_directories: include_directories(header_dir),
)
cdata.set('HAVE_' + header.underscorify().to_upper(), 1)
endif
endforeach
if get_option('with-kerberos').disabled()
have_kerberos = false
else
have_kerberos = kerberos.found()
if get_option('with-kerberos').enabled() and not have_kerberos
error('Kerberos support requested but not found')
endif
endif
if have_kerberos
if host_os == 'sunos'
kerberos_c_args += run_command(
krb5_config,
'--cflags',
check: true,
).stdout().strip()
endif
cdata.set('HAVE_KERBEROS', 1)
kerberos_functions = [
'krb5_free_unparsed_name',
'krb5_free_error_message',
'krb5_free_keytab_entry_contents',
'krb5_kt_free_entry',
]
foreach function : kerberos_functions
if cc.has_function(function, dependencies: kerberos)
cdata.set('HAVE_' + function.underscorify().to_upper(), 1)
endif
endforeach
endif
#
# Check whether Kerberos V UAM can be built
#
if get_option('enable-krbV-uam').disabled()
enable_krbV_uam = false
else
enable_krbV_uam = have_gssapi
if get_option('enable-krbV-uam').enabled() and not have_gssapi
warning('Need GSSAPI support to build Kerberos V UAM')
endif
endif
#
# Check for optional Zeroconf support
#
avahi = dependency('avahi-client', required: false)
dns_sd = cc.find_library('dns_sd', has_headers: 'dns_sd.h', required: false)
system = cc.find_library('system', required: false)
dns_sd_libs = [dns_sd, system]
zeroconf_provider = ''
freebsd_zeroconf_daemon = ''
have_dns = (
(dns_sd.found() or system.found())
and cc.has_function(
'DNSServiceRegister',
dependencies: dns_sd_libs,
)
)
if avahi.found()
cdata.set('USE_ZEROCONF', 1)
cdata.set('HAVE_AVAHI', 1)
if avahi.version() >= '0.6.4'
cdata.set('HAVE_AVAHI_THREADED_POLL', 1)
endif
freebsd_zeroconf_daemon = 'avahi_daemon'
zeroconf_provider += 'Avahi'
elif have_dns
cdata.set('USE_ZEROCONF', 1)
cdata.set('HAVE_MDNS', 1)
freebsd_zeroconf_daemon = 'mdnsd'
zeroconf_provider += 'mDNS'
endif
if get_option('enable-zeroconf').disabled()
enable_zeroconf = false
else
enable_zeroconf = avahi.found() or have_dns
endif
#
# Check for Spotlight support
#
talloc = dependency('talloc', required: false)
tracker_manager = ''
tracker_pkgconfig_version = get_option('with-tracker-pkgconfig-version')
tracker_prefix = get_option('with-tracker-prefix')
if get_option('with-spotlight').disabled()
have_spotlight = false
else
# Check for tracker SPARQL
if tracker_pkgconfig_version != ''
tracker_sparql = dependency(
'tracker-sparql-'
+ get_option('with-tracker-pkgconfig-version'),
required: false,
)
endif
tracker_sparql = dependency(
'tracker-sparql-3.0',
required: false,
)
if not tracker_sparql.found()
tracker_sparql = dependency(
'tracker-sparql-2.0',
required: false,
)
endif
if not tracker_sparql.found()
tracker_sparql = dependency(
'tracker-sparql-1.0',
required: false,
)
endif
if not tracker_sparql.found()
warning('tracker SPARQL not found (required for Spotlight support)')
else
# Check for tracker
tracker = find_program(
'tracker',
dirs: tracker_prefix + '/bin',
required: false,
)
tracker3 = find_program(
'tracker3',
dirs: tracker_prefix + '/bin',
required: false,
)
tracker_control = find_program(
'tracker-control',
dirs: tracker_prefix + '/bin',
required: false,
)
if tracker.found()
cdata.set(
'TRACKER_MANAGING_COMMAND',
'"tracker daemon"',
)
cdata.set(
'TRACKER_PREFIX',
'"'
+ tracker_sparql.get_variable(pkgconfig: 'prefix')
+ '"',
)
tracker_manager += 'tracker'
elif tracker3.found()
cdata.set('HAVE_TRACKER3', 1)
cdata.set(
'TRACKER_MANAGING_COMMAND',
'"tracker3 daemon"',
)
cdata.set(
'TRACKER_PREFIX',
'"'
+ tracker_sparql.get_variable(pkgconfig: 'prefix')
+ '"',
)
tracker_manager += 'tracker3'
elif tracker_control.found()
cdata.set(
'TRACKER_MANAGING_COMMAND',
'"tracker-control"',
)
cdata.set(
'TRACKER_PREFIX',
'"'
+ tracker_control.get_variable(pkgconfig: 'prefix')
+ '"',
)
tracker_manager += 'tracker_control'
else
warning('tracker not found (required for Spotlight support)')
endif
tracker_ok = (tracker.found() or tracker3.found() or tracker_control.found())
if tracker_ok
# Check for talloc
if talloc.found()
cdata.set('HAVE_TALLOC', 1)
else
warning(
'talloc library not found (required for Spotlight support)',
)
endif
endif
endif
endif
have_spotlight = (
tracker_sparql.found()
and tracker_ok
and talloc.found()
and flex.found()
and bison.found()
)
if have_spotlight
cdata.set('WITH_SPOTLIGHT', 1)
endif
#
# Check for libevent
#
libevent = dependency(
'libevent',
required: true,
not_found_message: 'Libevent library required but not found! Please install the libevent devel package',
)
#
# Check for quota support
#
rpcsvc = cc.find_library('rpcsvc', required: false)
quota = cc.find_library('quota', required: false)
tirpc = dependency('libtirpc', required: false)
quota_link_args = []
rpc_headers = [
'rpc/rpc.h',
'rpc/pmap_prot.h',
'rpcsvc/rquota.h',
]
foreach header : rpc_headers
if cc.has_header(header)
cdata.set('HAVE_' + header.underscorify().to_upper(), 1)
endif
endforeach
if get_option('enable-quota').disabled()
have_quota = false
cdata.set('NO_QUOTA_SUPPORT', 1)
else
if tirpc.found() and get_option('with-libtirpc')
have_quota = true
cdata.set('NEED_RQUOTA', 1)
rquota_test = cc.compiles(
'''
#include <rpcsvc/rquota.h>
int main(void) {
enum qr_status foo;
foo = Q_OK;
return 0;
}
''', dependencies: tirpc
)
if rquota_test
cdata.set('HAVE_RQUOTA_H_QR_STATUS', 1)
endif
if get_option('with-libtirpc') and not tirpc.found()
message('Libtirpc requested, but library not found')
endif
elif (
rpcsvc.found()
and (
cc.has_header('rpc/rpc.h')
or cc.has_header('rpc/pmap_prot.h')
or cc.has_header('rpcsvc/rquota.h')
)
)
have_rpcsvc = cc.has_function('main', dependencies: rpcsvc)
quota_link_args += '-lrpcsvc'
if quota.found() and have_rpcsvc
have_quota = cc.has_function('getfsquota', dependencies: quota)
cdata.set('HAVE_LIBQUOTA', 1)
quota_link_args += ['-lquota', '-lprop', '-lrpcsvc']
else
have_quota = false
cdata.set('NO_QUOTA_SUPPORT', 1)
endif
else
have_quota = false
endif
endif
if get_option('enable-quota').enabled() and not have_quota
warning('Quota support requested but required libraries not found')
endif
#
# Check for libgcrypt
#
libgcrypt_dir = get_option('with-libgcrypt-dir')
libgcrypt_link_args = []
if libgcrypt_dir != ''
libgcrypt_link_args += ['-L' + libgcrypt_dir / 'lib', '-lgcrypt']
if enable_rpath
libgcrypt_link_args += ['-R' + libgcrypt_dir / 'lib']
endif
libgcrypt = declare_dependency(
link_args: libgcrypt_link_args,
include_directories: include_directories(libgcrypt_dir / 'include'),
)
else
libgcrypt = dependency('libgcrypt', required: false)
if not libgcrypt.found()
libgcrypt = cc.find_library(
'libgcrypt',
dirs: libsearch_dirs,
required: false,
)
endif
endif
libgcrypt_config = find_program(
'libgcrypt-config',
dirs: libgcrypt_dir + '/bin',
required: false,
)
cast5_api = run_command(
libgcrypt_config,
'--algorithms',
check: false,
).stdout().strip().contains('cast5')
# Reserved for future use:
# libgcrypt_version = libgcrypt_config.version().version_compare('>=1.2.3')
if not libgcrypt.found()
have_libgcrypt = false
error(
'Libgcrypt library required for DHX2 UAM! Please install version 1.2.3 or later',
)
else
# Reserved for future use:
# have_libgcrypt = libgcrypt_version and cast5_api
have_libgcrypt = libgcrypt.found() and cast5_api
if not cast5_api
have_libgcrypt = false
error(
'Detected libgcrypt without CAST5, please install a more recent version that contains this API',
)
else
cdata.set('HAVE_LIBGCRYPT', 1)
cdata.set('UAM_DHX2', 1)
endif
endif
#
# Check for Extended Attributes support
#
ea = '"ad'
attr = cc.find_library('attr', required: false)
if host_os == 'sunos'
# extattr API has full fledged fds for EAs
have_ea = true
cdata.set('HAVE_EAFD', 1)
elif host_os == 'freebsd'
have_ea = true
ea_functions = [