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