[patch #8505] ac_cv_header_lua_h always set to yes

[email protected]
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <trinity-e9e87f9b-5229-4eb6-9109-f6d2736afa4d-1418599235898@3capp-gmx-bs20>
!

! First of all, my appologies for the 2 month delay. I've been slow.

Appologies accepted :)

Also you were faster to reverse the patch than I was able to defend my

point of view.

!

! I appricate your patch, but I think maybe you misunderstood the function of

! AX_LUA_HEADERS.

Whatever it means, ax_lua.m4 in some cases is broken and my goal was to improve it.

!

! This macro was not written to search /usr/include. All Lua distributions

! (rightfully) put their headers in a subdirectory with a version number. Could

! you please tell me more about your system, specifically why it is putting

! lua.h in /usr/include?

If Lua distributions put their headers in subdirectory, this doesn't mean that

all source packages around that use lua in their code will follow that convention.

Some will even bundle lua and make things worse.

For instance, dnsmasq 2.72 and nginx module ngx_http_lua_module don't follow

that convention.

ngx_http_lua_module will return an error like that:

checking for Lua library in /usr/lib64 and /usr/include/ (specified by the LUA_LIB and LUA_INC env) ... not found

./configure: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUA_LIB is defined as /usr/lib64 and LUA_INC (path for lua.h) is /usr/include/, but we cannot find standard Lua there.

For portability, /usr/include, /usr/lib /usr/bin are to be always the default

and are relevant if you don't care about revisions.

But I won't fight you for that :)

I'm using a meta distribution (GENTOO) and it is common to compile (on the fly)

more than 50 sources per day.

Patching every source is a pain when it comes to so many upgrades per day.

And if a patch is needed, it is actually better to modify a few lines in a

configure.ac and to hope that the patch will be included in the next release by

the maintainer.

! Your change to the search is only neccessary because you added /usr/include to

! the search list, and there is no version number in the path. Really, I think

! you should have just set the appropriate environment variables, like

! LUA_INCLUDE, which are well documented.

As said earlier, the issue isn't limited to lua include files.

Anyway, if LUA_INCLUDE were the solution, I wouldn't spend my (precious and

limited) time to patch :)

! I don't think this should have been a code change. The previous code was well

! tested, and sorry but I'm not convienced of the testing on this patch. In

! fact, it has some issues.

!

! So I recommend a revert.

!

! P.S. The "(cached)" is because you removed the unsets, and AC_CHECK_HEADERS is

! finding the cached results from the last loop iteration. I'm guessing that was

! a mistake.

Before taking such a decision, please consider the following:

The issue can be illustrated with a real example: dev-lua/luaposix-5.1.28

You can find it under https://github.com/luaposix/luaposix/archive/release.zip

Prerequisite:

# ls -l /usr/include | grep lua

lrwxrwxrwx 1 root root 29 13 août 01:01 lauxlib.h -> /usr/include/lua5.1/lauxlib.h

drwxr-xr-x 2 root root 4096 12 août 23:55 lua5.1

drwxr-xr-x 2 root root 4096 12 août 18:08 lua5.2

lrwxrwxrwx 1 root root 29 13 août 01:01 luaconf.h -> /usr/include/lua5.1 luaconf.h

lrwxrwxrwx 1 root root 25 13 août 01:01 lua.h -> /usr/include/lua5.1/lua.h

lrwxrwxrwx 1 root root 27 13 août 01:01 lua.hpp -> /usr/include/lua5.1/lua.hpp

lrwxrwxrwx 1 root root 28 13 août 01:01 lualib.h -> /usr/include/lua5.1/lualib.h

To begin you could test posixlua w/ its original configure and ax_lua.m4 file.

As expected, it will fail if you change AX_PROG_LUA(5.1, 5.3) to

AX_PROG_LUA(5.2, 5.3).

The issue affects lua's library and interpreter as well.

Solution:

I just care about configure, configure.ac and ax_lua.m4 patched.

To use efficiently the patch you need to alter the configure.ac file as follows:

# cd luaposix-release

# diff -ruN configure.ac.ori configure.ac

--- configure.ac.old 2014-12-10 16:18:05.694407443 +0100

+++ configure.ac 2014-12-10 16:23:24.700602738 +0100

@@ -1,3 +1,5 @@

+m4_define([LUA_PREREQ],5.2.0)

+

dnl configure.ac

dnl Written by Gary V. Vaughan, 2012

@@ -13,6 +15,8 @@

AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION])

echo

+PKG_CHECK_MODULES([LUA], [lua5.2 >= 5.2])

+

