0

我想定义PLATFORM64如果SIZEOF_VOIDP等于 8,下面的配置片段不起作用,但显示了我想要实现的目标。有没有办法在我的配置脚本中做到这一点?

# Get size of void*
AC_CHECK_SIZEOF(void*)

# Determine if this is a 32 or 64 bit system, this can also be set manually with "-DPLATFORM64"
AM_CONDITIONAL([PLATFORM64], [test SIZEOF_VOIDP = 8])

更新:

我试过了:

AM_CONDITIONAL([PLATFORM64], [test "$SIZEOF_VOIDP" -eq 8])

但我收到“测试:错误号码”错误消息。

4

1 回答 1

0

问题在于AC_CHECK_SIZEOF定义预处理器指令,而不是设置 shell 变量。$host_cpu您可以在调用后尝试测试AC_CANONICAL_HOST

或者:

AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#if SIZEOF_VOIDP != 8
#error
#endif
])], [platform64=true], [platform64=false])

AM_CONDITIONAL([PLATFORM64], [test "$platform64" = true])
于 2013-04-21T00:02:30.950 回答