@@ -54,23 +54,45 @@ add_project_arguments('-DVERSION="'+meson.project_version() + '"', language : 'c
5454
5555jose = dependency (' jose' , version : ' >=8' )
5656a2x = find_program (' a2x' , required : false )
57- compiler = meson .get_compiler(' c' )
57+ compiler = meson .get_compiler(' c' , native : true )
58+
59+ if meson .is_cross_build()
60+ compiler = meson .get_compiler(' c' , native : false )
61+ endif
62+
63+ message (compiler.version())
64+ message (compiler.get_id())
5865
5966http_lib = []
60- if compiler.has_header(' llhttp.h' , args : ' -I/usr/local/include' )
67+
68+ inc_dir = meson .get_external_property(' inc_dir' , ' -I/usr/local/include' )
69+ lib_dir = meson .get_external_property(' lib_dir' ,' /usr/local/lib' )
70+
71+ if meson .is_cross_build()
72+ message (' ----------------' )
73+ message (' *** THIS IS A CROSS BUILD ***' )
74+ message (' Compiler version :' + compiler.version())
75+ message (' Compiler ID :' + compiler.get_id())
76+ message (' Library search directory :' + lib_dir)
77+ message (' Include directory :' + inc_dir)
78+ message (' ----------------' )
79+ endif
80+
81+ if compiler.has_header(' llhttp.h' , args : inc_dir)
6182 http_lib = ' llhttp'
6283 add_project_arguments (' -DUSE_LLHTTP' , language : ' c' )
6384else
64- if not compiler.has_header(' http_parser.h' , args : ' -I/usr/local/include ' )
85+ if not compiler.has_header(' http_parser.h' , args : inc_dir )
6586 error (' neither llhttp nor http-parser devel files found.' )
6687 endif
88+
6789 http_lib = ' http_parser'
6890endif
6991
7092if host_machine .system() == ' freebsd'
7193 http_parser = compiler.find_library (http_lib, dirs : ' /usr/local/lib' )
7294else
73- http_parser = compiler.find_library (http_lib)
95+ http_parser = compiler.find_library (http_lib, dirs : [lib_dir] )
7496endif
7597
7698licenses = [' COPYING' ]
@@ -82,7 +104,9 @@ units = []
82104subdir (' doc' )
83105subdir (' src' )
84106subdir (' units' )
85- subdir (' tests' )
107+ if not meson .is_cross_build()
108+ subdir (' tests' )
109+ endif
86110
87111install_data (libexecbins, install_dir : libexecdir)
88112install_data (bins, install_dir : bindir)
0 commit comments