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