开发者

Porting shared library ELF projects in autoconf to OS X

How do I use autoconf macros to conditionally change values in a configure-script or Makefile it ouputs throug开发者_StackOverflow社区h AC_OUTPUT.

The goal is to use AC_CANONICAL_TARGET, or some other way, to identify that I'm on OS X and then allow my Makefiles to adapt the LDFLAGS by removing -shared and replacing -soname with -dylib_install_name.

So I basically need to learn how to modify the AC_SUBST values or the local variables in the configure.ac file using a conditional statement that checks the target host.

I must add that I've been trying to use AC_COMPILE_IFELSE with AC_LANG_PROGRAM to compile this code.

#include <unistd.h>
#ifndef __APPLE__
error: This is not apple Darwin
#endif

While I don't get any errors, I can't really confirm that it works. There is no output related to it when I run the new script on FreeBSD or Darwin. Also I always use autoconf -Wall.

Second and third arguments to AC_COMPILE_IFELSE is [is_darwin=yes], [is_darwin=no] but how do I access these values?

Thanks very much in advance for any help.


Well just to get the question off of stack I'll answer it by saying that those variables in the second and third arguments of AC_COMPILE_IFELSE are available as SHELL variables throughout the configure.ac script. In fact I solved this by placing multiple variable definitions in these two arguments as they accept multiple lines of Shell code and not just one variable definition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