I think this is a question about automake.
I'm struggling with the cally demo of Cal3D.
The first problem I ran into was that the Cal3D code base is missing #include <cstring>
and #include <memory>
in a lot of places.
Doing this every time I got an error in any source file in Cal3d was enough to let me compile it.
The cally demo also needed some #include <cstring>
Now my problem is that HAVE_SDL_H is not defined when tick.cpp is compiled.
The configure and makefile seems to accept that SDL is installed on my system, but the macros in src/tick.cpp doesn't.
I guess there is some kind of bug in the configure.in or something, but I don't seem to find out just what it is.
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -O3 -ffast-math -funroll-all-loops -g -O2 -I/usr/include -I/usr/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT tick.o -MD -MP -MF ".deps/tick.Tpo" -c -o tick.o tick.cpp; \
then mv -f ".deps/tick.Tpo" ".deps/tick.Po"; else rm -f ".deps/tick.Tpo"; exit 1; fi
tick.cpp:144:5: error: #error "no timer implemented for your plateform"
Edit:
I've finally compiled the demo.
When I compiled cal3d I added #include <cstring>
to the following files:
- src/cal3d/hardwaremodel.cpp
- src/cal3d/platform.cpp
- src/cal3d/renderer.cpp
- src/cal3d/submesh.cpp
- src/cal3d_converter.cpp
When I compiled cally I added #include <cstring>
to the following files:
- src/demo.cpp
- src/model.cpp
In model.cpp I changed line 640 from
glBindTexture(GL_TEXTURE_2D, (GLuint)pCalRenderer->getMapUserData(0));
to
glBindTexture(GL_TEXTURE_2D, *(GLuint*)pCalRenderer->getMapUserData(0));
I also did some uglier changes to get src/tick.cpp to compile.
In src/tick.cpp I removed everything that had anything to do with SDL. I also removed a macro if clause checking for __i386__ or __ia64__, so that Tick::getTime() could also be compiled.
I know that this is not a proper fix, so improvements are very much welcome.
- 64-bit OpenSuSE with a 2.6.27 kernel.
- GCC: 4.3.2
- GNU Automake: 1.10.1
- GNU Autoconf 2.63
- 64-bit versions of the SDL library is installed with zypper (through the GUI).
Solution
In configure.in change
AC_CHECK_HEADERS([SDL.h])
to
AC_CHECK_HEADERS([SDL/SDL.h])
(then run autoreconf and ./configure)
in tick.cpp change all checks for HAVE_SDL_H
to HAVE_SDL_SDL_H
This is all due to a restructuring in the sdl library.
Best Answer
The errors you got with missing
#include <cstring>
and#include <memory>
is mainly du to a cleanup that happened in GNU headers: inclusion of unnecessary headers were removed and consequently programs not including the proper headers for the features they use face compiling errors.About
HAVE_SDL_H
, most likely, your Linux distribution is missing packages.You probably need to install the SDL library. Some Linux distributions like Ubuntu split the packages between the library runtime and the dev files so you need to install both packages
sudo apt-get install libsdl1.2-dev
Regarding:
It indeed fails to compile because
HAVE_SDL_H
is not defined inconfig.h
. When you look atconfigure.in
you see it's usingAC_CHECK_HEADERS([SDL.h])
From the autoconf manual:
So,
AC_CHECK_HEADERS([SDL.h])
makes configure search forSDL.h
in/usr/include
and doesn't find it because its (new?) path is/usr/include/SDL/SDL.h
As a workaround, use
CPPFLAGS
to add system header search paths when invoking configure:./configure CPPFLAGS="-I/usr/include/SDL"
Now you may want to fix
configure.in
configure.in
usesAM_PATH_SDL(1.2.0)
which will end up invokingsdl-config --cflags
to defineSDL_CFLAGS
. (the implementation ofAM_PATH_SDL
typically lies in the/usr/share/aclocal/sdl.m4
file)sdl-config --cflags
returns-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
but those-I
and-D
directives should not end up inCFLAGS
anyway but rather inCPPFLAGS
(as per the autoconf manual). Hence I would say there is already something wrong "at the SDL level".Now take a look at the
AC_LANG
documentation:Moving the
AC_LANG_CPLUSPLUS
up so that it at least aboveAC_CHECK_HEADERS([SDL.h])
should make it now useg++
andCXXFLAGS
when trying to compileSDL.h
which should success sinceSDL_CFLAGS
were added toCXXFLAGS
. (again, it should really beSDL_CPPFLAGS
but you won't change SDL...)