1a4f78defSmrgAC_PREREQ(2.60)
2a4f78defSmrg
3fb570538SmrgAC_INIT(libvdpau, 1.2, [vdpau@lists.freedesktop.org], libvdpau)
4a4f78defSmrgAM_INIT_AUTOMAKE([dist-bzip2 foreign])
5a4f78defSmrg
6a4f78defSmrgAC_CONFIG_HEADERS(config.h)
7a4f78defSmrg
8a4f78defSmrg# Check for secure_getenv
9a4f78defSmrgAC_USE_SYSTEM_EXTENSIONS
10a4f78defSmrgAC_CHECK_FUNCS([__secure_getenv secure_getenv])
11a4f78defSmrg
12a4f78defSmrg# Disable static libraries by default.  Use --enable-static if you really want
13a4f78defSmrg# them.
14a4f78defSmrgAC_DISABLE_STATIC
15a4f78defSmrg
16a4f78defSmrg# Check for programs.
17a4f78defSmrgAC_PROG_CC
18a4f78defSmrgAC_PROG_CXX
19a4f78defSmrgAC_PROG_LIBTOOL
20a4f78defSmrg
21a4f78defSmrg# Checks for dependencies.
22a4f78defSmrgPKG_CHECK_MODULES(X11, x11)
23a4f78defSmrgAC_SUBST(X11_CFLAGS)
24a4f78defSmrgAC_SUBST(X11_LIBS)
25a4f78defSmrg
26a4f78defSmrg# Check for optional dependencies.
27a4f78defSmrgAC_ARG_ENABLE(dri2, AS_HELP_STRING([--disable-dri2], [Disable driver name query through DRI2 (default: auto)]), [DRI2=$enableval], [DRI2=auto])
28a4f78defSmrgPKG_CHECK_MODULES(dri2proto, dri2proto >= 2.2, [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
29a4f78defSmrgcase "$DRI2,$HAVE_DRI2PROTO" in
30a4f78defSmrg    yes,no)
31a4f78defSmrg        AC_MSG_ERROR([DRI2 queries require dri2proto >= 2.2])
32a4f78defSmrg        ;;
33a4f78defSmrg    yes,yes | auto,yes)
34a4f78defSmrg        AC_DEFINE(DRI2, 1, [Request driver name from DRI2])
35a4f78defSmrg        DRI2=yes
36a4f78defSmrg        PKG_CHECK_MODULES(XEXT, xext)
37a4f78defSmrg        AC_SUBST([XEXT_CFLAGS])
38a4f78defSmrg        AC_SUBST([XEXT_LIBS])
39a4f78defSmrg        ;;
40a4f78defSmrgesac
41a4f78defSmrgAM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
42a4f78defSmrg
43a4f78defSmrgdnl Check to see if dlopen is in default libraries (like Solaris, which
44a4f78defSmrgdnl has it in libc), or if libdl is needed to get it.
45a4f78defSmrgAC_CHECK_FUNC([dlopen], [],
46a4f78defSmrg        AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
47a4f78defSmrgAC_SUBST([DLOPEN_LIBS])
48a4f78defSmrg
49a4f78defSmrg# Look for POSIX threads
50a4f78defSmrgAC_SEARCH_LIBS([pthread_once], [pthread pthreads c_r], [
51a4f78defSmrg    AS_IF([test "$ac_cv_search_pthread_once" != "none required"], [
52a4f78defSmrg        PTHREAD_LIBS="$ac_cv_search_pthread_once"
53a4f78defSmrg    ])
54a4f78defSmrg])
55a4f78defSmrgAC_SUBST([PTHREAD_LIBS])
56a4f78defSmrg
57a4f78defSmrg# Check for Doxygen.
58a4f78defSmrgAC_ARG_ENABLE(documentation, AS_HELP_STRING([--disable-documentation], [Disable Doxygen documentation (default: auto)]), [DOCS=$enableval], [DOCS=auto])
59a4f78defSmrgif test "x$DOCS" != xno; then
60a4f78defSmrg    AC_CHECK_TOOL([DOXYGEN], [doxygen], [no])
61a4f78defSmrg    AC_CHECK_TOOL([DOT], [dot], [no])
62a4f78defSmrgelse
63a4f78defSmrg    DOXYGEN=no
64a4f78defSmrg    DOT=no
65a4f78defSmrgfi
66a4f78defSmrgif test "x$DOCS" = xyes; then
67a4f78defSmrg    if test "x$DOXYGEN" = xno; then
68a4f78defSmrg        AC_ERROR([Documentation enabled but doxygen was not found in your path])
69a4f78defSmrg    fi
70a4f78defSmrg    if test "x$DOT" = xno; then
71a4f78defSmrg        AC_ERROR([Documentation enabled but dot was not found in your path.  Please install graphviz])
72a4f78defSmrg    fi
73a4f78defSmrgfi
74a4f78defSmrgAM_CONDITIONAL([ENABLE_DOCS], [test "x$DOXYGEN" != xno -a "x$DOT" != xno])
75a4f78defSmrgAC_SUBST(DOXYGEN)
76a4f78defSmrg
77a4f78defSmrg# Options
78a4f78defSmrgAC_ARG_WITH(module-dir,
79a4f78defSmrg            AC_HELP_STRING([--with-module-dir=DIR],
80a4f78defSmrg                           [Default module directory [[default=LIBDIR/vdpau]]]),
81a4f78defSmrg            [moduledir="$withval"],
82a4f78defSmrg            [moduledir="$libdir/vdpau"])
83a4f78defSmrgAC_SUBST(moduledir)
84a4f78defSmrg
85a4f78defSmrgXORG_CHANGELOG
86a4f78defSmrg
87a4f78defSmrgAC_OUTPUT([Makefile
88a4f78defSmrg           doc/Makefile
89a4f78defSmrg           src/Makefile
90a4f78defSmrg           test/Makefile
91a4f78defSmrg           trace/Makefile
92a4f78defSmrg           vdpau.pc])
93