diff -ur allegro-4.2.0-orig/aclocal.m4 allegro-4.2.0/aclocal.m4 --- allegro-4.2.0-orig/aclocal.m4 2005-06-12 02:52:12.000000000 -0500 +++ allegro-4.2.0/aclocal.m4 2005-07-23 23:18:35.649567000 -0500 @@ -757,10 +757,14 @@ AC_DEFUN(ALLEGRO_ACTEST_GCC_VERSION, [AC_MSG_CHECKING(whether -fomit-frame-pointer is safe) AC_CACHE_VAL(allegro_cv_support_fomit_frame_pointer, -[if test $GCC = yes && $CC --version | grep '3\.0\(\.\?[[012]]\)\?$' >/dev/null; then +[if test "$GCC" = yes && $CC --version | grep '3\.0\(\.\?[[012]]\)\?$' >/dev/null; then allegro_cv_support_fomit_frame_pointer=no else - allegro_cv_support_fomit_frame_pointer=yes + if test "$GCC" = yes; then + allegro_cv_support_fomit_frame_pointer=yes + else + allegro_cv_support_fomit_frame_pointer=no + fi fi ]) AC_MSG_RESULT($allegro_cv_support_fomit_frame_pointer)]) @@ -776,7 +780,7 @@ allegro_save_CFLAGS="$CFLAGS" CFLAGS="-Werror -I$prefix/include $CFLAGS" AC_CACHE_VAL(allegro_cv_support_include_prefix, -[if test $GCC = yes; then +[if test "$GCC" = yes; then AC_TRY_COMPILE(,int foo(){return 0;}, allegro_cv_support_include_prefix=yes, allegro_cv_support_include_prefix=no) else allegro_cv_support_include_prefix=yes @@ -794,7 +798,7 @@ AC_DEFUN(ALLEGRO_ACTEST_GCC_CXX, [AC_MSG_CHECKING(whether a C++ compiler is installed) AC_CACHE_VAL(allegro_cv_support_cplusplus, -[if test $GCC = yes; then +[if test "$GCC" = yes; then allegro_save_CFLAGS=$CFLAGS CFLAGS="-x c++" AC_TRY_COMPILE(,class foo {foo() {}};, allegro_cv_support_cplusplus=yes, allegro_cv_support_cplusplus=no) @@ -816,7 +820,7 @@ allegro_save_CFLAGS="$CFLAGS" CFLAGS="-mtune=i386" AC_CACHE_VAL(allegro_cv_support_i386_mtune, -[if test $GCC = yes; then +[if test "$GCC" = yes; then AC_TRY_COMPILE(,int foo(){return 0;}, allegro_cv_support_i386_mtune=yes, allegro_cv_support_i386_mtune=no) else allegro_cv_support_i386_mtune=no @@ -836,7 +840,7 @@ allegro_save_CFLAGS="$CFLAGS" CFLAGS="-mtune=k8" AC_CACHE_VAL(allegro_cv_support_amd64_mtune, -[if test $GCC = yes; then +[if test "$GCC" = yes; then AC_TRY_COMPILE(,int foo(){return 0;}, allegro_cv_support_amd64_mtune=yes, allegro_cv_support_amd64_mtune=no) else allegro_cv_support_amd64_mtune=no diff -ur allegro-4.2.0-orig/configure.in allegro-4.2.0/configure.in --- allegro-4.2.0-orig/configure.in 2005-06-12 02:53:19.000000000 -0500 +++ allegro-4.2.0/configure.in 2005-07-23 20:33:40.470081000 -0500 @@ -712,7 +712,7 @@ CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD" dnl How to compile C and asm files. -if test -n "GCC"; then +if test -n "$GCC"; then if test "X$allegro_strict_warnings" = "Xyes"; then WFLAGS="-Wall -W -Wstrict-prototypes -Wno-unused-parameter -Werror" else diff -ur allegro-4.2.0-orig/src/misc/icolconv.s allegro-4.2.0/src/misc/icolconv.s --- allegro-4.2.0-orig/src/misc/icolconv.s 2004-11-28 14:42:47.000000000 -0600 +++ allegro-4.2.0/src/misc/icolconv.s 2005-07-23 20:33:40.473029000 -0500 @@ -30,7 +30,7 @@ #if !defined(__GNUC__) || (__GNUC__ < 3) #define SLOTS_TO_BYTES(n) (n*4) #else -#define SLOTS_TO_BYTES(n) (((n*4+15)/16)*16) +#define SLOTS_TO_BYTES(n) (((n*4+15)>>4)*16) #endif diff -ur allegro-4.2.0-orig/src/unix/usystem.c allegro-4.2.0/src/unix/usystem.c --- allegro-4.2.0-orig/src/unix/usystem.c 2005-06-26 09:48:01.000000000 -0500 +++ allegro-4.2.0/src/unix/usystem.c 2005-07-23 23:09:10.714503000 -0500 @@ -365,35 +365,37 @@ #ifdef ALLEGRO_HAVE_SV_PROCFS sprintf (linkname, "/proc/%d/exe", pid); fd = open(linkname, O_RDONLY); - ioctl(fd, PIOCPSINFO, &psinfo); - close(fd); + if (!fd == -1) { + ioctl(fd, PIOCPSINFO, &psinfo); + close(fd); /* Use argv[0] directly if we can */ #ifdef ALLEGRO_HAVE_PROCFS_ARGCV - if (psinfo.pr_argv && psinfo.pr_argc) { - if (_find_executable_file(psinfo.pr_argv[0], output, size)) - return; - } - else { + if (psinfo.pr_argv && psinfo.pr_argc) { + if (_find_executable_file(psinfo.pr_argv[0], output, size)) + return; + } + else { #endif - /* Emulate it */ - /* We use the pr_psargs field to find argv[0] - * This is better than using the pr_fname field because we need the - * additional path information that may be present in argv[0] - */ + /* Emulate it */ + /* We use the pr_psargs field to find argv[0] + * This is better than using the pr_fname field because we need the + * additional path information that may be present in argv[0] + */ - /* Skip other args */ - s = strchr(psinfo.pr_psargs, ' '); - if (s) s[0] = '\0'; - if (_find_executable_file(psinfo.pr_psargs, output, size)) - return; + /* Skip other args */ + s = strchr(psinfo.pr_psargs, ' '); + if (s) s[0] = '\0'; + if (_find_executable_file(psinfo.pr_psargs, output, size)) + return; #ifdef ALLEGRO_HAVE_PROCFS_ARGCV - } + } #endif - /* Try the pr_fname just for completeness' sake if argv[0] fails */ - if (_find_executable_file(psinfo.pr_fname, output, size)) - return; + /* Try the pr_fname just for completeness' sake if argv[0] fails */ + if (_find_executable_file(psinfo.pr_fname, output, size)) + return; + } #endif /* Last resort: try using the output of the ps command to at least find */