@@ -60,13 +60,9 @@ want_ftp = get_option('ftp')
6060want_history = get_option (' history' )
6161want_html = get_option (' html' )
6262want_http = get_option (' http' )
63- want_iconv = get_option (' iconv' )
64- want_icu = get_option (' icu' )
6563want_ipv6 = get_option (' ipv6' )
6664want_iso8859x = get_option (' iso8859x' )
6765want_legacy = get_option (' legacy' )
68- want_lzma = get_option (' lzma' )
69- want_modules = get_option (' modules' )
7066want_output = get_option (' output' )
7167want_pattern = get_option (' pattern' )
7268want_push = get_option (' push' )
@@ -77,7 +73,6 @@ want_regexps = get_option('regexps')
7773want_sax1 = get_option (' sax1' )
7874want_schemas = get_option (' schemas' )
7975want_schematron = get_option (' schematron' )
80- want_threads = get_option (' threads' )
8176want_thread_alloc = get_option (' thread-alloc' )
8277want_tls = get_option (' tls' )
8378want_tree = get_option (' tree' )
@@ -87,7 +82,6 @@ want_xinclude = get_option('xinclude')
8782want_xpath = get_option (' xpath' )
8883want_xptr = get_option (' xptr' )
8984want_xptr_locs = get_option (' xptr-locs' )
90- want_zlib = get_option (' zlib' )
9185
9286# TODO: Options should be three-valued: "yes", "no", default
9387
@@ -185,11 +179,8 @@ if get_option('minimum')
185179 want_history = false
186180 want_html = false
187181 want_http = false
188- want_iconv = false
189182 want_ipv6 = false
190183 want_iso8859x = false
191- want_lzma = false
192- want_modules = false
193184 want_output = false
194185 want_pattern = false
195186 want_push = false
@@ -200,7 +191,6 @@ if get_option('minimum')
200191 want_sax1 = false
201192 want_schemas = false
202193 want_schematron = false
203- want_threads = false
204194 want_thread_alloc = false
205195 want_tree = false
206196 want_valid = false
@@ -209,7 +199,6 @@ if get_option('minimum')
209199 want_xpath = false
210200 want_xptr = false
211201 want_xptr_locs = false
212- want_zlib = false
213202else
214203 # Disable dependent modules
215204 if want_output == false
@@ -402,49 +391,46 @@ if cc.has_function_attribute('destructor')
402391endif
403392
404393### DSO support
405- with_modules = false
406- if want_modules == true
407- if sys_cygwin == true
408- module_extension = ' .dll'
409- elif sys_windows == true
410- module_extension = ' .dll'
411- with_modules = true
412- else
413- module_extension = ' .so'
414- endif
394+ if sys_cygwin == true
395+ module_extension = ' .dll'
396+ elif sys_windows == true
397+ module_extension = ' .dll'
398+ else
399+ module_extension = ' .so'
400+ endif
415401
416- if with_modules == false
402+ dl_dep = dependency ('' , required : false )
403+ if not get_option (' minimum' )
404+ if host_machine .system() != ' windows'
417405 if meson .version().version_compare(' >=0.62' )
418- dl_dep = dependency (' dl' , required : false )
406+ dl_dep = dependency (' dl' , required : get_option ( ' modules ' ) )
419407 else
420- dl_dep = cc.find_library (' dl' , required : false )
408+ dl_dep = cc.find_library (' dl' , required : get_option ( ' modules ' ) )
421409 endif
422410 if dl_dep.found()
423411 config_h.set10(' HAVE_DLOPEN' , true )
424412 xml_deps += dl_dep
425- with_modules = true
426413 endif
414+ elif get_option (' modules' ).allowed()
415+ dl_dep = declare_dependency ()
427416 endif
428417endif
429418
430419### threads
431- if want_threads == true
432- if sys_windows == false
433- threads_dep = dependency (' threads' )
420+ threads_dep = dependency ('' , required : false )
421+ if not get_option (' minimum' )
422+ if host_machine .system() != ' windows'
423+ threads_dep = dependency (' threads' , required : get_option (' threads' ))
434424 if threads_dep.found()
435425 config_h.set10(' HAVE_PTHREAD_H' , true )
436426 xml_deps += threads_dep
437- else
438- want_threads = false
439427 endif
440- else
441- threads_dep = dependency ( '' , required : false )
428+ elif get_option ( ' threads ' ).allowed()
429+ threads_dep = declare_dependency ( )
442430 endif
443431endif
444432
445- want_thread_alloc = (
446- (want_threads == true and want_threads == true ) ? true : false
447- )
433+ want_thread_alloc = threads_dep.found()
448434
449435### xmllint shell history
450436xmllint_deps = []
@@ -582,51 +568,41 @@ int main()
582568endif
583569
584570### zlib
585- if want_zlib == true
586- zlib_dep = dependency (' zlib' , required : false )
587- if zlib_dep.found()
588- xml_deps += zlib_dep
589- else
590- want_zlib = false
591- endif
571+ if not get_option (' minimum' )
572+ zlib_dep = dependency (' zlib' , required : get_option (' zlib' ))
573+ else
574+ zlib_dep = dependency ('' , required : false )
592575endif
576+ xml_deps += zlib_dep
593577
594578### lzma
595- if want_lzma == true
596- lzma_dep = dependency (' liblzma' , required : false )
597- if lzma_dep.found()
598- xml_deps += lzma_dep
599- else
600- want_lzma = false
601- endif
579+ if not get_option (' minimum' )
580+ lzma_dep = dependency (' liblzma' , required : get_option (' lzma' ))
581+ else
582+ lzma_dep = dependency ('' , required : false )
602583endif
584+ xml_deps += lzma_dep
603585
604586### iconv
605- if want_iconv == true
606- iconv_dep = dependency (' iconv' , required : false )
607- if iconv_dep.found()
608- xml_deps += iconv_dep
609- else
610- want_iconv = false
611- endif
587+ if not get_option (' minimum' )
588+ iconv_dep = dependency (' iconv' , required : get_option (' iconv' ))
589+ else
590+ iconv_dep = dependency ('' , required : false )
612591endif
592+ xml_deps += iconv_dep
613593
614- if want_iconv == false and want_iso8859x == false
594+ if not iconv_dep.found() and want_iso8859x == false
615595 want_iso8859x = false
616596else
617597 want_iso8859x = true
618598endif
619599
620600# icu
621- if want_icu == true
622- icu_dep = dependency (' icu-i18n' , method : ' pkg-config' , required : false )
623- if icu_dep.found()
624- def_var = icu_dep.get_variable (pkgconfig : ' DEFS' )
625- config_dir += include_directories (def_var)
626- xml_deps += icu_dep
627- else
628- want_icu = false
629- endif
601+ icu_dep = dependency (' icu-i18n' , method : ' pkg-config' , required : get_option (' icu' ))
602+ if icu_dep.found()
603+ def_var = icu_dep.get_variable (pkgconfig : ' DEFS' )
604+ config_dir += include_directories (def_var)
605+ xml_deps += icu_dep
630606endif
631607
632608subdir (' include/libxml' )
@@ -667,8 +643,8 @@ xml_opt_src = [
667643 [want_html, [' HTMLparser.c' , ' HTMLtree.c' ]],
668644 [want_http, [' nanohttp.c' ]],
669645 [want_legacy, [' legacy.c' ]],
670- [want_lzma , [' xzlib.c' ]],
671- [with_modules , [' xmlmodule.c' ]],
646+ [lzma_dep.found() , [' xzlib.c' ]],
647+ [dl_dep.found() , [' xmlmodule.c' ]],
672648 [want_output, [' xmlsave.c' ]],
673649 [want_pattern, [' pattern.c' ]],
674650 [want_reader, [' xmlreader.c' ]],
@@ -787,7 +763,7 @@ pkgmod.generate(
787763 description : ' libXML library version2.' ,
788764 filebase : ' libxml-2.0' ,
789765 name : ' libXML' ,
790- variables : ' modules=' + with_modules .to_string(' 1' , ' 0' ),
766+ variables : ' modules=' + dl_dep.found() .to_string(' 1' , ' 0' ),
791767)
792768
793769## libxml2-config.cmake file
@@ -797,12 +773,12 @@ config_cmake.set('LIBXML_MAJOR_VERSION', v_maj)
797773config_cmake.set(' LIBXML_MINOR_VERSION' , v_min)
798774config_cmake.set(' LIBXML_MICRO_VERSION' , v_mic)
799775config_cmake.set(' VERSION' , meson .project_version())
800- config_cmake.set(' WITH_ICONV' , want_iconv .to_int().to_string())
801- config_cmake.set(' WITH_ICU' , want_icu .to_int().to_string())
802- config_cmake.set(' WITH_LZMA' , want_lzma .to_int().to_string())
803- config_cmake.set(' WITH_MODULES' , want_modules .to_int().to_string())
804- config_cmake.set(' WITH_THREADS' , want_threads .to_int().to_string())
805- config_cmake.set(' WITH_ZLIB' , want_zlib .to_int().to_string())
776+ config_cmake.set(' WITH_ICONV' , iconv_dep.found() .to_int().to_string())
777+ config_cmake.set(' WITH_ICU' , icu_dep.found() .to_int().to_string())
778+ config_cmake.set(' WITH_LZMA' , lzma_dep.found() .to_int().to_string())
779+ config_cmake.set(' WITH_MODULES' , dl_dep.found() .to_int().to_string())
780+ config_cmake.set(' WITH_THREADS' , threads_dep.found() .to_int().to_string())
781+ config_cmake.set(' WITH_ZLIB' , zlib_dep.found() .to_int().to_string())
806782config_cmake.set(' XML_CFLAGS' , xml_cflags)
807783configure_file (
808784 input : ' libxml2-config.cmake.in' ,
@@ -834,13 +810,13 @@ summary(
834810 ' history' : want_history,
835811 ' html' : want_html,
836812 ' http' : want_http,
837- ' iconv' : want_iconv ,
838- ' icu' : want_icu ,
813+ ' iconv' : iconv_dep.found() ,
814+ ' icu' : icu_dep.found() ,
839815 ' ipv6' : want_ipv6,
840816 ' iso8859x' : want_iso8859x,
841817 ' legacy' : want_legacy,
842- ' lzma' : want_lzma ,
843- ' modules' : want_modules ,
818+ ' lzma' : lzma_dep.found() ,
819+ ' modules' : dl_dep.found() ,
844820 ' output' : want_output,
845821 ' pattern' : want_pattern,
846822 ' push' : want_push,
@@ -851,7 +827,7 @@ summary(
851827 ' sax1' : want_sax1,
852828 ' schemas' : want_schemas,
853829 ' schematron' : want_schematron,
854- ' threads' : want_threads ,
830+ ' threads' : threads_dep.found() ,
855831 ' thread-alloc' : want_thread_alloc,
856832 ' tls' : want_tls,
857833 ' tree' : want_tree,
@@ -861,7 +837,7 @@ summary(
861837 ' xpath' : want_xpath,
862838 ' xptr' : want_xptr,
863839 ' xptr-locs' : want_xptr_locs,
864- ' zlib' : want_zlib ,
840+ ' zlib' : zlib_dep.found() ,
865841 },
866842 section : ' Configuration Options Summary:' ,
867843)
0 commit comments