SDL port for AIX

Hi !

Maybe I’m the only now who cares, but I have done an initial port of
SDL 1.1.1 to AIX 4.3.3.

Basically, porting meant AIX-specific modules in src/cdrom and src/audio
and some changes to the configure.in’s. More info and the modified
distribution can be found at http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL

The test programs for joystick and GL fail still; I don’t have a joystick
to look at the first problem, I believe there is not even a connector for
such a thing on my box. The GL problem is probably with my X setup.

Regards,
Carsten

Hi !

Maybe I’m the only now who cares, but I have done an initial port of
SDL 1.1.1 to AIX 4.3.3.

Very cool!

Basically, porting meant AIX-specific modules in src/cdrom and src/audio
and some changes to the configure.in’s. More info and the modified
distribution can be found at http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL

Your changes will be incorporated into SDL 1.1.2
I had some problems with the header file changes.
You rely on automake to generate the endianness information, but the
headers as they are installed on the system do not have the automake
defines enabled. Can you give me a unique C preprocessor symbol that
defines the AIX hardware platform?

gcc -v foo.c will show you a list of C preprocessor symbols that are
used.

Thanks!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Hi again !

Basically, porting meant AIX-specific modules …

Your changes will be incorporated into SDL 1.1.2

That’s great !

I had some problems with the header file changes.

I have attached a patch that should do better. It refers to the CVS tree,
not to the 1.1.1 release.

You rely on automake to generate the endianness information, but the
headers as they are installed on the system do not have the automake
defines enabled. Can you give me a unique C preprocessor symbol that
defines the AIX hardware platform?

The standard preprocessor symbol (for gcc and for CSet) is _AIX

The attached patch is supposed to do 2 things:

  • solve the little endian/big endian decision in configure by auto-generating
    the header file include/SDL_byteorder.h [as proposed in the comments ;-)]
  • add _AIX to include/SDL_syswm.h

The patch modifies these files:
configure.in: - define SDL_CONF_BIGENDIAN and call AC_SUBST
- add -I$(top_builddir)/include to CFLAGS and CXXFLAGS
- generate include/SDL_byteorder.h from include/SDL_byteorder.h.in
include/SDL_byteorder.h: deleted
include/SDL_byteorder.h.in: generated depending on @SDL_CONF_BIGENDIAN@
include/SDL_syswm.h: add _AIX to #if defined()

Regards,
Carsten

-------------- next part --------------
diff -Nur SDL/configure.in SDL.changes/configure.in
— SDL/configure.in Wed Mar 15 15:29:38 2000
+++ SDL.changes/configure.in Wed Mar 15 14:58:46 2000
@@ -45,6 +45,17 @@
AC_CANONICAL_TARGET
AC_C_INLINE

+dnl griff - 15mar2000
+dnl Check whether the platform is big endian
+dnl Use AC_SUBST later to make the appropriate adaptations
+AC_C_BIGENDIAN
+if test x$ac_cv_c_bigendian = xyes; then

  • SDL_CONF_BIGENDIAN=1
    +else
  • SDL_CONF_BIGENDIAN=0
    +fi+

dnl Check for tools

AC_LIBTOOL_WIN32_DLL
@@ -973,6 +984,13 @@
dnl Expand the libraries needed for static linking
AC_SUBST(SYSTEM_LIBS)

