linux – 如何使用automake检查操作系统
发布时间:2021-01-08 15:58:08 所属栏目:Linux 来源:网络整理
导读:我有一个项目,使用automake创建配置和所有相关文件(我使用autoreconf命令来制作所有这些东西).因此,我正在尝试设置一些条件文件,以便在项目编译macOS(OS X),Windows或 Linux时进行编译.但它失败了以下内容: $autoreconf -i ..src/Makefile.am:30: error: LI
|
我有一个项目,使用automake创建配置和所有相关文件(我使用autoreconf命令来制作所有这些东西).因此,我正在尝试设置一些条件文件,以便在项目编译macOS(OS X),Windows或 Linux时进行编译.但它失败了以下内容: $autoreconf -i .. src/Makefile.am:30: error: LINUX does not appear in AM_CONDITIONAL autoreconf: automake failed with exit status: 1 包含Makefile.am中的错误的部分如下: if OSX
butt_SOURCES += CurrentTrackOSX.h CurrentTrackOSX.m
endif
if LINUX
butt_SOURCES += currentTrack.h currentTrackLinux.cpp
endif
if WINDOWS
butt_SOURCES += currentTrack.h currentTrack.cpp
endif
我的问题是,如何检查操作系统是否为Linux?如果有可能,有没有更好的方法来检查automake中的操作系统? 解决方法您可以检测它 directly in the Makefile,或者在配置源文件(可能是configure.ac)中定义条件,因为您使用的是autoreconf:# AC_CANONICAL_HOST is needed to access the 'host_os' variable
AC_CANONICAL_HOST
build_linux=no
build_windows=no
build_mac=no
# Detect the target system
case "${host_os}" in
linux*)
build_linux=yes
;;
cygwin*|mingw*)
build_windows=yes
;;
darwin*)
build_mac=yes
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
# Pass the conditionals to automake
AM_CONDITIONAL([LINUX],[test "$build_linux" = "yes"])
AM_CONDITIONAL([WINDOWS],[test "$build_windows" = "yes"])
AM_CONDITIONAL([OSX],[test "$build_mac" = "yes"])
(编辑:均轻资讯网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 调用远程主机上的 RMI 服务时抛出 java.rmi.ConnectExcepti
- 在redhat 6.6 64位操作系统中,systemctl命令在哪里?
- iphone充电基本常识
- 离线盒子怎么注册 离线盒子注册不了怎么办
- Linux运维需要了解的Redis经验
- 不要 locate 指令,Linux plocate 才是更好的选择
- linux-kernel – 绑定驱动程序如何从奴役接口获取RX数据包
- linux – 推荐的电子邮件客户端来读取/应用git补丁?
- linux – erlang odbc:如何禁用oracle的autocommit
- 红帽Linux.5.5企业版本在VM虚拟机里中文乱码的解决方法


