configure.ac revision 61c899d4
1dnl Copyright (c) 2005, Oracle and/or its affiliates. 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 "Software"),
5dnl to deal in the Software without restriction, including without limitation
6dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
7dnl and/or sell copies of the Software, and to permit persons to whom the
8dnl Software is furnished to do so, subject to the following conditions:
9dnl
10dnl The above copyright notice and this permission notice (including the next
11dnl paragraph) shall be included in all copies or substantial portions of the
12dnl Software.
13dnl
14dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20dnl DEALINGS IN THE SOFTWARE.
21dnl
22dnl Process this file with autoconf to create configure.
23
24# Initialize Autoconf
25AC_PREREQ([2.60])
26AC_INIT([rgb], [1.0.5],
27	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [rgb])
28AC_CONFIG_SRCDIR([Makefile.am])
29AC_CONFIG_HEADERS([config.h])
30
31# Initialize Automake
32AM_INIT_AUTOMAKE([foreign dist-bzip2])
33AM_MAINTAINER_MODE
34
35# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
36m4_ifndef([XORG_MACROS_VERSION],
37	  [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
38XORG_MACROS_VERSION(1.8)
39XORG_DEFAULT_OPTIONS
40
41PKG_CHECK_MODULES(RGB, xproto)
42
43AC_MSG_CHECKING([for rgb database location])
44AC_ARG_WITH([rgb-db-dir],
45	AS_HELP_STRING([--with-rgb-db-dir=<path>],
46		[rgb database location (default is ${datadir}/X11/rgb)]),
47	[db_path=$withval], [db_path=${datadir}/X11/rgb])
48AC_MSG_RESULT([$db_path])
49dnl XXX not working - AC_DEFINE([RGB_DB], $db_path, [set to location of rgb database (without any file type suffix)])
50db_file=`basename $db_path`
51db_dir=`dirname $db_path`
52AC_SUBST([db_file])
53AC_SUBST([db_dir])
54
55AC_MSG_CHECKING([for rgb database format])
56AC_ARG_WITH([rgb-db-type],
57	AS_HELP_STRING([--with-rgb-db-type=(text|dbm|ndbm)],
58		[rgb database type (default is text)]),
59	[db_type=$withval], [db_type="text"])
60AC_MSG_RESULT([$db_type])
61
62RGB_DB_TYPE=$db_type
63
64case $db_type in
65	text)
66		RGB_DB_FILES=""
67		AC_DEFINE([USE_RGB_TXT], [1],
68			[Define to 1 to use plain text files for rgb database])
69		;;
70	dbm)
71		AC_SEARCH_LIBS([dbminit], [db dbm nsl], [],
72				AC_MSG_ERROR([dbm requested but dbminit() not found in any libraries]))
73		AC_CHECK_HEADER([dbm.h], [DBM_HEADER='<dbm.h>'],
74		  [AC_CHECK_HEADER([rpcsvc/dbm.h], [DBM_HEADER='<rpcsvc/dbm.h>'],
75		    [AC_MSG_ERROR([dbm requested but dbm.h not found])])])
76		PKG_CHECK_MODULES(XORG, [xorg-server])
77		RGB_CFLAGS="$RGB_CFLAGS $XORG_CFLAGS"
78		RGB_DB_FILES='$(db_file).dir $(db_file).pag'
79		;;
80	ndbm)
81		# Find a dbm or ndbm implementation
82		AC_SEARCH_LIBS([dbm_open], [db ndbm dbm],
83				AC_DEFINE([NDBM], [1],
84				 [Define to 1 if you have ndbm.h interfaces]),
85				AC_MSG_ERROR([ndbm requested but dbm_open() not found in any libraries]))
86		DBM_HEADER='<ndbm.h>'
87		PKG_CHECK_MODULES(XORG, [xorg-server])
88		RGB_CFLAGS="$RGB_CFLAGS $XORG_CFLAGS"
89		RGB_DB_FILES='$(db_file).dir $(db_file).pag'
90		;;
91esac
92if test x$DBM_HEADER != x ; then
93  AC_DEFINE_UNQUOTED([DBM_HEADER], [$DBM_HEADER],
94		     [Header file to include for dbm functions])
95fi
96AC_SUBST([RGB_DB_TYPE])
97AC_SUBST([RGB_DB_FILES])
98AM_CONDITIONAL(RGB_DB, [test x$db_type != xtext])
99
100AC_CONFIG_FILES([Makefile
101                 man/Makefile])
102
103AC_OUTPUT
104