如何在Makefile.am中检查root用户

时间:2014-12-04 20:37:37

标签: makefile

我想运行像

这样的支票
if user is root then
  directorypath = /set/path/to/this/dir
else
  directorypath = /set/path/to/that/dir/instead

在我的Makefile.am中,但我不确定使用什么语法来实现这一点以及我是否需要在configure.ac中执行某些操作才能完成条件工作。任何人都可以指出我正确的方向吗?

1 个答案:

答案 0 :(得分:0)

想出来。

configure.ac

 AM_CONDITIONAL(USER, test `whoami` = "root")

Makefile.am

if USER
directorypath = /set/path/to/this/dir
else
directorypath = /set/path/to/that/dir/instead
endif

Simples。

相关问题