configure.ac revision 29004570
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
23AC_PREREQ([2.60])
24AC_INIT([xinit], [1.3.0],
25        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xinit])
26AM_INIT_AUTOMAKE([foreign dist-bzip2])
27AM_MAINTAINER_MODE
28
29# Require X.Org macros 1.8 or later for AC_PROG_SED in XORG_DEFAULT_OPTIONS
30m4_ifndef([XORG_MACROS_VERSION],
31          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
32XORG_MACROS_VERSION(1.8)
33XORG_DEFAULT_OPTIONS
34
35AM_CONFIG_HEADER(config.h)
36
37XORG_PROG_RAWCPP
38AC_CANONICAL_HOST
39
40m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
41
42
43# Build options
44DEFAULT_XRDB=xrdb
45DEFAULT_XMODMAP=xmodmap
46DEFAULT_TWM=twm
47DEFAULT_XCLOCK=xclock
48DEFAULT_XTERM=xterm
49# You always want to specify the full path to the X server
50DEFAULT_XSERVER=${bindir}/X
51DEFAULT_XAUTH=xauth
52DEFAULT_XINIT=xinit
53DEFAULT_XINITDIR=${libdir}/X11/xinit
54
55AC_ARG_WITH(xrdb,
56	 AS_HELP_STRING([--with-xrdb=XRDB], [Path to xrdb]),
57	[XRDB="$withval"],
58	[XRDB="$DEFAULT_XRDB"])
59
60AC_ARG_WITH(xmodmap,
61	 AS_HELP_STRING([--with-xmodmap=XMODMAP], [Path to xmodmap]),
62	[XMODMAP="$withval"],
63	[XMODMAP="$DEFAULT_XMODMAP"])
64
65AC_ARG_WITH(twm,
66	 AS_HELP_STRING([--with-twm=TWM], [Path to twm]),
67	[TWM="$withval"],
68	[TWM="$DEFAULT_TWM"])
69
70AC_ARG_WITH(xclock,
71	 AS_HELP_STRING([--with-xclock=XCLOCK], [Path to xclock]),
72	[XCLOCK="$withval"],
73	[XCLOCK="$DEFAULT_XCLOCK"])
74
75AC_ARG_WITH(xterm,
76	 AS_HELP_STRING([--with-xterm=XTERM], [Path to xterm]),
77	[XTERM="$withval"],
78	[XTERM="$DEFAULT_XTERM"])
79
80AC_ARG_WITH(xserver,
81	 AS_HELP_STRING([--with-xserver=XSERVER], [Path to default X server]),
82	[XSERVER="$withval"],
83	[XSERVER="$DEFAULT_XSERVER"])
84
85AC_ARG_WITH(xauth,
86	 AS_HELP_STRING([--with-xauth=XAUTH], [Path to xauth]),
87	[XAUTH="$withval"],
88	[XAUTH="$DEFAULT_XAUTH"])
89
90AC_ARG_WITH(xinit,
91	 AS_HELP_STRING([--with-xinit=XINIT], [Path to xinit]),
92	[XINIT="$withval"],
93	[XINIT="$DEFAULT_XINIT"])
94
95AC_ARG_WITH(xinitdir,
96	 AS_HELP_STRING([--with-xinitdir=XINITDIR], [Path to xinitdir]),
97	[XINITDIR="$withval"],
98	[XINITDIR="$DEFAULT_XINITDIR"])
99
100AC_ARG_WITH(launchd,            AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
101AC_ARG_WITH(launchagents-dir,   AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
102                                [ launchagentsdir="${withval}" ],
103                                [ launchagentsdir="/Library/LaunchAgents" ])
104AC_ARG_WITH(launchdaemons-dir,  AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
105                                [ launchdaemonsdir="${withval}" ],
106                                [ launchdaemonsdir="/Library/LaunchDaemons" ])
107AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
108                                [ launchdidprefix="${withval}" ],
109                                [ launchdidprefix="org.x" ])
110
111if test "x$LAUNCHD" = "xauto"; then
112	unset LAUNCHD
113	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
114fi
115
116TIGER_LAUNCHD=no
117if test "x$LAUNCHD" = "xyes" ; then
118	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
119	case $host_os in
120		darwin8*)
121			TIGER_LAUNCHD=yes
122		;;
123	esac
124else
125        launchagentsdir=""
126        launchdaemonsdir=""
127fi
128
129AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$launchdidprefix", [Prefix to use for launchd identifiers])
130AC_SUBST([launchagentsdir])
131AC_SUBST([launchdaemonsdir])
132AC_SUBST([launchdidprefix])
133AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
134AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
135
136# Checks for pkg-config packages
137PKG_CHECK_MODULES(XINIT, x11)
138
139case $host_os in
140    *bsd*)
141        XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
142        ;;
143esac
144
145AC_SUBST(XINIT_CFLAGS)
146AC_SUBST(XINIT_LIBS)
147
148AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
149  [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
150
151case $host_os in
152	*openbsd*)
153	MCOOKIE='/usr/sbin/openssl rand -hex 16'
154	;;
155	*solaris*)
156	MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
157	;;
158esac
159
160if test "x$MCOOKIE" != x ; then
161	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
162fi
163AC_SUBST(STARTX_COOKIE_FLAGS)
164
165# Additional substitutions in startx, xinitrc & man pages
166ARCHMANDEFS=""
167SHELL_CMD="/bin/sh"
168XSERVERNAME="Xorg"
169XCONFIGFILE="xorg.conf"
170XCONFIGFILEMAN='${XCONFIGFILE} (__filemansuffix__)'
171case $host_os in
172    cygwin*)
173	XSERVERNAME="XWin"
174	XCONFIGFILE="XWinrc"
175	;;
176    darwin*)
177	XSERVERNAME="Xquartz"
178	XCONFIGFILE="defaults"
179	XCONFIGFILEMAN='defaults (1)'
180	;;
181    *solaris*)
182	SHELL_CMD="/bin/ksh"
183	;;
184    *sco*)
185	SHELL_CMD="/bin/ksh"
186	ARCHMANDEFS="-D__SCOMAN__"
187	;;
188esac
189AC_SUBST(SHELL_CMD)
190AC_SUBST(ARCHMANDEFS)
191AC_SUBST(XSERVERNAME)
192AC_SUBST(XCONFIGFILE)
193AC_SUBST(XCONFIGFILEMAN)
194
195AC_SUBST(XRDB)
196AC_SUBST(XMODMAP)
197AC_SUBST(TWM)
198AC_SUBST(XCLOCK)
199AC_SUBST(XTERM)
200AC_SUBST(XSERVER)
201AC_SUBST(XAUTH)
202AC_SUBST(XINIT)
203AC_SUBST(XINITDIR)
204
205AC_OUTPUT([Makefile])
206AC_OUTPUT([privileged_startx/Makefile])
207