Hello everybody! For our scientific software ESPResSo[1], I am trying to get configure to be able to handle MPI compilers correctly. MPI is a parallelization library and it often brings its own compiler, i.e. actually it only brings a wrapper to your compiler, which is usually called mpicc. In our case, the whole software is supposed to be compiled using the MPI compiler. If none is available, it is still possible to compile it using a standard compiler. The idea is, that I first check whether the user wants to use MPI at all ("--with-mpi"), and if he wants, I first try to find the possible MPI compilers using AC_PROG_CC([mpicc ...]). If he doesn't want it, or if no MPI compiler was found, then the standard compiler using AC_PROG_CC should be used. I have attached my simplified attempt do this. When I run autoconf, I get the warning configure.ac:4: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before it was required and configure doesn't seem to be looking for mpicc, but always finds gcc first. The problem seems to be that AC_PROG_CC doesn't work when using it in a conditional, is that right? Is there any simple way to do what I want? The autoconf macro archive contains the macro AX_MPI[2] which is intended to recognize MPI compilers, however, I find it has a few shortcomings and doesn't really solve the problem, as it always first uses AC_PROG_CC and like that recognizes the standard compiler and determines the various compiler characteristics and only afterwards finds the MPI compiler. If the MPI compiler understands completely different options than the standard compiler, this leads to massive problems. Best regards Olaf Lenz References: [1] http://espressomd.org [2] http://www.gnu.org/software/autoconf-archive/ax_mpi.html -- Dr. rer. nat. Olaf Lenz Institut fÃr Computerphysik, Pfaffenwaldring 27, D-70569 Stuttgart Phone: +49-711-685-63607
AC_INIT(ESPResSo, [2.9.0], [espressomd-users@xxxxxxxxxx]) AC_ARG_WITH(mpi,,, [with_mpi=guess]) AS_IF([test x"$with_mpi" = xno], [use_mpi_fake="yes"], [ # if MPI is wanted, look for MPI compiler AC_PROG_CC([mpicc hcc mpxlc_r mpxlc mpcc cmpicc]) # test whether MPI_Init is available now AC_CHECK_FUNC(MPI_Init,,, [ # if not, give up or use fake if test xyes = x"$with_mpi"; then AC_MSG_FAILURE([MPI compiler requested, but couldn't compile with MPI.]) else AC_MSG_WARN([No MPI compiler found, will use fake implementation!]) use_mpi_fake="yes" fi ]) ]) AS_IF([test x"$use_mpi_fake" = xyes], [ # use the fake implementation and the standard compiler AC_PROG_CC ESPRESSO_MPIEXEC="" ]) # if requested, use the fake implementation #AM_CONDITIONAL(MPI_FAKE, [test x$use_mpi_fake = xyes])
begin:vcard fn:Olaf Lenz n:Lenz;Olaf org;quoted-printable;quoted-printable:Universit=C3=A4t Stuttgart;Institut f=C3=BCr Computerphysik adr:;;Pfaffenwaldring 27;Stuttgart;;70569;Germany email;internet:olenz@xxxxxxxxxxxxxxxxxxxx title:Dr. rer. nat. tel;work:+49.711.685.63607 tel;fax:+49.711.685.63658 url:http://www.icp.uni-stuttgart.de/~icp/Olaf_Lenz version:2.1 end:vcard
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf