changeset 754:623b453a3219

Fixed "dist" make target for newer versions of automake
author Sam Lantinga <slouken@libsdl.org>
date Sun, 14 Dec 2003 06:25:53 +0000
parents b14fdadd8311
children b1595db396a7
files .cvsignore Makefile.am VisualC.zip configure.in install-sh missing mkinstalldirs src/main/Makefile.am src/main/arch.c src/main/dummy.c src/main/dummy/SDL_dummy_main.c src/main/linux/SDL_Qtopia_main.cc src/main/linux/SDL_main.c src/main/qtopia/SDL_qtopia_main.cc src/main/win32/SDL_main.c src/main/win32/SDL_win32_main.c src/thread/Makefile.am src/timer/Makefile.am src/timer/mint/SDL_systimer.c test/.cvsignore
diffstat 20 files changed, 445 insertions(+), 1124 deletions(-) [+]
line wrap: on
line diff
--- a/.cvsignore	Wed Dec 10 12:35:56 2003 +0000
+++ b/.cvsignore	Sun Dec 14 06:25:53 2003 +0000
@@ -3,7 +3,7 @@
 aclocal.m4
 config.log
 config.cache
-autom4te.cache
+autom4te*
 depcomp
 libtool
 config.status
--- a/Makefile.am	Wed Dec 10 12:35:56 2003 +0000
+++ b/Makefile.am	Sun Dec 14 06:25:53 2003 +0000
@@ -69,6 +69,7 @@
 exports:
 	(cd src/main/beos/exports; $(MAKE))
 	(cd src/main/macos/exports; $(MAKE))
+	(cd src/main/macosx/exports; $(MAKE))
 	(cd src/main/win32/exports; $(MAKE))
 
 # Rule to build the Project Builder archive in MacOS X
@@ -78,10 +79,6 @@
 	    tar zcvf $@ PBProjects; \
 	fi
 
-# Rule to force automake to rebuild the library
-changed:
-	@echo "This build target is no longer necessary"
-
 # Rule to install the libraries only - prevent rebuilding apps
 install-lib:
 	cd src && $(MAKE) install-libLTLIBRARIES
@@ -93,6 +90,7 @@
 # Grab the test programs for the distribution:
 dist-hook:
 	if test -f test/Makefile; then (cd test; make distclean); fi
+	rm -rf $(srcdir)/test/autom4te*
 	cp -rp $(srcdir)/test $(distdir)
 	rm -rf `find $(distdir) -type d -name CVS -print`
 
Binary file VisualC.zip has changed
--- a/configure.in	Wed Dec 10 12:35:56 2003 +0000
+++ b/configure.in	Sun Dec 14 06:25:53 2003 +0000
@@ -505,7 +505,7 @@
                   NASMFLAGS="-f aoutb"
                   ;;
               *)
-                  NASMFLAGS="-f elf -D __NOU__"
+                  NASMFLAGS="-f elf"
                   ;;
             esac
             AC_SUBST(NASMFLAGS)
@@ -1331,9 +1331,6 @@
     if test x$use_pthreads = xyes -o x$use_clone = xyes; then
         # Basic thread creation functions
         COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
-        if test x$use_clone = xyes; then
-            COPY_ARCH_SRC(src/thread, linux, clone.S)
-        fi
         COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
 
         # Semaphores
@@ -1757,11 +1754,8 @@
         CheckPTHREAD
         # Set up files for the main() stub
         if test "x$video_qtopia" = "xyes"; then
-          COPY_ARCH_SRC(src/main, linux, SDL_Qtopia_main.cc)
           SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
           SDL_LIBS="-lSDLmain $SDL_LIBS"
-        else
-          COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         fi
         # Set up files for the audio library
         # We use the OSS and ALSA API's, not the Sun audio API
@@ -1833,8 +1827,6 @@
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         # We use the OSS and ALSA API's, not the Sun audio API
         #if test x$enable_audio = xyes; then
@@ -1880,8 +1872,6 @@
         CheckOpenGL
         CheckPTHREAD
         CheckUSBHID
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         # We use the OSS and ALSA API's, not the Sun audio API
         #if test x$enable_audio = xyes; then
@@ -1918,8 +1908,6 @@
         CheckOpenGL
         CheckPTHREAD
         CheckUSBHID
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
@@ -1960,8 +1948,6 @@
         CheckOpenGL
         CheckPTHREAD
         CheckUSBHID
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
@@ -2002,8 +1988,6 @@
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
@@ -2045,8 +2029,6 @@
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
@@ -2085,8 +2067,6 @@
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # We use the dmedia audio API, not the Sun audio API
         #if test x$enable_audio = xyes; then
         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
@@ -2137,8 +2117,6 @@
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
@@ -2178,8 +2156,6 @@
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
@@ -2217,8 +2193,6 @@
         CheckOpenGL
         CheckPTHREAD
         SDL_LIBS="$SDL_LIBS -lrt"
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -I/usr/include/mme -DMMEAUDIO_SUPPORT"
@@ -2257,8 +2231,6 @@
         CheckX11
         CheckOpenGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             CFLAGS="$CFLAGS -DQNXNTOAUDIO_SUPPORT"
@@ -2302,8 +2274,6 @@
         CheckWIN32
         CheckDIRECTX
         CheckNASM
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, win32, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
@@ -2360,10 +2330,6 @@
         CheckNASM
         CheckBWINDOW
         CheckBeGL
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
-        COPY_ARCH_SRC(src/main, beos, SDL_BeApp.cc)
-        COPY_ARCH_SRC(src/main, beos, SDL_BeApp.h)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
@@ -2406,8 +2372,6 @@
         CheckDiskAudio
         CheckTOOLBOX
         CheckMacGL
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, macos, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
@@ -2452,9 +2416,6 @@
         CheckQUARTZ
         CheckMacGL
         CheckPTHREAD
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, macosx, SDLMain.m)
-        COPY_ARCH_SRC(src/main, macosx, SDLMain.h)
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
@@ -2498,8 +2459,6 @@
         CheckAtariAudio
         CheckAtariLdg
         CheckPTH
-        # Set up files for the main() stub
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
             if test x$enable_audio = xyes; then
@@ -2528,8 +2487,6 @@
                 COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
             else
                 COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
-                COPY_ARCH_SRC(src/timer, mint, SDL_vbltimer.S)
-                COPY_ARCH_SRC(src/timer, mint, SDL_vbltimer_s.h)
             fi
         fi
         # MiNT does not define "unix"
@@ -2540,7 +2497,6 @@
         JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS riscos"
         JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS riscos/libjoystick_riscos.la"
         COPY_ARCH_SRC(src/timer, riscos, SDL_systimer.c)
-        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         VIDEO_SUBDIRS="$VIDEO_SUBDIRS riscos"
         VIDEO_DRIVERS="$VIDEO_DRIVERS riscos/libvideo_riscos.la"
         AUDIO_SUBDIRS="$AUDIO_SUBDIRS riscos"
@@ -2648,7 +2604,6 @@
 CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
 CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
 CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
-CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
--- a/install-sh	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd="$cpprog"
-	    shift
-	    continue;;
-
-	-d) dir_arg=true
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd="$stripprog"
-	    shift
-	    continue;;
-
-	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-	    shift
-	    continue;;
-
-	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-	    shift
-	    continue;;
-
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		# this colon is to work around a 386BSD /bin/sh bug
-		:
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-	echo "install:	no input file specified"
-	exit 1
-else
-	true
-fi
-
-if [ x"$dir_arg" != x ]; then
-	dst=$src
-	src=""
-	
-	if [ -d $dst ]; then
-		instcmd=:
-		chmodcmd=""
-	else
-		instcmd=mkdir
-	fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad 
-# if $src (and thus $dsttmp) contains '*'.
-
-	if [ -f $src -o -d $src ]
-	then
-		true
-	else
-		echo "install:  $src does not exist"
-		exit 1
-	fi
-	
-	if [ x"$dst" = x ]
-	then
-		echo "install:	no destination specified"
-		exit 1
-	else
-		true
-	fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-	if [ -d $dst ]
-	then
-		dst="$dst"/`basename $src`
-	else
-		true
-	fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='	
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-	pathcomp="${pathcomp}${1}"
-	shift
-
-	if [ ! -d "${pathcomp}" ] ;
-        then
-		$mkdirprog "${pathcomp}"
-	else
-		true
-	fi
-
-	pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-	$doit $instcmd $dst &&
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-	if [ x"$transformarg" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		dstfile=`basename $dst $transformbasename | 
-			sed $transformarg`$transformbasename
-	fi
-
-# don't allow the sed command to completely eliminate the filename
-
-	if [ x"$dstfile" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		true
-	fi
-
-# Make a temp file name in the proper directory.
-
-	dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
-	$doit $instcmd $src $dsttmp &&
-
-	trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
-	$doit $rmcmd -f $dstdir/$dstfile &&
-	$doit $mvcmd $dsttmp $dstdir/$dstfile 
-
-fi &&
-
-
-exit 0
--- a/missing	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program 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 General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-case "$1" in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing 0.4 - GNU automake"
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-  aclocal*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case "$f" in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
-         system.  You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison|yacc)
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-	case "$LASTARG" in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if [ -f "$SRCFILE" ]; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if [ -f "$SRCFILE" ]; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if [ ! -f y.tab.h ]; then
-	echo >y.tab.h
-    fi
-    if [ ! -f y.tab.c ]; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex|flex)
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-	case "$LASTARG" in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if [ -f "$SRCFILE" ]; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if [ ! -f lex.yy.c ]; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit 1
-    fi
-    ;;
-
-  makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
-    fi
-    touch $file
-    ;;
-
-  tar)
-    shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case "$firstarg" in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case "$firstarg" in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
-         system.  You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequirements for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
--- a/mkinstalldirs	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain
-
-# $Id$
-
-errstatus=0
-
-for file
-do
-   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-   shift
-
-   pathcomp=
-   for d
-   do
-     pathcomp="$pathcomp$d"
-     case "$pathcomp" in
-       -* ) pathcomp=./$pathcomp ;;
-     esac
-
-     if test ! -d "$pathcomp"; then
-        echo "mkdir $pathcomp"
-
-        mkdir "$pathcomp" || lasterr=$?
-
-        if test ! -d "$pathcomp"; then
-  	  errstatus=$lasterr
-        fi
-     fi
-
-     pathcomp="$pathcomp/"
-   done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
--- a/src/main/Makefile.am	Wed Dec 10 12:35:56 2003 +0000
+++ b/src/main/Makefile.am	Sun Dec 14 06:25:53 2003 +0000
@@ -6,44 +6,40 @@
 
 ARCH_SUBDIRS = $(srcdir)/beos \
                $(srcdir)/epoc \
