==============linux内核中================================
.config中定义的变量自动写到include/generated/autoconf.h
这样.config中的变量就能在c文件中使用了
例如:
.config: CONFIG_SLHC=y
include/generated/autoconf.h: #define CONFIG_SLHC 1
==============autoconfig automake工程中================================
在configure.ac的AC_INIT和AC_OUTPUT之间添加:
myval=no
AC_ARG_ENABLE(
fd650,
[AC_HELP_STRING([--enable-fd650],[Define to 1 if you are using fd650])],
[],
[]
)
myval=$enableval
echo "myval====================$myval"
AS_IF(
[ test "$enableval" == "yes" ],
[AC_DEFINE(FD650,1,[Use fd650]) ]
)
configure.ac中的变量自动写到了config.h
这样config.h中的变量就能在在c文件中使用了
例如:
使用上述configure.ac,运行configure --enable-fd650=yes
在config.h中:#define FD650 1
==============android源代码中================================
在Android.mk中使用LOCAL_CFLAGS := -Dabc
在Andro