configure.ac revision 21212451
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([xinit], [1.3.2],
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xinit])
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 AC_PROG_SED in XORG_DEFAULT_OPTIONS
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
40XORG_PROG_RAWCPP
41AC_CANONICAL_HOST
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(launchagent-xserver, AS_HELP_STRING([--with-launchagent-xserver=PATH], [Path to the X server which the LaunchAgent should start (if not provided, let startx decide)"]),
105                                 [ launchagentxserver="${withval}" ],
106                                 [ launchagentxserver="no" ])
107AC_ARG_WITH(launchdaemons-dir,  AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
108                                [ launchdaemonsdir="${withval}" ],
109                                [ launchdaemonsdir="/Library/LaunchDaemons" ])
110AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
111                                [ bundleidprefix="${withval}" ],
112                                [ bundleidprefix="org.x" ])
113AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
114                                [ bundleidprefix="${withval}" ])
115
116if test "x$LAUNCHD" = "xauto"; then
117	unset LAUNCHD
118	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
119fi
120
121TIGER_LAUNCHD=no
122if test "x$LAUNCHD" = "xyes" ; then
123	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
124	case $host_os in
125		darwin8*)
126			TIGER_LAUNCHD=yes
127		;;
128	esac
129        AC_CHECK_FUNC(dispatch_async,
130                              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
131                              [])
132fi
133
134AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$bundleidprefix", [Prefix to use for launchd identifiers])
135AC_SUBST([launchagentsdir])
136AC_SUBST([launchdaemonsdir])
137AC_SUBST([bundleidprefix])
138AC_SUBST([launchagentxserver])
139AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
140AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
141AM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
142
143# Checks for pkg-config packages
144PKG_CHECK_MODULES(XINIT, x11)
145
146case $host_os in
147    *bsd*)
148        XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
149        ;;
150esac
151
152
153AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
154  [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
155
156case $host_os in
157	*openbsd*)
158	MCOOKIE='/usr/sbin/openssl rand -hex 16'
159	;;
160	*solaris*)
161	MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
162	;;
163esac
164
165if test "x$MCOOKIE" != x ; then
166	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
167fi
168AC_SUBST(STARTX_COOKIE_FLAGS)
169
170# Additional substitutions in startx, xinitrc & man pages
171SHELL_CMD="/bin/sh"
172XSERVERNAME="Xorg"
173XCONFIGFILE="xorg.conf"
174XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
175case $host_os in
176    cygwin*)
177	XSERVERNAME="XWin"
178	XCONFIGFILE="XWinrc"
179	;;
180    darwin*)
181	XSERVERNAME="Xquartz"
182	XCONFIGFILE="defaults"
183	XCONFIGFILEMAN='defaults (1)'
184	;;
185    *solaris*)
186	SHELL_CMD="/bin/ksh"
187	;;
188    *sco*)
189	SHELL_CMD="/bin/ksh"
190	SCOMAN=1
191	;;
192esac
193AC_SUBST(SHELL_CMD)
194AC_SUBST(SCOMAN)
195AC_SUBST(XSERVERNAME)
196AC_SUBST(XCONFIGFILE)
197AC_SUBST(XCONFIGFILEMAN)
198
199AC_SUBST(XRDB)
200AC_SUBST(XMODMAP)
201AC_SUBST(TWM)
202AC_SUBST(XCLOCK)
203AC_SUBST(XTERM)
204AC_SUBST(XSERVER)
205AC_SUBST(XAUTH)
206AC_SUBST(XINIT)
207AC_SUBST(XINITDIR)
208
209AC_CONFIG_FILES([Makefile
210	man/Makefile
211	launchd/Makefile
212	launchd/privileged_startx/Makefile
213	launchd/user_startx/Makefile])
214AC_OUTPUT
215