-               $(srcdir)/linux \
+               $(srcdir)/dummy \
                $(srcdir)/macos \
                $(srcdir)/macosx \
+               $(srcdir)/qtopia \
                $(srcdir)/win32
 
 # Build a separate library containing the main() entry point.
 lib_LIBRARIES = libSDLmain.a
 
+if TARGET_WIN32
+MAINLIB_ARCH_SRCS = win32/SDL_win32_main.c
+else
 if TARGET_MACOSX
-MAINLIB_ARCH_SRCS = SDLMain.m SDLMain.h
+MAINLIB_ARCH_SRCS = macosx/SDLMain.m macosx/SDLMain.h
 else
 if TARGET_QTOPIA
-MAINLIB_ARCH_SRCS = SDL_Qtopia_main.cc
+MAINLIB_ARCH_SRCS = qtopia/SDL_qtopia_main.cc
 else
-MAINLIB_ARCH_SRCS = SDL_main.c
-endif
-endif
+MAINLIB_ARCH_SRCS = dummy/SDL_dummy_main.c
+endif !TARGET_QTOPIA
+endif !TARGET_MACOSX
+endif !TARGET_WIN32
 libSDLmain_a_SOURCES = $(MAINLIB_ARCH_SRCS)
 
 # Build an internal library of any special app setup functions
 noinst_LTLIBRARIES = libarch.la
 
 if TARGET_BEOS
-ARCH_SRCS = SDL_BeApp.cc SDL_BeApp.h
+ARCH_SRCS = beos/SDL_BeApp.cc beos/SDL_BeApp.h
 else
-ARCH_SRCS = 
+ARCH_SRCS = arch.c
 endif
 
-# Include the architecture-independent sources
-COMMON_SRCS = dummy.c
-
-libarch_la_SOURCES = $(COMMON_SRCS) $(ARCH_SRCS)
-
-## Let automake know that it shouldn't distribute linked sources
-BUILT_SOURCES = $(MAINLIB_ARCH_SRCS) $(ARCH_SRCS)
-
-## Let automake know that it should remove these for distribution
-DISTCLEANFILES = $(MAINLIB_ARCH_SRCS) $(ARCH_SRCS)
+libarch_la_SOURCES = $(ARCH_SRCS)
 
 # The architecture specific directories need to be copied into place
 # when building a distribution.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/arch.c	Sun Dec 14 06:25:53 2003 +0000
