|
Lines 1-71
Link Here
|
| 1 |
# Configure paths for SMPEG |
1 |
# Configure paths for SMPEG |
| 2 |
# Nicolas Vignal 11/19/2000 |
2 |
# stolen from SDL2 2/5/2015 |
| 3 |
# stolen from Sam Lantinga |
3 |
# stolen from Nicolas Vignal 11/19/2000 |
|
|
4 |
# stolen from Sam Lantinga 9/21/99 |
| 4 |
# stolen from Manish Singh |
5 |
# stolen from Manish Singh |
| 5 |
# stolen back from Frank Belew |
6 |
# stolen back from Frank Belew |
| 6 |
# stolen from Manish Singh |
7 |
# stolen from Manish Singh |
| 7 |
# Shamelessly stolen from Owen Taylor |
8 |
# Shamelessly stolen from Owen Taylor |
| 8 |
|
9 |
|
| 9 |
dnl AM_PATH_SMPEG2([MINIMUM-VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) |
10 |
# serial 1 |
|
|
11 |
|
| 12 |
dnl AM_PATH_SMPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 10 |
dnl Test for SMPEG, and define SMPEG_CFLAGS and SMPEG_LIBS |
13 |
dnl Test for SMPEG, and define SMPEG_CFLAGS and SMPEG_LIBS |
| 11 |
dnl |
14 |
dnl |
| 12 |
AC_DEFUN([AM_PATH_SMPEG2], |
15 |
AC_DEFUN([AM_PATH_SMPEG2], |
| 13 |
[dnl |
16 |
[dnl |
| 14 |
dnl Get the cflags and libraries from the smpeg2-config script |
17 |
dnl Get the cflags and libraries from the smpeg2-config script |
| 15 |
dnl |
18 |
dnl |
| 16 |
AC_ARG_WITH([smpeg-prefix], |
19 |
AC_ARG_WITH(smpeg-prefix,[ --with-smpeg-prefix=PFX Prefix where SMPEG is installed (optional)], |
| 17 |
AS_HELP_STRING([--with-smpeg-prefix=PFX], |
20 |
smpeg_prefix="$withval", smpeg_prefix="") |
| 18 |
[Prefix where SMPEG is installed (optional)]), |
21 |
AC_ARG_WITH(smpeg-exec-prefix,[ --with-smpeg-exec-prefix=PFX Exec prefix where SMPEG is installed (optional)], |
| 19 |
[smpeg_prefix="$withval"], [smpeg_prefix=""]) |
22 |
smpeg_exec_prefix="$withval", smpeg_exec_prefix="") |
| 20 |
AC_ARG_WITH([smpeg-exec-prefix], |
23 |
AC_ARG_ENABLE(smpegtest, [ --disable-smpegtest Do not try to compile and run a test SMPEG program], |
| 21 |
AS_HELP_STRING([--with-smpeg-exec-prefix=PFX], |
24 |
, enable_smpegtest=yes) |
| 22 |
[Exec prefix where SMPEG is installed (optional)]), |
|
|
| 23 |
[smpeg_exec_prefix="$withval"], [smpeg_exec_prefix=""]) |
| 24 |
AC_ARG_ENABLE([smpegtest], |
| 25 |
AS_HELP_STRING([--disable-smpegtest], |
| 26 |
[Do not try to compile and run a test SMPEG program]), |
| 27 |
[], [enable_smpegtest=yes]) |
| 28 |
|
25 |
|
| 29 |
if test x$smpeg_exec_prefix != x ; then |
26 |
min_smpeg_version=ifelse([$1], ,2.0.0,$1) |
| 30 |
smpeg_args="$smpeg_args --exec-prefix=$smpeg_exec_prefix" |
27 |
|
| 31 |
if test x${SMPEG_CONFIG+set} != xset ; then |
28 |
if test "x$smpeg_prefix$smpeg_exec_prefix" = x ; then |
|
|
29 |
PKG_CHECK_MODULES([SMPEG], [smpeg2 >= $min_smpeg_version], |
| 30 |
[smpeg_pc=yes], |
| 31 |
[smpeg_pc=no]) |
| 32 |
else |
| 33 |
smpeg_pc=no |
| 34 |
if test x$smpeg_exec_prefix != x ; then |
| 35 |
smpeg_config_args="$smpeg_config_args --exec-prefix=$smpeg_exec_prefix" |
| 36 |
if test x${SMPEG_CONFIG+set} != xset ; then |
| 32 |
SMPEG_CONFIG=$smpeg_exec_prefix/bin/smpeg2-config |
37 |
SMPEG_CONFIG=$smpeg_exec_prefix/bin/smpeg2-config |
| 33 |
fi |
38 |
fi |
| 34 |
fi |
39 |
fi |
| 35 |
if test x$smpeg_prefix != x ; then |
40 |
if test x$smpeg_prefix != x ; then |
| 36 |
smpeg_args="$smpeg_args --prefix=$smpeg_prefix" |
41 |
smpeg_config_args="$smpeg_config_args --prefix=$smpeg_prefix" |
| 37 |
if test x${SMPEG_CONFIG+set} != xset ; then |
42 |
if test x${SMPEG_CONFIG+set} != xset ; then |
| 38 |
SMPEG_CONFIG=$smpeg_prefix/bin/smpeg2-config |
43 |
SMPEG_CONFIG=$smpeg_prefix/bin/smpeg2-config |
| 39 |
fi |
44 |
fi |
|
|
45 |
fi |
| 40 |
fi |
46 |
fi |
| 41 |
|
47 |
|
| 42 |
AC_PATH_PROG([SMPEG_CONFIG], [smpeg2-config], [no]) |
48 |
if test "x$smpeg_pc" = xyes ; then |
| 43 |
min_smpeg_version=ifelse([$1], [], [2.0.0], [$1]) |
49 |
no_smpeg="" |
| 44 |
AC_MSG_CHECKING([for SMPEG - version >= $min_smpeg_version]) |
50 |
SMPEG_CONFIG="pkg-config smpeg2" |
| 45 |
no_smpeg="" |
|
|
| 46 |
if test "$SMPEG_CONFIG" = "no" ; then |
| 47 |
no_smpeg=yes |
| 48 |
else |
51 |
else |
| 49 |
SMPEG_CFLAGS=`$SMPEG_CONFIG $smpegconf_args --cflags` |
52 |
as_save_PATH="$PATH" |
| 50 |
SMPEG_LIBS=`$SMPEG_CONFIG $smpegconf_args --libs` |
53 |
if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then |
|
|
54 |
PATH="$prefix/bin:$prefix/usr/bin:$PATH" |
| 55 |
fi |
| 56 |
AC_PATH_PROG(SMPEG_CONFIG, smpeg2-config, no, [$PATH]) |
| 57 |
PATH="$as_save_PATH" |
| 58 |
AC_MSG_CHECKING(for SMPEG - version >= $min_smpeg_version) |
| 59 |
no_smpeg="" |
| 51 |
|
60 |
|
| 52 |
smpeg_major_version=`$SMPEG_CONFIG $smpeg_args --version | \ |
61 |
if test "$SMPEG_CONFIG" = "no" ; then |
| 53 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
62 |
no_smpeg=yes |
| 54 |
smpeg_minor_version=`$SMPEG_CONFIG $smpeg_args --version | \ |
63 |
else |
| 55 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
64 |
SMPEG_CFLAGS=`$SMPEG_CONFIG $smpeg_config_args --cflags` |
| 56 |
smpeg_micro_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ |
65 |
SMPEG_LIBS=`$SMPEG_CONFIG $smpeg_config_args --libs` |
| 57 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
66 |
|
| 58 |
if test "x$enable_smpegtest" = "xyes" ; then |
67 |
smpeg_major_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ |
| 59 |
ac_save_CFLAGS="$CFLAGS" |
68 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
| 60 |
ac_save_LIBS="$LIBS" |
69 |
smpeg_minor_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ |
| 61 |
CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" |
70 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
| 62 |
LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" |
71 |
smpeg_micro_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ |
|
|
72 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
| 73 |
if test "x$enable_smpegtest" = "xyes" ; then |
| 74 |
ac_save_CFLAGS="$CFLAGS" |
| 75 |
ac_save_CXXFLAGS="$CXXFLAGS" |
| 76 |
ac_save_LIBS="$LIBS" |
| 77 |
CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" |
| 78 |
CXXFLAGS="$CXXFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" |
| 79 |
LIBS="$LIBS $SMPEG_LIBS" |
| 63 |
dnl |
80 |
dnl |
| 64 |
dnl Now check if the installed SMPEG is sufficiently new. (Also sanity |
81 |
dnl Now check if the installed SMPEG is sufficiently new. (Also sanity |
| 65 |
dnl checks the results of smpeg2-config to some extent |
82 |
dnl checks the results of smpeg2-config to some extent |
| 66 |
dnl |
83 |
dnl |
| 67 |
rm -f conf.smpegtest |
84 |
rm -f conf.smpegtest |
| 68 |
AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
85 |
AC_TRY_RUN([ |
| 69 |
#include <stdio.h> |
86 |
#include <stdio.h> |
| 70 |
#include <stdlib.h> |
87 |
#include <stdlib.h> |
| 71 |
#include <string.h> |
88 |
#include <string.h> |
|
Lines 75-81
Link Here
|
| 75 |
my_strdup (char *str) |
92 |
my_strdup (char *str) |
| 76 |
{ |
93 |
{ |
| 77 |
char *new_str; |
94 |
char *new_str; |
| 78 |
|
95 |
|
| 79 |
if (str) |
96 |
if (str) |
| 80 |
{ |
97 |
{ |
| 81 |
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); |
98 |
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); |
|
Lines 83-89
Link Here
|
| 83 |
} |
100 |
} |
| 84 |
else |
101 |
else |
| 85 |
new_str = NULL; |
102 |
new_str = NULL; |
| 86 |
|
103 |
|
| 87 |
return new_str; |
104 |
return new_str; |
| 88 |
} |
105 |
} |
| 89 |
|
106 |
|
|
Lines 122-137
Link Here
|
| 122 |
} |
139 |
} |
| 123 |
} |
140 |
} |
| 124 |
|
141 |
|
| 125 |
]])],[],[no_smpeg=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
142 |
],, no_smpeg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
| 126 |
CFLAGS="$ac_save_CFLAGS" |
143 |
CFLAGS="$ac_save_CFLAGS" |
| 127 |
LIBS="$ac_save_LIBS" |
144 |
CXXFLAGS="$ac_save_CXXFLAGS" |
| 128 |
fi |
145 |
LIBS="$ac_save_LIBS" |
|
|
146 |
fi |
| 147 |
fi |
| 148 |
if test "x$no_smpeg" = x ; then |
| 149 |
AC_MSG_RESULT(yes) |
| 150 |
else |
| 151 |
AC_MSG_RESULT(no) |
| 152 |
fi |
| 129 |
fi |
153 |
fi |
| 130 |
if test "x$no_smpeg" = x ; then |
154 |
if test "x$no_smpeg" = x ; then |
| 131 |
AC_MSG_RESULT([yes]) |
155 |
ifelse([$2], , :, [$2]) |
| 132 |
ifelse([$2], [], [:], [$2]) |
|
|
| 133 |
else |
156 |
else |
| 134 |
AC_MSG_RESULT([no]) |
|
|
| 135 |
if test "$SMPEG_CONFIG" = "no" ; then |
157 |
if test "$SMPEG_CONFIG" = "no" ; then |
| 136 |
echo "*** The smpeg2-config script installed by SMPEG could not be found" |
158 |
echo "*** The smpeg2-config script installed by SMPEG could not be found" |
| 137 |
echo "*** If SMPEG was installed in PREFIX, make sure PREFIX/bin is in" |
159 |
echo "*** If SMPEG was installed in PREFIX, make sure PREFIX/bin is in" |
|
Lines 143-154
Link Here
|
| 143 |
else |
165 |
else |
| 144 |
echo "*** Could not run SMPEG test program, checking why..." |
166 |
echo "*** Could not run SMPEG test program, checking why..." |
| 145 |
CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" |
167 |
CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" |
| 146 |
LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" |
168 |
CXXFLAGS="$CXXFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" |
| 147 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
169 |
LIBS="$LIBS $SMPEG_LIBS" |
|
|
170 |
AC_TRY_LINK([ |
| 148 |
#include <stdio.h> |
171 |
#include <stdio.h> |
| 149 |
#include "smpeg.h" |
172 |
#include "smpeg.h" |
| 150 |
]], |
173 |
|
| 151 |
[[ return 0; ]])], |
174 |
int main(int argc, char *argv[]) |
|
|
175 |
{ return 0; } |
| 176 |
#undef main |
| 177 |
#define main K_and_R_C_main |
| 178 |
], [ return 0; ], |
| 152 |
[ echo "*** The test program compiled, but did not run. This usually means" |
179 |
[ echo "*** The test program compiled, but did not run. This usually means" |
| 153 |
echo "*** that the run-time linker is not finding SMPEG or finding the wrong" |
180 |
echo "*** that the run-time linker is not finding SMPEG or finding the wrong" |
| 154 |
echo "*** version of SMPEG. If it is not finding SMPEG, you'll need to set your" |
181 |
echo "*** version of SMPEG. If it is not finding SMPEG, you'll need to set your" |
|
Lines 155-161
Link Here
|
| 155 |
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
182 |
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
| 156 |
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
183 |
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
| 157 |
echo "*** is required on your system" |
184 |
echo "*** is required on your system" |
| 158 |
echo "***" |
185 |
echo "***" |
| 159 |
echo "*** If you have an old version installed, it is best to remove it, although" |
186 |
echo "*** If you have an old version installed, it is best to remove it, although" |
| 160 |
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], |
187 |
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], |
| 161 |
[ echo "*** The test program failed to compile or link. See the file config.log for the" |
188 |
[ echo "*** The test program failed to compile or link. See the file config.log for the" |
|
Lines 163-176
Link Here
|
| 163 |
echo "*** or that you have moved SMPEG since it was installed. In the latter case, you" |
190 |
echo "*** or that you have moved SMPEG since it was installed. In the latter case, you" |
| 164 |
echo "*** may want to edit the smpeg2-config script: $SMPEG_CONFIG" ]) |
191 |
echo "*** may want to edit the smpeg2-config script: $SMPEG_CONFIG" ]) |
| 165 |
CFLAGS="$ac_save_CFLAGS" |
192 |
CFLAGS="$ac_save_CFLAGS" |
|
|
193 |
CXXFLAGS="$ac_save_CXXFLAGS" |
| 166 |
LIBS="$ac_save_LIBS" |
194 |
LIBS="$ac_save_LIBS" |
| 167 |
fi |
195 |
fi |
| 168 |
fi |
196 |
fi |
| 169 |
SMPEG_CFLAGS="" |
197 |
SMPEG_CFLAGS="" |
| 170 |
SMPEG_LIBS="" |
198 |
SMPEG_LIBS="" |
| 171 |
ifelse([$3], [], [:], [$3]) |
199 |
ifelse([$3], , :, [$3]) |
| 172 |
fi |
200 |
fi |
| 173 |
AC_SUBST([SMPEG_CFLAGS]) |
201 |
AC_SUBST(SMPEG_CFLAGS) |
| 174 |
AC_SUBST([SMPEG_LIBS]) |
202 |
AC_SUBST(SMPEG_LIBS) |
| 175 |
rm -f conf.smpegtest |
203 |
rm -f conf.smpegtest |
| 176 |
]) |
204 |
]) |