acinclude.m4
author Ozkan Sezer <sezero@users.sourceforge.net>
Wed, 24 May 2017 11:28:05 -0400
changeset 599 f0d57c9b72d8
parent 595 7ba87def9569
permissions -rw-r--r--
timidity.c: fix potential buffer overrun in RWgets (num_read check was off-by-one.) also simplify the procedure a bit. (transplanted from 0c4026dd32742e8b7d33fb96d40fe3c03b02f90c)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
dnl
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
     4
AC_DEFUN([AM_PATH_SDL],
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
[dnl 
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
dnl Get the cflags and libraries from the sdl-config script
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
            sdl_prefix="$withval", sdl_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
            sdl_exec_prefix="$withval", sdl_exec_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
		    , enable_sdltest=yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
  if test x$sdl_exec_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
     if test x${SDL_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
        SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
     fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
  fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
  if test x$sdl_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
     sdl_args="$sdl_args --prefix=$sdl_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
     if test x${SDL_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
        SDL_CONFIG=$sdl_prefix/bin/sdl-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
     fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
  fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
    28
  AC_REQUIRE([AC_CANONICAL_TARGET])
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
    29
  PATH="$prefix/bin:$prefix/usr/bin:$PATH"
595
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    30
  AC_PATH_PROG(SDL1_CONFIG, sdl-config, no, [$PATH])
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    31
  AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH])
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    32
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    33
  if test "$SDL2_CONFIG" != "no" ; then
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    34
    SDL_CONFIG=$SDL2_CONFIG
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    35
  else
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    36
    SDL_CONFIG=$SDL1_CONFIG
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    37
  fi
7ba87def9569 Check for sdl2-config when doing the SDL version test.
Ryan C. Gordon <icculus@icculus.org>
parents: 497
diff changeset
    38
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
  min_sdl_version=ifelse([$1], ,0.11.0,$1)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
  no_sdl=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
  if test "$SDL_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
    no_sdl=yes
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
  else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
    SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
    SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
    sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
    sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
    if test "x$enable_sdltest" = "xyes" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
      ac_save_CFLAGS="$CFLAGS"
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
    56
      ac_save_CXXFLAGS="$CXXFLAGS"
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
      ac_save_LIBS="$LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
      CFLAGS="$CFLAGS $SDL_CFLAGS"
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
    59
      CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
      LIBS="$LIBS $SDL_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
dnl Now check if the installed SDL is sufficiently new. (Also sanity
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
dnl checks the results of sdl-config to some extent
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
      rm -f conf.sdltest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
      AC_TRY_RUN([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
#include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
#include <stdlib.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
#include <string.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
#include "SDL.h"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
char*
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
my_strdup (char *str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
{
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
  char *new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
  
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
  if (str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
    {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
      strcpy (new_str, str);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
    }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
  else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
    new_str = NULL;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
  
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
  return new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
}
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
int main (int argc, char *argv[])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
{
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
  int major, minor, micro;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
  char *tmp_version;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
  /* This hangs on some systems (?)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
  system ("touch conf.sdltest");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
  */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
  /* HP/UX 9 (%@#!) writes to sscanf strings */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
  tmp_version = my_strdup("$min_sdl_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
     printf("%s, bad version string\n", "$min_sdl_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
     exit(1);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
   }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
   if (($sdl_major_version > major) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
    {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
      return 0;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
    }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
  else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
    {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
      printf("*** best to upgrade to the required version.\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
      printf("*** config.cache before re-running configure\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
      return 1;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
    }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
}
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
       CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
       LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
     fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
  fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
  if test "x$no_sdl" = x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
     AC_MSG_RESULT(yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
     ifelse([$2], , :, [$2])     
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
  else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
     AC_MSG_RESULT(no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
     if test "$SDL_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
       echo "*** The sdl-config script installed by SDL could not be found"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
       echo "*** your path, or set the SDL_CONFIG environment variable to the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
       echo "*** full path to sdl-config."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
     else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
       if test -f conf.sdltest ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
        :
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
       else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
          echo "*** Could not run SDL test program, checking why..."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
          CFLAGS="$CFLAGS $SDL_CFLAGS"
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
   144
          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
          LIBS="$LIBS $SDL_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
          AC_TRY_LINK([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
#include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
#include "SDL.h"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
int main(int argc, char *argv[])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
{ return 0; }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
#undef  main
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
#define main K_and_R_C_main
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
],      [ return 0; ],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
        [ echo "*** The test program compiled, but did not run. This usually means"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
          echo "*** that the run-time linker is not finding SDL or finding the wrong"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
          echo "*** is required on your system"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
	  echo "***"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
          echo "*** If you have an old version installed, it is best to remove it, although"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
          CFLAGS="$ac_save_CFLAGS"
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
   169
          CXXFLAGS="$ac_save_CXXFLAGS"
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
          LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
       fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
     fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
     SDL_CFLAGS=""
497
0b244f36049e Trimmed a bunch of junk out of the build system, and now it works on Mac
Ryan C. Gordon <icculus@icculus.org>
parents: 466
diff changeset
   174
     SDL_CXXFLAGS=""
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
     SDL_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
     ifelse([$3], , :, [$3])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
  fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
  AC_SUBST(SDL_CFLAGS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
  AC_SUBST(SDL_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
  rm -f conf.sdltest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
])