AM_INIT_AUTOMAKE([-Wall subdir-objects])

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

@@ -121,7 +125,9 @@

LIBS=$save_LIBS

dnl Lua 5.1 or 5.2

-AX_PROG_LUA(5.2, 5.3)

+dnl AX_PROG_LUA(5.2, 5.3)

+AX_PROG_LUA(LUA_PREREQ)

+AX_LUA_LIBS

AX_LUA_HEADERS

AC_PATH_PROG([SPECL], [specl], [:])

the additions are quite trivial.

# autoconf

# ./configure

The configure script will now succeed and output,

# ./configure

## ----------------------- ##

## Configuring luaposix 32 ##

## ----------------------- ##

checking for pkg-config... /usr/bin/pkg-config

checking pkg-config is at least version 0.9.0... yes

checking for LUA... yes

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether make supports nested variables... yes

checking whether make supports nested variables... (cached) yes

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking whether gcc understands -c and -o together... yes

checking for style of include used by make... GNU

checking dependency style of gcc... gcc3

checking how to run the C preprocessor... gcc -E

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for Minix Amsterdam compiler... no

checking for ar... ar

checking for ranlib... ranlib

checking for egrep... (cached) /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking minix/config.h usability... no

checking minix/config.h presence... no

checking for minix/config.h... no

checking whether it is safe to define __EXTENSIONS__... yes

checking the archiver (ar) interface... ar

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking how to print strings... print -r

checking for a sed that does not truncate output... (cached) /bin/sed

checking for fgrep... /bin/grep -F

checking for ld used by gcc... /usr/x86_64-pc-linux-gnu/bin/ld

checking if the linker (/usr/x86_64-pc-linux-gnu/bin/ld) is GNU ld... yes

checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B

checking the name lister (/usr/bin/nm -B) interface... BSD nm

checking whether ln -s works... yes

checking the maximum length of command line arguments... 1572864

checking whether the shell understands some XSI constructs... yes

checking whether the shell understands "+="... yes

checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop

checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop

checking for /usr/x86_64-pc-linux-gnu/bin/ld option to reload object files... -r

checking for objdump... objdump

checking how to recognize dependent libraries... pass_all

checking for dlltool... no

checking how to associate runtime and link libraries... print -r --

checking for archiver @FILE support... @

checking for strip... strip

checking for ranlib... (cached) ranlib

checking command to parse /usr/bin/nm -B output from gcc object... ok

checking for sysroot... no

checking for mt... mt

checking if mt is a manifest tool... no

checking for dlfcn.h... yes

checking for objdir... .libs

checking if gcc supports -fno-rtti -fno-exceptions... no

checking for gcc option to produce PIC... -fPIC -DPIC

checking if gcc PIC flag -fPIC -DPIC works... yes

checking if gcc static flag -static works... yes

checking if gcc supports -c -o file.o... yes

checking if gcc supports -c -o file.o... (cached) yes

checking whether the gcc linker (/usr/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... no

checking for ANSI C header files... (cached) yes

checking crypt.h usability... yes

checking crypt.h presence... yes

checking for crypt.h... yes

checking for strings.h... (cached) yes

checking sys/statvfs.h usability... yes

checking sys/statvfs.h presence... yes

checking for sys/statvfs.h... yes

checking net/if.h usability... yes

checking net/if.h presence... yes

checking for net/if.h... yes

checking linux/netlink.h usability... yes

checking linux/netlink.h presence... yes

checking for linux/netlink.h... yes

checking for library containing crypt... -lcrypt

checking for strlcpy... no

checking for statvfs... yes

checking for posix_fadvise... yes

checking for NcursesW wide-character library... yes

checking for working ncursesw/curses.h... yes

checking for working ncursesw.h... no

checking for working ncurses.h... no

checking for resizeterm... yes

checking for a Lua interpreter with version >= 5.2.0... lua5.2

checking for lua5.2... /usr/bin/lua5.2

checking for lua5.2 version... 5.2

checking for lua5.2 platform... unknown

checking for lua5.2 script directory... ${prefix}/share/lua/5.2

checking for lua5.2 module directory... ${exec_prefix}/lib/lua/5.2

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 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

checking for specl... :

checking for perl... /usr/bin/perl

checking for ldoc... false

checking that generated files are newer than configure... done

configure: creating ./config.status

config.status: creating .travis.yml

config.status: creating Makefile

config.status: creating build-aux/config.ld

config.status: creating config.h

config.status: config.h is unchanged

config.status: executing depfiles commands

config.status: executing libtool commands

And as expected the configure script has succeeded.

The patch could be weak... but not meaningless.
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.