我正在尝试修补configure.in
文件以便为某个包启用交叉编译。到目前为止,我只是在修补AC_TRY_RUN
宏,以使它们能够跳过编译代码的执行并使用包含测试结果的预定义变量,该变量应该先验运行。
在文件的开头,我插入了这样的行:
dnl -- The following block is used to allow cross-compilation:
CROSSCTEST00=yes dnl -- the result of test 0
CROSSCTEST01=yes dnl -- the result of test 1
...
CROSSCTESTNN=yes dnl -- the result of test N
dnl --
dnl This is where this file started previously:
AC_INIT(pl-wam.c)
AC_PREREQ([2.66])
AC_CONFIG_HEADER(config.h)
AC_SUBST(COFLAGS)
AC_SUBST(CWFLAGS)
...
然后,我正在使用这样的第四个参数AC_TRY_RUN
:
AC_TRY_RUN([ // piece of C code ],
[actions if exit(0)],
[actions if exit(1)],
if test "x$CROSSCTEST00" = xyes; then
dnl same actions if exit(0)
else
dnl same actions if exit(1)
fi)
但它不起作用。尽管 $CROSSCTEST 是yes
,但test ...
永远不是真的。我还尝试了另一种方法:
AC_TRY_RUN([ // piece of C code ],
[actions if exit(0)],
[actions if exit(1)],
AS_IF([test "x$CROSSCTEST00" = xyes],
[same actions if exit(0)],
[dnl same actions if exit(1)]))
......它也不起作用。我在这里错过了什么吗?您是否认为有更好的方法来修补 a configure.in
as 以启用交叉编译?