autotools

Conditionally disable shared library build

▼魔方 西西 提交于 2019-12-11 02:55:53
问题 I’ve written a C library that builds using Libtool, and I’d like to only build static libraries on Cygwin. To that end, I placed if test "$target_os" = "cygwin"; then AC_DISABLE_SHARED fi in my configure.ac . This does indeed disable building shared libraries on Cygwin; however, it also disables building them everywhere else. I assume this is because expanding AC_DISABLE_SHARED causes some unfortunate side effects. How can I use Libtool to avoid building shared libraries on Cygwin while still

autotools and -Wl,-whole-archive

南笙酒味 提交于 2019-12-10 21:57:05
问题 Is it possible to tell autotools to link one of the libraries with -Wl,-whole-archive flag? Makefile.am bin_PROGRAMS = pktanon pktanon_SOURCES = main.cpp pktanon_DEPENDENCIES = $(lib_LIBRARIES) pktanon_LDADD = libpktanon.a $(LDADD) I need to link libpktanon.a with -Wl,-whole-archive flag, also I want make to execute something like this: g++ -o pktanon main.o -Wl,-whole-archive libpktanon.a -Wl,-no-whole-archive -l... (as in this question) 回答1: I ran into a similar problem here. You can do

Changing *FLAGS in configure.ac vs. caching with subprojects

耗尽温柔 提交于 2019-12-10 18:08:04
问题 Say I wish to add a specific flag to CFLAGS within my configure script, that should propagate to all subprojects' configure scripts: CFLAGS+=" -Dfoobar" export CFLAGS AC_CONFIG_SUBDIRS([sub]) This works when configure is invoked trivially. As soon as one of the following happens: CFLAGS is exported in the environment when configure is invoked CFLAGS is set on configure command-line caching is used ( configure -C ) This approach no longer works. In the first two cases, the exported CFLAGS is

Calling SED for a source in Makefile.am

可紊 提交于 2019-12-10 10:03:38
问题 I've got c++ code that needs a sed done to it prior to compilation. How do I place this into Makefile.am ? I tried the typical makefile setup and the target appears to not exist: gentest.cc: $(SED) -i "s|FIND|REPLACE|" gentest.cc If you are interested as to why I want to do this, it's because I wrote my program ( slider3.py ) in python and my partner wrote his in c++ ( gentest.cc ) and his needs to call mine. I'm accomplishing this by editing the argv and then using execv() . ... { char *

Qt and QMake build dir

不羁的心 提交于 2019-12-10 08:17:32
问题 I would like to build qt and qt application out of the source tree. Do you know how to set from the command line the .obj directory both with configure and qmake? 回答1: If I understand question correctly you should set OBJECTS_DIR variable in *.pro file for any directory you want. If you don't want to change *.pro file try qmake "OBJECTS_DIR=some_dir" *.pro 来源: https://stackoverflow.com/questions/1741877/qt-and-qmake-build-dir

What is the best way to set compilation flags for individual source files using GCC and autotools?

做~自己de王妃 提交于 2019-12-10 07:28:03
问题 I need to disable optimization flag for a individual file using autotools. What is the best way to do it? 回答1: Do you mean an individual source file or an individual executable? To disable optimization for an executable is simple: bin_PROGRAMS = myprog myprog_SOURCES = foo.c bar.c myprog_CFLAGS = -O0 If you mean that you want to disable the optimization for a single source file temporarily , say for debugging purposes, you can just remake that file at the prompt: (example from the automake

Autotools include path

五迷三道 提交于 2019-12-10 02:54:05
问题 I have a directory structure like Makefile.am Configure.ac src/ hello.c Makefile.am include/ hello.h How to specify the include path in Makefile.am of src so that it includes header files from include/ dir as well as c file depends on header file. So if I modify any .h file it force to recompile .cc file. Defining AM_CPPFLAGS' is giving warning configure.ac:5: warning: macro `AM_CPPFLAGS' not found in library 回答1: In src/Makefile.am , write: AM_CPPFLAGS = -I$(top_srcdir)/include bin_PROGRAMS

Autotools library and object file output control

大兔子大兔子 提交于 2019-12-09 17:30:08
问题 My goal is to have all object files built in a .objs directory instead of the root of the Makefile, and to have the binaries (and libraries) copied into the project's bin/ directory. But I have been unable to find any resources to explain how to do this. How would I go about doing this? Here is my configure.ac and src/Makefile.am - I have similar Makefile.am files for two shared libraries that are referenced. They compile, and after copying them to the bin/ directory work as they should. I'm

Portably include GLib headers in autoconf/automake

不羁岁月 提交于 2019-12-09 11:22:38
问题 I need to include the GLib headers for a project that is built with an autoconf-based system for portability. How can I safely import the GLib headers in a portable manner? I know about pkg-config, but that is not entirely portable (since some systems don't have it and I would prefer to only rely on autoconf for configuration). 回答1: The GLib 2.22 INSTALL file states that pkg-config is a requirement for installing this library. I am not being GLib (pun intended!); statement of this requirement

Getting started with gnulib on MinGW and not familiar (enough) with autotools

邮差的信 提交于 2019-12-08 20:58:50
问题 I've got some C code that was written for Linux and relies on sockets and arpa/inet.h as well as libusb.h and I want to compile this for Windows under MinGW. (Note that the current project just has a very simple Makefile and doesn't rely on autotools at all). It looks like using gnulib would be a good way to be able to compile this for Windows under MinGW and I've started out in that direction, but it seems that if you're not very familiar with autotools you get into the deep weeds really