automake

理解 configure 脚本

痴心易碎 提交于 2019-11-30 22:26:32
configure脚本为了让一个程序能够在各种不同类型的机器上运行而设计的。在使用make编译源代码之前,configure会根据自己所依赖的库而在目标机器上进行匹配。 约定俗成的,所有的configure脚本都把脚本文件名起为 configure ,一般来讲都是shell脚本,根据所在的系统环境生成makefile文件。有时候看到一些程序的configure内容超级之多,让人难以看下去。 configure脚本运行时扫描当前环境,生成一个名为 config.status 的子脚本。子脚本将 Makefile.in 文件转换为适应于当前系统环境的 Makefile 文件。 GNU build system 这个工具能够帮助我们生成configure脚本。 GNU build system ,又叫做 Autotools 。 这个工具查询当前系统的环境变量、平台架构、当前所依赖的库以及他们的位置,然后根据这些信息去make,这样就能实现同一套代码仅需configure一下就可以在不同的unix/linux系统中编译运行。 Autotools包含的命令有 autoconf , automake , libtool 。 autoconf autoconf命令的主要作用是创建 configure 。它基于 configure.ac 文件生成 configure 文件。 autoscan

How do I troubleshoot boost library/header inclusion via autoconf/automake?

寵の児 提交于 2019-11-30 19:32:50
问题 I'm new to autom4te, and I'm trying to use autoconf/automake to build and link a C++ program on multiple architectures. Complicating the linking is the fact that the project requires boost (filesystem, system, program_options). I'm using boost.m4 (from http://github.com/tsuna/boost.m4/tree/), and it seems to locate all the libraries and headers successfully. Unfortunately, linking still fails, leaving me confused. These are the relevant lines of configure.ac : AC_CONFIG_MACRO_DIR([m4]) # ...

With autoconf/automake, how do I specify include file paths?

痞子三分冷 提交于 2019-11-30 17:53:09
问题 Let's say I want to have the generate makefile pass some specific header paths to g++. What do I need to add to configure.ac or Makefile.am to specify this? (note - I do not want to pass it in the CPPFLAGS with ./configure. I want those paths baked in before that step) EDIT: Specifically, I want to to include let's say /usr/include/freetype and /mypath/include. I put AC_CHECK_HEADERS([freetype/config/ftheader.h]) and it passes, but doesn't seem to add it to the -I passed to g++. I also did

Linking a PHP Extension Written in C

随声附和 提交于 2019-11-30 15:57:14
Edit: Revising My Question When building an external PHP module in C, how do I link shared objects? If your C extension code uses a shared library, you need to declare that in the config.m4 file. I strongly recommend using the ext_skel script that's included in the PHP source to generate a skeleton config.m4: ./ext_skel --extname=myextension Since you're linking to a library, by convention you should use the --with-myextension options (as opposed to --enable-myextension ). Uncomment the relevant lines in the config.m4 and fill in the details of your lib. Something like the following: # --with

autotools: force make not to rebuild configure/Makefile

雨燕双飞 提交于 2019-11-30 15:34:28
问题 I have a project with autotools: automake, autoconf. I want to prohibit make from remaking files configure , Makefile.in , etc; just to do compile job. Some of files are edited by hand, and I know that I should not to do this. (Or the project was updated from CVS with all generated files stored in CVS). But at the moment I have no correct version autotools installed. What must be modification times of this files (which must be newer/older): aclocal.m4 configure.in confdb/ax_prefix_config_h.m4

GNU Autotools: rebuild without version info

爷,独闯天下 提交于 2019-11-30 13:13:51
I need to build a lib that is configured with autotools. The usual configure && make && make install steps produce versioned shared lib, something like libfoo.so.x.x Is it possible to modify configure.ac or Makefile.am (and of course follow up with autoreconf ) so that un-versioned lib is build. Thank you! Yes, assuming that the library is built with libtool , you can remove the version information by adding the -avoid-version flag to the library's LDFLAGS. For example, if before there was libfoo_la_LDFLAGS = -version-info 1:0 you would change it to libfoo_la_LDFLAGS = -avoid-version . After

Automake generating binaries to bin/ instead of in src/

旧时模样 提交于 2019-11-30 06:27:26
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. You've got the wrong idea here. Your build tree is wherever you run configure . That's how autoconf is

Autotools : how to set global compilation flag

ε祈祈猫儿з 提交于 2019-11-30 06:25:35
I have a project with several sources directories : src/A /B /C In each, the Makefile.am contains AM_CXXFLAGS = -fPIC -Wall -Wextra How can avoid repeating this in each source folder ? I tried to modifiy src/Makefile.am and the configure.in, but without success. I thought I could use AC_PROG_CXX to set the compilation flags globally but can't find much documentation on how to use those macro (do you have any pointer to such a documentation ?). Thanks in advance adl You can do several things: (1) One solution is to include a common makefile fragment on all your Makefile.am s: include $(top

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

本小妞迷上赌 提交于 2019-11-30 04:57:47
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 ? ptomato As well as pkginclude_HEADERS , which you mention, you can also install header files into an arbitrary subdirectory of /usr

Linking a PHP Extension Written in C

☆樱花仙子☆ 提交于 2019-11-29 23:56:47
问题 Edit: Revising My Question When building an external PHP module in C, how do I link shared objects? 回答1: If your C extension code uses a shared library, you need to declare that in the config.m4 file. I strongly recommend using the ext_skel script that's included in the PHP source to generate a skeleton config.m4: ./ext_skel --extname=myextension Since you're linking to a library, by convention you should use the --with-myextension options (as opposed to --enable-myextension ). Uncomment the