Show
Ignore:
Timestamp:
06/10/07 11:56:57 (2 years ago)
Author:
takkaria
Message:
  • Clean up autoconf support more:
    • we never make use of info on what system we're built on, so remove config.sub and config.guess
    • stop checking for things we never use, or we use irrespectively of whether they're detected or not
    • use better SDL checking code
    • fix SOURCE line in src/Makefile so dependencies are generated once again
  • Move signals code to signals.c, and permissions grabbing code to z-file.c
  • Clean up the macros in z-virt.h
  • Remove autoconf.h.in (autogenerated by autoheader, so unnecessary)
  • Remove various double-includes and simplify bits of the header files

diff: +586 lines, -3898 lines, -3312 net.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/acinclude.m4

    r159 r182  
    101101 
    102102  if test x$sdl_exec_prefix != x ; then 
    103     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" 
    104     if test x${SDL_CONFIG+set} != xset ; then 
    105       SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config 
    106     fi 
    107   fi 
    108   if test x$sdl_prefix != x ; then 
    109     sdl_args="$sdl_args --prefix=$sdl_prefix" 
    110     if test x${SDL_CONFIG+set} != xset ; then 
    111       SDL_CONFIG=$sdl_prefix/bin/sdl-config 
    112     fi 
    113   fi 
    114  
    115   if test "x$prefix" != xNONE; then 
    116     PATH="$prefix/bin:$prefix/usr/bin:$PATH" 
    117   fi 
    118   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) 
    119   min_sdl_version=ifelse([$1], ,0.11.0,$1) 
    120   AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 
    121   no_sdl="" 
    122   if test "$SDL_CONFIG" = "no" ; then 
    123     no_sdl=yes 
    124   else 
    125     SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` 
    126     SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` 
    127  
    128     sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ 
    129            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 
    130     sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ 
    131            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 
    132     sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ 
    133            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 
    134     if test "x$enable_sdltest" = "xyes" ; then 
    135       ac_save_CFLAGS="$CFLAGS" 
    136       ac_save_CXXFLAGS="$CXXFLAGS" 
    137       ac_save_LIBS="$LIBS" 
    138       CFLAGS="$CFLAGS $SDL_CFLAGS" 
    139       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 
    140       LIBS="$LIBS $SDL_LIBS" 
    141 dnl 
    142 dnl Now check if the installed SDL is sufficiently new. (Also sanity 
    143 dnl checks the results of sdl-config to some extent 
    144 dnl 
    145       rm -f conf.sdltest 
    146       AC_TRY_RUN([ 
    147 #include <stdio.h> 
    148 #include <stdlib.h> 
    149 #include <string.h> 
    150 #include "SDL.h" 
    151  
    152 char* 
    153 my_strdup (char *str) 
    154 { 
    155   char *new_str; 
    156    
    157   if (str) 
    158     { 
    159       new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); 
    160       strcpy (new_str, str); 
    161     } 
    162   else 
    163     new_str = NULL; 
    164    
    165   return new_str; 
    166 } 
    167  
    168 int main (int argc, char *argv[]) 
    169 { 
    170   int major, minor, micro; 
    171   char *tmp_version; 
    172  
    173   /* This hangs on some systems (?) 
    174   system ("touch conf.sdltest"); 
    175   */ 
    176   { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } 
    177  
    178   /* HP/UX 9 (%@#!) writes to sscanf strings */ 
    179   tmp_version = my_strdup("$min_sdl_version"); 
    180   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) { 
    181      printf("%s, bad version string\n", "$min_sdl_version"); 
    182      exit(1); 
    183    } 
    184  
    185    if (($sdl_major_version > major) || 
    186       (($sdl_major_version == major) && ($sdl_minor_version > minor)) || 
    187       (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) 
    188     { 
    189       return 0; 
    190     } 
    191   else 
    192     { 
    193       printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); 
    194       printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); 
    195       printf("*** best to upgrade to the required version.\n"); 
    196       printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); 
    197       printf("*** to point to the correct copy of sdl-config, and remove the file\n"); 
    198       printf("*** config.cache before re-running configure\n"); 
    199       return 1; 
    200     } 
    201 } 
    202  
    203 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 
    204        CFLAGS="$ac_save_CFLAGS" 
    205        CXXFLAGS="$ac_save_CXXFLAGS" 
    206        LIBS="$ac_save_LIBS" 
    207      fi 
    208   fi 
    209   if test "x$no_sdl" = x ; then 
    210      AC_MSG_RESULT(yes) 
    211      ifelse([$2], , :, [$2])      
    212   else 
    213      AC_MSG_RESULT(no) 
    214      if test "$SDL_CONFIG" = "no" ; then 
    215        echo "*** The sdl-config script installed by SDL could not be found" 
    216        echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" 
    217        echo "*** your path, or set the SDL_CONFIG environment variable to the" 
    218        echo "*** full path to sdl-config." 
    219      else 
    220        if test -f conf.sdltest ; then 
    221         : 
    222        else 
    223           echo "*** Could not run SDL test program, checking why..." 
    224           CFLAGS="$CFLAGS $SDL_CFLAGS" 
    225           CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 
    226           LIBS="$LIBS $SDL_LIBS" 
    227           AC_TRY_LINK([ 
    228 #include <stdio.h> 
    229 #include "SDL.h" 
    230  
    231 int main(int argc, char *argv[]) 
    232 { return 0; } 
    233 #undef  main 
    234 #define main K_and_R_C_main 
    235 ],      [ return 0; ], 
    236         [ echo "*** The test program compiled, but did not run. This usually means" 
    237           echo "*** that the run-time linker is not finding SDL or finding the wrong" 
    238           echo "*** version of SDL. If it is not finding SDL, you'll need to set your" 
    239           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 
    240           echo "*** to the installed location  Also, make sure you have run ldconfig if that" 
    241           echo "*** is required on your system" 
    242           echo "***" 
    243           echo "*** If you have an old version installed, it is best to remove it, although" 
    244           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 
    245         [ echo "*** The test program failed to compile or link. See the file config.log for the" 
    246           echo "*** exact error that occured. This usually means SDL was incorrectly installed" 
    247           echo "*** or that you have moved SDL since it was installed. In the latter case, you" 
    248           echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) 
    249           CFLAGS="$ac_save_CFLAGS" 
    250           CXXFLAGS="$ac_save_CXXFLAGS" 
    251           LIBS="$ac_save_LIBS" 
    252        fi 
    253      fi 
    254      SDL_CFLAGS="" 
    255      SDL_LIBS="" 
    256      ifelse([$3], , :, [$3]) 
    257   fi 
    258   AC_SUBST(SDL_CFLAGS) 
    259   AC_SUBST(SDL_LIBS) 
    260   rm -f conf.sdltest 
    261 ]) 
    262 # Configure paths for SDL 
    263 # Sam Lantinga 9/21/99 
    264 # stolen from Manish Singh 
    265 # stolen back from Frank Belew 
    266 # stolen from Manish Singh 
    267 # Shamelessly stolen from Owen Taylor 
    268  
    269 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 
    270 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS 
    271 dnl 
    272 AC_DEFUN([AM_PATH_SDL], 
    273 [dnl  
    274 dnl Get the cflags and libraries from the sdl-config script 
    275 dnl 
    276 AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)], 
    277             sdl_prefix="$withval", sdl_prefix="") 
    278 AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], 
    279             sdl_exec_prefix="$withval", sdl_exec_prefix="") 
    280 AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program], 
    281                     , enable_sdltest=yes) 
    282  
    283   if test x$sdl_exec_prefix != x ; then 
    284     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" 
    285     if test x${SDL_CONFIG+set} != xset ; then 
    286       SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config 
    287     fi 
    288   fi 
    289   if test x$sdl_prefix != x ; then 
    290     sdl_args="$sdl_args --prefix=$sdl_prefix" 
    291     if test x${SDL_CONFIG+set} != xset ; then 
    292       SDL_CONFIG=$sdl_prefix/bin/sdl-config 
    293     fi 
    294   fi 
    295  
    296   if test "x$prefix" != xNONE; then 
    297     PATH="$prefix/bin:$prefix/usr/bin:$PATH" 
    298   fi 
    299   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) 
    300   min_sdl_version=ifelse([$1], ,0.11.0,$1) 
    301   AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 
    302   no_sdl="" 
    303   if test "$SDL_CONFIG" = "no" ; then 
    304     no_sdl=yes 
    305   else 
    306     SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` 
    307     SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` 
    308  
    309     sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ 
    310            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 
    311     sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ 
    312            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 
    313     sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ 
    314            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 
    315     if test "x$enable_sdltest" = "xyes" ; then 
    316       ac_save_CFLAGS="$CFLAGS" 
    317       ac_save_CXXFLAGS="$CXXFLAGS" 
    318       ac_save_LIBS="$LIBS" 
    319       CFLAGS="$CFLAGS $SDL_CFLAGS" 
    320       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 
    321       LIBS="$LIBS $SDL_LIBS" 
    322 dnl 
    323 dnl Now check if the installed SDL is sufficiently new. (Also sanity 
    324 dnl checks the results of sdl-config to some extent 
    325 dnl 
    326       rm -f conf.sdltest 
    327       AC_TRY_RUN([ 
    328 #include <stdio.h> 
    329 #include <stdlib.h> 
    330 #include <string.h> 
    331 #include "SDL.h" 
    332  
    333 char* 
    334 my_strdup (char *str) 
    335 { 
    336   char *new_str; 
    337    
    338   if (str) 
    339     { 
    340       new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); 
    341       strcpy (new_str, str); 
    342     } 
    343   else 
    344     new_str = NULL; 
    345    
    346   return new_str; 
    347 } 
    348  
    349 int main (int argc, char *argv[]) 
    350 { 
    351   int major, minor, micro; 
    352   char *tmp_version; 
    353  
    354   /* This hangs on some systems (?) 
    355   system ("touch conf.sdltest"); 
    356   */ 
    357   { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } 
    358  
    359   /* HP/UX 9 (%@#!) writes to sscanf strings */ 
    360   tmp_version = my_strdup("$min_sdl_version"); 
    361   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) { 
    362      printf("%s, bad version string\n", "$min_sdl_version"); 
    363      exit(1); 
    364    } 
    365  
    366    if (($sdl_major_version > major) || 
    367       (($sdl_major_version == major) && ($sdl_minor_version > minor)) || 
    368       (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) 
    369     { 
    370       return 0; 
    371     } 
    372   else 
    373     { 
    374       printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); 
    375       printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); 
    376       printf("*** best to upgrade to the required version.\n"); 
    377       printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); 
    378       printf("*** to point to the correct copy of sdl-config, and remove the file\n"); 
    379       printf("*** config.cache before re-running configure\n"); 
    380       return 1; 
    381     } 
    382 } 
    383  
    384 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 
    385        CFLAGS="$ac_save_CFLAGS" 
    386        CXXFLAGS="$ac_save_CXXFLAGS" 
    387        LIBS="$ac_save_LIBS" 
    388      fi 
    389   fi 
    390   if test "x$no_sdl" = x ; then 
    391      AC_MSG_RESULT(yes) 
    392      ifelse([$2], , :, [$2])      
    393   else 
    394      AC_MSG_RESULT(no) 
    395      if test "$SDL_CONFIG" = "no" ; then 
    396        echo "*** The sdl-config script installed by SDL could not be found" 
    397        echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" 
    398        echo "*** your path, or set the SDL_CONFIG environment variable to the" 
    399        echo "*** full path to sdl-config." 
    400      else 
    401        if test -f conf.sdltest ; then 
    402         : 
    403        else 
    404           echo "*** Could not run SDL test program, checking why..." 
    405           CFLAGS="$CFLAGS $SDL_CFLAGS" 
    406           CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 
    407           LIBS="$LIBS $SDL_LIBS" 
    408           AC_TRY_LINK([ 
    409 #include <stdio.h> 
    410 #include "SDL.h" 
    411  
    412 int main(int argc, char *argv[]) 
    413 { return 0; } 
    414 #undef  main 
    415 #define main K_and_R_C_main 
    416 ],      [ return 0; ], 
    417         [ echo "*** The test program compiled, but did not run. This usually means" 
    418           echo "*** that the run-time linker is not finding SDL or finding the wrong" 
    419           echo "*** version of SDL. If it is not finding SDL, you'll need to set your" 
    420           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 
    421           echo "*** to the installed location  Also, make sure you have run ldconfig if that" 
    422           echo "*** is required on your system" 
    423           echo "***" 
    424           echo "*** If you have an old version installed, it is best to remove it, although" 
    425           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 
    426         [ echo "*** The test program failed to compile or link. See the file config.log for the" 
    427           echo "*** exact error that occured. This usually means SDL was incorrectly installed" 
    428           echo "*** or that you have moved SDL since it was installed. In the latter case, you" 
    429           echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) 
    430           CFLAGS="$ac_save_CFLAGS" 
    431           CXXFLAGS="$ac_save_CXXFLAGS" 
    432           LIBS="$ac_save_LIBS" 
    433        fi 
    434      fi 
    435      SDL_CFLAGS="" 
    436      SDL_LIBS="" 
    437      ifelse([$3], , :, [$3]) 
    438   fi 
    439   AC_SUBST(SDL_CFLAGS) 
    440   AC_SUBST(SDL_LIBS) 
    441   rm -f conf.sdltest 
    442 ]) 
    443 # Configure paths for SDL 
    444 # Sam Lantinga 9/21/99 
    445 # stolen from Manish Singh 
    446 # stolen back from Frank Belew 
    447 # stolen from Manish Singh 
    448 # Shamelessly stolen from Owen Taylor 
    449  
    450 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 
    451 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS 
    452 dnl 
    453 AC_DEFUN([AM_PATH_SDL], 
    454 [dnl  
    455 dnl Get the cflags and libraries from the sdl-config script 
    456 dnl 
    457 AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)], 
    458             sdl_prefix="$withval", sdl_prefix="") 
    459 AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], 
    460             sdl_exec_prefix="$withval", sdl_exec_prefix="") 
    461 AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program], 
    462                     , enable_sdltest=yes) 
    463  
    464   if test x$sdl_exec_prefix != x ; then 
    465103     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" 
    466104     if test x${SDL_CONFIG+set} != xset ; then 
     
    475113  fi 
    476114 
    477   AC_REQUIRE([AC_CANONICAL_TARGET]) 
    478   PATH="$prefix/bin:$prefix/usr/bin:$PATH" 
    479   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) 
     115  AC_PATH_PROG(SDL_CONFIG, sdl-config, no) 
    480116  min_sdl_version=ifelse([$1], ,0.11.0,$1) 
    481117  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 
     
    585221#include <stdio.h> 
    586222#include "SDL.h" 
    587  
    588 int main(int argc, char *argv[]) 
    589 { return 0; } 
    590 #undef  main 
    591 #define main K_and_R_C_main 
    592223],      [ return 0; ], 
    593224        [ echo "*** The test program compiled, but did not run. This usually means" 
     
    616247  rm -f conf.sdltest 
    617248]) 
     249