test/aclocal.m4
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 17 Aug 2016 21:04:50 +0200
changeset 10275 ba7dc3ebb81e
parent 6272 f3dbef2cc0f2
permissions -rw-r--r--
Emscripten: Fixed opening previously closed joystick.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
# Configure paths for SDL
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
# Sam Lantinga 9/21/99
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     3
# stolen from Manish Singh
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
# stolen back from Frank Belew
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     5
# stolen from Manish Singh
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     6
# Shamelessly stolen from Owen Taylor
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     7
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
     8
# serial 1
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
     9
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    10
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    11
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
dnl
6272
f3dbef2cc0f2 Switched the SDL 2 autoconf macro to AM_PATH_SDL2
Sam Lantinga <slouken@libsdl.org>
parents: 6250
diff changeset
    13
AC_DEFUN([AM_PATH_SDL2],
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    14
[dnl 
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    15
dnl Get the cflags and libraries from the sdl2-config script
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
dnl
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
            sdl_prefix="$withval", sdl_prefix="")
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    19
AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
            sdl_exec_prefix="$withval", sdl_exec_prefix="")
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
		    , enable_sdltest=yes)
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    24
  min_sdl_version=ifelse([$1], ,0.9.0,$1)
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    25
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    26
  if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    27
    PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    28
           [sdl_pc=yes],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    29
           [sdl_pc=no])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    30
  else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    31
    sdl_pc=no
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    32
    if test x$sdl_exec_prefix != x ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    33
      sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    34
      if test x${SDL_CONFIG+set} != xset ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    35
        SDL_CONFIG=$sdl_exec_prefix/bin/sdl2-config
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    36
      fi
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
    fi
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    38
    if test x$sdl_prefix != x ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    39
      sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    40
      if test x${SDL_CONFIG+set} != xset ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    41
        SDL_CONFIG=$sdl_prefix/bin/sdl2-config
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    42
      fi
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
    fi
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
  fi
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    46
  if test "x$sdl_pc" = xyes ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    47
    no_sdl=""
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    48
    SDL_CONFIG="pkg-config sdl2"
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
  else
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    50
    as_save_PATH="$PATH"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    51
    if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    52
      PATH="$prefix/bin:$prefix/usr/bin:$PATH"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    53
    fi
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    54
    AC_PATH_PROG(SDL_CONFIG, sdl2-config, no, [$PATH])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    55
    PATH="$as_save_PATH"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    56
    AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    57
    no_sdl=""
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    59
    if test "$SDL_CONFIG" = "no" ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    60
      no_sdl=yes
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    61
    else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    62
      SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    63
      SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    64
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    65
      sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    66
             sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    67
      sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    68
             sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    69
      sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    70
             sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    71
      if test "x$enable_sdltest" = "xyes" ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    72
        ac_save_CFLAGS="$CFLAGS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    73
        ac_save_CXXFLAGS="$CXXFLAGS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    74
        ac_save_LIBS="$LIBS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    75
        CFLAGS="$CFLAGS $SDL_CFLAGS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    76
        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    77
        LIBS="$LIBS $SDL_LIBS"
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
dnl
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
dnl Now check if the installed SDL is sufficiently new. (Also sanity
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    80
dnl checks the results of sdl2-config to some extent
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
dnl
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
      rm -f conf.sdltest
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
      AC_TRY_RUN([
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
#include <stdio.h>
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
#include <stdlib.h>
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    86
#include <string.h>
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    87
#include "SDL.h"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    88
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    89
char*
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    90
my_strdup (char *str)
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    91
{
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    92
  char *new_str;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    93
  
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    94
  if (str)
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
    {
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
      strcpy (new_str, str);
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
    }
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
  else
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
    new_str = NULL;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
  
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
  return new_str;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
}
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
int main (int argc, char *argv[])
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   106
{
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   107
  int major, minor, micro;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   108
  char *tmp_version;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   109
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
  /* This hangs on some systems (?)
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   111
  system ("touch conf.sdltest");
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
  */
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
  /* HP/UX 9 (%@#!) writes to sscanf strings */
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
  tmp_version = my_strdup("$min_sdl_version");
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
     printf("%s, bad version string\n", "$min_sdl_version");
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
     exit(1);
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   120
   }
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   121
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
   if (($sdl_major_version > major) ||
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   124
      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
    {
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
      return 0;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
    }
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
  else
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
    {
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   130
      printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   131
      printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro);
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
      printf("*** best to upgrade to the required version.\n");
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   133
      printf("*** If sdl2-config was wrong, set the environment variable SDL_CONFIG\n");
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   134
      printf("*** to point to the correct copy of sdl2-config, and remove the file\n");
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
      printf("*** config.cache before re-running configure\n");
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   136
      return 1;
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
    }
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
}
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   140
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   141
        CFLAGS="$ac_save_CFLAGS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   142
        CXXFLAGS="$ac_save_CXXFLAGS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   143
        LIBS="$ac_save_LIBS"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   144
      fi
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   145
    fi
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   146
    if test "x$no_sdl" = x ; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   147
      AC_MSG_RESULT(yes)
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   148
    else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   149
      AC_MSG_RESULT(no)
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   150
    fi
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   151
  fi
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   152
  if test "x$no_sdl" = x ; then
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   153
     ifelse([$2], , :, [$2])
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   154
  else
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   155
     if test "$SDL_CONFIG" = "no" ; then
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   156
       echo "*** The sdl2-config script installed by SDL could not be found"
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   157
       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
       echo "*** your path, or set the SDL_CONFIG environment variable to the"
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   159
       echo "*** full path to sdl2-config."
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
     else
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
       if test -f conf.sdltest ; then
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   162
        :
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   163
       else
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   164
          echo "*** Could not run SDL test program, checking why..."
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   165
          CFLAGS="$CFLAGS $SDL_CFLAGS"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   166
          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   167
          LIBS="$LIBS $SDL_LIBS"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   168
          AC_TRY_LINK([
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   169
#include <stdio.h>
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   170
#include "SDL.h"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   171
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   172
int main(int argc, char *argv[])
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   173
{ return 0; }
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   174
#undef  main
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   175
#define main K_and_R_C_main
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   176
],      [ return 0; ],
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   177
        [ echo "*** The test program compiled, but did not run. This usually means"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   178
          echo "*** that the run-time linker is not finding SDL or finding the wrong"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   179
          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   180
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   181
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   182
          echo "*** is required on your system"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   183
	  echo "***"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   184
          echo "*** If you have an old version installed, it is best to remove it, although"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   185
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   186
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   187
          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   188
          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   189
          echo "*** may want to edit the sdl2-config script: $SDL_CONFIG" ])
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   190
          CFLAGS="$ac_save_CFLAGS"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   191
          CXXFLAGS="$ac_save_CXXFLAGS"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   192
          LIBS="$ac_save_LIBS"
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   193
       fi
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   194
     fi
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   195
     SDL_CFLAGS=""
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   196
     SDL_LIBS=""
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   197
     ifelse([$3], , :, [$3])
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   198
  fi
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   199
  AC_SUBST(SDL_CFLAGS)
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   200
  AC_SUBST(SDL_LIBS)
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   201
  rm -f conf.sdltest
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   202
])
6250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   203
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   204
# serial 1 (pkg-config-0.24)
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   205
# 
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   206
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   207
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   208
# This program is free software; you can redistribute it and/or modify
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   209
# it under the terms of the GNU General Public License as published by
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   210
# the Free Software Foundation; either version 2 of the License, or
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   211
# (at your option) any later version.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   212
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   213
# This program is distributed in the hope that it will be useful, but
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   214
# WITHOUT ANY WARRANTY; without even the implied warranty of
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   215
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   216
# General Public License for more details.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   217
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   218
# You should have received a copy of the GNU General Public License
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   219
# along with this program; if not, write to the Free Software
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   220
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   221
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   222
# As a special exception to the GNU General Public License, if you
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   223
# distribute this file as part of a program that contains a
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   224
# configuration script generated by Autoconf, you may include it under
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   225
# the same distribution terms that you use for the rest of that program.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   226
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   227
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   228
# ----------------------------------
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   229
AC_DEFUN([PKG_PROG_PKG_CONFIG],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   230
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   231
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   232
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   233
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   234
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   235
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   236
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   237
	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   238
fi
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   239
if test -n "$PKG_CONFIG"; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   240
	_pkg_min_version=m4_default([$1], [0.9.0])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   241
	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   242
	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   243
		AC_MSG_RESULT([yes])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   244
	else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   245
		AC_MSG_RESULT([no])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   246
		PKG_CONFIG=""
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   247
	fi
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   248
fi[]dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   249
])# PKG_PROG_PKG_CONFIG
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   250
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   251
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   252
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   253
# Check to see whether a particular set of modules exists.  Similar
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   254
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   255
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   256
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   257
# only at the first occurence in configure.ac, so if the first place
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   258
# it's called might be skipped (such as if it is within an "if", you
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   259
# have to call PKG_CHECK_EXISTS manually
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   260
# --------------------------------------------------------------
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   261
AC_DEFUN([PKG_CHECK_EXISTS],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   262
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   263
if test -n "$PKG_CONFIG" && \
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   264
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   265
  m4_default([$2], [:])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   266
m4_ifvaln([$3], [else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   267
  $3])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   268
fi])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   269
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   270
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   271
# ---------------------------------------------
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   272
m4_define([_PKG_CONFIG],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   273
[if test -n "$$1"; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   274
    pkg_cv_[]$1="$$1"
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   275
 elif test -n "$PKG_CONFIG"; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   276
    PKG_CHECK_EXISTS([$3],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   277
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   278
		     [pkg_failed=yes])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   279
 else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   280
    pkg_failed=untried
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   281
fi[]dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   282
])# _PKG_CONFIG
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   283
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   284
# _PKG_SHORT_ERRORS_SUPPORTED
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   285
# -----------------------------
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   286
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   287
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   288
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   289
        _pkg_short_errors_supported=yes
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   290
else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   291
        _pkg_short_errors_supported=no
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   292
fi[]dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   293
])# _PKG_SHORT_ERRORS_SUPPORTED
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   294
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   295
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   296
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   297
# [ACTION-IF-NOT-FOUND])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   298
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   299
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   300
# Note that if there is a possibility the first call to
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   301
# PKG_CHECK_MODULES might not happen, you should be sure to include an
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   302
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   303
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   304
#
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   305
# --------------------------------------------------------------
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   306
AC_DEFUN([PKG_CHECK_MODULES],
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   307
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   308
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   309
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   310
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   311
pkg_failed=no
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   312
AC_MSG_CHECKING([for $1])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   313
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   314
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   315
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   316
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   317
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   318
and $1[]_LIBS to avoid the need to call pkg-config.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   319
See the pkg-config man page for more details.])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   320
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   321
if test $pkg_failed = yes; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   322
   	AC_MSG_RESULT([no])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   323
        _PKG_SHORT_ERRORS_SUPPORTED
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   324
        if test $_pkg_short_errors_supported = yes; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   325
	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   326
        else 
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   327
	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   328
        fi
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   329
	# Put the nasty error message in config.log where it belongs
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   330
	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   331
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   332
	m4_default([$4], [AC_MSG_ERROR(
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   333
[Package requirements ($2) were not met:
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   334
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   335
$$1_PKG_ERRORS
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   336
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   337
Consider adjusting the PKG_CONFIG_PATH environment variable if you
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   338
installed software in a non-standard prefix.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   339
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   340
_PKG_TEXT])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   341
        ])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   342
elif test $pkg_failed = untried; then
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   343
     	AC_MSG_RESULT([no])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   344
	m4_default([$4], [AC_MSG_FAILURE(
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   345
[The pkg-config script could not be found or is too old.  Make sure it
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   346
is in your PATH or set the PKG_CONFIG environment variable to the full
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   347
path to pkg-config.
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   348
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   349
_PKG_TEXT
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   350
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   351
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   352
        ])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   353
else
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   354
	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   355
	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   356
        AC_MSG_RESULT([yes])
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   357
	$3
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   358
fi[]dnl
cce0ddcf6747 Updated to SDL 2.0, and SDL 2.0 can now be installed coexisting with SDL 1.2
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
   359
])# PKG_CHECK_MODULES