Dear all
I try to write a configure.in/Makefile.am system for my c++ code and I get
the following problem. I have a compiler check which looks like this
# Compiler check
AC_ARG_WITH(cxx,
[ --with-cxx=COMPILER[:name-flags] set options for COMPILER ],
[case "$withval" in
KCC*) # KAI C++ http://www.kai.com/
....
cxx*) # DEC C++ http://www.digital.com/
echo "Configuring for DEC cxx"
CXX="cxx"
CXX_OPTIMIZE_FLAGS="-O4 -tune host"
CXX_DEBUG_FLAGS="-g -msg_display_tag -DBZ_DEBUG"
CXXFLAGS="-std strict_ansi -DBZ_DISABLE_XOPEN_SOURCE -ieee"
CXXFLAGS="$CXXFLAGS -ptr \$(top_srcdir)/repository -ttimestamp"
;;
egcs*|gcc*) # gcc http://gcc.gnu.org/
....
*) AC_MSG_ERROR([ Known compilers are KCC, gcc, cxx])
esac
echo ""
echo CXX = $CXX
echo "" ],
[AC_MSG_ERROR([
This script only recognizes a small set of compilers and platforms so far.
You will have to rerun this script with one of these options:
--with-cxx=KCC KAI C++ (http://www.kai.com/)
--with-cxx=gcc gcc (http://gcc.gnu.org/)
--with-cxx=cxx DEC cxx 6.10 or better (http://www.dec.com/)
])] )
The problem is coming from the declaration of the CXXFLAGS for cxx
compiler. I need to declare a repository for instantiations of the
templates with -ptr <directory>. Since I have several subdirectories, I
need the templates to be instantiated in a known place.
Earlier I had set it
CXXFLAGS="$CXXFLAGS -ptr $PWD/repository -ttimestamp"
But I would like to take advantage of the $(top_srcdir) variable so that
each created Makefile contains not an instance but a variable.
It works fine and in each created Makefile I have
CXXFLAGS = -std strict_ansi -DBZ_DISABLE_XOPEN_SOURCE -ieee -ptr
$(top_srcdir)/repository -ttimestamp
The problem comes when I run configure to check whether the compiler works
then I get
% configure --with-cxx=cxx --with-blitz=/mn/sothi/u1/patrickg/src/blitz
--with-hdf=/astro/local/opt/HDF_4.1r3/4.1r3_digunix
....
checking for g++... cxx
checking whether the C++ compiler works... no
configure: error: C++ compiler cannot create executables
Looking at config.log I see that
....
configure:3583: result: cxx
configure:3632: checking whether the C++ compiler works
configure:3649: cxx -o conftest -std strict_ansi -DBZ_DISABLE_XOPEN_SOURCE
-ieee -ptr $(top_srcdir)/repository -ttimestamp -DHDF
-I/astro/local/opt/HDF_4.1r3/4.1r3_digunix/include
-I/mn/sothi/u1/patrickg/src/blitz -DFLOAT_FIELD
-L/mn/sothi/u1/patrickg/src/blitz/lib -lblitz
-L/astro/local/opt/HDF_4.1r3/4.1r3_digunix/lib -lmfhdf -ldf
/astro/local/opt/HDF_4.1r3/4.1r3_digunix/lib/libjpeg.a -lz conftest.cc
>&5
cxx: Severe: invalid directory for instantiation files:
$(top_srcdir)/repository
cxx: Info: 1 catastrophic error detected in the compilation of
"conftest.cc".
cxx: Info: Compilation terminated.
configure: failed program was:
#line 3635 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit (int);
#endif
int
main ()
{
;
return 0;
}
configure:3669: result: no
The problem is when testing the tested command does not contain an
instance of $(top_srcdir) but $(top_srcdir) itself!
What do I do wrong? Do you have tips to remedy?
Sincerely
Patrick Guio
======================================================================
Patrick Guio
Institute of Physics, University of Oslo
P.O. box 1048, Blindern, N-0316 Oslo
Tel : (+47) 22 84 40 60 - Fax : (+47) 22 85 56 71
E-mail : [EMAIL PROTECTED]
URL : http://www.fys.uio.no