2 # CXXFLAGS and LIBS for avifile
3 # taken from Autostar Sandbox, http://autostars.sourceforge.net/
4 # constructed by careful cross-pollination from various sources and lots of
8 dnl AS_AVIFILE(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
9 dnl Test for avifile, and defines
10 dnl - AVIFILE_CXXFLAGS (C++ compiler flags)
11 dnl - AVIFILE_LDFLAGS (linker flags, stripping and path)
12 dnl as well as set HAVE_AVIFILE to yes or no
14 dnl FIXME: should define AVIFILE_VERSION
17 dnl - working C++ compiler
18 dnl - usable libstdc++
25 dnl first look for avifile-config
26 AC_PATH_PROG(AVIFILE_CONFIG, avifile-config, no)
27 min_avifile_version=ifelse([$1], ,0.7.0,$1)
28 if test "x$AVIFILE_CONFIG" != "xno"; then
29 dnl now that we have it, we need to save libs and cflags
30 AVIFILE_LDFLAGS=`avifile-config --libs`
31 AVIFILE_CXXFLAGS=`avifile-config --cflags`
32 AC_SUBST(AVIFILE_LDFLAGS)
33 AC_SUBST(AVIFILE_CXXFLAGS)
37 dnl we got this far, now start checking if we have the right version
38 if test "x$HAVE_AVIFILE" = "xyes";
40 AC_MSG_CHECKING(for avifile - version >= $min_avifile_version)
41 dnl first get the version number from avifile-config
42 avifile_major_version=`$AVIFILE_CONFIG $avifile_args --version | \
43 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
44 avifile_minor_version=`$AVIFILE_CONFIG $avifile_args --version | \
45 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
46 avifile_micro_version=`$AVIFILE_CONFIG $avifile_config_args --version | \
47 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
49 dnl now run a short C app that tells us if the version is ok or not
50 dnl all of this is boilerplate code from other examples
51 rm -f conf.avifiletest
64 new_str = (char *) malloc ((strlen (str) + 1) * sizeof (char));
65 strcpy (new_str, str);
76 int major, minor, micro;
79 system ("touch conf.avifiletest");
81 /* HP/UX 9 (%@#!) writes to sscanf strings */
82 tmp_version = my_strdup ("$min_avifile_version");
83 if (sscanf (tmp_version, "%d.%d.%d", &major, &minor, µ) != 3)
85 printf ("%s, bad version string\n", "$min_avifile_version");
88 if (($avifile_major_version > major) ||
89 (($avifile_major_version == major) && ($avifile_minor_version > minor)) ||
90 (($avifile_major_version == major) && ($avifile_minor_version == minor) && ($avifile_micro_version >= micro)))
94 printf ("\n*** 'avifile-config --version' returned %d.%d.%d, but the minimum version\n", $avifile_major_version, $avifile_minor_version, $avifile_micro_version);
95 printf ("*** of AVIFILE required is %d.%d.%d. If avifile-config is correct, then it is\n", major, minor, micro);
96 printf ("*** best to upgrade to the required version.\n");
97 printf ("*** If avifile-config was wrong, set the environment variable AVIFILE_CONFIG\n");
98 printf ("*** to point to the correct copy of avifile-config, and remove the file\n");
99 printf ("*** config.cache (if it exists) before re-running configure\n");
112 if test "x$HAVE_AVIFILE" = "xyes";
114 dnl now try to compile a sample test app
116 dnl first save whatever language we're currently testing in
118 dnl AC_LANG_CPLUSPLUS
120 ac_save_CXXFLAGS=$CXXFLAGS
121 ac_save_LDFLAGS=$LDFLAGS
122 dnl add X flags, because it looks like avifile needs libXv and libXxf86vm
123 CXXFLAGS="$XXCFLAGS $AVIFILE_CXXFLAGS"
124 LDFLAGS="$LDFLAGS $AVIFILE_LDFLAGS $X_LIBS -lXv -lXxf86vm"
126 AC_MSG_CHECKING(compilation of avifile test program)
132 #include <creators.h>
135 IVideoDecoder *decoder;
138 decoder = Creators::CreateVideoDecoder (bh);
140 AC_MSG_RESULT(succeeded)
142 AC_MSG_RESULT(failed)
146 CXXFLAGS="$ac_save_CXXFLAGS"
147 LDFLAGS="$ac_save_LDFLAGS"