@@ -614,33 +614,66 @@ gssapiopt = get_option('gssapi')
614
614
krb_srvtab = ''
615
615
have_gssapi = false
616
616
if not gssapiopt.disabled()
617
- gssapi = dependency (' krb5-gssapi' , required : gssapiopt )
617
+ gssapi = dependency (' krb5-gssapi' , required : false )
618
618
have_gssapi = gssapi.found()
619
619
620
+ if have_gssapi
621
+ gssapi_deps = [gssapi]
622
+ elif not have_gssapi
623
+ # Hardcoded lookup for gssapi. This is necessary as gssapi on windows does
624
+ # not install neither pkg-config nor cmake dependency information.
625
+ if host_system == ' windows'
626
+ is_64 = cc.sizeof(' void *' , args : test_c_args) == 8
627
+ if is_64
628
+ gssapi_search_libs = [' gssapi64' , ' krb5_64' , ' comerr64' ]
629
+ else
630
+ gssapi_search_libs = [' gssapi32' , ' krb5_32' , ' comerr32' ]
631
+ endif
632
+ else
633
+ gssapi_search_libs = [' gssapi_krb5' ]
634
+ endif
635
+
636
+ gssapi_deps = []
637
+ foreach libname : gssapi_search_libs
638
+ lib = cc.find_library (libname, dirs : test_lib_d, required : false )
639
+ if lib.found()
640
+ have_gssapi = true
641
+ gssapi_deps += lib
642
+ endif
643
+ endforeach
644
+
645
+ if have_gssapi
646
+ # Meson before 0.57.0 did not support using check_header() etc with
647
+ # declare_dependency(). Thus the tests below use the library looked up
648
+ # above. Once we require a newer meson version, we can simplify.
649
+ gssapi = declare_dependency (dependencies : gssapi_deps)
650
+ endif
651
+ endif
652
+
620
653
if not have_gssapi
621
- elif cc.check_header(' gssapi/gssapi.h' , dependencies : gssapi , required : false ,
654
+ elif cc.check_header(' gssapi/gssapi.h' , dependencies : gssapi_deps , required : false ,
622
655
args : test_c_args, include_directories : postgres_inc)
623
656
cdata.set(' HAVE_GSSAPI_GSSAPI_H' , 1 )
624
- elif cc.check_header(' gssapi.h' , dependencies : gssapi , required : gssapiopt,
657
+ elif cc.check_header(' gssapi.h' , dependencies : gssapi_deps , required : gssapiopt,
625
658
args : test_c_args, include_directories : postgres_inc)
626
659
cdata.set(' HAVE_GSSAPI_H' , 1 )
627
660
else
628
661
have_gssapi = false
629
662
endif
630
663
631
664
if not have_gssapi
632
- elif cc.check_header(' gssapi/gssapi_ext.h' , dependencies : gssapi , required : false ,
665
+ elif cc.check_header(' gssapi/gssapi_ext.h' , dependencies : gssapi_deps , required : false ,
633
666
args : test_c_args, include_directories : postgres_inc)
634
667
cdata.set(' HAVE_GSSAPI_GSSAPI_EXT_H' , 1 )
635
- elif cc.check_header(' gssapi_ext.h' , dependencies : gssapi , required : gssapiopt,
668
+ elif cc.check_header(' gssapi_ext.h' , dependencies : gssapi_deps , required : gssapiopt,
636
669
args : test_c_args, include_directories : postgres_inc)
637
670
cdata.set(' HAVE_GSSAPI_EXT_H' , 1 )
638
671
else
639
672
have_gssapi = false
640
673
endif
641
674
642
675
if not have_gssapi
643
- elif cc.has_function(' gss_store_cred_into' , dependencies : gssapi ,
676
+ elif cc.has_function(' gss_store_cred_into' , dependencies : gssapi_deps ,
644
677
args : test_c_args, include_directories : postgres_inc)
645
678
cdata.set(' ENABLE_GSS' , 1 )
646
679
@@ -651,6 +684,11 @@ if not gssapiopt.disabled()
651
684
else
652
685
have_gssapi = false
653
686
endif
687
+
688
+ if not have_gssapi and gssapiopt.enabled()
689
+ error (' dependency lookup for gssapi failed' )
690
+ endif
691
+
654
692
endif
655
693
if not have_gssapi
656
694
gssapi = not_found_dep
0 commit comments