Use a tool like the GNU Autoconf for which it is intended. (In windows you can use CMake ).
So in your configure.ac
you will have a line like:
AC_CHECK_HEADERS([foo.h])
Which, after running configure
, would define HAVE_FOO_H
, which you can test as follows:
#ifdef HAVE_FOO_H #include "foo.h" #else #define BAR 1 #endif
If you intend to go down the autotools route (these are autoconf and automake, because they work well together), I suggest you start with this great tutorial .
source share