@@ -0,0 +1,4 @@
+
+/* This is needed for automake, so that it can build an empty archive */
+
+int pointless_symbol_so_the_archive_doesnt_look_empty;
--- a/src/main/dummy.c	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-/* This is needed for automake, so that it can build an empty archive */
-
-int pointless_symbol_so_the_archive_doesnt_look_empty;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/dummy/SDL_dummy_main.c	Sun Dec 14 06:25:53 2003 +0000
@@ -0,0 +1,11 @@
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+#ifdef main
+#undef main
+#endif
+
+int main(int argc, char *argv[])
+{
+	return(SDL_main(argc, argv));
+}
--- a/src/main/linux/SDL_Qtopia_main.cc	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-
-/* Include the SDL main definition header */
-#include "SDL_main.h"
-#include <stdlib.h>
-#include <unistd.h>
-#ifdef main
-#undef main
-#endif
-#ifdef QWS
-#include <qpe/qpeapplication.h>
-#include <qapplication.h>
-#include <qpe/qpeapplication.h>
-#include <stdlib.h>
-
-// Workaround for OPIE to remove taskbar icon. Also fixes
-// some issues in Qtopia where there are left-over qcop files in /tmp/.
-// I'm guessing this will also clean up the taskbar in the Sharp version
-// of Qtopia.
-static inline void cleanupQCop() {
-  QString appname(qApp->argv()[0]);
-  int slash = appname.findRev("/");
-  if(slash != -1) {  appname = appname.mid(slash+1); }
-  QString cmd = QPEApplication::qpeDir() + "bin/qcop QPE/System 'closing(QString)' '"+appname+"'";
-  system(cmd.latin1());
-  cmd = "/tmp/qcop-msg-"+appname;
-  unlink(cmd.latin1());
-}
-
-static QPEApplication *app;
-#endif
-
-extern int SDL_main(int argc, char *argv[]);
-
-int main(int argc, char *argv[])
-{
-#ifdef QWS
-  // This initializes the Qtopia application. It needs to be done here
-  // because it parses command line options.
-  app = new QPEApplication(argc, argv);
-  QWidget dummy;
-  app->showMainWidget(&dummy);
-  atexit(cleanupQCop);
-#endif
-  // Exit here because if return is used, the application
-  // doesn't seem to quit correctly.
-  exit(SDL_main(argc, argv));
-}
--- a/src/main/linux/SDL_main.c	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-/* Include the SDL main definition header */
-#include "SDL_main.h"
-#ifdef main
-#undef main
-#endif
-
-extern int SDL_main(int argc, char *argv[]);
-
-int main(int argc, char *argv[])
-{
-	return(SDL_main(argc, argv));
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/qtopia/SDL_qtopia_main.cc	Sun Dec 14 06:25:53 2003 +0000
@@ -0,0 +1,47 @@
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef main
+#undef main
+#endif
+#ifdef QWS
+#include <qpe/qpeapplication.h>
+#include <qapplication.h>
+#include <qpe/qpeapplication.h>
+#include <stdlib.h>
+
+// Workaround for OPIE to remove taskbar icon. Also fixes
+// some issues in Qtopia where there are left-over qcop files in /tmp/.
+// I'm guessing this will also clean up the taskbar in the Sharp version
+// of Qtopia.
+static inline void cleanupQCop() {
+  QString appname(qApp->argv()[0]);
+  int slash = appname.findRev("/");
+  if(slash != -1) {  appname = appname.mid(slash+1); }
+  QString cmd = QPEApplication::qpeDir() + "bin/qcop QPE/System 'closing(QString)' '"+appname+"'";
+  system(cmd.latin1());
+  cmd = "/tmp/qcop-msg-"+appname;
+  unlink(cmd.latin1());
+}
+
+static QPEApplication *app;
+#endif
+
+extern int SDL_main(int argc, char *argv[]);
+
+int main(int argc, char *argv[])
+{
+#ifdef QWS
+  // This initializes the Qtopia application. It needs to be done here
+  // because it parses command line options.
+  app = new QPEApplication(argc, argv);
+  QWidget dummy;
+  app->showMainWidget(&dummy);
+  atexit(cleanupQCop);
+#endif
+  // Exit here because if return is used, the application
+  // doesn't seem to quit correctly.
+  exit(SDL_main(argc, argv));
+}
--- a/src/main/win32/SDL_main.c	Wed Dec 10 12:35:56 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,361 +0,0 @@
-/*
-    SDL_main.c, placed in the public domain by Sam Lantinga  4/13/98
-
-    The WinMain function -- calls your program's main() function
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#include <windows.h>
-#include <malloc.h>			/* For _alloca() */
-
-#ifdef _WIN32_WCE
-# define DIR_SEPERATOR TEXT("\\")
-# define _getcwd(str,len)	wcscpy(str,DIR_SEPERATOR);
-# define setbuf(x)
-# define setvbuf(x)
-# define fopen		_wfopen
-# define freopen	_wfreopen
-# define remove(x)	DeleteFile(x)
-# define strcat		wcscat
-#else
-# define DIR_SEPERATOR TEXT("/")
-# include <direct.h>
-#endif
-
-/* Include the SDL main definition header */
-#include "SDL.h"
-#include "SDL_main.h"
-
-#ifdef main
-# ifndef _WIN32_WCE_EMULATION
-#  undef main
-# endif /* _WIN32_WCE_EMULATION */
-#endif /* main */
-
-/* The standard output files */
-#define STDOUT_FILE	TEXT("stdout.txt")
-#define STDERR_FILE	TEXT("stderr.txt")
-
-#ifndef NO_STDIO_REDIRECT
-# ifdef _WIN32_WCE
-  static wchar_t stdoutPath[MAX_PATH];
-  static wchar_t stderrPath[MAX_PATH];
-# else
-  static char stdoutPath[MAX_PATH];
-  static char stderrPath[MAX_PATH];
-# endif
-#endif
-
-#if defined(_WIN32_WCE) && _WIN32_WCE < 300
-/* seems to be undefined in Win CE although in online help */
-#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
-
-/* seems to be undefined in Win CE although in online help */
-char *strrchr(char *str, int c)
-{
-	char *p;
-
-	/* Skip to the end of the string */
-	p=str;
-	while (*p)
-		p++;
-
-	/* Look for the given character */
-	while ( (p >= str) && (*p != (CHAR)c) )
-		p--;
-
-	/* Return NULL if character not found */
-	if ( p < str ) {
-		p = NULL;
-	}
-	return p;
-}
-#endif /* _WIN32_WCE < 300 */
-
-/* Parse a command line buffer into arguments */
-static int ParseCommandLine(char *cmdline, char **argv)
-{
-	char *bufp;
-	int argc;
-
-	argc = 0;
-	for ( bufp = cmdline; *bufp; ) {
-		/* Skip leading whitespace */
-		while ( isspace(*bufp) ) {
-			++bufp;
-		}
-		/* Skip over argument */
-		if ( *bufp == '"' ) {
-			++bufp;
-			if ( *bufp ) {
-				if ( argv ) {
-					argv[argc] = bufp;
-				}
-				++argc;
-			}
-			/* Skip over word */
-			while ( *bufp && (*bufp != '"') ) {
-				++bufp;
-			}
-		} else {
-			if ( *bufp ) {
-				if ( argv ) {
-					argv[argc] = bufp;
-				}
-				++argc;
-			}
-			/* Skip over word */
-			while ( *bufp && ! isspace(*bufp) ) {
-				++bufp;
-			}
-		}
-		if ( *bufp ) {
-			if ( argv ) {
-				*bufp = '\0';
-			}
-			++bufp;
-		}
-	}
-	if ( argv ) {
-		argv[argc] = NULL;
-	}
-	return(argc);
-}
-
-/* Show an error message */
-static void ShowError(const char *title, const char *message)
-{
-/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
-#ifdef USE_MESSAGEBOX
-	MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK);
-#else
-	fprintf(stderr, "%s: %s\n", title, message);
-#endif
-}
-
-/* Pop up an out of memory message, returns to Windows */
-static BOOL OutOfMemory(void)
-{
-	ShowError("Fatal Error", "Out of memory - aborting");
-	return FALSE;
-}
-
-/* Remove the output files if there was no output written */
-static void __cdecl cleanup_output(void)
-{
-#ifndef NO_STDIO_REDIRECT
-	FILE *file;
-	int empty;
-#endif
-
-	/* Flush the output in case anything is queued */
-	fclose(stdout);
-	fclose(stderr);
-
-#ifndef NO_STDIO_REDIRECT
-	/* See if the files have any output in them */
-	if ( stdoutPath[0] ) {
-		file = fopen(stdoutPath, TEXT("rb"));
-		if ( file ) {
-			empty = (fgetc(file) == EOF) ? 1 : 0;
-			fclose(file);
-			if ( empty ) {
-				remove(stdoutPath);
-			}
-		}
-	}
-	if ( stderrPath[0] ) {
-		file = fopen(stderrPath, TEXT("rb"));
-		if ( file ) {
-			empty = (fgetc(file) == EOF) ? 1 : 0;
-			fclose(file);
-			if ( empty ) {
-				remove(stderrPath);
-			}
-		}
-	}
-#endif
-}
-
-#if defined(_MSC_VER) && !defined(_WIN32_WCE)
-/* The VC++ compiler needs main defined */
-#define console_main main
-#endif
-
-/* This is where execution begins [console apps] */
-int console_main(int argc, char *argv[])
-{
-	int n;
-	char *bufp, *appname;
-
-	/* Get the class name from argv[0] */
-	appname = argv[0];
-	if ( (bufp=strrchr(argv[0], '\\')) != NULL ) {
-		appname = bufp+1;
-	} else
-	if ( (bufp=strrchr(argv[0], '/')) != NULL ) {
-		appname = bufp+1;
-	}
-
-	if ( (bufp=strrchr(appname, '.')) == NULL )
-		n = strlen(appname);
-	else
-		n = (bufp-appname);
-
-	bufp = (char *)alloca(n+1);
-	if ( bufp == NULL ) {
-		return OutOfMemory();
-	}
-	strncpy(bufp, appname, n);
-	bufp[n] = '\0';
-	appname = bufp;
-
-	/* Load SDL dynamic link library */
-	if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
-		ShowError("WinMain() error", SDL_GetError());
-		return(FALSE);
-	}
-	atexit(cleanup_output);
-	atexit(SDL_Quit);
-
-#ifndef DISABLE_VIDEO
-#if 0
-	/* Create and register our class *
-	   DJM: If we do this here, the user nevers gets a chance to
-	   putenv(SDL_WINDOWID).  This is already called later by
-	   the (DIB|DX5)_CreateWindow function, so it should be
-	   safe to comment it out here.
-	if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT, 
-	                     GetModuleHandle(NULL)) < 0 ) {
-		ShowError("WinMain() error", SDL_GetError());
-		exit(1);
-	}*/
-#else
-	/* Sam:
-	   We still need to pass in the application handle so that
-	   DirectInput will initialize properly when SDL_RegisterApp()
-	   is called later in the video initialization.
-	 */
-	SDL_SetModuleHandle(GetModuleHandle(NULL));
-#endif /* 0 */
-#endif /* !DISABLE_VIDEO */
-
-	/* Run the application main() code */
-	SDL_main(argc, argv);
-
-	/* Exit cleanly, calling atexit() functions */
-	exit(0);
-
-	/* Hush little compiler, don't you cry... */
-	return(0);
-}
-
-/* This is where execution begins [windowed apps] */
-#ifdef _WIN32_WCE
-int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
-#else
-int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
-#endif
-{
-	HINSTANCE handle;
-	char **argv;
-	int argc;
-	char *cmdline;
-#ifdef _WIN32_WCE
-	wchar_t *bufp;
-	int nLen;
-#else
-	char *bufp;
-#endif
-#ifndef NO_STDIO_REDIRECT
-	FILE *newfp;
-#endif
-
-	/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
-	   keep them open.  This is a hack.. hopefully it will be fixed 
-	   someday.  DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
-	 */
-	handle = LoadLibrary(TEXT("DDRAW.DLL"));
-	if ( handle != NULL ) {
-		FreeLibrary(handle);
-	}
-
-#ifndef NO_STDIO_REDIRECT
-	_getcwd( stdoutPath, sizeof( stdoutPath ) );
-	strcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE );
-    
-	/* Redirect standard input and standard output */
-	newfp = freopen(stdoutPath, TEXT("w"), stdout);
-
-#ifndef _WIN32_WCE
-	if ( newfp == NULL ) {	/* This happens on NT */
-#if !defined(stdout)
-		stdout = fopen(stdoutPath, TEXT("w"));
-#else
-		newfp = fopen(stdoutPath, TEXT("w"));
-		if ( newfp ) {
-			*stdout = *newfp;
-		}
-#endif
-	}
-#endif /* _WIN32_WCE */
-
-	_getcwd( stderrPath, sizeof( stderrPath ) );
-	strcat( stderrPath, DIR_SEPERATOR STDERR_FILE );
-
-	newfp = freopen(stderrPath, TEXT("w"), stderr);
-#ifndef _WIN32_WCE
-	if ( newfp == NULL ) {	/* This happens on NT */
-#if !defined(stderr)
-		stderr = fopen(stderrPath, TEXT("w"));
-#else
-		newfp = fopen(stderrPath, TEXT("w"));
-		if ( newfp ) {
-			*stderr = *newfp;
-		}
-#endif
-	}
-#endif /* _WIN32_WCE */
-
-	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);	/* Line buffered */
-	setbuf(stderr, NULL);			/* No buffering */
-#endif /* !NO_STDIO_REDIRECT */
-
-#ifdef _WIN32_WCE
-	nLen = wcslen(szCmdLine)+128+1;
-	bufp = (wchar_t *)alloca(nLen*2);
-	wcscpy (bufp, TEXT("\""));
-	GetModuleFileName(NULL, bufp+1, 128-3);
-	wcscpy (bufp+wcslen(bufp), TEXT("\" "));
-	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
-	nLen = wcslen(bufp)+1;
-	cmdline = (char *)alloca(nLen);
-	if ( cmdline == NULL ) {
-		return OutOfMemory();
-	}
-	WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
-#else
-	/* Grab the command line (use alloca() on Windows) */
-	bufp = GetCommandLine();
-	cmdline = (char *)alloca(strlen(bufp)+1);
-	if ( cmdline == NULL ) {
-		return OutOfMemory();
-	}
-	strcpy(cmdline, bufp);
-#endif
-
-	/* Parse it into argv and argc */
-	argc = ParseCommandLine(cmdline, NULL);
-	argv = (char **)alloca((argc+1)*(sizeof *argv));
-	if ( argv == NULL ) {
-		return OutOfMemory();
-	}
-	ParseCommandLine(cmdline, argv);
-
-	/* Run the main program (after a little SDL initialization) */
-	return(console_main(argc, argv));
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/win32/SDL_win32_main.c	Sun Dec 14 06:25:53 2003 +0000
@@ -0,0 +1,361 @@
+/*
+    SDL_main.c, placed in the public domain by Sam Lantinga  4/13/98
+
+    The WinMain function -- calls your program's main() function
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#include <windows.h>
+#include <malloc.h>			/* For _alloca() */
+
+#ifdef _WIN32_WCE
+# define DIR_SEPERATOR TEXT("\\")
+# define _getcwd(str,len)	wcscpy(str,DIR_SEPERATOR);
+# define setbuf(x)
+# define setvbuf(x)
+# define fopen		_wfopen
+# define freopen	_wfreopen
+# define remove(x)	DeleteFile(x)
+# define strcat		wcscat
+#else
+# define DIR_SEPERATOR TEXT("/")
+# include <direct.h>
+#endif
+
+/* Include the SDL main definition header */
+#include "SDL.h"
+#include "SDL_main.h"
+
+#ifdef main
+# ifndef _WIN32_WCE_EMULATION
+#  undef main
+# endif /* _WIN32_WCE_EMULATION */
+#endif /* main */
+
+/* The standard output files */
+#define STDOUT_FILE	TEXT("stdout.txt")
+#define STDERR_FILE	TEXT("stderr.txt")
+
+#ifndef NO_STDIO_REDIRECT
+# ifdef _WIN32_WCE
+  static wchar_t stdoutPath[MAX_PATH];
+  static wchar_t stderrPath[MAX_PATH];
+# else
+  static char stdoutPath[MAX_PATH];
+  static char stderrPath[MAX_PATH];
+# endif
+#endif
+
+#if defined(_WIN32_WCE) && _WIN32_WCE < 300
+/* seems to be undefined in Win CE although in online help */
+#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
+
+/* seems to be undefined in Win CE although in online help */
+char *strrchr(char *str, int c)
+{
+	char *p;
+
+	/* Skip to the end of the string */
+	p=str;
+	while (*p)
+		p++;
+
+	/* Look for the given character */
+	while ( (p >= str) && (*p != (CHAR)c) )
+		p--;
+
+	/* Return NULL if character not found */
+	if ( p < str ) {
+		p = NULL;
+	}
+	return p;
+}
+#endif /* _WIN32_WCE < 300 */
+
+/* Parse a command line buffer into arguments */
+static int ParseCommandLine(char *cmdline, char **argv)
+{
+	char *bufp;
+	int argc;
+
+	argc = 0;
+	for ( bufp = cmdline; *bufp; ) {
+		/* Skip leading whitespace */
+		while ( isspace(*bufp) ) {
+			++bufp;
+		}
+		/* Skip over argument */
+		if ( *bufp == '"' ) {
+			++bufp;
+			if ( *bufp ) {
+				if ( argv ) {
+					argv[argc] = bufp;
+				}
+				++argc;
+			}
+			/* Skip over word */
+			while ( *bufp && (*bufp != '"') ) {
+				++bufp;
+			}
+		} else {
+			if ( *bufp ) {
+				if ( argv ) {
+					argv[argc] = bufp;
+				}
+				++argc;
+			}
+			/* Skip over word */
+			while ( *bufp && ! isspace(*bufp) ) {
+				++bufp;
+			}
+		}
+		if ( *bufp ) {
+			if ( argv ) {
+				*bufp = '\0';
+			}
+			++bufp;
+		}
+	}
+	if ( argv ) {
+		argv[argc] = NULL;
+	}
+	return(argc);
+}
+
+/* Show an error message */
+static void ShowError(const char *title, const char *message)
+{
+/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
+#ifdef USE_MESSAGEBOX
+	MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK);
+#else
+	fprintf(stderr, "%s: %s\n", title, message);
+#endif
+}
+
+/* Pop up an out of memory message, returns to Windows */
+static BOOL OutOfMemory(void)
+{
+	ShowError("Fatal Error", "Out of memory - aborting");
+	return FALSE;
+}
+
+/* Remove the output files if there was no output written */
+static void __cdecl cleanup_output(void)
+{
+#ifndef NO_STDIO_REDIRECT
+	FILE *file;
+	int empty;
+#endif
+
+	/* Flush the output in case anything is queued */
+	fclose(stdout);
+	fclose(stderr);
+
+#ifndef NO_STDIO_REDIRECT
+	/* See if the files have any output in them */
+	if ( stdoutPath[0] ) {
+		file = fopen(stdoutPath, TEXT("rb"));
+		if ( file ) {
+			empty = (fgetc(file) == EOF) ? 1 : 0;
+			fclose(file);
+			if ( empty ) {
+				remove(stdoutPath);
+			}
+		}
+	}
+	if ( stderrPath[0] ) {
+		file = fopen(stderrPath, TEXT("rb"));
+		if ( file ) {
+			empty = (fgetc(file) == EOF) ? 1 : 0;
+			fclose(file);
+			if ( empty ) {
+				remove(stderrPath);
+			}
+		}
+	}
+#endif
+}
+
+#if defined(_MSC_VER) && !defined(_WIN32_WCE)
+/* The VC++ compiler needs main defined */
+#define console_main main
+#endif
+
+/* This is where execution begins [console apps] */
+int console_main(int argc, char *argv[])
+{
+	int n;
+	char *bufp, *appname;
+
+	/* Get the class name from argv[0] */
+	appname = argv[0];
+	if ( (bufp=strrchr(argv[0], '\\')) != NULL ) {
+		appname = bufp+1;
+	} else
+	if ( (bufp=strrchr(argv[0], '/')) != NULL ) {
+		appname = bufp+1;
+	}
+
+	if ( (bufp=strrchr(appname, '.')) == NULL )
+		n = strlen(appname);
+	else
+		n = (bufp-appname);
+
+	bufp = (char *)alloca(n+1);
+	if ( bufp == NULL ) {
+		return OutOfMemory();
+	}
+	strncpy(bufp, appname, n);
+	bufp[n] = '\0';
+	appname = bufp;
+
+	/* Load SDL dynamic link library */
+	if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
+		ShowError("WinMain() error", SDL_GetError());
+		return(FALSE);
+	}
+	atexit(cleanup_output);
+	atexit(SDL_Quit);
+
+#ifndef DISABLE_VIDEO
+#if 0
+	/* Create and register our class *
+	   DJM: If we do this here, the user nevers gets a chance to
+	   putenv(SDL_WINDOWID).  This is already called later by
+	   the (DIB|DX5)_CreateWindow function, so it should be
+	   safe to comment it out here.
+	if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT, 
+	                     GetModuleHandle(NULL)) < 0 ) {
+		ShowError("WinMain() error", SDL_GetError());
+		exit(1);
+	}*/
+#else
+	/* Sam:
+	   We still need to pass in the application handle so that
+	   DirectInput will initialize properly when SDL_RegisterApp()
+	   is called later in the video initialization.
+	 */
+	SDL_SetModuleHandle(GetModuleHandle(NULL));
+#endif /* 0 */
+#endif /* !DISABLE_VIDEO */
+
+	/* Run the application main() code */
+	SDL_main(argc, argv);
+
+	/* Exit cleanly, calling atexit() functions */
+	exit(0);
+
+	/* Hush little compiler, don't you cry... */
+	return(0);
+}
+
+/* This is where execution begins [windowed apps] */
+#ifdef _WIN32_WCE
+int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
+#else
+int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
+#endif
+{
+	HINSTANCE handle;
+	char **argv;
+	int argc;
+	char *cmdline;
+#ifdef _WIN32_WCE
+	wchar_t *bufp;
+	int nLen;
+#else
+	char *bufp;
+#endif
+#ifndef NO_STDIO_REDIRECT
+	FILE *newfp;
+#endif
+
+	/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
+	   keep them open.  This is a hack.. hopefully it will be fixed 
+	   someday.  DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
+	 */
+	handle = LoadLibrary(TEXT("DDRAW.DLL"));
+	if ( handle != NULL ) {
+		FreeLibrary(handle);
+	}
+
+#ifndef NO_STDIO_REDIRECT
+	_getcwd( stdoutPath, sizeof( stdoutPath ) );
+	strcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE );
+    
+	/* Redirect standard input and standard output */
+	newfp = freopen(stdoutPath, TEXT("w"), stdout);
+
+#ifndef _WIN32_WCE
+	if ( newfp == NULL ) {	/* This happens on NT */
+#if !defined(stdout)
+		stdout = fopen(stdoutPath, TEXT("w"));
+#else
+		newfp = fopen(stdoutPath, TEXT("w"));
+		if ( newfp ) {
+			*stdout = *newfp;
+		}
+#endif
+	}
+#endif /* _WIN32_WCE */
+
+	_getcwd( stderrPath, sizeof( stderrPath ) );
+	strcat( stderrPath, DIR_SEPERATOR STDERR_FILE );
+
+	newfp = freopen(stderrPath, TEXT("w"), stderr);
+#ifndef _WIN32_WCE
+	if ( newfp == NULL ) {	/* This happens on NT */
+#if !defined(stderr)
+		stderr = fopen(stderrPath, TEXT("w"));
+#else
+		newfp = fopen(stderrPath, TEXT("w"));
+		if ( newfp ) {
+			*stderr = *newfp;
+		}
+#endif
+	}
+#endif /* _WIN32_WCE */
+
+	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);	/* Line buffered */
+	setbuf(stderr, NULL);			/* No buffering */
+#endif /* !NO_STDIO_REDIRECT */
+
+#ifdef _WIN32_WCE
+	nLen = wcslen(szCmdLine)+128+1;
+	bufp = (wchar_t *)alloca(nLen*2);
+	wcscpy (bufp, TEXT("\""));
+	GetModuleFileName(NULL, bufp+1, 128-3);
+	wcscpy (bufp+wcslen(bufp), TEXT("\" "));
+	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
+	nLen = wcslen(bufp)+1;
+	cmdline = (char *)alloca(nLen);
+	if ( cmdline == NULL ) {
+		return OutOfMemory();
+	}
+	WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
+#else
+	/* Grab the command line (use alloca() on Windows) */
+	bufp = GetCommandLine();
+	cmdline = (char *)alloca(strlen(bufp)+1);
+	if ( cmdline == NULL ) {
+		return OutOfMemory();
+	}
+	strcpy(cmdline, bufp);
+#endif
+
+	/* Parse it into argv and argc */
+	argc = ParseCommandLine(cmdline, NULL);
+	argv = (char **)alloca((argc+1)*(sizeof *argv));
+	if ( argv == NULL ) {
+		return OutOfMemory();
+	}
+	ParseCommandLine(cmdline, argv);
+
+	/* Run the main program (after a little SDL initialization) */
+	return(console_main(argc, argv));
+}
--- a/src/thread/Makefile.am	Wed Dec 10 12:35:56 2003 +0000
+++ b/src/thread/Makefile.am	Sun Dec 14 06:25:53 2003 +0000
@@ -16,7 +16,7 @@
 
 # Older versions of Linux require an asm clone() implementation
 if USE_CLONE
