automake

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

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?

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

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 =

Build 32bit on 64 bit Linux using an automake configure script?

纵然是瞬间 提交于 2019-11-27 17:06:35
I'm using a 64bit system but want a set of 32bit binaries. What options must I pass to a configure script to generate a 32bit/x86 makefile? Passing the following argument to configure script allowed me to build the 32bit library on 64bit Linux ./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" Jack's answer is incomplete. You need compiler/libc support for 32-bit compilation. In some distros like Ubuntu, what you need to do is install packages gcc-multilib and/or g++-multilib : sudo apt-get install gcc-multilib g++-multilib Then you can call configure as you

What are Makefile.am and Makefile.in?

核能气质少年 提交于 2019-11-27 16:33:46
These two files are mostly seen in open source projects. What are they for, and how do they work? Sean A.O. Harney Makefile.am is a programmer-defined file and is used by automake to generate the Makefile.in file (the .am stands for a uto m ake). The configure script typically seen in source tarballs will use the Makefile.in to generate a Makefile . The configure script itself is generated from a programmer-defined file named either configure.ac or configure.in (deprecated). I prefer .ac (for a uto c onf) since it differentiates it from the generated Makefile.in files and that way I can have

Append compile flags to CFLAGS and CXXFLAGS while configuration/make

谁说胖子不能爱 提交于 2019-11-27 12:38:49
The project that I am trying to build has default flags CFLAGS = -Wall -g -O2 CXXFLAGS = -g -O2 I need to append a flag -w to both these variables (to remove: 'consider all warnings as errors') I have a method to work it out, give make 'CFLAGS=-Wall -g -O2 -w'; 'CXXFLAGS=-g -O2 -w' OR Run ./configure and statically modify Makefile But I want to append my options with the existing options while running configure or make The post Where to add a CFLAG, such as -std=gnu99, into an autotools project conveniently uses a macro to achieve this. You almost have it right; why did you add the semicolon?

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

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 11:36:33
问题 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

例解 autoconf 和 automake 生成 Makefile 文件

自古美人都是妖i 提交于 2019-11-27 11:20:29
引子 无论是在Linux还是在Unix环境中,make都是一个非常重要的编译命令。不管是自己进行项目开发还是安装应用软件,我们都经常要用到make或 make install。利用make工具,我们可以将大型的开发项目分解成为多个更易于管理的模块,对于一个包括几百个源文件的应用程序,使用make和 makefile工具就可以轻而易举的理顺各个源文件之间纷繁复杂的相互关系。 但是如果通过查阅make的帮助文档来手工编写Makefile,对任何程序员都是一场挑战。幸而有GNU 提供的Autoconf及Automake这两套工具使得编写makefile不再是一个难题。 本文将介绍如何利用 GNU Autoconf 及 Automake 这两套工具来协助我们自动产生 Makefile文件,并且让开发出来的软件可以像大多数源码包那样,只需"./configure", "make","make install" 就可以把程序安装到系统中。 回页首 模拟需求 假设源文件按如下目录存放,如图1所示,运用autoconf和automake生成makefile文件。 图 1文件目录结构 假设src是我们源文件目录,include目录存放其他库的头文件,lib目录存放用到的库文件,然后开始按模块存放,每个模块都有一个对应的目录,模块下再分子模块,如apple、orange。每个子目录下又分core

How to overcome “'aclocal-1.15' is missing on your system” warning?

最后都变了- 提交于 2019-11-27 09:20:02
问题 Im trying to run a c++ program on github. (available at the following link https://github.com/mortehu/text-classifier) I have a mac, and am trying to run it in the terminal. I think I have downloaded autoconf and automake but am not sure. To run the program I am going to the correct folder in terminal then running ./configure && make But I get the error: WARNING: 'aclocal-1.15' is missing on your system. You should only need it if you modified 'acinclude.m4' or 'configure.ac' or m4 files