autoconf/autoreconf addition to support aarches64 by Andrew
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / libdv-1.0.0.patch0
1 From 6bc7b5fa3f4a4d120da985f79566713ddc9ca2d7 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian.droege@collabora.co.uk>
3 Date: Wed, 14 Nov 2012 17:44:00 +0100
4 Subject: [PATCH 07/14] Don't require libsdl to be installed for autoreconf
5
6 ---
7  Makefile.am |   2 +
8  m4/sdl.m4   | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9  2 files changed, 187 insertions(+)
10  create mode 100644 m4/sdl.m4
11
12 diff --git a/Makefile.am b/Makefile.am
13 index 831bb9b..0ecf95b 100644
14 --- a/Makefile.am
15 +++ b/Makefile.am
16 @@ -1,3 +1,5 @@
17 +ACLOCAL_AMFLAGS = -I m4
18 +
19  if HAVE_GTK
20  gtk_subdirs = playdv
21  else
22 diff --git a/m4/sdl.m4 b/m4/sdl.m4
23 new file mode 100644
24 index 0000000..639eb85
25 --- /dev/null
26 +++ b/m4/sdl.m4
27 @@ -0,0 +1,185 @@
28 +# Configure paths for SDL
29 +# Sam Lantinga 9/21/99
30 +# stolen from Manish Singh
31 +# stolen back from Frank Belew
32 +# stolen from Manish Singh
33 +# Shamelessly stolen from Owen Taylor
34 +
35 +# serial 1
36 +
37 +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
38 +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
39 +dnl
40 +AC_DEFUN([AM_PATH_SDL],
41 +[dnl 
42 +dnl Get the cflags and libraries from the sdl-config script
43 +dnl
44 +AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
45 +            sdl_prefix="$withval", sdl_prefix="")
46 +AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
47 +            sdl_exec_prefix="$withval", sdl_exec_prefix="")
48 +AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
49 +                   , enable_sdltest=yes)
50 +
51 +  if test x$sdl_exec_prefix != x ; then
52 +    sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
53 +    if test x${SDL_CONFIG+set} != xset ; then
54 +      SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
55 +    fi
56 +  fi
57 +  if test x$sdl_prefix != x ; then
58 +    sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
59 +    if test x${SDL_CONFIG+set} != xset ; then
60 +      SDL_CONFIG=$sdl_prefix/bin/sdl-config
61 +    fi
62 +  fi
63 +
64 +  as_save_PATH="$PATH"
65 +  if test "x$prefix" != xNONE; then
66 +    PATH="$prefix/bin:$prefix/usr/bin:$PATH"
67 +  fi
68 +  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
69 +  PATH="$as_save_PATH"
70 +  min_sdl_version=ifelse([$1], ,0.11.0,$1)
71 +  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
72 +  no_sdl=""
73 +  if test "$SDL_CONFIG" = "no" ; then
74 +    no_sdl=yes
75 +  else
76 +    SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
77 +    SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
78 +
79 +    sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
80 +           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
81 +    sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
82 +           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
83 +    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
84 +           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
85 +    if test "x$enable_sdltest" = "xyes" ; then
86 +      ac_save_CFLAGS="$CFLAGS"
87 +      ac_save_CXXFLAGS="$CXXFLAGS"
88 +      ac_save_LIBS="$LIBS"
89 +      CFLAGS="$CFLAGS $SDL_CFLAGS"
90 +      CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
91 +      LIBS="$LIBS $SDL_LIBS"
92 +dnl
93 +dnl Now check if the installed SDL is sufficiently new. (Also sanity
94 +dnl checks the results of sdl-config to some extent
95 +dnl
96 +      rm -f conf.sdltest
97 +      AC_TRY_RUN([
98 +#include <stdio.h>
99 +#include <stdlib.h>
100 +#include <string.h>
101 +#include "SDL.h"
102 +
103 +char*
104 +my_strdup (char *str)
105 +{
106 +  char *new_str;
107 +  
108 +  if (str)
109 +    {
110 +      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
111 +      strcpy (new_str, str);
112 +    }
113 +  else
114 +    new_str = NULL;
115 +  
116 +  return new_str;
117 +}
118 +
119 +int main (int argc, char *argv[])
120 +{
121 +  int major, minor, micro;
122 +  char *tmp_version;
123 +
124 +  /* This hangs on some systems (?)
125 +  system ("touch conf.sdltest");
126 +  */
127 +  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
128 +
129 +  /* HP/UX 9 (%@#!) writes to sscanf strings */
130 +  tmp_version = my_strdup("$min_sdl_version");
131 +  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
132 +     printf("%s, bad version string\n", "$min_sdl_version");
133 +     exit(1);
134 +   }
135 +
136 +   if (($sdl_major_version > major) ||
137 +      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
138 +      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
139 +    {
140 +      return 0;
141 +    }
142 +  else
143 +    {
144 +      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
145 +      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
146 +      printf("*** best to upgrade to the required version.\n");
147 +      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
148 +      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
149 +      printf("*** config.cache before re-running configure\n");
150 +      return 1;
151 +    }
152 +}
153 +
154 +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
155 +       CFLAGS="$ac_save_CFLAGS"
156 +       CXXFLAGS="$ac_save_CXXFLAGS"
157 +       LIBS="$ac_save_LIBS"
158 +     fi
159 +  fi
160 +  if test "x$no_sdl" = x ; then
161 +     AC_MSG_RESULT(yes)
162 +     ifelse([$2], , :, [$2])     
163 +  else
164 +     AC_MSG_RESULT(no)
165 +     if test "$SDL_CONFIG" = "no" ; then
166 +       echo "*** The sdl-config script installed by SDL could not be found"
167 +       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
168 +       echo "*** your path, or set the SDL_CONFIG environment variable to the"
169 +       echo "*** full path to sdl-config."
170 +     else
171 +       if test -f conf.sdltest ; then
172 +        :
173 +       else
174 +          echo "*** Could not run SDL test program, checking why..."
175 +          CFLAGS="$CFLAGS $SDL_CFLAGS"
176 +          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
177 +          LIBS="$LIBS $SDL_LIBS"
178 +          AC_TRY_LINK([
179 +#include <stdio.h>
180 +#include "SDL.h"
181 +
182 +int main(int argc, char *argv[])
183 +{ return 0; }
184 +#undef  main
185 +#define main K_and_R_C_main
186 +],      [ return 0; ],
187 +        [ echo "*** The test program compiled, but did not run. This usually means"
188 +          echo "*** that the run-time linker is not finding SDL or finding the wrong"
189 +          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
190 +          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
191 +          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
192 +          echo "*** is required on your system"
193 +         echo "***"
194 +          echo "*** If you have an old version installed, it is best to remove it, although"
195 +          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
196 +        [ echo "*** The test program failed to compile or link. See the file config.log for the"
197 +          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
198 +          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
199 +          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
200 +          CFLAGS="$ac_save_CFLAGS"
201 +          CXXFLAGS="$ac_save_CXXFLAGS"
202 +          LIBS="$ac_save_LIBS"
203 +       fi
204 +     fi
205 +     SDL_CFLAGS=""
206 +     SDL_LIBS=""
207 +     ifelse([$3], , :, [$3])
208 +  fi
209 +  AC_SUBST(SDL_CFLAGS)
210 +  AC_SUBST(SDL_LIBS)
211 +  rm -f conf.sdltest
212 +])
213 -- 
214 2.1.4
215