Automake: How to prefix a command to compiler command

433 views Asked by At

The following quote is taken from documentation of scorep. In order to use the software, the scorep command is said to prefixed to compiler which is mpicc. I am using automake. So far, in configure.ac I had AC_PROG_CC([mpicc]). How can I prefix the scorep command to compiler command with automake?

When makefiles are employed to build the application, it is convenient to define a placeholder variable to indicate whether a “preparation'' step like an instrumentation is desired or only the pure compilation and linking. For example, if this variable is called PREP then the lines defining the C compiler in the makefile can be changed from:

MPICC = mpicc to MPICC = $(PREP) mpicc

One can then use the same makefile to either build an instru- mented version with the

make PREP="scorep"

command or a fully optimized and not instrumented default build by simply using:

make.

3

There are 3 answers

0
Joseph Varghese On

Install_Scorep is a bash script to install Score-P 3.0 on Linux based systems. To install Score-P clone the repository and run the script named install_scorep.sh. This will do all the necessary tasks to successfully install Score-P 3.0 .

0
Tom Tromey On

If your package must always be built with scorep, then just prepend it to CC in your configure.ac, like:

AC_PROG_CC([mpicc])
CC="scorep $CC"

This will cause a build failure if the user building your package doesn't have scorep, but presumably that's what you want. (Or you could add a check to configure.ac to have it error if scorep is not found.)

If you want the user to optionally use scorep, you could make the above assignment conditional. One common way is to use an option, in your case, say, --with-scorep.

A final option is to do nothing and let users wanting this functionality request it like:

make CC='scorep mpicc'
0
Shibli On

This answer is specific to Score-P.

I would like to share Score-P mailing list's answer. Based on this link, it is necessary to configure with

SCOREP_WRAPPER=OFF ../configure \
     CC=scorep-mpicc \
     CXX=scorep-mpicxx \
     FC=scorep-mpif90 \
     --disable-dependency-tracking