configure.ac revision 6f02d4e9
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.3],
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=${sysconfdir}/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 xproto >= 7.0.17)
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
156# If mcookie not found, try openssl, else per-system fallbacks
157if test "x$MCOOKIE" = x ; then
158    AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
159        [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
160    if test "x$OPENSSL" != x ; then
161        MCOOKIE="$OPENSSL rand -hex 16"
162    else
163        case $host_os in
164            *openbsd*)
165                MCOOKIE='/usr/sbin/openssl rand -hex 16'
166                ;;
167            *solaris*)
168                MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
169                ;;
170        esac
171    fi
172fi
173if test "x$MCOOKIE" != x ; then
174	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
175	AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
176fi
177AC_SUBST(STARTX_COOKIE_FLAGS)
178
179# Additional substitutions in startx, xinitrc & man pages
180SHELL_CMD="/bin/sh"
181XSERVERNAME="Xorg"
182XCONFIGFILE="xorg.conf"
183XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
184case $host_os in
185    cygwin*)
186	XSERVERNAME="XWin"
187	XCONFIGFILE="XWinrc"
188	;;
189    darwin*)
190	XSERVERNAME="Xquartz"
191	XCONFIGFILE="defaults"
192	XCONFIGFILEMAN='defaults (1)'
193	;;
194    *solaris*)
195	SHELL_CMD="/bin/ksh"
196	;;
197    *sco*)
198	SHELL_CMD="/bin/ksh"
199	SCOMAN=1
200	;;
201esac
202AC_SUBST(SHELL_CMD)
203AC_SUBST(SCOMAN)
204AC_SUBST(XSERVERNAME)
205AC_SUBST(XCONFIGFILE)
206AC_SUBST(XCONFIGFILEMAN)
207
208AC_SUBST(XRDB)
209AC_SUBST(XMODMAP)
210AC_SUBST(TWM)
211AC_SUBST(XCLOCK)
212AC_SUBST(XTERM)
213AC_SUBST(XSERVER)
214AC_SUBST(XAUTH)
215AC_SUBST(XINIT)
216AC_SUBST(XINITDIR)
217
218AC_CONFIG_FILES([Makefile
219	man/Makefile
220	launchd/Makefile
221	launchd/privileged_startx/Makefile
222	launchd/user_startx/Makefile])
223AC_OUTPUT
224