在configure中找到底层编译器
我有一个使用编译器包装器编译的应用程序,例如 h5fc/h5cc(HDF5 编译器包装器)或 mpif90/mpicc(MPI 编译器包装器)。这些只是包装器,可以使用 -show 参数来查看真正的底层编译器,例如,
$ h5fc -show
ifort -fPIC [...] -lz -lm
$ mpif90 -show
ifort [...] -lmpichf90 -lmpichf90 -lpmpich -lmpich -lopa -lpthread
在这两种情况下,底层编译器都是 ifort。现在我使用 configure.ac
生成配置脚本来设置 Makefile
,并且我希望能够向编译器添加依赖于编译器的参数,但是这个需要在 configure.ac
中有代码来找出 h5fc/cc
或 mpif90/cc
的底层编译器是什么。我想这一定是可能的,但我不知道该怎么做。有人有什么建议吗?
额外问题:事实上,在某些情况下,我需要使用 h5pfc/cc 进行编译,它是启用 MPI 的 HDF5 包装器:
$ h5pfc -show
mpif90 [...] -lsz -lz -lm
这将需要迭代搜索,因为我需要执行 mpif90 -显示...
I have an application which is compiled using compiler wrappers such as h5fc/h5cc
(the HDF5 compiler wrappers), or mpif90/mpicc
(the MPI compiler wrappers). These are just wrappers, and it is possible using the -show
argument to see the real underlying compiler, e.g.
$ h5fc -show
ifort -fPIC [...] -lz -lm
$ mpif90 -show
ifort [...] -lmpichf90 -lmpichf90 -lpmpich -lmpich -lopa -lpthread
In both cases the underlying compiler is ifort. Now I am using configure.ac
to generate a configure script to set up the Makefile
, and I want to be able to add compiler-dependent arguments to the compiler, but this requires having code in configure.ac
to find out what the underlying compiler of h5fc/cc
or mpif90/cc
is. I imagine this must be possible, but I have no idea how to do this. Does anyone have any suggestions?
Bonus question: in fact in some cases I need to compile with h5pfc/cc
which is the MPI-enabled HDF5 wrapper:
$ h5pfc -show
mpif90 [...] -lsz -lz -lm
which would require an iterative search, because I then need to do mpif90 -show
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于想通了 - 答案很简单:
I finally figured it out - the answer is simply to do: