Home | History | Annotate | Line # | Download | only in dist
      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.2  mrg 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.2  mrg PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
     36  1.1.1.2  mrg AC_SUBST(PTHREADSTUBS_CFLAGS)
     37  1.1.1.2  mrg AC_SUBST(PTHREADSTUBS_LIBS)
     38  1.1.1.2  mrg 
     39      1.1  mrg pkgconfigdir=${libdir}/pkgconfig
     40      1.1  mrg AC_SUBST(pkgconfigdir)
     41  1.1.1.2  mrg AC_ARG_ENABLE(udev,	AS_HELP_STRING([--enable-udev],
     42  1.1.1.2  mrg 				[Enable support for using udev instead of mknod (default: disabled)]),
     43  1.1.1.2  mrg 				[UDEV=$enableval], [UDEV=no])
     44  1.1.1.2  mrg 
     45  1.1.1.2  mrg AC_ARG_ENABLE(nouveau-experimental-api,
     46  1.1.1.2  mrg 	      AS_HELP_STRING([--enable-nouveau-experimental-api],
     47  1.1.1.2  mrg 	      [Enable support for nouveau's experimental API (default: disabled)]),
     48  1.1.1.2  mrg 	      [NOUVEAU=$enableval], [NOUVEAU=no])
     49  1.1.1.2  mrg 
     50  1.1.1.2  mrg dnl ===========================================================================
     51  1.1.1.2  mrg dnl check compiler flags
     52  1.1.1.2  mrg AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
     53  1.1.1.2  mrg   AC_MSG_CHECKING([whether $CC supports $1])
     54  1.1.1.2  mrg 
     55  1.1.1.2  mrg   libdrm_save_CFLAGS="$CFLAGS"
     56  1.1.1.2  mrg   CFLAGS="$CFLAGS $1"
     57  1.1.1.2  mrg 
     58  1.1.1.2  mrg   AC_COMPILE_IFELSE([ ], [libdrm_cc_flag=yes], [libdrm_cc_flag=no])
     59  1.1.1.2  mrg   CFLAGS="$libdrm_save_CFLAGS"
     60  1.1.1.2  mrg 
     61  1.1.1.2  mrg   if test "x$libdrm_cc_flag" = "xyes"; then
     62  1.1.1.2  mrg     ifelse([$2], , :, [$2])
     63  1.1.1.2  mrg   else
     64  1.1.1.2  mrg     ifelse([$3], , :, [$3])
     65  1.1.1.2  mrg   fi
     66  1.1.1.2  mrg   AC_MSG_RESULT([$libdrm_cc_flag])
     67  1.1.1.2  mrg ])
     68  1.1.1.2  mrg 
     69  1.1.1.2  mrg dnl We use clock_gettime to check for timeouts in drmWaitVBlank
     70  1.1.1.2  mrg 
     71  1.1.1.2  mrg AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
     72  1.1.1.2  mrg                [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
     73  1.1.1.2  mrg                              [AC_MSG_ERROR([Couldn't find clock_gettime])])])
     74  1.1.1.2  mrg AC_SUBST([CLOCK_LIB])
     75  1.1.1.2  mrg 
     76  1.1.1.2  mrg dnl Use lots of warning flags with with gcc and compatible compilers
     77  1.1.1.2  mrg 
     78  1.1.1.2  mrg dnl Note: if you change the following variable, the cache is automatically
     79  1.1.1.2  mrg dnl skipped and all flags rechecked.  So there's no need to do anything
     80  1.1.1.2  mrg dnl else.  If for any reason you need to force a recheck, just change
     81  1.1.1.2  mrg dnl MAYBE_WARN in an ignorable way (like adding whitespace)
     82  1.1.1.2  mrg 
     83  1.1.1.2  mrg MAYBE_WARN="-Wall -Wextra \
     84  1.1.1.2  mrg -Wsign-compare -Werror-implicit-function-declaration \
     85  1.1.1.2  mrg -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
     86  1.1.1.2  mrg -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
     87  1.1.1.2  mrg -Wpacked -Wswitch-enum -Wmissing-format-attribute \
     88  1.1.1.2  mrg -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
     89  1.1.1.2  mrg -Wdeclaration-after-statement -Wold-style-definition \
     90  1.1.1.2  mrg -Wno-missing-field-initializers -Wno-unused-parameter \
     91  1.1.1.2  mrg -Wno-attributes -Wno-long-long -Winline"
     92  1.1.1.2  mrg 
     93  1.1.1.2  mrg # invalidate cached value if MAYBE_WARN has changed
     94  1.1.1.2  mrg if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then
     95  1.1.1.2  mrg 	unset libdrm_cv_warn_cflags
     96  1.1.1.2  mrg fi
     97  1.1.1.2  mrg AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
     98  1.1.1.2  mrg 	echo
     99  1.1.1.2  mrg 	WARN_CFLAGS=""
    100  1.1.1.2  mrg 
    101  1.1.1.2  mrg 	# Some warning options are not supported by all versions of
    102  1.1.1.2  mrg 	# gcc, so test all desired options against the current
    103  1.1.1.2  mrg 	# compiler.
    104  1.1.1.2  mrg 	#
    105  1.1.1.2  mrg 	# Note that there are some order dependencies
    106  1.1.1.2  mrg 	# here. Specifically, an option that disables a warning will
    107  1.1.1.2  mrg 	# have no net effect if a later option then enables that
    108  1.1.1.2  mrg 	# warnings, (perhaps implicitly). So we put some grouped
    109  1.1.1.2  mrg 	# options (-Wall and -Wextra) up front and the -Wno options
    110  1.1.1.2  mrg 	# last.
    111  1.1.1.2  mrg 
    112  1.1.1.2  mrg 	for W in $MAYBE_WARN; do
    113  1.1.1.2  mrg 		LIBDRM_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
    114  1.1.1.2  mrg 	done
    115  1.1.1.2  mrg 
    116  1.1.1.2  mrg 	libdrm_cv_warn_cflags=$WARN_CFLAGS
    117  1.1.1.2  mrg 	libdrm_cv_warn_maybe=$MAYBE_WARN
    118  1.1.1.2  mrg 
    119  1.1.1.2  mrg 	AC_MSG_CHECKING([which warning flags were supported])])
    120  1.1.1.2  mrg WARN_CFLAGS="$libdrm_cv_warn_cflags"
    121  1.1.1.2  mrg 
    122  1.1.1.2  mrg if test "x$UDEV" = xyes; then
    123  1.1.1.2  mrg 	AC_DEFINE(UDEV, 1, [Have UDEV support])
    124  1.1.1.2  mrg fi
    125  1.1.1.2  mrg 
    126  1.1.1.2  mrg AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
    127  1.1.1.2  mrg 
    128  1.1.1.2  mrg PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no])
    129  1.1.1.2  mrg if test "x$HAVE_CAIRO" = xyes; then
    130  1.1.1.2  mrg 	AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support])
    131  1.1.1.2  mrg fi
    132  1.1.1.2  mrg AM_CONDITIONAL(HAVE_CAIRO, [test "x$HAVE_CAIRO" = xyes])
    133  1.1.1.2  mrg 
    134  1.1.1.2  mrg # For enumerating devices in test case
    135  1.1.1.2  mrg PKG_CHECK_MODULES(LIBUDEV, libudev, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
    136  1.1.1.2  mrg if test "x$HAVE_LIBUDEV" = xyes; then
    137  1.1.1.2  mrg    	AC_DEFINE(HAVE_LIBUDEV, 1, [Have libudev support])
    138  1.1.1.2  mrg fi
    139  1.1.1.2  mrg AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
    140  1.1.1.2  mrg 
    141      1.1  mrg 
    142  1.1.1.2  mrg 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.2  mrg 	libdrm/intel/Makefile
    147  1.1.1.2  mrg 	libdrm/nouveau/Makefile
    148  1.1.1.2  mrg 	libdrm/nouveau/libdrm_nouveau.pc
    149      1.1  mrg 	shared-core/Makefile
    150      1.1  mrg 	tests/Makefile
    151  1.1.1.2  mrg 	tests/modeprint/Makefile
    152  1.1.1.2  mrg 	tests/modetest/Makefile
    153  1.1.1.2  mrg 	libdrm.pc
    154  1.1.1.2  mrg 	libdrm_intel.pc])
    155