makefile - How to install a lua module in a subdirectory of libdir with the autotools -
i have written little lua module complile using autotools , want modify organization:
now have in main directory:
autogen.sh configure.ac makefile.am src file1.c file2.c file3.c
the autogen.sh
#!/bin/sh echo "running aclocal..." ; aclocal $aclocal_flags || exit 1 echo "running libtoolize..."; libtoolize --copy --automake || exit 1; echo "running autoheader..." ; autoheader || exit 1 echo "running autoconf..." ; autoconf || exit 1 echo "running automake..." ; automake --add-missing --copy --gnu || exit 1 ./configure "$@"
the configure.ac
# -*- autoconf -*- # process file autoconf produce configure script. ac_prereq([2.69]) ac_init([lua-clangc], [0.0.1], [cedlemo@gmx.com]) ac_config_srcdir([configure.ac]) ac_config_headers([config.h]) # checks programs. ac_prog_cc(clang gcc) # checks libraries. pkg_check_modules([deps], [lua]) #lua_version = $(pkg-config --version) #ac_subst([lua_version]) # checks header files. ac_check_headers([string.h stdlib.h clang-c/index.h]) # checks typedefs, structures, , compiler characteristics. # checks library functions. am_init_automake(1.13 dist-bzip2 foreign subdir-objects) lt_prereq(2.4) lt_init ac_config_files([ makefile ]) ac_output
and makefile.am
maintainercleanfiles = \ makefile.in aclocal.m4 config.h.in configure \ depcomp install-sh missing compile config.sub \ config.guess ltmain.sh compile lib_ltlibraries = src/clangc.la src_clangc_la_sources = src/clangc.c src/indexlib.c src/translationunitlib.c src/constants.c src/clangc_module_functions.c src_clangc_la_ldflags = -module -avoid-version -shared -llua -lm -lclang -fpic
i use commands compile , install lua module:
./autogen.sh --libdir=/usr/lib/lua/5.3 make sudo make install
my files installed in /usr/lib/lua/5.3
/usr/lib/lua/5.3/clangc.so /usr/lib/lua/5.3/clangc.la
i use
./autogen.sh --prefix=/usr
and configure.ac script build libdir this:
libdir=prefix + /lib/lua/ + lua_version + /clangc/
(i have way lua_version in configure.ac)
as answer myself:
i have modify configure.ac this:
ac_prereq([2.69]) ac_init([lua-clangc], [0.0.1], [cedlemo@gmx.com]) ac_config_srcdir([configure.ac]) ac_config_headers([config.h]) # checks programs. ac_prog_cc(clang gcc) # checks libraries. pkg_check_modules([deps], [lua]) lua_version=$(pkg-config --modversion lua | awk -f "." '{print $1"."$2}') ac_subst([lua_version]) libdir=$prefix/lib/lua/$lua_version/clangc # checks header files. ac_check_headers([string.h stdlib.h clang-c/index.h]) # checks typedefs, structures, , compiler characteristics. # checks library functions. am_init_automake(1.13 dist-bzip2 foreign subdir-objects) lt_prereq(2.4) lt_init ac_config_files([ makefile ]) ac_output
first had find current lua version:
lua_version=$(pkg-config --modversion lua | awk -f "." '{print $1"."$2}')
on system:
- pkg-config --modversion lua returns 5.3.1
- awk -f "." '{print $1"."$2}' returns 5.3
then line:
libdir=$prefix/lib/lua/$lua_version/clangc
do magic.
when use:
./autogen.sh --prefix=/usr
my lib installed in:
/usr/lib/lua/5.3/clangc
Comments
Post a Comment