Major update to the autoconf script: cleanup and a nifty cpu detection code by Nach to optimize architecture properly with most cpus. OpenBSD guys, test this - I changed the frame pointer params along the way.
This commit is contained in:
@@ -92,7 +92,7 @@ PSR=parsegen
|
|||||||
@CXX@ @CFLAGS@ -o $@ $<
|
@CXX@ @CFLAGS@ -o $@ $<
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
@CC@ @CFLAGS@ -I. -o $@ -c $<
|
@CC@ @CFLAGS@ -o $@ -c $<
|
||||||
|
|
||||||
%.o: %.asm
|
%.o: %.asm
|
||||||
@NASMPATH@ @NFLAGS@ -o $@ $<
|
@NASMPATH@ @NFLAGS@ -o $@ $<
|
||||||
@@ -289,4 +289,4 @@ clean:
|
|||||||
rm -f *.o ${CHIPDIR}/*.o ${CPUDIR}/*.o ${DOSDIR}/*.o ${EFFECTSDIR}/*.o ${GUIDIR}/*.o ${JMADIR}/*.o ${NETDIR}/*.o ${TOOLSDIR}/*.o ${VIDEODIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o ${PSR} temppsr.c @ZSNESEXE@
|
rm -f *.o ${CHIPDIR}/*.o ${CPUDIR}/*.o ${DOSDIR}/*.o ${EFFECTSDIR}/*.o ${GUIDIR}/*.o ${JMADIR}/*.o ${NETDIR}/*.o ${TOOLSDIR}/*.o ${VIDEODIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o ${PSR} temppsr.c @ZSNESEXE@
|
||||||
|
|
||||||
distclean:
|
distclean:
|
||||||
rm -f *.o ${CHIPDIR}/*.o ${CPUDIR}/*.o ${DOSDIR}/*.o ${EFFECTSDIR}/*.o ${GUIDIR}/*.o ${JMADIR}/*.o ${NETDIR}/*.o ${TOOLSDIR}/*.o ${VIDEODIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o ${PSR} temppsr.c @ZSNESEXE@ Makefile config.cache config.log config.status config.h
|
rm -f *.o ${CHIPDIR}/*.o ${CPUDIR}/*.o ${DOSDIR}/*.o ${EFFECTSDIR}/*.o ${GUIDIR}/*.o ${JMADIR}/*.o ${NETDIR}/*.o ${TOOLSDIR}/*.o ${VIDEODIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o ${PSR} temppsr.c @ZSNESEXE@ Makefile aclocal.m4 configure config.cache config.log config.status config.h
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ AC_MSG_CHECKING(for zlib - version >= $min_zlib_version)
|
|||||||
tempLIBS="$LIBS"
|
tempLIBS="$LIBS"
|
||||||
tempCFLAGS="$CFLAGS"
|
tempCFLAGS="$CFLAGS"
|
||||||
if test x$zlib_prefix != x ; then
|
if test x$zlib_prefix != x ; then
|
||||||
ZLIB_LIBS="-L$zlib_prefix"
|
ZLIB_LIBS="-L$zlib_prefix"
|
||||||
ZLIB_CFLAGS="-I$zlib_prefix"
|
ZLIB_CFLAGS="-I$zlib_prefix"
|
||||||
fi
|
fi
|
||||||
ZLIB_LIBS="$ZLIB_LIBS -lz"
|
ZLIB_LIBS="$ZLIB_LIBS -lz"
|
||||||
LIBS="$LIBS $ZLIB_LIBS"
|
LIBS="$LIBS $ZLIB_LIBS"
|
||||||
@@ -31,72 +31,70 @@ AC_TRY_RUN([
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.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, zlib_major_version, zlib_minor_version, zlib_micro_version;
|
int major, minor, micro, zlib_major_version, zlib_minor_version, zlib_micro_version;
|
||||||
|
|
||||||
char *zlibver;
|
char *zlibver, *tmp_version;
|
||||||
char *tmp_version;
|
|
||||||
|
|
||||||
zlibver = ZLIB_VERSION;
|
zlibver = ZLIB_VERSION;
|
||||||
|
|
||||||
{ FILE *fp = fopen("conf.zlibtest", "a");
|
FILE *fp = fopen("conf.zlibtest", "a");
|
||||||
if ( fp ) {
|
if ( fp ) {
|
||||||
fprintf(fp, "%s", zlibver);
|
fprintf(fp, "%s", zlibver);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||||
tmp_version = my_strdup("$min_zlib_version");
|
tmp_version = my_strdup("$min_zlib_version");
|
||||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||||
printf("%s, bad version string for min_zlib_version.\n", "$min_zlib_version");
|
printf("%s, bad version string for\n\tmin_zlib_version... ", "$min_zlib_version");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (sscanf(zlibver, "%d.%d.%d", &zlib_major_version, &zlib_minor_version, &zlib_micro_version) != 3) {
|
if (sscanf(zlibver, "%d.%d.%d", &zlib_major_version, &zlib_minor_version, &zlib_micro_version) != 3) {
|
||||||
printf("%s, bad version string given by zlib, sometimes due to very old zlibs \n didnt correctly define their version. Please upgrade if you are running \n an old zlib.\n", "zlibver");
|
printf("%s, bad version string given\n", zlibver);
|
||||||
exit(1);
|
puts("\tby zlib, sometimes due to very old zlibs that didnt correctly");
|
||||||
}
|
printf("\tdefine their version. Please upgrade if you are running an\n\told zlib... ");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if ((zlib_major_version > major) ||
|
if ((zlib_major_version > major) ||
|
||||||
((zlib_major_version == major) && (zlib_minor_version > minor)) ||
|
((zlib_major_version == major) && (zlib_minor_version > minor)) ||
|
||||||
((zlib_major_version == major) && (zlib_minor_version == minor) && (zlib_micro_version >= micro)))
|
((zlib_major_version == major) && (zlib_minor_version == minor) && (zlib_micro_version >= micro)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],with_zlib=yes,,[AC_MSG_WARN(Cross Compiling, Assuming zlib is avalible)])
|
],with_zlib=yes,,[AC_MSG_WARN(Cross Compiling, Assuming zlib is avalible)])
|
||||||
|
|
||||||
if test x$with_zlib = xyes; then
|
if test x$with_zlib = xyes; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
ZLIB_VERSION=$(<conf.zlibtest)
|
ZLIB_VERSION=$(<conf.zlibtest)
|
||||||
ifelse([$2], , :, [$2])
|
ifelse([$2], , :, [$2])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
ZLIB_CFLAGS=""
|
ZLIB_CFLAGS=""
|
||||||
ZLIB_LIBS=""
|
ZLIB_LIBS=""
|
||||||
ZLIB_VERSION=""
|
ZLIB_VERSION=""
|
||||||
ifelse([$3], , :, [$3])
|
ifelse([$3], , :, [$3])
|
||||||
fi
|
fi
|
||||||
LIBS="$tempLIBS"
|
LIBS="$tempLIBS"
|
||||||
CFLAGS="$tempCFLAGS"
|
CFLAGS="$tempCFLAGS"
|
||||||
@@ -138,8 +136,8 @@ min_libpng_version=ifelse([$1], ,1.2.0,$1)
|
|||||||
tempLIBS="$LIBS"
|
tempLIBS="$LIBS"
|
||||||
tempCFLAGS="$CFLAGS"
|
tempCFLAGS="$CFLAGS"
|
||||||
if test x$libpng_prefix != x ; then
|
if test x$libpng_prefix != x ; then
|
||||||
LIBPNG_LIBS="-L$libpng_prefix"
|
LIBPNG_LIBS="-L$libpng_prefix"
|
||||||
LIBPNG_CFLAGS="-I$libpng_prefix"
|
LIBPNG_CFLAGS="-I$libpng_prefix"
|
||||||
fi
|
fi
|
||||||
LIBPNG_LIBS="$LIBPNG_LIBS -lpng -lm"
|
LIBPNG_LIBS="$LIBPNG_LIBS -lpng -lm"
|
||||||
LIBS="$LIBS $LIBPNG_LIBS"
|
LIBS="$LIBS $LIBPNG_LIBS"
|
||||||
@@ -152,90 +150,299 @@ dnl <--- disable for no user choice part #2
|
|||||||
if test x$enable_libpng != xno; then
|
if test x$enable_libpng != xno; then
|
||||||
dnl --->
|
dnl --->
|
||||||
|
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.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, libpng_major_version, libpng_minor_version, libpng_micro_version;
|
int major, minor, micro, libpng_major_version, libpng_minor_version, libpng_micro_version;
|
||||||
|
|
||||||
char *libpngver;
|
char *libpngver, *tmp_version;
|
||||||
char *tmp_version;
|
|
||||||
|
|
||||||
libpngver = PNG_LIBPNG_VER_STRING;
|
libpngver = PNG_LIBPNG_VER_STRING;
|
||||||
|
|
||||||
{ FILE *fp = fopen("conf.libpngtest", "a");
|
FILE *fp = fopen("conf.libpngtest", "a");
|
||||||
if ( fp ) {
|
if ( fp ) {
|
||||||
fprintf(fp, "%s", libpngver);
|
fprintf(fp, "%s", libpngver);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||||
tmp_version = my_strdup("$min_libpng_version");
|
tmp_version = my_strdup("$min_libpng_version");
|
||||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||||
printf("%s, bad version string for min_libpng_version.\n", "$min_libpng_version");
|
printf("%s, bad version string for\n\tmin_libpng_version... ", "$min_libpng_version");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (sscanf(libpngver, "%d.%d.%d", &libpng_major_version, &libpng_minor_version, &libpng_micro_version) != 3) {
|
if (sscanf(libpngver, "%d.%d.%d", &libpng_major_version, &libpng_minor_version, &libpng_micro_version) != 3) {
|
||||||
printf("%s, bad version string given by libpng, sometimes due to very old libpngs \n didnt correctly define their version. Please upgrade if you are running \n an old libpng.\n", "libpngver");
|
printf("%s, bad version string given\n", libpngver);
|
||||||
exit(1);
|
puts("\tby libpng, sometimes due to very old libpngs that didnt correctly");
|
||||||
}
|
printf("\tdefine their version. Please upgrade if you are running an\n\told libpng... ");
|
||||||
|
exit(1);
|
||||||
if ((libpng_major_version > major) ||
|
}
|
||||||
((libpng_major_version == major) && (libpng_minor_version > minor)) ||
|
if ((libpng_major_version > major) ||
|
||||||
((libpng_major_version == major) && (libpng_minor_version == minor) && (libpng_micro_version >= micro)))
|
((libpng_major_version == major) && (libpng_minor_version > minor)) ||
|
||||||
|
((libpng_major_version == major) && (libpng_minor_version == minor) && (libpng_micro_version >= micro)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],with_libpng=yes,,[AC_MSG_WARN(Cross Compiling, Assuming libpng is avalible)])
|
],with_libpng=yes,,[AC_MSG_WARN(Cross Compiling, Assuming libpng is avalible)])
|
||||||
|
|
||||||
if test x$with_libpng = xyes; then
|
if test x$with_libpng = xyes; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
LIBPNG_VERSION=$(<conf.libpngtest)
|
LIBPNG_VERSION=$(<conf.libpngtest)
|
||||||
ifelse([$2], , :, [$2])
|
ifelse([$2], , :, [$2])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
LIBPNG_CFLAGS=""
|
LIBPNG_CFLAGS=""
|
||||||
LIBPNG_LIBS=""
|
LIBPNG_LIBS=""
|
||||||
LIBPNG_VERSION=""
|
LIBPNG_VERSION=""
|
||||||
ifelse([$3], , :, [$3])
|
ifelse([$3], , :, [$3])
|
||||||
fi
|
fi
|
||||||
LIBS="$tempLIBS"
|
LIBS="$tempLIBS"
|
||||||
CFLAGS="$tempCFLAGS"
|
CFLAGS="$tempCFLAGS"
|
||||||
rm conf.libpngtest
|
rm conf.libpngtest
|
||||||
AC_SUBST(LIBPNG_CFLAGS)
|
AC_SUBST(LIBPNG_CFLAGS)
|
||||||
AC_SUBST(LIBPNG_VERSION)
|
AC_SUBST(LIBPNG_VERSION)
|
||||||
AC_SUBST(LIBPNG_LIBS)
|
AC_SUBST(LIBPNG_LIBS)
|
||||||
|
|
||||||
dnl <--- disable for no user choice part #3
|
dnl <--- disable for no user choice part #3
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(disabled by user)
|
AC_MSG_RESULT(disabled by user)
|
||||||
fi
|
fi
|
||||||
dnl --->
|
dnl --->
|
||||||
])
|
])
|
||||||
dnl -- End libpng autoconf macro
|
dnl -- End libpng autoconf macro
|
||||||
|
|
||||||
|
dnl ----
|
||||||
|
|
||||||
|
dnl -- Begin custom cpu detection autoconf macro
|
||||||
|
dnl Copyright (c) 2005 Nach, grinvader
|
||||||
|
dnl Under the GPL License
|
||||||
|
dnl When copying, include from Begin to End custom cpu detection autoconf macro,
|
||||||
|
dnl including those tags, so others can easily copy it too.
|
||||||
|
dnl
|
||||||
|
dnl AM_CPU_DETECT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||||
|
dnl Tests and reads the first entry in /proc/cpuinfo, outputs CPU_INFO
|
||||||
|
AC_DEFUN(AM_CPU_DETECT,
|
||||||
|
[
|
||||||
|
CPU_INFO=""
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for cpu info)
|
||||||
|
AC_ARG_ENABLE(cpucheck, [ --disable-cpucheck Do not try to autodetect cpu ],,enable_cpucheck=yes)
|
||||||
|
|
||||||
|
if test x$enable_cpucheck != xno; then
|
||||||
|
AC_TRY_RUN([
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char line[256], key[40], arg[216], *cpu = 0;
|
||||||
|
const char *pattern = " %39[^:]: %215[ -~]"; // for sscanf
|
||||||
|
|
||||||
|
char model_name[216], flags[216], cpu_family[216], vendor_id[216], model[216];
|
||||||
|
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
*model_name = 0;
|
||||||
|
*flags = 0;
|
||||||
|
*cpu_family = 0;
|
||||||
|
*vendor_id = 0;
|
||||||
|
*model = 0;
|
||||||
|
|
||||||
|
if ((fp = fopen("/proc/cpuinfo", "r")))
|
||||||
|
{
|
||||||
|
while (fgets(line, sizeof(line), fp) && sscanf(line, pattern, key, arg) == 2)
|
||||||
|
{
|
||||||
|
if (!strncmp(key, "model name", strlen("model name")) && !*model_name)
|
||||||
|
{ strcpy(model_name, arg); }
|
||||||
|
else if (!strncmp(key, "flags", strlen("flags")) && !*flags)
|
||||||
|
{ strcpy(flags, arg); }
|
||||||
|
else if (!strncmp(key, "cpu family", strlen("cpu family")) && !*cpu_family)
|
||||||
|
{ strcpy(cpu_family, arg); }
|
||||||
|
else if (!strncmp(key, "vendor_id", strlen("vendor_id")) && !*vendor_id)
|
||||||
|
{ strcpy(vendor_id, arg); }
|
||||||
|
else if (!strncmp(key, "model", strlen("model")) && !*model)
|
||||||
|
{ strcpy(model, arg); }
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD"))
|
||||||
|
{
|
||||||
|
if (strstr(flags, "mmx"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 2
|
||||||
|
if (strstr(flags, "3dnow"))
|
||||||
|
{
|
||||||
|
if (strstr(flags, "3dnowext"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 0
|
||||||
|
if (strstr(flags, "sse"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 3
|
||||||
|
if (strstr(flags, "sse2") && strstr(flags, "lm")) //Need two checks to protect Semprons
|
||||||
|
{
|
||||||
|
if (strstr(model_name, "Opteron")) { cpu = "opteron"; }
|
||||||
|
else { cpu = (strstr(model_name, "Athlon(tm) 64")) ? cpu = "athlon64" : "k8"; }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!cpu)
|
||||||
|
{
|
||||||
|
if (strstr(model_name, "Athlon(tm) 4")) { cpu = "athlon-4"; }
|
||||||
|
else { cpu = (strstr(model_name, "Athlon(tm) MP")) ? "athlon-mp" : "athlon-xp"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cpu && (atoi(model) > 3)) { cpu = "athlon-tbird"; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!cpu) { cpu = "athlon"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 0
|
||||||
|
if (!cpu)
|
||||||
|
{
|
||||||
|
int model_num = atoi(model);
|
||||||
|
cpu = ((model_num == 9) || (model_num >= 13)) ? "k6-3" : "k6-2";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!cpu && (atoi(cpu_family) > 5)) { cpu = "k6"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strcmp(vendor_id, "GenuineIntel") || strstr(model_name, "Intel"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 2
|
||||||
|
if (strstr(flags, "mmx"))
|
||||||
|
{
|
||||||
|
if (strstr(flags, "sse"))
|
||||||
|
{
|
||||||
|
if (strstr(flags, "sse2"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 2
|
||||||
|
if (strstr(flags, "pni"))
|
||||||
|
{
|
||||||
|
cpu = (strstr(flags, "lm")) ? "nocona" : "prescott";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!cpu)
|
||||||
|
{
|
||||||
|
if (strstr(model_name, "Pentium(R) M"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 3
|
||||||
|
cpu = "pentium-m";
|
||||||
|
#else
|
||||||
|
cpu = "pentium3";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 2
|
||||||
|
if (strstr(model_name, "Mobile")) { cpu = "pentium4m"; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!cpu) { cpu = "pentium4"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { cpu = "pentium3"; }
|
||||||
|
}
|
||||||
|
else { cpu = (!strcmp(cpu_family, "6")) ? "pentium2" : "pentium-mmx"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cpu)
|
||||||
|
{
|
||||||
|
int family = atoi(cpu_family);
|
||||||
|
if (family > 5) { cpu = "pentiumpro"; }
|
||||||
|
else if (family == 5) { cpu = "pentium"; }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#if __GNUC__ > 2
|
||||||
|
else if (strstr(model_name, "VIA"))
|
||||||
|
{
|
||||||
|
if (strstr(flags, "mmx"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 2
|
||||||
|
if (strstr(flags, "3dnow")) { cpu = "c3"; }
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 3
|
||||||
|
else if (strstr(flags, "sse")) { cpu = "c3-2"; }
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strstr(model_name, "WinChip"))
|
||||||
|
{
|
||||||
|
#if __GNUC__ > 3 || __GNUC_MINOR__ > 2
|
||||||
|
if (strstr(flags, "mmx"))
|
||||||
|
{
|
||||||
|
cpu = (strstr(flags, "3dnow")) ? "winchip2" : "winchip-c6";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!cpu)
|
||||||
|
{
|
||||||
|
int family = atoi(cpu_family);
|
||||||
|
if (family > 5) { cpu = "i686"; }
|
||||||
|
else if (family == 5) { cpu = "i586"; }
|
||||||
|
else if (family == 4) { cpu = "i486"; }
|
||||||
|
else { cpu = "i386"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((fp = fopen("conf.cpuchk", "a")))
|
||||||
|
{
|
||||||
|
fprintf(fp, "%s", (cpu) ? cpu : "");
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
],cpu_found=yes)
|
||||||
|
|
||||||
|
if test x$cpu_found = xyes; then
|
||||||
|
AC_MSG_RESULT(found)
|
||||||
|
CPU_INFO=$(<conf.cpuchk)
|
||||||
|
ifelse([$1], , :, [$1])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(not found)
|
||||||
|
ifelse([$2], , :, [$2])
|
||||||
|
fi
|
||||||
|
rm conf.cpuchk
|
||||||
|
AC_SUBST(CPU_INFO)
|
||||||
|
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(disabled by user)
|
||||||
|
fi
|
||||||
|
|
||||||
|
])
|
||||||
|
dnl -- End custom cpu detection autoconf macro
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ AC_INIT(init.asm)
|
|||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
ISODATE=`date +%Y-%m-%d`
|
ISODATE=`date +%Y-%m-%d`
|
||||||
AC_SUBST(ISODATE)
|
AC_SUBST(ISODATE)
|
||||||
VERSION=1.42
|
VERSION=pre1.43
|
||||||
AC_SUBST(VERSION)
|
AC_SUBST(VERSION)
|
||||||
X8664="false"
|
X8664="false"
|
||||||
AC_SUBST(X8664)
|
AC_SUBST(X8664)
|
||||||
AC_ARG_WITH(nasm-prefix,[ --with-nasm-prefix=PFX Prefix where nasm is installed (optional)], nasm_prefix="$withval", nasm_prefix="")
|
AC_ARG_WITH(nasm-prefix,[ --with-nasm-prefix=PFX Prefix where nasm is installed (optional)], nasm_prefix="$withval", nasm_prefix="")
|
||||||
|
|
||||||
dnl -- Where is our compiler, and who are we compiling for?
|
dnl -- Where is our compiler, and who are we compiling for?
|
||||||
CFLAGS="$CFLAGS -pipe -I. -Wall -I/usr/local/include -I/usr/include"
|
CFLAGS="$CFLAGS -pipe -I. -I/usr/local/include -I/usr/include"
|
||||||
|
|
||||||
dnl -- You might wanna change -I/usr/include if you're trying to do this with
|
dnl -- You might wanna change -I/usr/include if you're trying to do this with
|
||||||
dnl Mingw, because it doesnt have a standard file tree. Maybe if ming do this
|
dnl Mingw, because it doesnt have a standard file tree. Maybe if ming do this
|
||||||
@@ -26,38 +26,33 @@ AC_PROG_CC
|
|||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_CHECK_TOOL(NASMPATH,nasm,"no",$nasm_prefix:$PATH)
|
AC_CHECK_TOOL(NASMPATH,nasm,"no",$nasm_prefix:$PATH)
|
||||||
if test x$NASMPATH = xno; then
|
if test x$NASMPATH = xno; then
|
||||||
AC_MSG_ERROR(You need NASM installed to compile ZSNES)
|
AC_MSG_ERROR(You need NASM installed to compile ZSNES)
|
||||||
fi
|
fi
|
||||||
NFLAGS="$NFLAGS -w-orphan-labels"
|
NFLAGS="$NFLAGS -w-orphan-labels"
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
case "$target" in
|
case "$target" in
|
||||||
*-*-linux*)
|
*-*-linux*)
|
||||||
CFLAGS="$CFLAGS -D__UNIXSDL__"
|
CFLAGS="$CFLAGS -D__UNIXSDL__"
|
||||||
NFLAGS="$NFLAGS -D__UNIXSDL__ -f elf -DELF"
|
NFLAGS="$NFLAGS -D__UNIXSDL__ -f elf -DELF"
|
||||||
;;
|
;;
|
||||||
*-*-beos*)
|
*-*-beos*)
|
||||||
CFLAGS="$CFLAGS -D__UNIXSDL__ -D__BEOS__"
|
CFLAGS="$CFLAGS -D__UNIXSDL__ -D__BEOS__"
|
||||||
NFLAGS="$NFLAGS -D__UNIXSDL__ -D__BEOS__ -f elf -DELF"
|
NFLAGS="$NFLAGS -D__UNIXSDL__ -D__BEOS__ -f elf -DELF"
|
||||||
;;
|
;;
|
||||||
*-*-*openbsd*)
|
*-*-*bsd*)
|
||||||
CFLAGS="$CFLAGS -D__UNIXSDL__ -D__BSDSDL__"
|
CFLAGS="$CFLAGS -D__UNIXSDL__ -D__BSDSDL__"
|
||||||
NFLAGS="$NFLAGS -D__UNIXSDL__ -D__BSDSDL__ -DELF -f elf"
|
NFLAGS="$NFLAGS -D__UNIXSDL__ -D__BSDSDL__ -DELF -f elf"
|
||||||
;;
|
;;
|
||||||
*-*-*bsd*)
|
*-*-cygwin* | *-*-*ming*)
|
||||||
CFLAGS="$CFLAGS -D__UNIXSDL__ -D__BSDSDL__"
|
CFLAGS="$CFLAGS -D__UNIXSDL__"
|
||||||
NFLAGS="$NFLAGS -D__UNIXSDL__ -D__BSDSDL__ -DELF -f elf"
|
NFLAGS="$NFLAGS -D__UNIXSDL__ -f win32"
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-*ming*)
|
*)
|
||||||
CFLAGS="$CFLAGS -D__UNIXSDL__"
|
AC_MSG_ERROR(This target is not supported)
|
||||||
NFLAGS="$NFLAGS -D__UNIXSDL__ -f win32"
|
;;
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR(This Target is Not Supported)
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
|
||||||
dnl -- Where is libSDL and zlib, and do we want/have libPNG and OpenGL support?
|
dnl -- Where is libSDL and zlib, and do we want/have libPNG and OpenGL support?
|
||||||
|
|
||||||
AM_PATH_SDL(1.2.0,,[AC_MSG_ERROR(SDL >= 1.2.0 is required)])
|
AM_PATH_SDL(1.2.0,,[AC_MSG_ERROR(SDL >= 1.2.0 is required)])
|
||||||
@@ -69,92 +64,106 @@ CFLAGS="$CFLAGS $SDL_CFLAGS"
|
|||||||
LDFLAGS="$LDFLAGS $SDL_LIBS"
|
LDFLAGS="$LDFLAGS $SDL_LIBS"
|
||||||
|
|
||||||
if test x$with_libpng != xyes; then
|
if test x$with_libpng != xyes; then
|
||||||
CFLAGS="$CFLAGS -DNO_PNG"
|
CFLAGS="$CFLAGS -DNO_PNG"
|
||||||
NFLAGS="$NFLAGS -DNO_PNG"
|
NFLAGS="$NFLAGS -DNO_PNG"
|
||||||
else
|
else
|
||||||
CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
|
CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
|
||||||
LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
|
LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl -- opengl stuff
|
dnl -- opengl stuff
|
||||||
|
|
||||||
AC_ARG_ENABLE(opengl,[ --disable-opengl Build without opengl support],,enable_opengl=yes)
|
AC_ARG_ENABLE(opengl,[ --disable-opengl Build without opengl support],,enable_opengl=yes)
|
||||||
AC_ARG_WITH(opengl-prefix,[ --with-opengl-prefix=PFX Prefix where opengl is installed (optional)], opengl_prefix="$withval", opengl_prefix="")
|
AC_ARG_WITH(opengl-prefix,[ --with-opengl-prefix=PFX Prefix where opengl is installed (optional)], opengl_prefix="$withval", opengl_prefix="")
|
||||||
|
|
||||||
if test x$enable_opengl != xno; then
|
if test x$enable_opengl != xno; then
|
||||||
AC_PATH_X
|
AC_PATH_X
|
||||||
if test x$opengl_prefix != x; then
|
if test x$opengl_prefix != x; then
|
||||||
CFLAGS="$CFLAGS -I$opengl_prefix/include"
|
CFLAGS="$CFLAGS -I$opengl_prefix/include"
|
||||||
LDFLAGS-"$LDFLAGS -L$opengl_prefix/lib"
|
LDFLAGS-"$LDFLAGS -L$opengl_prefix/lib"
|
||||||
|
fi
|
||||||
|
if test x$x_libraries != x; then
|
||||||
|
LDFLAGS="$LDFLAGS -L$x_libraries"
|
||||||
|
fi
|
||||||
|
AC_CHECK_LIB(GL, glGetError,found_opengl="yes",,)
|
||||||
fi
|
fi
|
||||||
if test x$x_libraries != x; then
|
AC_MSG_CHECKING(for OpenGL)
|
||||||
LDFLAGS="$LDFLAGS -L$x_libraries"
|
if test x$enable_opengl != xno; then
|
||||||
fi
|
if test x$found_opengl = xyes; then
|
||||||
AC_CHECK_LIB(GL, glGetError,found_opengl="yes",,)
|
AC_MSG_RESULT(yes)
|
||||||
if test x$found_opengl = xyes; then
|
LDFLAGS="$LDFLAGS -lGL"
|
||||||
echo checking for OpenGL... yes
|
CFLAGS="$CFLAGS -D__OPENGL__"
|
||||||
LDFLAGS="$LDFLAGS -lGL"
|
NFLAGS="$NFLAGS -D__OPENGL__"
|
||||||
CFLAGS="$CFLAGS -D__OPENGL__"
|
GL_DRAW="\${WINDIR}/gl_draw.o"
|
||||||
NFLAGS="$NFLAGS -D__OPENGL__"
|
else
|
||||||
GL_DRAW="\${WINDIR}/gl_draw.o"
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo checking for OpenGL... no
|
AC_MSG_RESULT(disabled by user)
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo checking for OpenGL... disabled by user
|
|
||||||
fi
|
fi
|
||||||
dnl --
|
dnl --
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl -- Various debug and optimization option checks
|
dnl -- Various debug and optimization option checks
|
||||||
|
|
||||||
AC_ARG_ENABLE(debug, [ --enable-debug Build GDB Friendly binary (zsnesd) ],debug=yes)
|
AC_ARG_ENABLE(debug, [ --enable-debug Build GDB friendly binary (zsnesd) ],debug=$enableval)
|
||||||
AC_MSG_CHECKING(if you want gdb friendly executable)
|
AC_MSG_CHECKING(if you want gdb friendly executable)
|
||||||
|
|
||||||
if test x$debug = xyes; then
|
if test x$debug = xyes; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
|
|
||||||
dnl It is actually easier to debug zsnes with no optimization
|
dnl It is easier to debug zsnes with no optimization enabled.
|
||||||
dnl enabled.
|
CFLAGS="$CFLAGS -Wall -W -DDEBUG -O0 -fno-omit-frame-pointer -gstabs3"
|
||||||
|
NFLAGS="$NFLAGS -DDEBUG -g -F stabs -s -O0"
|
||||||
CFLAGS="$CFLAGS -DDEBUG -O0 -fomit-frame-pointer -ggdb3"
|
ZSNESEXE="zsnesd"
|
||||||
NFLAGS="$NFLAGS -DDEBUG -s -O0" dnl it works now
|
|
||||||
ZSNESEXE="zsnesd"
|
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
ZSNESEXE="zsnes"
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer -fexpensive-optimizations -s"
|
AC_ARG_ENABLE(release, [ --enable-release Build ultra-optimized binary (zsnes) ],release=$enableval)
|
||||||
NFLAGS="$NFLAGS -O1"
|
AC_MSG_CHECKING(if you want crazy optimizations)
|
||||||
ZSNESEXE="zsnes"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(which processor class to optimize for)
|
if test x$release = xyes; then
|
||||||
if test x$debug != xyes; then
|
AC_MSG_RESULT(yes)
|
||||||
case "$target" in
|
CFLAGS="$CFLAGS -O3 -pipe -fomit-frame-pointer -ffast-math -fno-exceptions -fprefetch-loop-arrays -fno-rtti -frename-registers -fforce-addr -s"
|
||||||
i486-*-*)
|
NFLAGS="$NFLAGS -O99999999"
|
||||||
CFLAGS="$CFLAGS -march=i486"
|
else
|
||||||
AC_MSG_RESULT(486)
|
AC_MSG_RESULT(no)
|
||||||
;;
|
CFLAGS="$CFLAGS -O2 -fomit-frame-pointer -s"
|
||||||
i586-*-*)
|
NFLAGS="$NFLAGS -O1"
|
||||||
CFLAGS="$CFLAGS -march=pentium"
|
fi
|
||||||
AC_MSG_RESULT(586)
|
|
||||||
;;
|
AM_CPU_DETECT()
|
||||||
i686-*-*)
|
|
||||||
CFLAGS="$CFLAGS -march=pentiumpro"
|
AC_MSG_CHECKING(which processor arch to optimize for)
|
||||||
dnl CFLAGS="$CFLAGS -march=pentium3 -mmmx -msse -mfpmath=sse,387"
|
if test x$CPU_INFO = x ; then
|
||||||
AC_MSG_RESULT(686)
|
case "$target" in
|
||||||
;;
|
x86_64-*-* | x86_64-*-*-*)
|
||||||
x86_64-*-* | x86_64-*-*-*)
|
AC_MSG_RESULT(guessing x86-64)
|
||||||
CFLAGS="$CFLAGS -march=k8"
|
CFLAGS="$CFLAGS -march=x86-64"
|
||||||
X8664="true"
|
X8664="true"
|
||||||
AC_MSG_RESULT(x86-64)
|
;;
|
||||||
;;
|
i686-*-*)
|
||||||
*)
|
AC_MSG_RESULT(guessing i686)
|
||||||
AC_MSG_RESULT(386)
|
CFLAGS="$CFLAGS -march=i686"
|
||||||
AC_MSG_WARN(*** This is probably not what you want use --target)
|
;;
|
||||||
;;
|
i586-*-*)
|
||||||
esac
|
AC_MSG_RESULT(guessing i586)
|
||||||
else
|
CFLAGS="$CFLAGS -march=i586"
|
||||||
AC_MSG_RESULT(no optimization because debug enabled)
|
;;
|
||||||
|
i486-*-*)
|
||||||
|
AC_MSG_RESULT(guessing i486)
|
||||||
|
CFLAGS="$CFLAGS -march=i486"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_MSG_RESULT(guessing i386)
|
||||||
|
CFLAGS="$CFLAGS -march=i386"
|
||||||
|
AC_MSG_WARN(*** This is probably not what you want *** use --target)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT($CPU_INFO)
|
||||||
|
CFLAGS="$CFLAGS -march=$CPU_INFO"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
@@ -171,22 +180,22 @@ echo
|
|||||||
echo
|
echo
|
||||||
echo ZSNES v$VERSION
|
echo ZSNES v$VERSION
|
||||||
echo
|
echo
|
||||||
echo "SDL support Version `$SDL_CONFIG --version`"
|
echo "SDL support Version `$SDL_CONFIG --version`"
|
||||||
echo "NASM support `nasm -r`"
|
echo "NASM support `nasm -v`"
|
||||||
echo "ZLib support Version $ZLIB_VERSION"
|
echo "ZLib support Version $ZLIB_VERSION"
|
||||||
if test "$with_libpng" = "yes"; then
|
if test "$with_libpng" = "yes"; then
|
||||||
echo "PNG support (png screenshots) Yes, version $LIBPNG_VERSION"
|
echo "PNG support Yes, version $LIBPNG_VERSION"
|
||||||
elif test "$enable_libpng" = "no"; then
|
elif test "$enable_libpng" = "no"; then
|
||||||
echo "PNG support Disabled by user"
|
echo "PNG support Disabled by user"
|
||||||
else
|
else
|
||||||
echo "PNG support Disabled, library not found"
|
echo "PNG support Disabled, library not found"
|
||||||
fi
|
fi
|
||||||
if test "$found_opengl" = "yes"; then
|
if test "$found_opengl" = "yes"; then
|
||||||
echo "OpenGL support Yes"
|
echo "OpenGL support Yes"
|
||||||
elif test "$enable_opengl" = "no"; then
|
elif test "$enable_opengl" = "no"; then
|
||||||
echo "OpenGL support Disabled by user"
|
echo "OpenGL support Disabled by user"
|
||||||
else
|
else
|
||||||
echo "OpenGL support Disabled, library not found"
|
echo "OpenGL support Disabled, library not found"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
echo The binary will be installed in $prefix/bin
|
echo The binary will be installed in $prefix/bin
|
||||||
|
|||||||
Reference in New Issue
Block a user