标签: autotools

GNU autotools的推荐版本是什么?

我们在工作中维护基于RPM的软件分发,以便我们在所有支持的平台上拥有一套通用软件.因此,我们必须构建许多第三方软件,并经常发现需要运行autoconf/automake/libtoolize/etc以使其在Solaris或其他平台上构建的情况.

我的结果非常复杂.看起来这些工具相当脆弱,并且文件通常仅适用于最初编写的autoconf/automake/etc版本.

理想情况下,我只想支持一个版本的GNU autotools,但我得到的印象是,我真的最终必须拥有每个版本的副本.

这是不寻常的,还是其他人有同样的问题?是否有一部分autotools版本可以涵盖所有案例?

c c++ unix gnu autotools

1
推荐指数
1
解决办法
328
查看次数

libtool被'make distclean'删除

我已经将libtool复制到程序的源代码树中,并将其与程序一起分发.但是当我运行'make distclean'时,libtool会被剩下的其余生成文件删除.我如何阻止这种情况发生?

我尝试放入EXTRA_DIST = libtoolMakefile.am,但这不起作用.

这基本上是我的configure.ac的样子.

AC_PREREQ(2.53)
AC_INIT( [program], [0.16], [program] )
AC_CONFIG_SRCDIR([src/c/program.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR(build-aux)
AM_INIT_AUTOMAKE( [-Wall -Werror foreign] )

m4_include(ax_pkg_swig.m4)

# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_ENABLE_SHARED
AC_PROG_SWIG

# Checks for libraries.

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T

# Checks for library functions.
AC_REPLACE_FNMATCH
AC_FUNC_MALLOC
AC_FUNC_STAT
AC_CHECK_FUNCS([regcomp strdup strtoull])

AC_CONFIG_FILES([
    Makefile
    src/c/Makefile
    src/perl/Makefile
    src/verilog/Makefile
])
AC_OUTPUT
Run Code Online (Sandbox Code Playgroud)

automake autoconf autotools libtool

1
推荐指数
1
解决办法
675
查看次数

PKG_CHECK_MODULES打破了solaris

我的项目要求libxml2使用自动工具来检查依赖关系并安装相同的依赖关系.我声明在configure.ac中使用以下宏的依赖性

echo -n "checking if libxml2 is present... "

PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.19],
              [echo "yes (features requiring libxml2 enabled)"  AC_DEFINE(HAVE_LIB_XML, 1,     [define if libxml2 is present])],
              [echo "no"] )
Run Code Online (Sandbox Code Playgroud)

宏按照需要工作GNU/Linux.

但不知何故,它失败Solaris了以下错误

