You are not logged in.
Pages: 1
So I've been learning how to use autotools. I noticed that the code to check for a required library and associated headers is the same four or five lines over and over again, so I tried my hand at writing a macro...
# AX_REQUIRED_LIB(function, library-file, header-files...)
AC_DEFUN([AX_REQUIRED_LIB], [
AC_SEARCH_LIBS([$1], [$2], [],
[AC_MSG_ERROR([$2 required.])
])
m4_foreach([header], [$3],
[AC_CHECK_HEADER([header], [],
[AC_MSG_ERROR([header required.])])
])
])
It seems to work well for libs, but not headers. If I test it out with something like this:
AX_REQUIRED_LIB([initscr], [curses], [curses.h, stdlib.h, doesnotexist.h])
Which from my understanding should fail with the message 'doesnotexist.h required.', but instead I get this:
checking for doesnotexist.h... (cached) yes
Offline
Pages: 1