sync with dosbox svn

This commit is contained in:
dborth 2009-12-14 07:10:18 +00:00
parent 5b8f46ee24
commit f23c2ea048
12 changed files with 443 additions and 435 deletions

View File

@ -1,396 +1,398 @@
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl dnl
AC_DEFUN([AM_PATH_SDL], AC_DEFUN([AM_PATH_SDL],
[dnl [dnl
dnl Get the cflags and libraries from the sdl-config script dnl Get the cflags and libraries from the sdl-config script
dnl dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="") sdl_prefix="$withval", sdl_prefix="")
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
sdl_exec_prefix="$withval", sdl_exec_prefix="") sdl_exec_prefix="$withval", sdl_exec_prefix="")
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
, enable_sdltest=yes) , enable_sdltest=yes)
if test x$sdl_exec_prefix != x ; then if test x$sdl_exec_prefix != x ; then
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
fi fi
fi fi
if test x$sdl_prefix != x ; then if test x$sdl_prefix != x ; then
sdl_args="$sdl_args --prefix=$sdl_prefix" sdl_args="$sdl_args --prefix=$sdl_prefix"
if test x${SDL_CONFIG+set} != xset ; then if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_prefix/bin/sdl-config SDL_CONFIG=$sdl_prefix/bin/sdl-config
fi fi
fi fi
AC_PATH_PROG(SDL_CONFIG, sdl-config, no) AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
min_sdl_version=ifelse([$1], ,0.11.0,$1) min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl="" no_sdl=""
if test "$SDL_CONFIG" = "no" ; then if test "$SDL_CONFIG" = "no" ; then
no_sdl=yes no_sdl=yes
else else
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS" ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS" CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS" LIBS="$LIBS $SDL_LIBS"
dnl dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent dnl checks the results of sdl-config to some extent
dnl dnl
rm -f conf.sdltest rm -f conf.sdltest
AC_TRY_RUN([ AC_TRY_RUN([
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "SDL.h" #include "SDL.h"
char* char*
my_strdup (char *str) my_strdup (char *str)
{ {
char *new_str; char *new_str;
if (str) if (str)
{ {
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str); strcpy (new_str, str);
} }
else else
new_str = NULL; new_str = NULL;
return new_str; return new_str;
} }
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int major, minor, micro; int major, minor, micro;
char *tmp_version; char *tmp_version;
/* This hangs on some systems (?) /* This hangs on some systems (?)
system ("touch conf.sdltest"); system ("touch conf.sdltest");
*/ */
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */ /* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version"); tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) { if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version"); printf("%s, bad version string\n", "$min_sdl_version");
exit(1); exit(1);
} }
if (($sdl_major_version > major) || if (($sdl_major_version > major) ||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{ {
return 0; return 0;
} }
else else
{ {
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n"); printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n"); printf("*** config.cache before re-running configure\n");
return 1; return 1;
} }
} }
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS" CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS" LIBS="$ac_save_LIBS"
fi fi
fi fi
if test "x$no_sdl" = x ; then if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2]) ifelse([$2], , :, [$2])
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found" echo "*** The sdl-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** your path, or set the SDL_CONFIG environment variable to the"
echo "*** full path to sdl-config." echo "*** full path to sdl-config."
else else
if test -f conf.sdltest ; then if test -f conf.sdltest ; then
: :
else else
echo "*** Could not run SDL test program, checking why..." echo "*** Could not run SDL test program, checking why..."
CFLAGS="$CFLAGS $SDL_CFLAGS" CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS" LIBS="$LIBS $SDL_LIBS"
AC_TRY_LINK([ AC_TRY_LINK([
#include <stdio.h> #include <stdio.h>
#include "SDL.h" #include "SDL.h"
], [ return 0; ], ], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means" [ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** that the run-time linker is not finding SDL or finding the wrong"
echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system" echo "*** is required on your system"
echo "***" echo "***"
echo "*** If you have an old version installed, it is best to remove it, although" echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the" [ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** exact error that occured. This usually means SDL was incorrectly installed"
echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** or that you have moved SDL since it was installed. In the latter case, you"
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS" CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS" LIBS="$ac_save_LIBS"
fi fi
fi fi
SDL_CFLAGS="" SDL_CFLAGS=""
SDL_LIBS="" SDL_LIBS=""
ifelse([$3], , :, [$3]) ifelse([$3], , :, [$3])
fi fi
AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS) AC_SUBST(SDL_LIBS)
rm -f conf.sdltest rm -f conf.sdltest
]) ])
dnl Configure Paths for Alsa dnl Configure Paths for Alsa
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org> dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
dnl Christopher Lansdown <lansdoct@cs.alfred.edu> dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
dnl Jaroslav Kysela <perex@suse.cz> dnl Jaroslav Kysela <perex@suse.cz>
dnl Last modification: alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp dnl Last modification: alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp
dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate. dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
dnl enables arguments --with-alsa-prefix= dnl enables arguments --with-alsa-prefix=
dnl --with-alsa-enc-prefix= dnl --with-alsa-enc-prefix=
dnl --disable-alsatest (this has no effect, as yet) dnl --disable-alsatest (this has no effect, as yet)
dnl dnl
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified, dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result. dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
dnl dnl
AC_DEFUN([AM_PATH_ALSA], AC_DEFUN([AM_PATH_ALSA],
[dnl Save the original CFLAGS, LDFLAGS, and LIBS [dnl Save the original CFLAGS, LDFLAGS, and LIBS
alsa_save_CFLAGS="$CFLAGS" alsa_save_CFLAGS="$CFLAGS"
alsa_save_LDFLAGS="$LDFLAGS" alsa_save_LDFLAGS="$LDFLAGS"
alsa_save_LIBS="$LIBS" alsa_save_LIBS="$LIBS"
alsa_found=yes alsa_found=yes
dnl dnl
dnl Get the cflags and libraries for alsa dnl Get the cflags and libraries for alsa
dnl dnl
AC_ARG_WITH(alsa-prefix, AC_ARG_WITH(alsa-prefix,
[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)], [ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
[alsa_prefix="$withval"], [alsa_prefix=""]) [alsa_prefix="$withval"], [alsa_prefix=""])
AC_ARG_WITH(alsa-inc-prefix, AC_ARG_WITH(alsa-inc-prefix,
[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)], [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
dnl FIXME: this is not yet implemented dnl FIXME: this is not yet implemented
AC_ARG_ENABLE(alsatest, AC_ARG_ENABLE(alsatest,
[ --disable-alsatest Do not try to compile and run a test Alsa program], [ --disable-alsatest Do not try to compile and run a test Alsa program],
[enable_alsatest=no], [enable_alsatest=no],
[enable_alsatest=yes]) [enable_alsatest=yes])
dnl Add any special include directories dnl Add any special include directories
AC_MSG_CHECKING(for ALSA CFLAGS) AC_MSG_CHECKING(for ALSA CFLAGS)
if test "$alsa_inc_prefix" != "" ; then if test "$alsa_inc_prefix" != "" ; then
ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
CFLAGS="$CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix"
fi fi
AC_MSG_RESULT($ALSA_CFLAGS) AC_MSG_RESULT($ALSA_CFLAGS)
dnl add any special lib dirs dnl add any special lib dirs
AC_MSG_CHECKING(for ALSA LDFLAGS) AC_MSG_CHECKING(for ALSA LDFLAGS)
if test "$alsa_prefix" != "" ; then if test "$alsa_prefix" != "" ; then
ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
LDFLAGS="$LDFLAGS $ALSA_LIBS" LDFLAGS="$LDFLAGS $ALSA_LIBS"
fi fi
dnl add the alsa library dnl add the alsa library
ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread" ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
LIBS=`echo $LIBS | sed 's/-lm//'` LIBS=`echo $LIBS | sed 's/-lm//'`
LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/-ldl//'`
LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/-lpthread//'`
LIBS=`echo $LIBS | sed 's/ //'` LIBS=`echo $LIBS | sed 's/ //'`
LIBS="$ALSA_LIBS $LIBS" LIBS="$ALSA_LIBS $LIBS"
AC_MSG_RESULT($ALSA_LIBS) AC_MSG_RESULT($ALSA_LIBS)
dnl Check for a working version of libasound that is of the right version. dnl Check for a working version of libasound that is of the right version.
min_alsa_version=ifelse([$1], ,0.1.1,$1) min_alsa_version=ifelse([$1], ,0.1.1,$1)
AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
no_alsa="" no_alsa=""
alsa_min_major_version=`echo $min_alsa_version | \ alsa_min_major_version=`echo $min_alsa_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
alsa_min_minor_version=`echo $min_alsa_version | \ alsa_min_minor_version=`echo $min_alsa_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
alsa_min_micro_version=`echo $min_alsa_version | \ alsa_min_micro_version=`echo $min_alsa_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_C AC_LANG_C
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
], [ ], [
/* ensure backward compatibility */ /* ensure backward compatibility */
#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
#endif #endif
#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
#endif #endif
#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
#endif #endif
# if(SND_LIB_MAJOR > $alsa_min_major_version) # if(SND_LIB_MAJOR > $alsa_min_major_version)
exit(0); exit(0);
# else # else
# if(SND_LIB_MAJOR < $alsa_min_major_version) # if(SND_LIB_MAJOR < $alsa_min_major_version)
# error not present # error not present
# endif # endif
# if(SND_LIB_MINOR > $alsa_min_minor_version) # if(SND_LIB_MINOR > $alsa_min_minor_version)
exit(0); exit(0);
# else # else
# if(SND_LIB_MINOR < $alsa_min_minor_version) # if(SND_LIB_MINOR < $alsa_min_minor_version)
# error not present # error not present
# endif # endif
# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) # if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
# error not present # error not present
# endif # endif
# endif # endif
# endif # endif
exit(0); exit(0);
], ],
[AC_MSG_RESULT(found.)], [AC_MSG_RESULT(found.)],
[AC_MSG_RESULT(not present.) [AC_MSG_RESULT(not present.)
ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)]) ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
alsa_found=no] alsa_found=no]
) )
AC_LANG_RESTORE AC_LANG_RESTORE
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
AC_CHECK_LIB([asound], [snd_ctl_open],, AC_CHECK_LIB([asound], [snd_ctl_open],,
[ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)]) [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
alsa_found=no] alsa_found=no]
) )
if test "x$alsa_found" = "xyes" ; then if test "x$alsa_found" = "xyes" ; then
ifelse([$2], , :, [$2]) ifelse([$2], , :, [$2])
LIBS=`echo $LIBS | sed 's/-lasound//g'` LIBS=`echo $LIBS | sed 's/-lasound//g'`
LIBS=`echo $LIBS | sed 's/ //'` LIBS=`echo $LIBS | sed 's/ //'`
LIBS="-lasound $LIBS" LIBS="-lasound $LIBS"
fi fi
if test "x$alsa_found" = "xno" ; then if test "x$alsa_found" = "xno" ; then
ifelse([$3], , :, [$3]) ifelse([$3], , :, [$3])
CFLAGS="$alsa_save_CFLAGS" CFLAGS="$alsa_save_CFLAGS"
LDFLAGS="$alsa_save_LDFLAGS" LDFLAGS="$alsa_save_LDFLAGS"
LIBS="$alsa_save_LIBS" LIBS="$alsa_save_LIBS"
ALSA_CFLAGS="" ALSA_CFLAGS=""
ALSA_LIBS="" ALSA_LIBS=""
fi fi
dnl That should be it. Now just export out symbols: dnl That should be it. Now just export out symbols:
AC_SUBST(ALSA_CFLAGS) AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS) AC_SUBST(ALSA_LIBS)
]) ])
AH_TOP([ AH_TOP([
/* /*
* Copyright (C) 2002-2009 The DOSBox Team * Copyright (C) 2002-2009 The DOSBox Team
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
]) ])
AH_BOTTOM([#if C_ATTRIBUTE_ALWAYS_INLINE AH_BOTTOM([#if C_ATTRIBUTE_ALWAYS_INLINE
#define INLINE inline __attribute__((always_inline)) #define INLINE inline __attribute__((always_inline))
#else #else
#define INLINE inline #define INLINE inline
#endif]) #endif])
AH_BOTTOM([#if C_ATTRIBUTE_FASTCALL AH_BOTTOM([#if C_ATTRIBUTE_FASTCALL
#define DB_FASTCALL __attribute__((fastcall)) #define DB_FASTCALL __attribute__((fastcall))
#else #else
#define DB_FASTCALL #define DB_FASTCALL
#endif]) #endif])
AH_BOTTOM([#if C_HAS_ATTRIBUTE AH_BOTTOM([#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) __attribute__ ((x)) #define GCC_ATTRIBUTE(x) __attribute__ ((x))
#else #else
#define GCC_ATTRIBUTE(x) /* attribute not supported */ #define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif]) #endif])
AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
#define GCC_UNLIKELY(x) __builtin_expect((x),0) #define GCC_UNLIKELY(x) __builtin_expect((x),0)
#else #define GCC_LIKELY(x) __builtin_expect((x),1)
#define GCC_UNLIKELY(x) (x) #else
#endif]) #define GCC_UNLIKELY(x) (x)
#define GCC_LIKELY(x) (x)
AH_BOTTOM([ #endif])
typedef double Real64;
AH_BOTTOM([
#if SIZEOF_UNSIGNED_CHAR != 1 typedef double Real64;
# error "sizeof (unsigned char) != 1"
#else #if SIZEOF_UNSIGNED_CHAR != 1
typedef unsigned char Bit8u; # error "sizeof (unsigned char) != 1"
typedef signed char Bit8s; #else
#endif typedef unsigned char Bit8u;
typedef signed char Bit8s;
#if SIZEOF_UNSIGNED_SHORT != 2 #endif
# error "sizeof (unsigned short) != 2"
#else #if SIZEOF_UNSIGNED_SHORT != 2
typedef unsigned short Bit16u; # error "sizeof (unsigned short) != 2"
typedef signed short Bit16s; #else
#endif typedef unsigned short Bit16u;
typedef signed short Bit16s;
#if SIZEOF_UNSIGNED_INT == 4 #endif
typedef unsigned int Bit32u;
typedef signed int Bit32s; #if SIZEOF_UNSIGNED_INT == 4
#elif SIZEOF_UNSIGNED_LONG == 4 typedef unsigned int Bit32u;
typedef unsigned long Bit32u; typedef signed int Bit32s;
typedef signed long Bit32s; #elif SIZEOF_UNSIGNED_LONG == 4
#else typedef unsigned long Bit32u;
# error "can't find sizeof(type) of 4 bytes!" typedef signed long Bit32s;
#endif #else
# error "can't find sizeof(type) of 4 bytes!"
#if SIZEOF_UNSIGNED_LONG == 8 #endif
typedef unsigned long Bit64u;
typedef signed long Bit64s; #if SIZEOF_UNSIGNED_LONG == 8
#elif SIZEOF_UNSIGNED_LONG_LONG == 8 typedef unsigned long Bit64u;
typedef unsigned long long Bit64u; typedef signed long Bit64s;
typedef signed long long Bit64s; #elif SIZEOF_UNSIGNED_LONG_LONG == 8
#else typedef unsigned long long Bit64u;
# error "can't find data type of 8 bytes" typedef signed long long Bit64s;
#endif #else
# error "can't find data type of 8 bytes"
#if SIZEOF_INT_P == 4 #endif
typedef Bit32u Bitu;
typedef Bit32s Bits; #if SIZEOF_INT_P == 4
#else typedef Bit32u Bitu;
typedef Bit64u Bitu; typedef Bit32s Bits;
typedef Bit64s Bits; #else
#endif typedef Bit64u Bitu;
typedef Bit64s Bits;
]) #endif
])

View File

@ -44,7 +44,7 @@ class DOS_Shell;
class BatchFile { class BatchFile {
public: public:
BatchFile(DOS_Shell * host,char const* const name, char const * const cmd_line); BatchFile(DOS_Shell * host,char const* const resolved_name,char const* const entered_name, char const * const cmd_line);
virtual ~BatchFile(); virtual ~BatchFile();
virtual bool ReadLine(char * line); virtual bool ReadLine(char * line);
bool Goto(char * where); bool Goto(char * where);

View File

@ -53,7 +53,7 @@ CPUBlock cpu;
Segments Segs; Segments Segs;
Bit32s CPU_Cycles = 0; Bit32s CPU_Cycles = 0;
Bit32s CPU_CycleLeft = 0; Bit32s CPU_CycleLeft = 3000;
Bit32s CPU_CycleMax = 3000; Bit32s CPU_CycleMax = 3000;
Bit32s CPU_OldCycleMax = 3000; Bit32s CPU_OldCycleMax = 3000;
Bit32s CPU_CyclePercUsed = 100; Bit32s CPU_CyclePercUsed = 100;
@ -2226,7 +2226,7 @@ public:
bool Change_Config(Section* newconfig){ bool Change_Config(Section* newconfig){
Section_prop * section=static_cast<Section_prop *>(newconfig); Section_prop * section=static_cast<Section_prop *>(newconfig);
CPU_AutoDetermineMode=CPU_AUTODETERMINE_NONE; CPU_AutoDetermineMode=CPU_AUTODETERMINE_NONE;
CPU_CycleLeft=0;//needed ? //CPU_CycleLeft=0;//needed ?
CPU_Cycles=0; CPU_Cycles=0;
CPU_SkipCycleAutoAdjust=false; CPU_SkipCycleAutoAdjust=false;

View File

@ -816,7 +816,11 @@ static Bitu DOS_21Handler(void) {
break; break;
case 0x59: /* Get Extended error information */ case 0x59: /* Get Extended error information */
reg_ax=dos.errorcode; reg_ax=dos.errorcode;
reg_bh=0; //Unkown error class if (dos.errorcode==DOSERR_FILE_NOT_FOUND || dos.errorcode==DOSERR_PATH_NOT_FOUND) {
reg_bh=8; //Not Found error class (Road Hog)
} else {
reg_bh=0; //Unspecified error class
}
reg_bl=1; //Retry retry retry reg_bl=1; //Retry retry retry
reg_ch=0; //Unkown error locus reg_ch=0; //Unkown error locus
break; break;

View File

@ -68,7 +68,8 @@ static void cmos_checktimer(void) {
LOG(LOG_PIT,LOG_NORMAL)("RTC Timer at %.2f hz",1000.0/cmos.timer.delay); LOG(LOG_PIT,LOG_NORMAL)("RTC Timer at %.2f hz",1000.0/cmos.timer.delay);
// PIC_AddEvent(cmos_timerevent,cmos.timer.delay); // PIC_AddEvent(cmos_timerevent,cmos.timer.delay);
/* A rtc is always running */ /* A rtc is always running */
PIC_AddEvent(cmos_timerevent,(double)cmos.timer.delay-fmod(PIC_FullIndex(),(double)cmos.timer.delay)); //Should be more like a real pc. Check double remd=fmod(PIC_FullIndex(),(double)cmos.timer.delay);
PIC_AddEvent(cmos_timerevent,(float)((double)cmos.timer.delay-remd)); //Should be more like a real pc. Check
// status reg A reading with this (and with other delays actually) // status reg A reading with this (and with other delays actually)
} }

View File

@ -401,9 +401,9 @@ Bits Operator::TemplateVolume( ) {
break; break;
case DECAY: case DECAY:
vol += RateForward( decayAdd ); vol += RateForward( decayAdd );
if ( vol >= sustainLevel ) { if ( GCC_UNLIKELY(vol >= sustainLevel) ) {
//Check if we didn't overshoot max attenuation, then just go off //Check if we didn't overshoot max attenuation, then just go off
if ( vol >= ENV_MAX ) { if ( GCC_UNLIKELY(vol >= ENV_MAX) ) {
volume = ENV_MAX; volume = ENV_MAX;
SetState( OFF ); SetState( OFF );
return ENV_MAX; return ENV_MAX;
@ -420,7 +420,7 @@ Bits Operator::TemplateVolume( ) {
//In sustain phase, but not sustaining, do regular release //In sustain phase, but not sustaining, do regular release
case RELEASE: case RELEASE:
vol += RateForward( releaseAdd );; vol += RateForward( releaseAdd );;
if ( vol >= ENV_MAX ) { if ( GCC_UNLIKELY(vol >= ENV_MAX) ) {
volume = ENV_MAX; volume = ENV_MAX;
SetState( OFF ); SetState( OFF );
return ENV_MAX; return ENV_MAX;
@ -1260,7 +1260,7 @@ void Chip::Setup( Bit32u rate ) {
count += guessAdd; count += guessAdd;
Bit32s change = count >> RATE_SH; Bit32s change = count >> RATE_SH;
count &= RATE_MASK; count &= RATE_MASK;
if ( change ) { if ( GCC_UNLIKELY(change) ) { // less than 1 %
volume += ( ~volume * change ) >> 3; volume += ( ~volume * change ) >> 3;
} }
samples++; samples++;
@ -1496,7 +1496,7 @@ void Handler::WriteReg( Bit32u addr, Bit8u val ) {
void Handler::Generate( MixerChannel* chan, Bitu samples ) { void Handler::Generate( MixerChannel* chan, Bitu samples ) {
Bit32s buffer[ 512 * 2 ]; Bit32s buffer[ 512 * 2 ];
if ( samples > 512 ) if ( GCC_UNLIKELY(samples > 512) )
samples = 512; samples = 512;
if ( !chip.opl3Active ) { if ( !chip.opl3Active ) {
chip.GenerateBlock2( samples, buffer ); chip.GenerateBlock2( samples, buffer );

View File

@ -65,7 +65,7 @@ static const fltype frqmul_tab[16] = {
0.5,1,2,3,4,5,6,7,8,9,10,10,12,12,15,15 0.5,1,2,3,4,5,6,7,8,9,10,10,12,12,15,15
}; };
// calculated frequency multiplication values (depend on sampling rate) // calculated frequency multiplication values (depend on sampling rate)
static float frqmul[16]; static fltype frqmul[16];
// key scale levels // key scale levels
static Bit8u kslev[8][16]; static Bit8u kslev[8][16];

View File

@ -357,9 +357,10 @@ void FinishSetMode_ET4K(Bitu crtc_base, VGA_ModeExtraData* modeData) {
Bitu best = 1; Bitu best = 1;
Bits dist = 100000000; Bits dist = 100000000;
for (Bitu i=0; i<16; i++) { for (Bitu i=0; i<16; i++) {
if (abs(target-et4k.clockFreq[i]) < dist) { Bits cdiff=abs((Bits)(target-et4k.clockFreq[i]));
if (cdiff < dist) {
best = i; best = i;
dist = abs(target-et4k.clockFreq[i]); dist = cdiff;
} }
} }
set_clock_index_et4k(best); set_clock_index_et4k(best);
@ -718,9 +719,10 @@ void FinishSetMode_ET3K(Bitu crtc_base, VGA_ModeExtraData* modeData) {
Bitu best = 1; Bitu best = 1;
Bits dist = 100000000; Bits dist = 100000000;
for (Bitu i=0; i<8; i++) { for (Bitu i=0; i<8; i++) {
if (abs(target-et3k.clockFreq[i]) < dist) { Bits cdiff = abs((Bits)(target-et3k.clockFreq[i]));
if (cdiff < dist) {
best = i; best = i;
dist = abs(target-et3k.clockFreq[i]); dist = cdiff;
} }
} }
set_clock_index_et3k(best); set_clock_index_et3k(best);

View File

@ -286,6 +286,8 @@ void DOS_Shell::Run(void) {
std::string line; std::string line;
if (cmd->FindStringRemain("/C",line)) { if (cmd->FindStringRemain("/C",line)) {
strcpy(input_line,line.c_str()); strcpy(input_line,line.c_str());
char* sep = strpbrk(input_line,"\r\n"); //GTA installer
if (sep) *sep = 0;
DOS_Shell temp; DOS_Shell temp;
temp.echo = echo; temp.echo = echo;
temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal; temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal;

View File

@ -24,14 +24,14 @@
#include "shell.h" #include "shell.h"
#include "support.h" #include "support.h"
BatchFile::BatchFile(DOS_Shell * host,char const * const name, char const * const cmd_line) { BatchFile::BatchFile(DOS_Shell * host,char const * const resolved_name,char const * const entered_name, char const * const cmd_line) {
location = 0; location = 0;
prev=host->bf; prev=host->bf;
echo=host->echo; echo=host->echo;
shell=host; shell=host;
char totalname[DOS_PATHLENGTH+4]; char totalname[DOS_PATHLENGTH+4];
DOS_Canonicalize(name,totalname); // Get fullname including drive specificiation DOS_Canonicalize(resolved_name,totalname); // Get fullname including drive specificiation
cmd = new CommandLine(totalname,cmd_line); cmd = new CommandLine(entered_name,cmd_line);
filename = totalname; filename = totalname;
//Test if file is openable //Test if file is openable

View File

@ -473,27 +473,26 @@ void DOS_Shell::CMD_DIR(char * args) {
/* Skip non-directories if option AD is present */ /* Skip non-directories if option AD is present */
if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue; if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue;
char * ext = empty_string;
if (!optW && (name[0] != '.')) {
ext = strrchr(name, '.');
if (!ext) ext = empty_string;
else *ext++ = 0;
}
Bit8u day = (Bit8u)(date & 0x001f);
Bit8u month = (Bit8u)((date >> 5) & 0x000f);
Bit16u year = (Bit16u)((date >> 9) + 1980);
Bit8u hour = (Bit8u)((time >> 5 ) >> 6);
Bit8u minute = (Bit8u)((time >> 5) & 0x003f);
/* output the file */ /* output the file */
if (optB) { if (optB) {
// this overrides pretty much everything // this overrides pretty much everything
if (strcmp(".",name) && strcmp("..",name)) { if (strcmp(".",name) && strcmp("..",name)) {
if ((attr & DOS_ATTR_DIRECTORY)||(strlen(ext)==0)) WriteOut("%s\n",name); WriteOut("%s\n",name);
else WriteOut("%s.%s\n",name,ext);
} }
} else { } else {
char * ext = empty_string;
if (!optW && (name[0] != '.')) {
ext = strrchr(name, '.');
if (!ext) ext = empty_string;
else *ext++ = 0;
}
Bit8u day = (Bit8u)(date & 0x001f);
Bit8u month = (Bit8u)((date >> 5) & 0x000f);
Bit16u year = (Bit16u)((date >> 9) + 1980);
Bit8u hour = (Bit8u)((time >> 5 ) >> 6);
Bit8u minute = (Bit8u)((time >> 5) & 0x003f);
if (attr & DOS_ATTR_DIRECTORY) { if (attr & DOS_ATTR_DIRECTORY) {
if (optW) { if (optW) {
WriteOut("[%s]",name); WriteOut("[%s]",name);
@ -518,11 +517,9 @@ void DOS_Shell::CMD_DIR(char * args) {
if (optW) { if (optW) {
w_count++; w_count++;
} }
if (optP) { }
if (!(++p_count%(22*w_size))) { if (optP && !(++p_count%(22*w_size))) {
CMD_PAUSE(empty_string); CMD_PAUSE(empty_string);
}
}
} }
} while ( (ret=DOS_FindNext()) ); } while ( (ret=DOS_FindNext()) );
if (optW) { if (optW) {

View File

@ -431,7 +431,7 @@ bool DOS_Shell::Execute(char * name,char * args) {
/* delete old batch file if call is not active*/ /* delete old batch file if call is not active*/
bool temp_echo=echo; /*keep the current echostate (as delete bf might change it )*/ bool temp_echo=echo; /*keep the current echostate (as delete bf might change it )*/
if(bf && !call) delete bf; if(bf && !call) delete bf;
bf=new BatchFile(this,fullname,line); bf=new BatchFile(this,fullname,name,line);
echo=temp_echo; //restore it. echo=temp_echo; //restore it.
} }
else else