autotools

How to generate a source file when building using autotools

时光总嘲笑我的痴心妄想 提交于 2019-11-29 06:34:37
With Make, I do something like generated.c: input.txt generator ./generator input.txt > generated.c How would I get equivalent functionality out of autotools? (removing generated.c on cleaning would also be a bonus). I'm assuming that input.txt is a source file that is distributed, that you do not want to distribute generated.c (i.e., it must be built by each user), and that generator is a program built by your package too. EXTRA_DIST = input.txt bin_PROGRAMS = prog noinst_PROGRAMS = generator # Source files for the generator generator_SOURCES = generator.c ... # Source files for prog prog

Automake generating binaries to bin/ instead of in src/

醉酒当歌 提交于 2019-11-29 05:12:35
问题 I searched for the answer to this question but couldn't find any good. Maybe they're old and something has changed, so I ask again. I have a directory structure as: my_project src bin I want that, when I do make in the root dir, the binaries are put in ./bin, instead of cluttering ./src. But how? EDIT: I am using C++. My Makefile.am has nothing special. Just the bin_PROGRAM and _SOURCES variables. When I run make, the binaries generated are put into ./src. I simply want them in ./bin. 回答1:

Linker flags in wrong place

﹥>﹥吖頭↗ 提交于 2019-11-29 04:19:54
I'm trying to use Autotools to build my C program that needs to be linked against certain libraries. It only contains one C source file. This is the Makefile.am associated with it: bin_PROGRAMS=game game_SOURCES=main.c game_CFLAGS=`pkg-config --cflags libglfw` game_LDFLAGS=`pkg-config --libs libglfw` When I run make, it tries to compile it using this: gcc `pkg-config --cflags libglfw` -g -O2 `pkg-config --libs libglfw` -o game game-main.o However this is wrong, as the library link flags must be at the end, or else it will give errors about undefined references. For example if I run this: gcc

Placing header files in a subdirectory of /usr/include with automake?

前提是你 提交于 2019-11-29 03:05:57
问题 If I write a library, and have header files for development included, and have a src/Makefile.am like this: AM_CFLAGS = -std=c99 -Wall -Werror -Os lib_LTLIBRARIES = libmylibrary.la libmylibrary_la_SOURCES = a.c b.c include_HEADERS = a.h b.h Everything works nicely. However, a.h and b.h are installed directly under /usr/include (or /usr/local/include ). What should I do to get them installed, in a subdirectory specific to my library, e.g. /usr/include/mylibrary ? 回答1: As well as pkginclude

How to create a shared library (.so) in an automake script?

一个人想着一个人 提交于 2019-11-28 18:41:47
given some source file test.cpp I would like to create a shared library libtest.so . I am trying to do this within the scope of an automake file however I cannot seem to get this to work. For example under g++ I do the following: g++ -shared -fPIC test.cpp -o libtest.so then i can create another file that will depend on the shared library as follows: g++ mytest.cpp libtest.so -o blah I have read that automake only supports making shared libraries via libtool. I have tried to get my automake scriupt to work as follows but it never seems to produce an .so . The closest i have gotten is for it to

error: Libtool library used but 'LIBTOOL' is undefined

旧巷老猫 提交于 2019-11-28 16:55:35
I am trying to automake the OrientDb C++ library, but getting some errors. Makefile.am:10: error: Libtool library used but 'LIBTOOL' is undefined Makefile.am:10: The usual way to define 'LIBTOOL' is to add 'LT_INIT' Makefile.am:10: to 'configure.ac' and run 'aclocal' and 'autoconf' again. Makefile.am:10: If 'LT_INIT' is in 'configure.ac', make sure Makefile.am:10: its definition is in aclocal's search path. https://github.com/tglman/orientdb-c https://github.com/tglman/orientdb-c/wiki/Install I have configure.ac and Makefile.am already defined. I run the following autotools aclocal autoheader

installed libtool but libtoolize not found

☆樱花仙子☆ 提交于 2019-11-28 16:28:45
问题 im trying to build libxml2 from source on my mac. so i have autoconf libtool and automake installed using mac ports autoconf and automake seem to be working fine as expected. i try running autogen.sh first. libtoolize --version unfortunately gives -bash: libtoolize: command not found i try running (again) sudo port install libtool ---> Cleaning libtool ---> Scanning binaries for linking errors: 100.0% ---> No broken files found. i try locate libtool and it seems to be installed fine

possibly undefined macro: AC_MSG_ERROR

ぐ巨炮叔叔 提交于 2019-11-28 15:42:31
问题 I have the following in configure.ac: AC_CHECK_PROGS(MAKE,$MAKE make gmake,error) if test "x$MAKE" = "xerror" ;then AC_MSG_ERROR([cannot find a make command]) fi This has been in our project for a long time, but in some set ups, I get this error: configure.ac:45: error: possibly undefined macro: AC_MSG_ERROR If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. The lines that were recently added above this: AC_CONFIG_MACRO_DIR([m4]) LT_INIT Can

GNU autotools: Debug/Release targets?

て烟熏妆下的殇ゞ 提交于 2019-11-28 15:11:30
I've been looking for this for a while: I'm currently converting a medium-size program to autotools, coming from an Eclipse-based method (with makefiles) I'm always used to having a "debug" build, with all debug symbols and no optimizations, and a "release" build, without debug symbols and best optimizations. Now I'm trying to replicate this in some way with autotools, so I can (perhaps) do something like: ./configure make debug Which would have all debug symbols and no optimizations, and where: ./configure make Would result in the "release" version (default) PS: I've read about the --enable

What are the differences between Autotools, Cmake and Scons?

耗尽温柔 提交于 2019-11-28 14:57:05
What are the differences between Autotools, Cmake and Scons? Svartalf In truth, Autotools' only real 'saving grace' is that it is what all the GNU projects are largely using. Issues with Autotools: Truly ARCANE m4 macro syntax combined with verbose, twisted shell scripting for tests for "compatibility", etc. If you're not paying attention, you will mess up cross-compilation ability (It should clearly be noted that Nokia came up with Scratchbox/Scratchbox2 to side-step highly broken Autotools build setups for Maemo/Meego.) If you, for any reason, have fixed, static paths in your tests, you're