打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
configure 里的检查函数

编译目标:
compile_object() {
  do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
}
执行编译命令把源文件编译成.o文件

检查宏定义:
check_define() {
cat > $TMPC <<EOF

#if !defined($1)
#error $1 not defined
#endif
int main(void) { return 0; }
EOF
  compile_object
}

检查宏定义的用法:
if check_define __linux__ ; then
  targetos="Linux"
elif check_define _WIN32 ; then
  targetos='MINGW32'
elif check_define __OpenBSD__ ; then
  targetos='OpenBSD'
elif check_define __sun__ ; then
  targetos='SunOS'
elif check_define __HAIKU__ ; then
  targetos='Haiku'
else
  targetos=`uname -s`
fi

执行 check_define __linux__
如果有定义 __linux__则会把
#if !defined($1)
#error $1 not defined
#endif
int main(void) { return 0; }
这些内容写入 $TMPC 文件中 然后执行compile_object函数对 $TMPC文件进行编译
如果有定义__linux__宏 则编译会成功 否则#error __linux__ not defined错误 


cat > $TMPC <<EOF
...
EOF
通过cat命令把...的内容写入 $TMPC

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
使用批处理自动定时备份文件到邮箱
C++ 如何识别各种编译器样板
getchar()和EOF总结(转载)
linux下 MPI和PVM程序示例
read
移植ucGUI到s3c2440
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服