+dnl Select the little endian/big endian case in the byteorder header file
+AC_SUBST(SDL_CONF_BIGENDIAN)
+
+dnl griff - 15mar2000
+dnl For headers generated by configure, files must be included from builddir
+CFLAGS="$CFLAGS -I$(top_builddir)/include"
+
dnl Expand the include directories for building SDL
CFLAGS="$CFLAGS -I$(top_srcdir)/include"
CFLAGS="$CFLAGS -I$(top_srcdir)/include/SDL"
@@ -993,10 +1011,15 @@
dnl Important: Any directory that you want to be in the distcheck should
dnl have a file listed here, so that configure generates the
dnl subdirectories on the build target.
+dnl
+dnl griff - 15mar2000
+dnl added generation of include/SDL_byteorder.h
+dnl
AC_OUTPUT([
Makefile
docs/Makefile
include/Makefile
+include/SDL_byteorder.h
src/Makefile
src/main/Makefile
src/audio/Makefile
diff -Nur SDL/include/SDL_byteorder.h SDL.changes/include/SDL_byteorder.h
— SDL/include/SDL_byteorder.h Wed Mar 15 09:13:46 2000
+++ SDL.changes/include/SDL_byteorder.h Thu Jan 1 01:00:00 1970
@@ -1,48 +0,0 @@
-/*

  • SDL - Simple DirectMedia Layer
  • Copyright © 1997, 1998, 1999 Sam Lantinga
  • This library is free software; you can redistribute it and/or
  • modify it under the terms of the GNU Library General Public
  • License as published by the Free Software Foundation; either
  • version 2 of the License, or (at your option) any later version.
  • This library is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  • Library General Public License for more details.
  • You should have received a copy of the GNU Library General Public
  • License along with this library; if not, write to the Free
  • Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  • Sam Lantinga
  • slouken at devolution.com
    -*/

-#ifdef SAVE_RCSID
-static char rcsid =

  • “@(#) $Id: SDL_byteorder.h,v 1.3 1999/12/09 22:31:52 hercules Exp $”;
    -#endif

-/* Macros for determining the byte-order of this platform */

-#ifndef _SDL_byteorder_h
-#define _SDL_byteorder_h

-/* The two types of endianness */
-#define SDL_LIL_ENDIAN 1234
-#define SDL_BIG_ENDIAN 4321

-/* Pardon the mess, I’m trying to determine the endianness of this host.

  • I’m doing it by preprocessor defines rather than some sort of configure
  • script so that application code can use this too. The “right” way would
  • be to dynamically generate this file on install, but that’s alot of work.
  • */
    -#if defined(i386) || defined(WIN32) || defined(alpha) || defined(arm)
    -#define SDL_BYTEORDER SDL_LIL_ENDIAN
    -#else
    -#define SDL_BYTEORDER SDL_BIG_ENDIAN
    -#endif

-#endif /* _SDL_byteorder_h /
diff -Nur SDL/include/SDL_byteorder.h.in SDL.changes/include/SDL_byteorder.h.in
— SDL/include/SDL_byteorder.h.in Thu Jan 1 01:00:00 1970
+++ SDL.changes/include/SDL_byteorder.h.in Wed Mar 15 10:10:31 2000
@@ -0,0 +1,43 @@
+/

  • SDL - Simple DirectMedia Layer
  • Copyright © 1997, 1998, 1999 Sam Lantinga
  • This library is free software; you can redistribute it and/or
  • modify it under the terms of the GNU Library General Public
  • License as published by the Free Software Foundation; either
  • version 2 of the License, or (at your option) any later version.
  • This library is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  • Library General Public License for more details.
  • You should have received a copy of the GNU Library General Public
  • License along with this library; if not, write to the Free
  • Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  • Sam Lantinga
  • slouken at devolution.com
    +*/

+#ifdef SAVE_RCSID
+static char rcsid =

  • “@(#) $Id: SDL_byteorder.h,v 1.3 1999/12/09 22:31:52 hercules Exp $”;
    +#endif

+/* Macros for determining the byte-order of this platform /
+
+#ifndef _SDL_byteorder_h
+#define _SDL_byteorder_h
+
+/
The two types of endianness /
+#define SDL_LIL_ENDIAN 1234
+#define SDL_BIG_ENDIAN 4321
+
+#if @SDL_CONF_BIGENDIAN@ /
<- this value is determined by configure /
+#define SDL_BYTEORDER SDL_LIL_ENDIAN
+#else
+#define SDL_BYTEORDER SDL_BIG_ENDIAN
+#endif
+
+#endif /
_SDL_byteorder_h */
diff -Nur SDL/include/SDL_syswm.h SDL.changes/include/SDL_syswm.h
— SDL/include/SDL_syswm.h Wed Mar 15 09:13:48 2000
+++ SDL.changes/include/SDL_syswm.h Wed Mar 15 10:15:54 2000
@@ -49,7 +49,8 @@
#else

/* This is the structure for custom window manager events */
-#if defined(unix) || defined(unix)
+#if defined(unix) || defined(unix) || defined(_AIX)

  • /* AIX is unix, of course, but the native compiler CSet doesn’t define unix */
    #include <X11/Xlib.h>
    #include <X11/Xatom.h>

The attached patch is supposed to do 2 things:

  • solve the little endian/big endian decision in configure by auto-generating
    the header file include/SDL_byteorder.h [as proposed in the comments ;-)]

Unfortunately, on many systems (like Win32) autoconf doesn’t work, so the
header can’t be generated. I’ll use the _AIX define… so are AIX machines
big or little endian?

Thanks!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Unfortunately, on many systems (like Win32) autoconf doesn’t work, so the
header can’t be generated. I’ll use the _AIX define… so are AIX machines
big or little endian?

I see … that’s unfortunate.

AIX for RS/6000 is big endian. It is probably safer to check
(defined(_AIX)&&defined(_POWER)).
A few others may be around.

Regards,
Carsten>

Thanks!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Unfortunately, on many systems (like Win32) autoconf doesn’t work, so the
header can’t be generated. I’ll use the _AIX define… so are AIX machines
big or little endian?

I see … that’s unfortunate.

AIX for RS/6000 is big endian. It is probably safer to check
(defined(_AIX)&&defined(_POWER)).
A few others may be around.

Looking at the header, SDL_LIL_ENDIAN is only defined if i386, WIN32,
alpha, or arm is defined. Otherwise the host is detected as
big endian, so the existing header should work fine.

What am I missing?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Looking at the header, SDL_LIL_ENDIAN is only defined if i386, WIN32,
alpha, or arm is defined. Otherwise the host is detected as
big endian, so the existing header should work fine.

What am I missing?

You don’t miss anything.

Either something is badly wrong with my eyes or it was with my
configuration during the weekend. I am convinced that I saw 'testver’
printing “little endian”. It doesn’t do that now.

Sorry about the confusion.

Regards,
Carsten>

-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Are you referring to cygwin? When I worked with cygwin about 3 months
ago, I had no problems with autoconf or automake. As a matter of fact I
installed their default distributions as autoconf doesn’t come with the
cygwin package. As for mingw, as far as I know it also works (it might
have to be modified). There was a little discussion about this on the
cygwin mailing list (http://sourceware.cygnus.com/cygwin).

MarcusOn Wed, 15 Mar 2000, Sam Lantinga wrote:

Unfortunately, on many systems (like Win32) autoconf doesn’t work, so the
header can’t be generated. I’ll use the _AIX define… so are AIX machines
big or little endian?

Thanks!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Are you referring to cygwin? When I worked with cygwin about 3 months
ago, I had no problems with autoconf or automake. As a matter of fact I
installed their default distributions as autoconf doesn’t come with the
cygwin package. As for mingw, as far as I know it also works (it might
have to be modified). There was a little discussion about this on the
cygwin mailing list (http://sourceware.cygnus.com/cygwin).

I was referring to VC++

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec