views:

21

answers:

1

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...

+1  A: 

I finally figured it out - the answer is simply to do:

fccompiler = `h5fc -show | awk {'print $1'}`
AC_MSG_RESULT($fccompiler) # print out to check
astrofrog