configure.ac revision 5bd32fd1
1dnl  Copyright 2005 Red Hat, Inc.
2dnl 
3dnl  Permission to use, copy, modify, distribute, and sell this software and its
4dnl  documentation for any purpose is hereby granted without fee, provided that
5dnl  the above copyright notice appear in all copies and that both that
6dnl  copyright notice and this permission notice appear in supporting
7dnl  documentation, and that the name of Red Hat not be used in
8dnl  advertising or publicity pertaining to distribution of the software without
9dnl  specific, written prior permission.  Red Hat makes no
10dnl  representations about the suitability of this software for any purpose.  It
11dnl  is provided "as is" without express or implied warranty.
12dnl 
13dnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15dnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19dnl  PERFORMANCE OF THIS SOFTWARE.
20dnl
21dnl Process this file with autoconf to create configure.
22
23# Initialize Autoconf
24AC_PREREQ([2.60])
25AC_INIT([xrdb], [1.0.7],
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xrdb])
27AC_CONFIG_SRCDIR([Makefile.am])
28AC_CONFIG_HEADERS([config.h])
29
30# Initialize Automake
31AM_INIT_AUTOMAKE([foreign dist-bzip2])
32AM_MAINTAINER_MODE
33
34# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
35m4_ifndef([XORG_MACROS_VERSION],
36	  [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
37XORG_MACROS_VERSION(1.8)
38XORG_DEFAULT_OPTIONS
39
40AC_CHECK_FUNC([mkstemp], 
41   AC_DEFINE(HAS_MKSTEMP,1,[Define to 1 if you have the 'mkstemp' function.]))
42
43# Find MAXHOSTNAMELEN definition
44# Common hidey holes:
45#  BSD & Linux - <sys/param.h>
46#  Solaris - <netdb.h>
47
48AC_CHECK_DECL([MAXHOSTNAMELEN],[FOUND_MAXHOSTNAMELEN=yes])
49
50if test x$FOUND_MAXHOSTNAMELEN != xyes ; then
51	AC_MSG_CHECKING([for header that defines MAXHOSTNAMELEN])
52
53	FOUND_MAXHOSTNAMELEN='not found'
54
55	AC_COMPILE_IFELSE(
56	    AC_LANG_PROGRAM([#include <sys/param.h>],
57			    [int h = MAXHOSTNAMELEN;]),
58	    [FOUND_MAXHOSTNAMELEN='sys/param.h'
59	     AC_DEFINE(NEED_SYS_PARAM_H,1,
60	       [Define to 1 if you need <sys/param.h> to define MAXHOSTNAMELEN])])
61
62	AC_COMPILE_IFELSE(
63	    AC_LANG_PROGRAM([#include <netdb.h>],
64			    [int h = MAXHOSTNAMELEN;]),
65	    [FOUND_MAXHOSTNAMELEN='netdb.h'
66	     AC_DEFINE(NEED_NETDB_H,1,
67	       [Define to 1 if you need <netdb.h> to define MAXHOSTNAMELEN])])
68
69	AC_MSG_RESULT([$FOUND_MAXHOSTNAMELEN])
70fi
71
72# xrdb needs to know where to find cpp at runtime - previously set as CppCmd
73# in Imake config files for each OS
74AC_ARG_WITH([cpp], 
75	AC_HELP_STRING([--with-cpp=path],
76		       [comma-separated list of paths to cpp command for xrdb to use at runtime]), 
77	[AC_MSG_CHECKING(for cpp)
78	CPP_PATH=$withval
79	AC_MSG_RESULT(--with-cpp specified $CPP_PATH)], 
80	[AC_PATH_PROG([CPP_PATH],[cpp], [cpp], 
81 [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])])
82CPP_PATH=`echo ${CPP_PATH} | sed 's/,/\\",\\"/g'`
83AC_DEFINE_UNQUOTED([CPP], "$CPP_PATH", [Path to CPP program])
84
85# Checks for pkg-config packages
86PKG_CHECK_MODULES(XRDB, xmuu x11)
87
88AC_OUTPUT([Makefile])
89