You are not logged in.

#1 2013-02-12 18:09:35

AaronBP
Member
Registered: 2012-08-06
Posts: 149
Website

custom autoconf macro bug

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

Board footer

Powered by FluxBB