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