1 dnl Configure paths for GStreamer
2 dnl This was based upon the glib.m4 created by Owen Taylor 97-11-3
3 dnl Changes mostly involve replacing GLIB with GStreamer
5 dnl Written by Thomas Nyberg <thomas.nyberg@codefactory.se> 2001-03-01
7 dnl AM_PATH_GSTREAMER([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
8 dnl Test for GStreamer, and define GSTREAMER_CFLAGS and GSTREAMER_LIBS
10 AC_DEFUN(AM_PATH_GSTREAMER,
13 dnl Get command-line stuff
15 AC_ARG_WITH(gstreamer-prefix,[ --with-gstreamer-prefix=PFX Prefix where GStreamer is installed (optional)],
16 gstreamer_config_prefix="$withval", gstreamer_config_prefix="")
17 AC_ARG_WITH(gstreamer-exec-prefix,[ --with-gstreamer-exec-prefix=PFX Exec prefix where GStreamer is installed (optional)],
18 gstreamer_config_exec_prefix="$withval", gstreamer_config_exec_prefix="")
19 AC_ARG_ENABLE(gstreamer-test, [ --disable-gstreamer-test Do not try and run a test GStreamer-program],
20 , enable_gstreamer_test=yes)
22 if test "x$gstreamer_config_prefix" != "x"; then
23 gstreamer_config_args="$gstreamer_config_args --prefix=$gstreamer_config_prefix" ;
25 if test "x${GSTREAMER_CONFIG+set}" != "xset" ; then
26 GSTREAMER_CONFIG="$gstreamer_config_prefix/bin/gstreamer-config"
29 if test "x$gstreamer_config_exec_prefix" != "x"; then
30 gstreamer_config_args="$gstreamer_config_args --exec-prefix=$gstreamer_config_exec_prefix" ;
32 if test "x${GSTREAMER_CONFIG+set}" != "xset" ; then
33 GSTREAMER_CONFIG="$gstreamer_config_exec_prefix/bin/gstreamer-config"
37 AC_PATH_PROG(GSTREAMER_CONFIG, gstreamer-config, no)
39 if test "x$1" == "x" ; then
40 min_gstreamer_version="0.0.1"
42 min_gstreamer_version="$1"
46 dnl Check to make sure version wanted is better than the existing version
48 AC_MSG_CHECKING(for GStreamer-version >= $min_gstreamer_version)
51 if test "x$GSTREAMER_CONFIG" = "xno" ; then
54 GSTREAMER_CFLAGS=`$GSTREAMER_CONFIG $gstreamer_config_args --cflags`
55 GSTREAMER_LIBS=`$GSTREAMER_CONFIG $gstreamer_config_args --libs`
57 gstreamer_config_major_version=`$GSTREAMER_CONFIG $gstreamer_config_args --version | \
58 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
59 gstreamer_config_minor_version=`$GSTREAMER_CONFIG $gstreamer_config_args --version | \
60 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
61 gstreamer_config_micro_version=`$GSTREAMER_CONFIG $gstreamer_config_args --version | \
62 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
64 if test "x$enable_gstreamer_test" = "xyes" ; then
65 ac_save_CFLAGS="$CFLAGS"
67 CFLAGS="$CFLAGS $GSTREAMER_CFLAGS"
68 LIBS="$GSTREAMER_LIBS $LIBS"
70 dnl Try and run a program linked with libs
80 int major, minor, micro;
83 system("touch conf.gstreamertest");
85 tmp_version = strdup("$min_gstreamer_version");
86 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
87 printf("%s, bad version string\n", "$min_gstreamer_version");
91 if (($gstreamer_config_major_version > major) ||
92 (($gstreamer_config_major_version == major) && ($gstreamer_config_minor_version > minor)) ||
93 (($gstreamer_config_major_version == major) && ($gstreamer_config_minor_version == minor) &&
94 ($gstreamer_config_micro_version >= micro))) {
97 printf("\n*** An old version of GStreamer(%d.%d.%d) was found.\n",
98 $gstreamer_config_major_version, $gstreamer_config_minor_version,
99 $gstreamer_config_micro_version);
101 printf("*** You need a version of GStreamer newer than %d.%d.%d.\n", major, minor, micro);
108 ],, no_gstreamer=yes, [echo $ac_n "cross compiling; assuming OK... $ac_c"])
109 CFLAGS="$ac_save_CFLAGS"
113 if test "x$no_gstreamer" = "x" ; then
115 ifelse([$2], , :, [$2])
118 dnl Something went wrong, looks like GStreamer was not found
120 if test "$GSTREAMER_CONFIG" = "no" ; then
121 echo "*** The gstreamer-config script installed by GStreamer could not be found"
122 echo "*** If GStreamer was installed in PREFIX, make sure PREFIX/bin is in"
123 echo "*** your path, or set the GSTREAMER_CONFIG environment variable to the"
124 echo "*** full path to gstreamer-config."
126 if test -f conf.gstreamertest ; then
129 echo "*** Could not run GStreamer test program, checking why..."
130 CFLAGS="$CFLAGS $GSTREAMER_CFLAGS"
131 LIBS="$LIBS $GSTREAMER_LIBS"
137 gst_init(NULL, NULL);
140 [ echo "*** The test program compiled, but did not run. This usually means"
141 echo "*** that the run-time linker is not finding GStreamer or finding the wrong"
142 echo "*** version of GStreamer. If it is not finding GStreamer, you'll need to set your"
143 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
144 echo "*** to the installed location Also, make sure you have run ldconfig if that"
145 echo "*** is required on your system"
147 echo "*** If you have an old version installed, it is best to remove it, although"
148 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
149 [ echo "*** The test program failed to compile or link. See the file config.log for the"
150 echo "*** exact error that occured. This usually means GStreamer was incorrectly installed"
151 echo "*** or that you have moved GStreamer since it was installed. In the latter case, you"
152 echo "*** may want to edit the gstremaer-config script: $GSTREAMER_CONFIG" ])
153 CFLAGS="$ac_save_CFLAGS"
159 ifelse([$3], , :, [$3])
163 dnl Define our flags and libs
165 AC_SUBST(GSTREAMER_CFLAGS)
166 AC_SUBST(GSTREAMER_LIBS)
167 rm -f conf.gstreamertest