autotools

What is the best way to auto detect library dependencies in a C/C++ project?

两盒软妹~` 提交于 2019-11-28 10:16:02
问题 What is the best way to auto detect library dependencies in a C/C++ project? I have a project where I have all the dependencies on the machine. It builds and runs. Now I want to put together a autotools build system. I am looking for a good way to auto detect all the dependencies needed such as header files used and libraries needed for linking. The library bit seems to be the hardest for me to figure out. I'd like to be able to say, generate AC_CHECK_LIB commands for every function in a list

Autotools check for C++11

喜夏-厌秋 提交于 2019-11-28 08:11:57
I use AX_CXX_COMPILE_STDCXX_0X (can look on autoconf-archive) to check for c++11 capabilities of the compiler. It correctly determines that -std=c++0x required, but does not add it to CXXFLAGS . I took a look at the macro source and it actually checks but then restores previous flags. What should I do to get CXXFLAGS set to be able to compile c++11 source? Just adding -std=c++0x to AM_CXXFLAGS is not nice solution, because I'd like to put the burden of making the compiler compile in C++11 mode on the autoconf developers, not me. What you're looking for has already been made as AX_CXX_COMPILE

How can I use Google Test with my project that builds via autotools?

谁说胖子不能爱 提交于 2019-11-28 05:26:09
It seems like there are a few answers that kind-of, sort-of make sense, but that I don't know how to carry out. And I haven't found a comprehensive answer. The First Problem Google Test should not be an installed library, it should be built with the project. (See the FAQ .) As far as I can tell, this means the Google Test libraries are a dependency of my unit tests, and should be built when I run "make check" within my project for the first time. This should build Google Test libraries in some directory. I don't know how to do this. It mentions some autotools script that's deprecated, and I'm

Automake AM_LDADD workaround

喜夏-厌秋 提交于 2019-11-28 04:29:52
问题 I want to set the same LDADD attribute (Unit test library) to a large number of targets (unit test C++ files). I first though that maybe automake has AM_LDADD variable to add that library to all the targets within the file but is not the case. In some mail list I found some short discussion asking to add it: http://gnu-automake.7480.n7.nabble.com/AM-LIBS-AM-LDADD-td3698.html My question is, how do you deal with that? is it there any way to avoid manually adding LDADD attribute to each target?

libtool version mismatch error

久未见 提交于 2019-11-28 03:14:41
When building my application with kdevelop 3.5 on Ubuntu 10.04, I get the following errors: libtool: Version mismatch error. This is libtool 2.2.6 Debian-2.2.6a-4, but the libtool: definition of this LT_INIT comes from libtool 2.2.6b. libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6 Debian-2.2.6a-4 libtool: and run autoconf again. make[2]: *** [wktools4] Error 63 make[2]: Target `all' not remade because of errors. make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 *** Exited with status: 2 *** Where can I get the needed version of libtool, or how can I recreate

Autotools build fails due to subdir-objects option in AM_INIT_AUTOMAKE

☆樱花仙子☆ 提交于 2019-11-28 01:20:29
I'm currently working on a C++ project which relies on recursive automake for building. I want to build a shared library and the Makefile.am in the src directory of the library looks like # ... # Library name lib_LTLIBRARIES = libadapter-@MY_API_VERSION@.la # Sources libadapter_@MY_API_VERSION@_la_SOURCES = \ $(top_builddir)/src/sourceA.cpp \ $(top_builddir)/src/sourceB.cpp # ... Since version 1.14, automake issues a warning when the subdir-objects option is not specified in AM_INIT_AUTOMAKE in configure.ac . However, adding the subdir-objects option seems to break the build process with make

CMake generate config.h like from Autoconf

三世轮回 提交于 2019-11-28 00:38:51
问题 When using the Autotools it's common to generate a config.h file by specifying the AC_CONFIG_HEADERS macro in configure.ac like this: AC_CONFIG_HEADERS([config.h]) What is the respective equivalent for this when using CMake? 回答1: You have to create a file similar to config.h.in . Something like #cmakedefine HAVE_FEATURE_A @Feature_A_FOUND@ #cmakedefine HAVE_FEATURE_B @Feature_B_FOUND@ #cmakedefine HAVE_FEATURE_BITS @B_BITSIZE@ Then you have to declare the variables Feature_A_FOUND , Feature_B

How to generate a source file when building using autotools

☆樱花仙子☆ 提交于 2019-11-27 23:55:32
问题 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). 回答1: 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 =

libtool version mismatch error

一笑奈何 提交于 2019-11-27 19:14:18
问题 When building my application with kdevelop 3.5 on Ubuntu 10.04, I get the following errors: libtool: Version mismatch error. This is libtool 2.2.6 Debian-2.2.6a-4, but the libtool: definition of this LT_INIT comes from libtool 2.2.6b. libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6 Debian-2.2.6a-4 libtool: and run autoconf again. make[2]: *** [wktools4] Error 63 make[2]: Target `all' not remade because of errors. make[1]: *** [all-recursive] Error 1 make: *** [all]

Linker flags in wrong place

微笑、不失礼 提交于 2019-11-27 18:13:05
问题 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