diff options
author | Emil Renner Berthing <esmil@mailme.dk> | 2013-01-14 15:15:09 +0100 |
---|---|---|
committer | Emil Renner Berthing <esmil@mailme.dk> | 2013-01-14 21:51:00 +0100 |
commit | 2497cff15ba23c7af58043f5ac92f3ae6893ae79 (patch) | |
tree | 1ac666707507c9c347dfa60e4ffcc0b62a489ea8 | |
parent | d5c4013e1c60c5801545632b99a4409c45f74d62 (diff) | |
download | lem-2497cff15ba23c7af58043f5ac92f3ae6893ae79.tar.gz lem-2497cff15ba23c7af58043f5ac92f3ae6893ae79.tar.xz lem-2497cff15ba23c7af58043f5ac92f3ae6893ae79.zip |
configure: allow any pkg-config name for Lua/LuaJIT
-rw-r--r-- | Makefile.in | 12 | ||||
-rwxr-xr-x | configure | 840 | ||||
-rw-r--r-- | configure.ac | 85 | ||||
-rw-r--r-- | lem.pc.in | 2 |
4 files changed, 716 insertions, 223 deletions
diff --git a/Makefile.in b/Makefile.in index f384a8f..149b2f1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,12 +1,12 @@ CC = @CC@ CFLAGS ?= @CFLAGS@ -CFLAGS += @CPPFLAGS_PRIVATE@ @CPPFLAGS@ +CFLAGS += @CPPFLAGS@ SHARED = @SHARED@ +LIBS = @LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -STRIP = @STRIP@ INSTALL = @INSTALL@ SED = @SED@ +STRIP = @STRIP@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -18,10 +18,8 @@ pkgconfigdir = @pkgconfigdir@ lmoddir = @lmoddir@ cmoddir = @cmoddir@ -objects = @objects@ -LIBS = @LIBS@ - headers = @headers@ +objects = @objects@ llibs = \ lem/repl.lua \ @@ -83,7 +81,7 @@ lem.pc: lem.pc.in -e 's|@lmoddir[@]|$(lmoddir)|' \ -e 's|@cmoddir[@]|$(cmoddir)|' \ -e 's|@includedir[@]|$(includedir)|' \ - -e 's|@CPPFLAGS[@]|@CPPFLAGS@|' \ + -e 's|@Lua_CFLAGS[@]|@Lua_CFLAGS@|' \ $< > $@ %-strip: % @@ -623,13 +623,11 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS -luajit_LIBS -luajit_CFLAGS EGREP GREP CPP -lua_LIBS -lua_CFLAGS +Lua_LIBS +Lua_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG @@ -660,7 +658,6 @@ build pkgconfigdir cmoddir lmoddir -CPPFLAGS_PRIVATE SHARED objects headers @@ -721,11 +718,9 @@ CPPFLAGS PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR -lua_CFLAGS -lua_LIBS -CPP -luajit_CFLAGS -luajit_LIBS' +Lua_CFLAGS +Lua_LIBS +CPP' # Initialize some variables set by options. @@ -1339,7 +1334,7 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-lua check, builtin, lua or luajit [default=check] + --with-lua check, builtin or pkg-config name [default=check] --with-lmoddir Lua module installation directory --with-cmoddir Lua C module installation directory --with-pkgconfigdir pkg-config installation directory @@ -1358,12 +1353,9 @@ Some influential environment variables: directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path - lua_CFLAGS C compiler flags for lua, overriding pkg-config - lua_LIBS linker flags for lua, overriding pkg-config + Lua_CFLAGS C compiler flags for Lua, overriding pkg-config + Lua_LIBS linker flags for Lua, overriding pkg-config CPP C preprocessor - luajit_CFLAGS - C compiler flags for luajit, overriding pkg-config - luajit_LIBS linker flags for luajit, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2165,24 +2157,12 @@ objects='bin/lem.o' SHARED='-shared' -CPPFLAGS_PRIVATE='-Iinclude' - +CPPFLAGS='-Iinclude' # Check whether --with-lua was given. if test "${with_lua+set}" = set; then : - withval=$with_lua; case "$with_lua" in #( - check) : - ;; #( - builtin) : - ;; #( - lua) : - ;; #( - luajit) : - ;; #( - *) : - as_fn_error $? "invalid argument --with-lua=$with_lua" "$LINENO" 5 ;; -esac + withval=$with_lua; else with_lua=check fi @@ -3768,7 +3748,12 @@ if test "$ac_res" != no; then : fi -# Checks for Lua. +# Configure libev +objects="bin/libev.o $objects" +headers="ev-config.h ev.h $headers" +CPPFLAGS="$CPPFLAGS -Ilibev" + +# Configure Lua ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4167,14 +4152,16 @@ done case "x$with_lua" in #( + xbuiltin) : + ;; #( xcheck) : pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua" >&5 -$as_echo_n "checking for lua... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } -if test -n "$lua_CFLAGS"; then - pkg_cv_lua_CFLAGS="$lua_CFLAGS" +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 @@ -4182,7 +4169,7 @@ if test -n "$lua_CFLAGS"; then ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4190,8 +4177,8 @@ fi else pkg_failed=untried fi -if test -n "$lua_LIBS"; then - pkg_cv_lua_LIBS="$lua_LIBS" +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 @@ -4199,7 +4186,7 @@ if test -n "$lua_LIBS"; then ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4220,12 +4207,130 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` else - lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$lua_PKG_ERRORS" >&5 + echo "$Lua_PKG_ERRORS" >&5 + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } + +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.2" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } + +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 $as_echo_n "checking for lua_newstate in -llua... " >&6; } @@ -4267,7 +4372,8 @@ if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" if test "x$ac_cv_header_lua_h" = xyes; then : with_lua=lua - LIBS="-llua $LIBS" + Lua_CFLAGS='' + Lua_LIBS='-llua' else with_lua=builtin fi @@ -4320,7 +4426,8 @@ if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" if test "x$ac_cv_header_lua_h" = xyes; then : with_lua=lua - LIBS="-llua $LIBS" + Lua_CFLAGS='' + Lua_LIBS='-llua' else with_lua=builtin fi @@ -4331,36 +4438,30 @@ else fi else - lua_CFLAGS=$pkg_cv_lua_CFLAGS - lua_LIBS=$pkg_cv_lua_LIBS + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - with_lua=lua - CPPFLAGS="$CPPFLAGS $lua_CFLAGS" - LIBS="$lua_LIBS $LIBS" - if test "x$lmoddir" = 'x'; then : - lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD lua`" -fi - if test "x$cmoddir" = 'x'; then : - cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD lua`" + with_lua=lua5.1 fi -fi ;; #( - xlua) : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua" >&5 -$as_echo_n "checking for lua... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } -if test -n "$lua_CFLAGS"; then - pkg_cv_lua_CFLAGS="$lua_CFLAGS" +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4368,16 +4469,16 @@ fi else pkg_failed=untried fi -if test -n "$lua_LIBS"; then - pkg_cv_lua_LIBS="$lua_LIBS" +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4398,12 +4499,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` else - lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$lua_PKG_ERRORS" >&5 + echo "$Lua_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 $as_echo_n "checking for lua_newstate in -llua... " >&6; } @@ -4442,27 +4543,209 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 $as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLUA 1 -_ACEOF + ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" +if test "x$ac_cv_header_lua_h" = xyes; then : + with_lua=lua + Lua_CFLAGS='' + Lua_LIBS='-llua' +else + with_lua=builtin +fi - LIBS="-llua $LIBS" else - as_fn_error $? "Lua library requested, but no Lua library found" "$LINENO" 5 + with_lua=builtin fi - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 +$as_echo_n "checking for lua_newstate in -llua... " >&6; } +if ${ac_cv_lib_lua_lua_newstate+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-llua $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char lua_newstate (); +int +main () +{ +return lua_newstate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_lua_lua_newstate=yes else - as_fn_error $? "Lua library requested, but no lua.h header found" "$LINENO" 5 + ac_cv_lib_lua_lua_newstate=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 +$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } +if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" +if test "x$ac_cv_header_lua_h" = xyes; then : + with_lua=lua + Lua_CFLAGS='' + Lua_LIBS='-llua' +else + with_lua=builtin +fi + +else + with_lua=builtin +fi +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_lua=lua5.1 +fi +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_lua=lua5.2 +fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } + +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.2" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } + +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 $as_echo_n "checking for lua_newstate in -llua... " >&6; } if ${ac_cv_lib_lua_lua_newstate+:} false; then : @@ -4500,54 +4783,99 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 $as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLUA 1 -_ACEOF + ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" +if test "x$ac_cv_header_lua_h" = xyes; then : + with_lua=lua + Lua_CFLAGS='' + Lua_LIBS='-llua' +else + with_lua=builtin +fi - LIBS="-llua $LIBS" else - as_fn_error $? "Lua library requested, but no Lua library found" "$LINENO" 5 + with_lua=builtin fi - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 +$as_echo_n "checking for lua_newstate in -llua... " >&6; } +if ${ac_cv_lib_lua_lua_newstate+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-llua $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char lua_newstate (); +int +main () +{ +return lua_newstate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_lua_lua_newstate=yes else - as_fn_error $? "Lua library requested, but no lua.h header found" "$LINENO" 5 + ac_cv_lib_lua_lua_newstate=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 +$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } +if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" +if test "x$ac_cv_header_lua_h" = xyes; then : + with_lua=lua + Lua_CFLAGS='' + Lua_LIBS='-llua' +else + with_lua=builtin fi else - lua_CFLAGS=$pkg_cv_lua_CFLAGS - lua_LIBS=$pkg_cv_lua_LIBS + with_lua=builtin +fi + +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CPPFLAGS="$CPPFLAGS $lua_CFLAGS" - LIBS="$lua_LIBS $LIBS" - if test "x$lmoddir" = 'x'; then : - lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD lua`" + with_lua=lua5.1 fi - if test "x$cmoddir" = 'x'; then : - cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD lua`" -fi -fi ;; #( - xluajit) : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for luajit" >&5 -$as_echo_n "checking for luajit... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } -if test -n "$luajit_CFLAGS"; then - pkg_cv_luajit_CFLAGS="$luajit_CFLAGS" +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"luajit\""; } >&5 - ($PKG_CONFIG --exists --print-errors "luajit") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_luajit_CFLAGS=`$PKG_CONFIG --cflags "luajit" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4555,16 +4883,16 @@ fi else pkg_failed=untried fi -if test -n "$luajit_LIBS"; then - pkg_cv_luajit_LIBS="$luajit_LIBS" +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"luajit\""; } >&5 - ($PKG_CONFIG --exists --print-errors "luajit") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_luajit_LIBS=`$PKG_CONFIG --libs "luajit" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4585,44 +4913,220 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - luajit_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "luajit" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` else - luajit_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "luajit" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$luajit_PKG_ERRORS" >&5 + echo "$Lua_PKG_ERRORS" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 +$as_echo_n "checking for lua_newstate in -llua... " >&6; } +if ${ac_cv_lib_lua_lua_newstate+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-llua $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char lua_newstate (); +int +main () +{ +return lua_newstate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_lua_lua_newstate=yes +else + ac_cv_lib_lua_lua_newstate=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 +$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } +if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" +if test "x$ac_cv_header_lua_h" = xyes; then : + with_lua=lua + Lua_CFLAGS='' + Lua_LIBS='-llua' +else + with_lua=builtin +fi + + +else + with_lua=builtin +fi - as_fn_error $? "LuaJIT library requested, but no pkg-config file found" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "LuaJIT library requested, but no pkg-config file found" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 +$as_echo_n "checking for lua_newstate in -llua... " >&6; } +if ${ac_cv_lib_lua_lua_newstate+:} false; then : + $as_echo_n "(cached) " >&6 else - luajit_CFLAGS=$pkg_cv_luajit_CFLAGS - luajit_LIBS=$pkg_cv_luajit_LIBS + ac_check_lib_save_LIBS=$LIBS +LIBS="-llua $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char lua_newstate (); +int +main () +{ +return lua_newstate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_lua_lua_newstate=yes +else + ac_cv_lib_lua_lua_newstate=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 +$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } +if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" +if test "x$ac_cv_header_lua_h" = xyes; then : + with_lua=lua + Lua_CFLAGS='' + Lua_LIBS='-llua' +else + with_lua=builtin +fi + + +else + with_lua=builtin +fi + +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CPPFLAGS="$CPPFLAGS $luajit_CFLAGS" - LIBS="$luajit_LIBS $LIBS" - if test "x$lmoddir" = 'x'; then : - lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD luajit`" + with_lua=lua5.1 fi - if test "x$cmoddir" = 'x'; then : - cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD luajit`" +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_lua=lua5.2 fi +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_lua=lua fi ;; #( *) : - ;; + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } + +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$with_lua\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors ""$with_lua"") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags ""$with_lua"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$with_lua\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors ""$with_lua"") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs ""$with_lua"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs ""$with_lua"" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs ""$with_lua"" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 + + as_fn_error $? "\"pkg-config package '$with_lua' not found\"" "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "\"pkg-config package '$with_lua' not found\"" "$LINENO" 5 +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi ;; esac if test "x$with_lua" = 'xbuiltin'; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin in -lm" >&5 -$as_echo_n "checking for sin in -lm... " >&6; } -if ${ac_cv_lib_m_sin+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sin" >&5 +$as_echo_n "checking for library containing sin... " >&6; } +if ${ac_cv_search_sin+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4641,23 +5145,35 @@ return sin (); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_sin=yes -else - ac_cv_lib_m_sin=no +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_sin=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if ${ac_cv_search_sin+:} false; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sin" >&5 -$as_echo "$ac_cv_lib_m_sin" >&6; } -if test "x$ac_cv_lib_m_sin" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBM 1 -_ACEOF +done +if ${ac_cv_search_sin+:} false; then : - LIBS="-lm $LIBS" +else + ac_cv_search_sin=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sin" >&5 +$as_echo "$ac_cv_search_sin" >&6; } +ac_res=$ac_cv_search_sin +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -4719,7 +5235,9 @@ fi objects="bin/lua.o $objects" headers="luaconf.h lua.h lauxlib.h $headers" - CPPFLAGS_PRIVATE="$CPPFLAGS_PRIVATE -Ilua" + CPPFLAGS="$CPPFLAGS -Ilua" + Lua_CFLAGS='' + Lua_LIBS='' if test "x$lmoddir" = 'x'; then : lmoddir="\${datarootdir}/lua/$builtin_lua_version" fi @@ -4728,6 +5246,22 @@ fi fi fi +CPPFLAGS="$CPPFLAGS $Lua_CFLAGS" +LIBS="$Lua_LIBS $LIBS" +if test "x$lmoddir" = 'x'; then : + lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD $with_lua`" +fi +if test "x$cmoddir" = 'x'; then : + cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD $with_lua`" +fi + +if test "x$lmoddir" = 'x'; then : + as_fn_error $? "unable to deduce Lua module directory, please use --with-lmoddir=path" "$LINENO" 5 +fi +if test "x$cmoddir" = 'x'; then : + as_fn_error $? "unable to deduce Lua C module directory, please use --with-cmoddir=path" "$LINENO" 5 +fi + # Checks for header files. for ac_header in stddef.h stdlib.h string.h unistd.h sys/time.h time.h pthread.h do : @@ -4756,19 +5290,6 @@ fi done -# [AC_RUN_IFELSE([AC_LANG_PROGRAM([ -##include <stdio.h> -##include <lua.h> -#], [ -#FILE *f = fopen("conftest.out", "w"); -#fputs(LUA_VERSION, f); -#])], -# [echo "conftest returned: `cat conftest.out`"],[])]) - -objects="bin/libev.o $objects" -headers="ev-config.h ev.h $headers" -CPPFLAGS_PRIVATE="$CPPFLAGS_PRIVATE -Ilibev" - if test "x$ac_cv_header_sys_eventfd_h" = 'xyes'; then : ac_fn_c_check_func "$LINENO" "eventfd" "ac_cv_func_eventfd" if test "x$ac_cv_func_eventfd" = xyes; then : @@ -4863,13 +5384,6 @@ fi fi fi -if test "x$lmoddir" = 'x'; then : - as_fn_error $? "unable to deduce Lua module directory, please use --with-lmoddir=path" "$LINENO" 5 -fi -if test "x$cmoddir" = 'x'; then : - as_fn_error $? "unable to deduce Lua C module directory, please use --with-cmoddir=path" "$LINENO" 5 -fi - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF diff --git a/configure.ac b/configure.ac index b6b60b0..1e7fc76 100644 --- a/configure.ac +++ b/configure.ac @@ -8,13 +8,12 @@ AC_CONFIG_HEADERS([libev/ev-config.h:ev-config.h.in]) AC_SUBST([headers], ['lem.h lem-parsers.h']) AC_SUBST([objects], ['bin/lem.o']) AC_SUBST([SHARED], ['-shared']) -AC_SUBST([CPPFLAGS_PRIVATE], ['-Iinclude']) +CPPFLAGS='-Iinclude' AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], - [check, builtin, lua or luajit @<:@default=check@:>@])], - [AS_CASE(["$with_lua"], [check],,[builtin],,[lua],,[luajit],, - [AC_MSG_ERROR([invalid argument --with-lua=$with_lua])])], + [check, builtin or pkg-config name @<:@default=check@:>@])], + [], [with_lua=check]) AC_SUBST([lmoddir]) @@ -49,67 +48,54 @@ AS_CASE(["x$target_os"], # Check for pthread library AC_SEARCH_LIBS([pthread_create], [pthread]) -# Checks for Lua. +# Configure libev +objects="bin/libev.o $objects" +headers="ev-config.h ev.h $headers" +CPPFLAGS="$CPPFLAGS -Ilibev" + +# Configure Lua AS_CASE(["x$with_lua"], + [xbuiltin], + [], [xcheck], - [PKG_CHECK_MODULES([lua], [lua], - [with_lua=lua] - [CPPFLAGS="$CPPFLAGS $lua_CFLAGS"] - [LIBS="$lua_LIBS $LIBS"] - [AS_IF([test "x$lmoddir" = 'x'], [lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD lua`"])] - [AS_IF([test "x$cmoddir" = 'x'], [cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD lua`"])], + [PKG_CHECK_MODULES([Lua], [lua], [with_lua=lua], + [PKG_CHECK_MODULES([Lua], [lua5.2], [with_lua=lua5.2], + [PKG_CHECK_MODULES([Lua], [lua5.1], [with_lua=lua5.1], [AC_CHECK_LIB([lua], [lua_newstate], [AC_CHECK_HEADER([lua.h], [with_lua=lua] - [LIBS="-llua $LIBS"], + [Lua_CFLAGS=''] + [Lua_LIBS='-llua'], [with_lua=builtin])], - [with_lua=builtin])])], - [xlua], - [PKG_CHECK_MODULES([lua], [lua], - [CPPFLAGS="$CPPFLAGS $lua_CFLAGS"] - [LIBS="$lua_LIBS $LIBS"] - [AS_IF([test "x$lmoddir" = 'x'], [lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD lua`"])] - [AS_IF([test "x$cmoddir" = 'x'], [cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD lua`"])], - [AC_CHECK_LIB([lua], [lua_newstate], - [], - [AC_MSG_ERROR([Lua library requested, but no Lua library found])])] - [AC_CHECK_HEADER([lua.h], - [], - [AC_MSG_ERROR([Lua library requested, but no lua.h header found])])])], - [xluajit], - [PKG_CHECK_MODULES([luajit], [luajit], - [CPPFLAGS="$CPPFLAGS $luajit_CFLAGS"] - [LIBS="$luajit_LIBS $LIBS"] - [AS_IF([test "x$lmoddir" = 'x'], [lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD luajit`"])] - [AS_IF([test "x$cmoddir" = 'x'], [cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD luajit`"])], - [AC_MSG_ERROR([LuaJIT library requested, but no pkg-config file found])])]) + [with_lua=builtin])])])])], + [PKG_CHECK_MODULES([Lua], ["$with_lua"], [], + [AC_MSG_ERROR(["pkg-config package '$with_lua' not found"])])]) AS_IF([test "x$with_lua" = 'xbuiltin'], - [AC_CHECK_LIB([m], [sin])] + [AC_SEARCH_LIBS([sin], [m])] [AC_SEARCH_LIBS([dlopen], [dl])] [objects="bin/lua.o $objects"] [headers="luaconf.h lua.h lauxlib.h $headers"] - [CPPFLAGS_PRIVATE="$CPPFLAGS_PRIVATE -Ilua"] + [CPPFLAGS="$CPPFLAGS -Ilua"] + [Lua_CFLAGS=''] + [Lua_LIBS=''] [AS_IF([test "x$lmoddir" = 'x'], [lmoddir="\${datarootdir}/lua/$builtin_lua_version"])] [AS_IF([test "x$cmoddir" = 'x'], [cmoddir="\${libdir}/lua/$builtin_lua_version"])]) +CPPFLAGS="$CPPFLAGS $Lua_CFLAGS" +LIBS="$Lua_LIBS $LIBS" +AS_IF([test "x$lmoddir" = 'x'], [lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD $with_lua`"]) +AS_IF([test "x$cmoddir" = 'x'], [cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD $with_lua`"]) + +AS_IF([test "x$lmoddir" = 'x'], + [AC_MSG_ERROR([unable to deduce Lua module directory, please use --with-lmoddir=path])]) +AS_IF([test "x$cmoddir" = 'x'], + [AC_MSG_ERROR([unable to deduce Lua C module directory, please use --with-cmoddir=path])]) + # Checks for header files. AC_CHECK_HEADERS([stddef.h stdlib.h string.h unistd.h sys/time.h time.h pthread.h]) AC_CHECK_HEADERS([sys/eventfd.h sys/epoll.h sys/event.h]) -# [AC_RUN_IFELSE([AC_LANG_PROGRAM([ -##include <stdio.h> -##include <lua.h> -#], [ -#FILE *f = fopen("conftest.out", "w"); -#fputs(LUA_VERSION, f); -#])], -# [echo "conftest returned: `cat conftest.out`"],[])]) - -objects="bin/libev.o $objects" -headers="ev-config.h ev.h $headers" -CPPFLAGS_PRIVATE="$CPPFLAGS_PRIVATE -Ilibev" - AS_IF([test "x$ac_cv_header_sys_eventfd_h" = 'xyes'], [AC_CHECK_FUNC([eventfd], [AC_DEFINE([EV_USE_EVENTFD], 1)], @@ -146,10 +132,5 @@ AS_IF([test "x$ac_cv_func_epoll_ctl" = 'xyes'], [ AC_MSG_ERROR([neither poll or select found]) ])])])]) -AS_IF([test "x$lmoddir" = 'x'], - [AC_MSG_ERROR([unable to deduce Lua module directory, please use --with-lmoddir=path])]) -AS_IF([test "x$cmoddir" = 'x'], - [AC_MSG_ERROR([unable to deduce Lua C module directory, please use --with-cmoddir=path])]) - AC_CONFIG_FILES([Makefile]) AC_OUTPUT @@ -7,4 +7,4 @@ Name: lem Description: A Lua Event Machine Version: 0.3 URL: https://github.com/esmil/lem -Cflags: -I${includedir} @CPPFLAGS@ +Cflags: -I${includedir} @Lua_CFLAGS@ |