checking if libxml2 is present... ./configure: line 11586: syntax error near unexpected token `LIBXML2,'
./configure: line 11586: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.19,'
Run Code Online (Sandbox Code Playgroud)

谷歌搜索解决方案,他们中的大多数抱怨pkg-config没有安装.但是在我的测试机器中实际安装了它,通过执行以下命令来检查它.

bash-3.00# pkg-config libxml-2.0 --modversion
2.6.23
Run Code Online (Sandbox Code Playgroud)

一些建议会受到欢迎.

automake autoconf solaris autotools

1
推荐指数
1
解决办法
4279
查看次数

使用autotools分发脚本

我想用我的应用程序分发我的启动脚本.它被称为"blah",它位于我项目的脚本/文件夹中.我在configure.ac中有这个:

... 
AC_CONFIG_FILES([
    Makefile
    scripts/Makefile
    ....
])

AC_CONFIG_FILES([scripts/blah], [chmod +x scripts/blah])

AC_OUTPUT
Run Code Online (Sandbox Code Playgroud)

在scripts目录中,我有以下Makefile.am:

dist_bin_SCRIPTS = blah
CLEANFILES = $(bin_SCRIPTS)
Run Code Online (Sandbox Code Playgroud)

在同一个目录中,我有"blah.in"文件.

但是当我做"make install"时它会创建脚本/ blah,bot不会将它安装到/ usr/local/bin目录.我的设置有什么问题?谢谢

autoconf autotools

1
推荐指数
1
解决办法
2100
查看次数

Automake向install.sh添加标志

我正在使用autotools来构建一些我希望只有在更改它们时才能安装标头的软件包.

我看到只有不同的安装install.sh标志-C,但我如何在autotools中设置该标志?

在我的Makefile.am中,如果有帮助,我提供nobase_libhello_include_HEADERS = file1.h file2.h.

automake makefile autotools

1
推荐指数
1
解决办法
344
查看次数

一旦安装了软件并且源代码仍然存在,如何找到--configure字符串?

这是一个典型的场景 - 您从源代码安装软件,花一个小时搞清楚配置选项,最后运行:

./configure --prefix=/a/b/c --with-X --with-Y=/usr/local/Y/lib \
            --disable-Z --with-extension=foo --build=bar ...
Run Code Online (Sandbox Code Playgroud)

一年过去了,一个新的软件版本问世了,你想要升级.为此,您需要在新的源代码上再次运行configure.但是,您已经忘记了配置标志是什么,但您仍然在主目录中的某处具有旧源代码和旧版本.

一年后当你忘记原始配置字符串是什么时,如何恢复配置字符串?

install autotools configure

1
推荐指数
1
解决办法
44
查看次数

autoconf 中的库版本字符串

在 autoconf 中首次指定库版本的正确方法是什么?该库处于不稳定状态,我想在它0.1.0为公共 API 准备好之前它应该是1.0.0. 所以我把以下内容configure.ac

AC_SUBST([FOO_SO_VERSION], [0:1:0])
AC_SUBST([FOO_API_VERSION], [0.1.0])
Run Code Online (Sandbox Code Playgroud)

还有Makefile.am

libfoo_la_LDFLAGS = -version-info $(FOO_SO_VERSION)
Run Code Online (Sandbox Code Playgroud)

虽然我得到了这个文件:

libfoo.so.0.0.1
Run Code Online (Sandbox Code Playgroud)

c++ automake autoconf autotools

1
推荐指数
1
解决办法
634
查看次数

如何将 libusb 编译为共享库?

我正在尝试将 libusb 构建为共享库,如下所示。

以下是两个步骤。1. 配置 2. 制作。

我通过“--enable-shared”来配置脚本,假设它将生成共享的 .so 文件

配置

./configure CC=/mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc --host=arm-linux --enable-udev=no --enable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... (cached) yes …
Run Code Online (Sandbox Code Playgroud)

gcc autotools shared-libraries ld libusb-1.0

1
推荐指数
1
解决办法
5216
查看次数

需要包运行autoreconf并在debian wheezy上配置

.deb在debian wheezy Linux上运行这些命令需要什么包?

cd software_that_builds_with_autotools
autoreconf --install &&\
./configure --prefix=/opt/foo/bar &&\
make && make install
Run Code Online (Sandbox Code Playgroud)

我尝试安装以下内容,但它仍然说它缺乏aclocal:

apt-get install binutils make csh g++ sed gawk autoconf autotools-dev

Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
Run Code Online (Sandbox Code Playgroud)

linux autotools autoreconf

1
推荐指数
1
解决办法
2204
查看次数

使用Automake为bin_SCRIPTS中的每个文件应用命令

在我的项目中,我有一组bash脚本,它们与C/C++二进制文件一起复制到安装根目录.

问题是我必须在安装之前为每个BASH脚本运行一个命令.更具体的是,我必须用autoconf输出变量替换变量:

 anyfile sed 's/ECLIPSE_PATH/@prefix@/g'
Run Code Online (Sandbox Code Playgroud)

这是在Makefile.am中定义脚本的地方

 bin_SCRIPTS = file1.sh file2.sh
Run Code Online (Sandbox Code Playgroud)

我想知道是否有任何标准的方法来解决这个问题.如果不是,我想来一些黑客来处理它.谢谢!

UPDATE

我想出了一个解决它的黑客,这是Automake的配方:

install-data-hook:
  input_path="@prefix@";                          \
  path=$${input_path//\//\\/};                    \
  for i in @bindir@/*; do                         \
    if [[ ! `file $${i}` =~ "ELF" ]]; then        \                                                                                                                                                                  
      sed -i "s/\$$ECLIPSE_PATH/$${path}/g" $$i;  \
    fi                                            \
  done
Run Code Online (Sandbox Code Playgroud)

但我仍然想知道是否有标准的方法来做到这一点

c++ bash automake autotools m4

1
推荐指数
1
解决办法
167
查看次数