Dmitry V. Levin | 916aded | 2010-09-09 17:36:36 +0000 | [diff] [blame] | 1 | dnl ### A macro to find the include directory, useful for cross-compiling. |
| 2 | AC_DEFUN([AC_INCLUDEDIR], |
| 3 | [AC_REQUIRE([AC_PROG_AWK])dnl |
| 4 | AC_SUBST(includedir) |
| 5 | AC_MSG_CHECKING(for primary include directory) |
| 6 | includedir=/usr/include |
| 7 | if test -n "$GCC" |
| 8 | then |
| 9 | >conftest.c |
| 10 | new_includedir=` |
| 11 | $CC -v -E conftest.c 2>&1 | $AWK ' |
| 12 | /^End of search list/ { print last; exit } |
| 13 | { last = [$]1 } |
| 14 | ' |
| 15 | ` |
| 16 | rm -f conftest.c |
| 17 | if test -n "$new_includedir" && test -d "$new_includedir" |
| 18 | then |
| 19 | includedir=$new_includedir |
| 20 | fi |
| 21 | fi |
| 22 | AC_MSG_RESULT($includedir) |
| 23 | ]) |