configure.ac revision 1.1.1.1.10.1 1 1.1 mrg # Copyright 2005 Adam Jackson.
2 1.1 mrg #
3 1.1 mrg # Permission is hereby granted, free of charge, to any person obtaining a
4 1.1 mrg # copy of this software and associated documentation files (the "Software"),
5 1.1 mrg # to deal in the Software without restriction, including without limitation
6 1.1 mrg # on the rights to use, copy, modify, merge, publish, distribute, sub
7 1.1 mrg # license, and/or sell copies of the Software, and to permit persons to whom
8 1.1 mrg # the Software is furnished to do so, subject to the following conditions:
9 1.1 mrg #
10 1.1 mrg # The above copyright notice and this permission notice (including the next
11 1.1 mrg # paragraph) shall be included in all copies or substantial portions of the
12 1.1 mrg # Software.
13 1.1 mrg #
14 1.1 mrg # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 1.1 mrg # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 1.1 mrg # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 1.1 mrg # ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 1.1 mrg # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 1.1 mrg # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 1.1 mrg
21 1.1 mrg AC_PREREQ(2.57)
22 1.1.1.1.10.1 snj AC_INIT([libdrm], 2.4.11, [dri-devel (a] lists.sourceforge.net], libdrm)
23 1.1 mrg AC_CONFIG_SRCDIR([Makefile.am])
24 1.1 mrg AM_INIT_AUTOMAKE([dist-bzip2])
25 1.1 mrg
26 1.1 mrg AM_CONFIG_HEADER([libdrm/config.h])
27 1.1 mrg
28 1.1 mrg AC_DISABLE_STATIC
29 1.1 mrg AC_PROG_LIBTOOL
30 1.1 mrg AC_PROG_CC
31 1.1 mrg
32 1.1 mrg AC_HEADER_STDC
33 1.1 mrg AC_SYS_LARGEFILE
34 1.1 mrg
35 1.1.1.1.10.1 snj PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
36 1.1.1.1.10.1 snj AC_SUBST(PTHREADSTUBS_CFLAGS)
37 1.1.1.1.10.1 snj AC_SUBST(PTHREADSTUBS_LIBS)
38 1.1.1.1.10.1 snj
39 1.1 mrg pkgconfigdir=${libdir}/pkgconfig
40 1.1 mrg AC_SUBST(pkgconfigdir)
41 1.1.1.1.10.1 snj AC_ARG_ENABLE(udev, AS_HELP_STRING([--enable-udev],
42 1.1.1.1.10.1 snj [Enable support for using udev instead of mknod (default: disabled)]),
43 1.1.1.1.10.1 snj [UDEV=$enableval], [UDEV=no])
44 1.1.1.1.10.1 snj
45 1.1.1.1.10.1 snj AC_ARG_ENABLE(nouveau-experimental-api,
46 1.1.1.1.10.1 snj AS_HELP_STRING([--enable-nouveau-experimental-api],
47 1.1.1.1.10.1 snj [Enable support for nouveau's experimental API (default: disabled)]),
48 1.1.1.1.10.1 snj [NOUVEAU=$enableval], [NOUVEAU=no])
49 1.1.1.1.10.1 snj
50 1.1.1.1.10.1 snj dnl ===========================================================================
51 1.1.1.1.10.1 snj dnl check compiler flags
52 1.1.1.1.10.1 snj AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
53 1.1.1.1.10.1 snj AC_MSG_CHECKING([whether $CC supports $1])
54 1.1.1.1.10.1 snj
55 1.1.1.1.10.1 snj libdrm_save_CFLAGS="$CFLAGS"
56 1.1.1.1.10.1 snj CFLAGS="$CFLAGS $1"
57 1.1.1.1.10.1 snj
58 1.1.1.1.10.1 snj AC_COMPILE_IFELSE([ ], [libdrm_cc_flag=yes], [libdrm_cc_flag=no])
59 1.1.1.1.10.1 snj CFLAGS="$libdrm_save_CFLAGS"
60 1.1.1.1.10.1 snj
61 1.1.1.1.10.1 snj if test "x$libdrm_cc_flag" = "xyes"; then
62 1.1.1.1.10.1 snj ifelse([$2], , :, [$2])
63 1.1.1.1.10.1 snj else
64 1.1.1.1.10.1 snj ifelse([$3], , :, [$3])
65 1.1.1.1.10.1 snj fi
66 1.1.1.1.10.1 snj AC_MSG_RESULT([$libdrm_cc_flag])
67 1.1.1.1.10.1 snj ])
68 1.1.1.1.10.1 snj
69 1.1.1.1.10.1 snj dnl We use clock_gettime to check for timeouts in drmWaitVBlank
70 1.1.1.1.10.1 snj
71 1.1.1.1.10.1 snj AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
72 1.1.1.1.10.1 snj [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
73 1.1.1.1.10.1 snj [AC_MSG_ERROR([Couldn't find clock_gettime])])])
74 1.1.1.1.10.1 snj AC_SUBST([CLOCK_LIB])
75 1.1.1.1.10.1 snj
76 1.1.1.1.10.1 snj dnl Use lots of warning flags with with gcc and compatible compilers
77 1.1.1.1.10.1 snj
78 1.1.1.1.10.1 snj dnl Note: if you change the following variable, the cache is automatically
79 1.1.1.1.10.1 snj dnl skipped and all flags rechecked. So there's no need to do anything
80 1.1.1.1.10.1 snj dnl else. If for any reason you need to force a recheck, just change
81 1.1.1.1.10.1 snj dnl MAYBE_WARN in an ignorable way (like adding whitespace)
82 1.1.1.1.10.1 snj
83 1.1.1.1.10.1 snj MAYBE_WARN="-Wall -Wextra \
84 1.1.1.1.10.1 snj -Wsign-compare -Werror-implicit-function-declaration \
85 1.1.1.1.10.1 snj -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
86 1.1.1.1.10.1 snj -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
87 1.1.1.1.10.1 snj -Wpacked -Wswitch-enum -Wmissing-format-attribute \
88 1.1.1.1.10.1 snj -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
89 1.1.1.1.10.1 snj -Wdeclaration-after-statement -Wold-style-definition \
90 1.1.1.1.10.1 snj -Wno-missing-field-initializers -Wno-unused-parameter \
91 1.1.1.1.10.1 snj -Wno-attributes -Wno-long-long -Winline"
92 1.1.1.1.10.1 snj
93 1.1.1.1.10.1 snj # invalidate cached value if MAYBE_WARN has changed
94 1.1.1.1.10.1 snj if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then
95 1.1.1.1.10.1 snj unset libdrm_cv_warn_cflags
96 1.1.1.1.10.1 snj fi
97 1.1.1.1.10.1 snj AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
98 1.1.1.1.10.1 snj echo
99 1.1.1.1.10.1 snj WARN_CFLAGS=""
100 1.1.1.1.10.1 snj
101 1.1.1.1.10.1 snj # Some warning options are not supported by all versions of
102 1.1.1.1.10.1 snj # gcc, so test all desired options against the current
103 1.1.1.1.10.1 snj # compiler.
104 1.1.1.1.10.1 snj #
105 1.1.1.1.10.1 snj # Note that there are some order dependencies
106 1.1.1.1.10.1 snj # here. Specifically, an option that disables a warning will
107 1.1.1.1.10.1 snj # have no net effect if a later option then enables that
108 1.1.1.1.10.1 snj # warnings, (perhaps implicitly). So we put some grouped
109 1.1.1.1.10.1 snj # options (-Wall and -Wextra) up front and the -Wno options
110 1.1.1.1.10.1 snj # last.
111 1.1.1.1.10.1 snj
112 1.1.1.1.10.1 snj for W in $MAYBE_WARN; do
113 1.1.1.1.10.1 snj LIBDRM_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
114 1.1.1.1.10.1 snj done
115 1.1.1.1.10.1 snj
116 1.1.1.1.10.1 snj libdrm_cv_warn_cflags=$WARN_CFLAGS
117 1.1.1.1.10.1 snj libdrm_cv_warn_maybe=$MAYBE_WARN
118 1.1.1.1.10.1 snj
119 1.1.1.1.10.1 snj AC_MSG_CHECKING([which warning flags were supported])])
120 1.1.1.1.10.1 snj WARN_CFLAGS="$libdrm_cv_warn_cflags"
121 1.1.1.1.10.1 snj
122 1.1.1.1.10.1 snj if test "x$UDEV" = xyes; then
123 1.1.1.1.10.1 snj AC_DEFINE(UDEV, 1, [Have UDEV support])
124 1.1.1.1.10.1 snj fi
125 1.1.1.1.10.1 snj
126 1.1.1.1.10.1 snj AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
127 1.1.1.1.10.1 snj
128 1.1.1.1.10.1 snj PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no])
129 1.1.1.1.10.1 snj if test "x$HAVE_CAIRO" = xyes; then
130 1.1.1.1.10.1 snj AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support])
131 1.1.1.1.10.1 snj fi
132 1.1.1.1.10.1 snj AM_CONDITIONAL(HAVE_CAIRO, [test "x$HAVE_CAIRO" = xyes])
133 1.1.1.1.10.1 snj
134 1.1.1.1.10.1 snj # For enumerating devices in test case
135 1.1.1.1.10.1 snj PKG_CHECK_MODULES(LIBUDEV, libudev, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
136 1.1.1.1.10.1 snj if test "x$HAVE_LIBUDEV" = xyes; then
137 1.1.1.1.10.1 snj AC_DEFINE(HAVE_LIBUDEV, 1, [Have libudev support])
138 1.1.1.1.10.1 snj fi
139 1.1.1.1.10.1 snj AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
140 1.1.1.1.10.1 snj
141 1.1 mrg
142 1.1.1.1.10.1 snj AC_SUBST(WARN_CFLAGS)
143 1.1 mrg AC_OUTPUT([
144 1.1 mrg Makefile
145 1.1 mrg libdrm/Makefile
146 1.1.1.1.10.1 snj libdrm/intel/Makefile
147 1.1.1.1.10.1 snj libdrm/nouveau/Makefile
148 1.1.1.1.10.1 snj libdrm/nouveau/libdrm_nouveau.pc
149 1.1 mrg shared-core/Makefile
150 1.1 mrg tests/Makefile
151 1.1.1.1.10.1 snj tests/modeprint/Makefile
152 1.1.1.1.10.1 snj tests/modetest/Makefile
153 1.1.1.1.10.1 snj libdrm.pc
154 1.1.1.1.10.1 snj libdrm_intel.pc])
155