Re: [patch #8505] ac_cv_header_lua_h always set to yes

Peter Johansson <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
On 10/08/14 04:49, anonymous wrote:
> As I understand, AX_LUA_HEADERS() will search for lua.h in /usr/include
> because of the <> brackets.
> If lua{,lib,xlib}.h are found in /usr/include (default) AC_CHECK_HEADERS will
> return yes.

This is not true. From the Autoconf manual:

This macro caches its result in the |ac_cv_header_|header-file variable, 
with characters not suitable for a variable name mapped to underscores.

http://www.gnu.org/software/autoconf/manual/autoconf.html#Generic-Headers

and playing around with ac_cv_ variable is dangerous as it might mess up 
the caching functionality unless you know what you're doing.

Reading the code a bit more careful now, it looks like the author 
assumes that AC_CHECK_HEADERS sets ac_cv_header_lua_h to yes if 
successful, and that false assumption is probably the reason that mnacro 
doesn't behave as you want. It is not clear to me what the macro is 
actually supposed to do, so hard to fix it.

Hope this helps somehow, and I'm happy to help if we perhaps can fix it 
together.


Cheers,

Peter

> If by any chance the version is not what we expect, the function
> will fail without going through the directory list.
> I changed the script to make it work in my environment at least and it needs
> probably some improvements.
>
> For the test,
> /usr/include contains lua{,lib,xlib}.h version 5.1
> /usr/include/lua5.1 contains lua{,lib,xlib}.h version 5.1
> /usr/include/lua5.2 contains lua{,lib,xlib}.h version 5.2
> I'm looking for version 5.2
> ./configure returns,
>
> checking if LUA_VERSION is defined... yes
> checking for library containing exp... -lm
> checking for library containing dlopen... -ldl
> checking for library containing lua_load... -llua5.2
> checking whether sys/types.h defines makedev... yes
> checking whether to enable assertions... yes
> checking if LUA_VERSION is defined... yes
> checking lua.h usability... yes
> checking lua.h presence... yes
> checking for lua.h... yes
> checking lualib.h usability... yes
> checking lualib.h presence... yes
> checking for lualib.h... yes
> checking lauxlib.h usability... yes
> checking lauxlib.h presence... yes
> checking for lauxlib.h... yes
> checking luaconf.h usability... yes
> checking luaconf.h presence... yes
> checking for luaconf.h... yes
> checking if Lua header version 5.1 matches 5.2... no
> checking for lua.h... (cached) yes
> checking for lualib.h... (cached) yes
> checking for lauxlib.h... (cached) yes
> checking for luaconf.h... (cached) yes
> checking if Lua header version 5.2 matches 5.2... yes
> [...]
> 	   prefix:            /usr
> 	   exec prefix:       ${prefix}
>
> 	   localstatedir:     ${prefix}/var
> 	   pkgconfigdir:      ${libdir}/pkgconfig
> 	   rundir:            ${localstatedir}/run
> 	   bindir:            ${exec_prefix}/bin
> 	   sbindir:           ${exec_prefix}/sbin
> 	   libdir:            ${exec_prefix}/lib
> 	   includedir:        ${prefix}/include
> 	   luaincludedir:     /usr/include/lua5.2
> 	   luadir:            ${prefix}/share/lua/5.2
> 	   luaexecdir:        ${exec_prefix}/lib/lua/5.2
> 	   pkgluadir:         ${luadir}/mytest
> 	   pkgluaexecdir:     ${luaexecdir}/mytest
>
>
> Also the '(cached)' comment of configure still puzzles me.
> Does it really read the right directory ?
> Anyway CPPFLAGS has the right pathname for lua.h in confdefs.h.
>
> What I can say, autoconf is not easy to debug ;)
>
> Regards
>
>
> (file #31882)
>      _______________________________________________________
>
> Additional Item Attachment:
>
> File name: ax_lua.m4.diff                 Size:4 KB
>
>
>      _______________________________________________________
>
> Reply to this item at:
>
>    <http://savannah.gnu.org/patch/?8505>
>
> _______________________________________________
>    Message sent via/by Savannah
>    http://savannah.gnu.org/
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.