Jari Häkkinen wrote:
Tatsuhiro Nishioka wrote:
Ah, so there is no real need for alut.h at all. Hm, so the alut.h issue
should rather go in to simgear. I now tested with a zero length alut.h
and no libalut. Compiling works but the linker fails with alut-complaints
Undefined symbols:
"_alutInitWithoutContext", referenced from:
SGSoundMgr::SGSoundMgr()in libsgsound.a(soundmgr_openal.o)
To get simgear I of course had to provide an alut.h but the one I have
is from freealut-1.1 which gives me unwanted consequences. I am not sure
about the #if statements on ALUT_API_MAJOR_VERSION in
simgear/soundmgr_openal.cxx but I think that the compiler should not
compile code calling alutInitWithoutContext on Apple computers. With my
below suggested changes this issue will go away.
and more. Listing alut-related functions in the OpenAL framwork only
gives a short list of alut related functions:
#> nm openAL | grep alut
00013133 T _alutExit
00013168 T _alutInit
00013a2e T _alutLoadWAVFile
000136f8 T _alutLoadWAVMemory
0001311e T _alutUnloadWAV
I have freealut installed to resolve the above linker problem
Browsing through simgear/soundmgr_openal.cxx it looks like the calls to
non-supported alut functions can be avoided. I look into that.
I removed all dependencies on alut.h which all seems to be in
simgear/sound only. I simply removed a few include statements and added
one function declaration (see attached patch file). All of the fg
components now compiles without any alut/freealut added (except for the
backward compatibility stuff in OpenAL framework supplied by Apple).
Isn't there non-alut replacement for alutLoadWAVFile? If there is then
alut could be removed completely.
I have not yet had the possiblity to extensively test the changes
suggested in the patch but during a short flight the changes seems to work.
If the proposed changes is pushed to the official simgear CVS then the
configure scripting will be easier for simgear and fg/source wrt alut
(at least for mac developers).
Cheers,
Jari
? simgear_sound4mac.patch
Index: simgear/sound/openal_test1.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/sound/openal_test1.cxx,v
retrieving revision 1.13
diff -u -p -r1.13 openal_test1.cxx
--- simgear/sound/openal_test1.cxx 22 Oct 2009 08:32:04 -0000 1.13
+++ simgear/sound/openal_test1.cxx 27 Nov 2009 11:04:22 -0000
@@ -13,7 +13,6 @@ static unsigned int sleep(unsigned int s
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
# include <OpenAL/al.h>
# include <OpenAL/alc.h>
-# include <OpenAL/alut.h>
#elif defined(OPENALSDK)
# include <al.h>
# include <alc.h>
Index: simgear/sound/soundmgr_openal.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/sound/soundmgr_openal.cxx,v
retrieving revision 1.74
diff -u -p -r1.74 soundmgr_openal.cxx
--- simgear/sound/soundmgr_openal.cxx 26 Nov 2009 13:05:44 -0000 1.74
+++ simgear/sound/soundmgr_openal.cxx 27 Nov 2009 11:04:22 -0000
@@ -30,7 +30,25 @@
#endif
#if defined( __APPLE__ )
-# include <OpenAL/alut.h>
+# include <OpenAL/al.h>
+# include <OpenAL/alc.h>
+
+// Definitions taken from alut.h (from #if defined (__APPLE__)
+// clauses) with the aim to become independent of alut.h since alut is
+// not available in a standard OpenAL installation on mac (since xcode
+// 2.4). Five alut functions are still included in the OpenAL
+// framework libraries but they are not declared in any header file
+// (at least in OSX 10.6.2): alutExit, alutInit, alutLoadWAVFile,
+// alutLoadWAVMemory, and alutUnloadWAV
+extern "C" {
+
+#define ALUT_API extern
+#define ALUT_APIENTRY
+#define ALUT_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
+
+ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutLoadWAVFile (ALbyte
*fileName, ALenum *format, void **data, ALsizei *size, ALsizei *frequency);
+}
+
#else
# include <AL/alut.h>
#endif
Index: simgear/sound/soundmgr_openal.hxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/sound/soundmgr_openal.hxx,v
retrieving revision 1.35
diff -u -p -r1.35 soundmgr_openal.hxx
--- simgear/sound/soundmgr_openal.hxx 23 Nov 2009 10:32:28 -0000 1.35
+++ simgear/sound/soundmgr_openal.hxx 27 Nov 2009 11:04:22 -0000
@@ -48,7 +48,6 @@
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
# include <OpenAL/al.h>
# include <OpenAL/alc.h>
-# include <OpenAL/alut.h>
#elif defined(OPENALSDK)
# include <al.h>
# include <alc.h>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel