1AC_INIT
2AC_PROG_CC
3AC_PATH_X
4if test "x$no_x" != "xyes"; then
5  savecpp="$CPPFLAGS"
6  CPPFLAGS="$CPPFLAGS -I$x_includes"
7  AC_CHECK_HEADER($x_includes/X11/Xlib.h,,\
8	 [AC_MSG_ERROR(Could not find X installation.)])
9  CPPFLAGS="$savecpp"
10  MDRIINC="-I$x_includes"
11  LIBS="-L$x_libraries $LIBS"
12else
13  AC_MSG_ERROR(Could not find X installation. Aborting.)
14fi
15AC_ARG_WITH(libdrm,
16            AC_HELP_STRING([--with-libdrm=DIR],
17                           [Installation prefix of libdrm [[default=/usr]]]),
18            [libdrmpref="$withval"],
19            [libdrmpref="/usr"])
20savecpp="$CPPFLAGS"
21MDRIINC="-I$libdrmpref/include -I$libdrmpref/include/drm -I$x_includes"
22CPPFLAGS="$CPPFLAGS $MDRIINC"
23AC_CHECK_HEADER(xf86drm.h,,\
24		 [AC_MSG_ERROR(Could not find libdrm installation. Use --with-libdrm=<libdrm_installation_prefix>)])
25AC_CHECK_HEADER(drm.h,,\
26		 [AC_MSG_ERROR(Could not find libdrm installation. Use --with-libdrm=<libdrm_installation_prefix>)])
27CPPFLAGS="$savecpp"
28LIBS="-L$libdrmpref/lib64 -L$libdrmpref/lib $LIBS"
29AC_SUBST(MDRIINC)
30AC_SYS_LARGEFILE
31AM_INIT_AUTOMAKE(minidri,0.1.0)
32AM_CONFIG_HEADER(config.h)
33AC_OUTPUT([Makefile src/Makefile])
34