PKG_CHECK_MODULES syntax error near luajit
Asked Answered
S

3

13

I'm new to GNU autotools.In my project when i try ./configure it generates following error :

./configure: line 9852: syntax error near unexpected token `luajit,'
./configure: line 9852: `    PKG_CHECK_MODULES(luajit, luajit,LLUAJIT="yes",LLUAJIT="no")'

In Configure.in :

 PKG_CHECK_MODULES(luajit, luajit,LLUAJIT="yes",LLUAJIT="no")
    if test "x$LLUAJIT" = "xyes"; then
        CONFIGFLAGS="$CONFIGFLAGS -DHAVE_LIBLUAJIT"
        LUA_CFLAGS="$luajit_CFLAGS"
        LUA_LIBS="$luajit_LIBS"
        AC_SUBST(LUA_CFLAGS)
        AC_SUBST(LUA_LIBS)
        if test "x$macos" != "xno"; then
            LDFLAGS="${LDFLAGS} -pagezero_size 10000 -image_base 100000000"
        fi

    else
        echo
        echo "   ERROR!  LuaJIT library not found. For better performance, go get it from"
        echo "   http://www.luajit.org/."
        AC_MSG_ERROR("Fatal!")
    fi

It seems autoconf(maybe) is unable to find PKG_CHECK_MODULES macro. I searched the Internet for solution and found that it is because libtool is not installed.I re-installed libtool but error remains same.

Hope Someone recognizes the problem and has quick solution for it.Any help would be appreciated.

Senter answered 16/4, 2016 at 3:44 Comment(0)
A
10

The PKG_CHECK_MODULES macro is defined in the pkg.m4 file and pkg.m4 is part of pkgconfig package. So in order to use this macro, make sure pkgconfig is be installed on your system, and pkg.m4 is in the right place, on most system it is at:

/usr/share/aclocal/pkg.m4

In you configure script, enable libtool and add macro dir:

LT_INIT
AC_CONFIG_MACRO_DIRS([m4])
Antofagasta answered 16/4, 2016 at 4:3 Comment(3)
please post your entire configure.ac.Antofagasta
There are two configs missing in your configure script, see updated answer.Antofagasta
On Ubuntu/Debian systems it's got a dash in the package name: pkg-configVachill
S
14

For those who end up here searching the solution , following worked for me :

PKG_CHECK_MODULES breaking in solaris

The PKG_CHECK_MODULES macro doesn't seem to be expanded properly. When you installed pkg-config, did it install pkg.m4 (in somewhere like /usr/share/aclocal)? If so, try running aclocal again (maybe with -I m4, if you've got custom m4 code in the m4 subdirectory) and then run autoconf.

If that doesn't work and pkg.m4 was installed, try running autoreconf -f (and maybe autoreconf -i -f).

If that doesn't work, you'll need to copy pkg.m4 to a directory for your package. Usually this is the m4 subdirectory. Set ACLOCAL_AMFLAGS = -I m4 (or ACLOCAL_AMFLAGS = -I m4 --install) in Makefile.am (if you're using automake), and AC_CONFIG_MACRO_DIR([m4]) in configure.ac. Then run aclocal -I m4 and autoconf and ./configure.

Senter answered 16/4, 2016 at 5:16 Comment(1)
Just wanted to add: this may happen if a "autogen.sh" is not included (which means after a fresh checkout there already is a ./configure script). The autogen script is usually just a "autoreconf -fiv" or whatever. Thanks for the help!Sinker
A
10

The PKG_CHECK_MODULES macro is defined in the pkg.m4 file and pkg.m4 is part of pkgconfig package. So in order to use this macro, make sure pkgconfig is be installed on your system, and pkg.m4 is in the right place, on most system it is at:

/usr/share/aclocal/pkg.m4

In you configure script, enable libtool and add macro dir:

LT_INIT
AC_CONFIG_MACRO_DIRS([m4])
Antofagasta answered 16/4, 2016 at 4:3 Comment(3)
please post your entire configure.ac.Antofagasta
There are two configs missing in your configure script, see updated answer.Antofagasta
On Ubuntu/Debian systems it's got a dash in the package name: pkg-configVachill
E
4

In my case, I added the conf file before installing the libtool, so you need to run again autoreconf -i -f after installing the libtool

Esprit answered 28/5, 2019 at 5:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.