# Mkmf.rb questions

**URL:** <https://www.ruby-forum.com/t/mkmf-rb-questions/170562>\
**Category:** Ruby\
**Created:** [June 19, 2009, 12:01am UTC](https://www.ruby-forum.com/t/mkmf-rb-questions/170562 "2009-06-19T00:01:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [June 19, 2009, 12:01am UTC](https://www.ruby-forum.com/t/mkmf-rb-questions/170562/1 "2009-06-19T00:01:54Z")

</div>

I am a very sad panda right now. I need some help with mkmf.rb.

I have a header file “foo.h” that is in /usr/include.

I have a list of other directories where a newer version of foo.h might  
live. For example, it is possible that I have a newer version of foo.h  
installed in either /opt/local/include, /usr/local/include, or some  
other  
directory.

Is there a way with mkmf to detect the newer version of foo.h under one  
of the directories in my list?

I’m using find\_header(), and the first thing it tries is compiling with  
no extra gcc flags. Since foo.h was already under /usr/include,  
find\_header() returns true and does not modify the include paths _even  
though_ I’ve told it to search other directories.

On top of that, even if I gave gcc a specific -I flag, it will still  
return true because the header file is in /usr/include.

What is the “best” way to solve the problem? I’m tempted to just try  
File.exists? for the header file under each possible include directory,  
then mucking with the -I flags myself.

Thanks!
