Method: MakeMakefile#have_header
- Defined in:
- lib/mkmf.rb
#have_header(header, preheaders = nil, opt = "", &b) ⇒ Object
Returns whether or not the given header file can be found on your system. If found, a macro is passed as a preprocessor constant to the compiler using the header file name, in uppercase, prepended with HAVE_.
For example, if have_header('foo.h') returned true, then the HAVE_FOO_H preprocessor macro would be passed to the compiler.
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 |
# File 'lib/mkmf.rb', line 1239 def have_header(header, preheaders = nil, opt = "", &b) dir_config(header[/.*?(?=\/)|.*?(?=\.)/]) checking_for header do if try_header(cpp_include(preheaders)+cpp_include(header), opt, &b) $defs.push(format("-DHAVE_%s", header.tr_cpp)) true else false end end end |