configure.ac revision 53354cdb
1dnl Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
2dnl
3dnl Permission is hereby granted, free of charge, to any person obtaining a
4dnl copy of this software and associated documentation files (the
5dnl "Software"), to deal in the Software without restriction, including
6dnl without limitation the rights to use, copy, modify, merge, publish,
7dnl distribute, and/or sell copies of the Software, and to permit persons
8dnl to whom the Software is furnished to do so, provided that the above
9dnl copyright notice(s) and this permission notice appear in all copies of
10dnl the Software and that both the above copyright notice(s) and this
11dnl permission notice appear in supporting documentation.
12dnl
13dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
16dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
17dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
18dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
19dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22dnl
23dnl Except as contained in this notice, the name of a copyright holder
24dnl shall not be used in advertising or otherwise to promote the sale, use
25dnl or other dealings in this Software without prior written authorization
26dnl of the copyright holder.
27dnl
28dnl Process this file with autoconf to create configure.
29
30AC_PREREQ([2.57])
31AC_INIT(rgb,[1.0.3],[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],rgb)
32AM_INIT_AUTOMAKE([dist-bzip2])
33AM_MAINTAINER_MODE
34
35AM_CONFIG_HEADER(config.h)
36
37AC_PROG_CC
38AC_PROG_INSTALL
39
40PKG_CHECK_MODULES(RGB, xproto)
41
42AC_MSG_CHECKING([for rgb database location])
43AC_ARG_WITH([rgb-db-dir],
44	AC_HELP_STRING([--with-rgb-db-dir=<path>],
45		[rgb database location (default is ${datadir}/X11/rgb)]),
46	[db_path=$withval], [db_path=${datadir}/X11/rgb])
47AC_MSG_RESULT([$db_path])
48dnl XXX not working - AC_DEFINE([RGB_DB], $db_path, [set to location of rgb database (without any file type suffix)])
49db_file=`basename $db_path`
50db_dir=`dirname $db_path`
51AC_SUBST([db_file])
52AC_SUBST([db_dir])
53
54AC_MSG_CHECKING([for rgb database format])
55AC_ARG_WITH([rgb-db-type],
56	AC_HELP_STRING([--with-rgb-db-type=(text|dbm|ndbm)],
57		[rgb database type (default is text)]),
58	[db_type=$withval], [db_type="text"])
59AC_MSG_RESULT([$db_type])
60
61RGB_DB_TYPE=$db_type
62
63case $db_type in
64	text)
65		RGB_DB_FILES=""
66		AC_DEFINE([USE_RGB_TXT], [1],
67			[Define to 1 to use plain text files for rgb database])
68		;;
69	dbm)
70		AC_SEARCH_LIBS([dbminit], [db dbm nsl], [],
71				AC_MSG_ERROR([dbm requested but dbminit() not found in any libraries]))
72		AC_CHECK_HEADER([dbm.h], [DBM_HEADER='<dbm.h>'],
73		  [AC_CHECK_HEADER([rpcsvc/dbm.h], [DBM_HEADER='<rpcsvc/dbm.h>'],
74		    [AC_MSG_ERROR([dbm requested but dbm.h not found])])])
75		PKG_CHECK_MODULES(XORG, [xorg-server])
76		RGB_CFLAGS="$RGB_CFLAGS $XORG_CFLAGS"
77		RGB_DB_FILES='$(db_file).dir $(db_file).pag'
78		;;
79	ndbm)
80		# Find a dbm or ndbm implementation
81		AC_SEARCH_LIBS([dbm_open], [db ndbm dbm],
82				AC_DEFINE([NDBM], [1],
83				 [Define to 1 if you have ndbm.h interfaces]),
84				AC_MSG_ERROR([ndbm requested but dbm_open() not found in any libraries]))
85		DBM_HEADER='<ndbm.h>'
86		PKG_CHECK_MODULES(XORG, [xorg-server])
87		RGB_CFLAGS="$RGB_CFLAGS $XORG_CFLAGS"
88		RGB_DB_FILES='$(db_file).dir $(db_file).pag'
89		;;
90esac
91if test x$DBM_HEADER != x ; then
92  AC_DEFINE_UNQUOTED([DBM_HEADER], [$DBM_HEADER], 
93		     [Header file to include for dbm functions])
94fi
95AC_SUBST([RGB_DB_TYPE])
96AC_SUBST([RGB_DB_FILES])
97AM_CONDITIONAL(RGB_DB, [test x$db_type != xtext])
98
99AC_SUBST(RGB_CFLAGS)
100
101XORG_MANPAGE_SECTIONS
102XORG_RELEASE_VERSION
103
104AC_OUTPUT([Makefile])
105