-THREAD_ASM_SRC = clone.S
+THREAD_ASM_SRC = linux/clone.S
 else
 THREAD_ASM_SRC =
 endif
--- a/src/timer/Makefile.am	Wed Dec 10 12:35:56 2003 +0000
+++ b/src/timer/Makefile.am	Sun Dec 14 06:25:53 2003 +0000
@@ -18,7 +18,7 @@
 
 # Include the architecture-specific sources
 if TARGET_MINT
-ARCH_SRCS = SDL_systimer.c SDL_vbltimer.S SDL_vbltimer_s.h
+ARCH_SRCS = SDL_systimer.c mint/SDL_vbltimer.S mint/SDL_vbltimer_s.h
 else
 ARCH_SRCS = SDL_systimer.c
 endif
--- a/src/timer/mint/SDL_systimer.c	Wed Dec 10 12:35:56 2003 +0000
+++ b/src/timer/mint/SDL_systimer.c	Sun Dec 14 06:25:53 2003 +0000
@@ -47,7 +47,7 @@
 #include "SDL_timer_c.h"
 #include "SDL_thread.h"
 
-#include "SDL_vbltimer_s.h"
+#include "mint/SDL_vbltimer_s.h"
 
 /* The first ticks value of the application */
 static Uint32 start;
--- a/test/.cvsignore	Wed Dec 10 12:35:56 2003 +0000
+++ b/test/.cvsignore	Sun Dec 14 06:25:53 2003 +0000
@@ -4,6 +4,7 @@
 config.cache
 config.log
 config.status
+autom4te*
 aclocal.m4
 checkkeys
 graywin