-
Notifications
You must be signed in to change notification settings - Fork 87
/
meson.build
2501 lines (2173 loc) · 63.9 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: '4.0.8dev',
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')
if not cc.compiles('int func() { return 0; }')
error('The C compiler cannot compile code. Please check the logs.')
endif
# Reserved for future use:
# cc.has_function_attribute('unused', required: false)
####################
# Global variables #
####################
cdata = configuration_data()
fs = import('fs')
netatalk_version = meson.project_version()
cpu = host_machine.cpu_family()
host_os = host_machine.system()
target_os = target_machine.system()
build_type = get_option('buildtype')
linux_distro = ''
if host_os == 'linux' and fs.exists('/etc/os-release')
os_release = fs.read('/etc/os-release').strip()
if os_release.contains('alpine')
linux_distro = 'alpine'
elif os_release.contains('arch')
linux_distro = 'arch'
elif os_release.contains('centos')
linux_distro = 'centos'
elif os_release.contains('gentoo')
linux_distro = 'gentoo'
elif os_release.contains('suse')
linux_distro = 'suse'
elif os_release.contains('fedora')
linux_distro = 'fedora'
elif os_release.contains('rhel')
linux_distro = 'rhel'
elif os_release.contains('ubuntu')
linux_distro = 'ubuntu'
elif os_release.contains('debian')
linux_distro = 'debian'
endif
message('Linux distro detected: ' + linux_distro)
endif
#########
# 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')
mandir = prefix / get_option('mandir')
sbindir = prefix / get_option('sbindir')
sysconfdir = prefix / get_option('sysconfdir')
pkgconfdir = get_option('with-pkgconfdir-path')
if pkgconfdir == ''
pkgconfdir = sysconfdir
endif
# TODO: This breaks FHS. Should be /var/lib or the platform-specific equivalent.
# Meson's built-in option is called sharedstatedir.
# Will keep the non-standard location for now to avoid breaking existing setups.
# Ref: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html
localstatedir = prefix / get_option('localstatedir')
statedir_override = get_option('with-statedir-path')
if statedir_override != ''
localstatedir = statedir_override
endif
if host_os == 'darwin'
homedir = '/Users'
elif host_os == 'sunos'
homedir = '/export/home'
else
homedir = '/home'
endif
manual_install_path = get_option('with-manual-install-path')
if manual_install_path == ''
manual_install_path = datadir / 'doc/netatalk/htmldocs'
endif
##################
# Compiler flags #
##################
# Global
netatalk_common_flags = [
'-DHAVE_CONFIG_H',
'-D_U_=__attribute__((unused))',
'-Wno-pedantic',
'-Wno-extra',
'-Wno-all',
'-Wno-deprecated-declarations',
]
if host_os == 'linux'
netatalk_common_flags += '-D_GNU_SOURCE'
endif
if build_type == 'debug'
netatalk_common_flags += '-DEBUG'
endif
add_global_arguments(netatalk_common_flags, language: 'c')
netatalk_common_link_args = []
# 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="' + netatalk_version + '"'
messagedir = '-DSERVERTEXT="' + localstatedir + '/netatalk/msg/"'
statedir = '-D_PATH_STATEDIR="' + localstatedir + '/netatalk/"'
uamdir = '-D_PATH_AFPDUAMPATH="' + libdir + '/netatalk/"'
############
# Includes #
############
macos_prefix = ''
if host_os == 'darwin'
brew = find_program('brew', required: false)
if cpu == 'aarch64' and brew.found()
macos_prefix += '/opt/homebrew'
elif cpu == 'x86_64' and brew.found()
macos_prefix += '/usr/local'
endif
endif
if host_os in ['dragonfly', 'freebsd', 'openbsd']
root_includes = include_directories(
'.',
'include',
'sys',
'etc/afpd',
'/usr/local/include',
)
elif host_os == 'netbsd'
root_includes = include_directories(
'.',
'include',
'sys',
'etc/afpd',
'/usr/pkg/include',
)
elif host_os == 'omnios'
root_includes = include_directories(
'.',
'include',
'sys',
'etc/afpd',
'/opt/local/include',
)
else
root_includes = include_directories(
'.',
'include',
'sys',
'etc/afpd',
)
endif
############
# Programs #
############
flex = find_program('flex', required: false)
grep = find_program('grep', required: false)
uname = find_program('uname', required: false)
cmarkgfm = find_program('cmark-gfm', required: false)
if host_os == 'darwin'
bison = find_program(macos_prefix / 'opt/bison/bin/bison', required: false)
if not bison.found()
bison = find_program('/opt/local/bin/bison', required: false)
endif
else
bison = find_program('bison', required: false)
endif
#############
# Libraries #
#############
uname_stdout = run_command(uname, '-a', check: false).stdout().strip()
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 uname_stdout.to_lower().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',
'errno.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',
'poll.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',
'errno',
'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',
]
have_atfuncs = false
foreach f : at_functions
if cc.has_function(f)
have_atfuncs = true
cdata.set('HAVE_' + f.underscorify().to_upper(), 1)
cdata.set('_ATFILE_SOURCE', 1)
cdata.set('HAVE_ATFUNCS', 1)
endif
endforeach
if cc.has_function('rresvport')
cdata.set('HAVE_RRESVPORT', 1)
endif
##########################
# 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 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_64_bit_mode = run_command(
'/usr/bin/file',
meson.global_build_root() / 'dummy.o',
check: true,
).stdout().strip().contains('ELF 64')
#
# Check whether to enable rpath (the default on Solaris and NetBSD)
#
rpath_libdir = ''
if host_os == 'sunos' or host_os == 'netbsd' or get_option('with-rpath')
rpath_libdir = libdir
endif
#
# Check for the Berkeley DB library
#
bdb_path = get_option('with-bdb-path')
bdb_req_version = get_option('with-bdb-version')
have_bdb = false
bdb_header = ''
bdb_includes = []
bdb_libdir = ''
bdb_link_args = []
bdb_major_version = ''
bdb_minor_version = ''
bdb_version = ''
if bdb_path != ''
bdb_dirs = [ bdb_path ]
else
bdb_dirs = [
'/usr/local',
'/usr/pkg',
'/opt/local',
macos_prefix / 'opt/berkeley-db',
'/usr',
]
endif
bdb_subdirs = [
'db62',
'db6.2',
'db61',
'db6.1',
'db5',
'db53',
'db5.3',
'db52',
'db5.2',
'db51',
'db5.1',
'db50',
'db5.0',
'db4',
'db48',
'db4.8',
'db47',
'db4.7',
'db46',
'db4.6',
'',
]
if bdb_req_version != ''
if not bdb_req_version.version_compare('>=4.6')
error('Berkeley DB library version is below supported 4.6')
endif
message('Searching for Berkeley DB library version', bdb_req_version)
endif
foreach dir : bdb_dirs
foreach subdir : bdb_subdirs
bdb_include_path = dir / 'include' / subdir
bdb_header = bdb_include_path / 'db.h'
if fs.exists(bdb_header)
bdb_includes = include_directories(bdb_include_path)
grep_result = run_command(
'grep',
'DB_VERSION_MAJOR',
bdb_header,
check: false,
)
if grep_result.returncode() != 0
warning('Unable to determine Berkeley DB major version from header', bdb_header)
continue
endif
bdb_major_version = grep_result.stdout().strip().substring(25)
grep_result = run_command(
'grep',
'DB_VERSION_MINOR',
bdb_header,
check: false,
)
if grep_result.returncode() != 0
warning('Unable to determine Berkeley DB minor version from header', bdb_header)
continue
endif
bdb_minor_version = grep_result.stdout().strip().substring(25)
bdb_version = bdb_major_version + '.' + bdb_minor_version
if not bdb_version.version_compare('>=4.6')
continue
endif
if bdb_req_version != '' and not bdb_version.version_compare('~' + bdb_req_version)
continue
endif
message('Berkeley DB header found at', bdb_header)
# Now find lib file matching header
if target_os == 'sunos' and compiler_64_bit_mode and fs.exists(dir / 'lib/64')
bdb_libdir = dir / 'lib/64'
else
bdb_libdir = dir / 'lib'
endif
# Guess lib name starting from more specific ones
bdb_libnames = [
'db-' + bdb_major_version + '.' + bdb_minor_version,
'db' + bdb_major_version + '.' + bdb_minor_version,
'db' + bdb_major_version + bdb_minor_version,
'db-' + bdb_major_version,
'db' + bdb_major_version,
'db',
]
foreach name : bdb_libnames
db = cc.find_library(name, dirs: bdb_libdir, required: false)
if db.found()
have_bdb = true
break
endif
endforeach
if have_bdb
break
endif
endif
endforeach
if have_bdb
break
endif
endforeach
if not have_bdb
if bdb_req_version != ''
msg = 'Berkeley DB library version ' + bdb_req_version + ' requested via -Dwith-bdb-version= not found!'
else
msg = 'Berkeley DB library required but not found!'
endif
error(msg, 'Please specify an installation path using the -Dwith-bdb-path= configure option (must include lib and include dirs)')
endif
#
# Check for Perl
#
perl_path = get_option('with-perl-path')
if perl_path == ''
perl = find_program('perl', required: false)
else
perl = find_program(perl_path / 'perl', required: false)
endif
#
# Check for Unicode Character Database
#
unicode_dirs = [
meson.current_source_dir(),
'/usr/share/unicode',
'/usr/share/unicode/ucd',
'/usr/pkg/share/texmf-dist/tex/generic/unicode-data',
'/usr/local/share/texmf-dist/tex/generic/unicode-data/',
]
unicode_data_path = get_option('with-unicode-data-path')
if unicode_data_path == ''
foreach dir : unicode_dirs
if fs.exists(dir / 'UnicodeData.txt')
unicode_data_path = dir
break
endif
endforeach
elif not fs.is_absolute(unicode_data_path)
unicode_data_path = meson.current_source_dir() / unicode_data_path
endif
unicode_data_file = unicode_data_path / 'UnicodeData.txt'
if fs.exists(unicode_data_file)
message('Unicode Character Database found at ' + unicode_data_path)
endif
#
# Check for crypt (for DHX authentication)
#
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
#
# Check whether Kerberos V UAM should be compiled
#
enable_krb5_uam = get_option('with-krbV-uam')
if not enable_krb5_uam
have_krb5_uam = false
have_gssapi = false
have_kerberos = false
else
#
# Check for GSSAPI
#
enable_gssapi = get_option('with-gssapi')
gssapi_path = get_option('with-gssapi-path')
gss_libs = []
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(
[gssapi_path / 'include', header_dir],
),
)
cdata.set('HAVE_' + header.underscorify().to_upper(), 1)
endif
endforeach
if not enable_gssapi
have_gssapi = false
elif get_option('with-gssapi-path') != ''
have_gssapi = true
gss = cc.find_library(
'gssapi',
dirs: gssapi_path / 'lib',
required: false,
)
gssapi_includes += include_directories(gssapi_path / '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)
if not gss.found()
gss = cc.find_library(
'gssapi_krb5',
dirs: libsearch_dirs,
required: false,
)
if not gss.found()
have_gssapi = false
endif
endif
endif
have_gssapi = gss.found() and cc.has_function('gss_acquire_cred', dependencies: gss)
if have_gssapi
gss_libs += gss
cdata.set('HAVE_GSSAPI', 1)
# 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
else
have_gssapi = false
warning('GSSAPI support requested but gssapi libraries not found')
endif
endif
#
# Check for Kerberos V
#
enable_kerberos = get_option('with-kerberos')
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 not enable_kerberos
have_kerberos = false
else
have_kerberos = kerberos.found()
if have_kerberos
gss_libs += kerberos
cdata.set('HAVE_KERBEROS', 1)
if host_os == 'sunos'
kerberos_c_args += run_command(
krb5_config,
'--cflags',
check: true,
).stdout().strip()
endif
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
else
have_kerberos = false
warning('Kerberos API support requested but libkrb5 not found')
endif
endif
if have_gssapi and have_kerberos
have_krb5_uam = true
else
have_krb5_uam = false
endif
if enable_krb5_uam and not have_gssapi
warning('Need GSSAPI support to build Kerberos V UAM')
endif
endif
#
# Check for optional Zeroconf support
#
enable_zeroconf = get_option('with-zeroconf')
have_zeroconf = false
zeroconf_provider = ''
avahi = dependency('avahi-client', required: false)
dns_sd_libs = []
dns_sd = cc.find_library('dns_sd', required: false)
if dns_sd.found()
dns_sd_libs += dns_sd
endif
system = cc.find_library('system', required: false)
if dns_sd.found()
dns_sd_libs += system
endif
have_dns = (
(dns_sd.found() or system.found())
and cc.has_header('dns_sd.h')
and cc.has_function(
'DNSServiceRegister',
dependencies: dns_sd_libs,
)
)
if enable_zeroconf
if avahi.found()
have_zeroconf = true
cdata.set('USE_ZEROCONF', 1)
cdata.set('HAVE_AVAHI', 1)
if avahi.version() >= '0.6.4'
cdata.set('HAVE_AVAHI_THREADED_POLL', 1)
endif
cdata.set('freebsd_zeroconf', 'avahi_daemon')
zeroconf_provider += 'Avahi'
elif have_dns
have_zeroconf = true
cdata.set('USE_ZEROCONF', 1)
cdata.set('HAVE_MDNS', 1)
cdata.set('freebsd_zeroconf', 'mdnsd')
zeroconf_provider += 'mDNS'
endif
endif
if enable_zeroconf and not have_zeroconf
warning(
'Zeroconf (Bonjour) support requested but required libraries not found',
'Please install Avahi or mDNS',
)
endif
#
# Check for Spotlight support
#
talloc = dependency('talloc', required: false)
tracker_prefix = get_option('with-tracker-prefix')
have_spotlight = false
if get_option('with-spotlight')
# Check for SPARQL
sparql_versions = [
'tracker-sparql-3.0',
'tracker-sparql-2.0',
'tracker-sparql-1.0'
]
foreach sparql_version : sparql_versions
sparql = dependency(sparql_version, required: false)
if sparql.found()
break
endif
endforeach
if not sparql.found()
warning('Tracker SPARQL or TinySPARQL not found (required for Spotlight support)')
else
sparql_prefix = sparql.get_variable(pkgconfig: 'prefix')
# Check for indexer
if tracker_prefix != ''
indexer_dirs = [tracker_prefix + '/bin']
else
indexer_dirs = []
endif
tracker = find_program(
'tracker',
dirs: indexer_dirs,
required: false,
)
tracker3 = find_program(
'tracker3',
dirs: indexer_dirs,
required: false,
)
tracker_control = find_program(
'tracker-control',
dirs: indexer_dirs,
required: false,
)
localsearch = find_program(
'localsearch',
dirs: indexer_dirs,
required: false,
)
indexer_command = ''
if localsearch.found()
cdata.set('HAVE_TRACKER3', 1)
indexer_command = localsearch.full_path() + ' daemon'
elif tracker3.found()
cdata.set('HAVE_TRACKER3', 1)
indexer_command = tracker3.full_path() + ' daemon'
elif tracker.found()
indexer_command = tracker.full_path() + ' daemon'
elif tracker_control.found()
indexer_command = tracker_control.full_path()
endif
indexer_found = (
tracker.found()
or tracker3.found()
or tracker_control.found()
or localsearch.found()
)
if not indexer_found
warning('Tracker or LocalSearch not found (required for Spotlight support)')
else
cdata.set('INDEXER_COMMAND', '"' + indexer_command + '"')
# Check for talloc
if talloc.found()
cdata.set('HAVE_TALLOC', 1)
else
warning(
'talloc library not found (required for Spotlight support)',
)
endif
endif
endif
have_spotlight = (
sparql.found()
and indexer_found
and talloc.found()
and flex.found()
and bison.found()
)
endif
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 CUPS
#
cups = dependency('cups', required: false)
cups_config = find_program('cups-config', required: false)
spooldir = ''
if get_option('with-cups') and get_option('with-appletalk')
spooldir = get_option('localstatedir') / 'spool' / 'netatalk'
spooldir_override = get_option('with-spooldir')
if spooldir_override != ''
spooldir = spooldir_override
endif
have_cups = cups.found() and cups_config.found()
if have_cups
spooldir_required = true
cdata.set('HAVE_CUPS', 1)
cups_api_version = run_command(
cups_config,
'--api-version',
check: true,
).stdout().strip()
cdata.set('CUPS_API_VERSION', '"' + cups_api_version + '"')
else
warning('CUPS not found, you might need to specify the path to cups-config')
endif
else
have_cups = false
spooldir_required = false
cdata.set('DISABLE_SPOOL', 1)
endif
#
# Check for quota support
#
enable_quota = get_option('with-quota')
prop = cc.find_library('prop', required: false)
quota = cc.find_library('quota', required: false)
rpcsvc = cc.find_library('rpcsvc', required: false)
tirpc = dependency('libtirpc', required: false)
quota_deps = []
quota_provider = ''
have_libquota = false
rpc_headers = [
'rpc/rpc.h',
'rpc/pmap_prot.h',
'rpcsvc/rquota.h',
]
rpc_headers_ok = (