configure.ac revision 7253c0c7
1a73027baSmrgdnl  Copyright 2005 Red Hat, Inc.
2a73027baSmrgdnl 
3a73027baSmrgdnl  Permission to use, copy, modify, distribute, and sell this software and its
4a73027baSmrgdnl  documentation for any purpose is hereby granted without fee, provided that
5a73027baSmrgdnl  the above copyright notice appear in all copies and that both that
6a73027baSmrgdnl  copyright notice and this permission notice appear in supporting
7a73027baSmrgdnl  documentation, and that the name of Red Hat not be used in
8a73027baSmrgdnl  advertising or publicity pertaining to distribution of the software without
9a73027baSmrgdnl  specific, written prior permission.  Red Hat makes no
10a73027baSmrgdnl  representations about the suitability of this software for any purpose.  It
11a73027baSmrgdnl  is provided "as is" without express or implied warranty.
12a73027baSmrgdnl 
13a73027baSmrgdnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14a73027baSmrgdnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15a73027baSmrgdnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16a73027baSmrgdnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17a73027baSmrgdnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18a73027baSmrgdnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19a73027baSmrgdnl  PERFORMANCE OF THIS SOFTWARE.
20a73027baSmrgdnl
21a73027baSmrgdnl Process this file with autoconf to create configure.
22a73027baSmrg
23c81d8f5eSmrg# Initialize Autoconf
2429004570SmrgAC_PREREQ([2.60])
257253c0c7SmrgAC_INIT([xinit], [1.3.4],
2629004570Smrg        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xinit])
27c81d8f5eSmrgAC_CONFIG_SRCDIR([Makefile.am])
28c81d8f5eSmrgAC_CONFIG_HEADERS([config.h])
29c81d8f5eSmrg
30c81d8f5eSmrg# Initialize Automake
31bf4a254eSmrgAM_INIT_AUTOMAKE([foreign dist-bzip2])
32a73027baSmrg
337253c0c7Smrg# Require X.Org macros 1.19 or later for TRADITIONALCPPFLAGS
34bf4a254eSmrgm4_ifndef([XORG_MACROS_VERSION],
357253c0c7Smrg          [m4_fatal([must install xorg-macros 1.19 or later before running autoconf/autogen])])
367253c0c7SmrgXORG_MACROS_VERSION(1.19)
37bf4a254eSmrgXORG_DEFAULT_OPTIONS
38bf4a254eSmrg
39a73027baSmrgXORG_PROG_RAWCPP
40a73027baSmrgAC_CANONICAL_HOST
41a73027baSmrg
42a73027baSmrg# Build options
43a73027baSmrgDEFAULT_XRDB=xrdb
44a73027baSmrgDEFAULT_XMODMAP=xmodmap
45a73027baSmrgDEFAULT_TWM=twm
46a73027baSmrgDEFAULT_XCLOCK=xclock
47a73027baSmrgDEFAULT_XTERM=xterm
48a73027baSmrg# You always want to specify the full path to the X server
49a73027baSmrgDEFAULT_XSERVER=${bindir}/X
50a73027baSmrgDEFAULT_XAUTH=xauth
51a73027baSmrgDEFAULT_XINIT=xinit
526f02d4e9SmrgDEFAULT_XINITDIR=${sysconfdir}/X11/xinit
53a73027baSmrg
54a73027baSmrgAC_ARG_WITH(xrdb,
55a73027baSmrg	 AS_HELP_STRING([--with-xrdb=XRDB], [Path to xrdb]),
56a73027baSmrg	[XRDB="$withval"],
57a73027baSmrg	[XRDB="$DEFAULT_XRDB"])
58a73027baSmrg
59a73027baSmrgAC_ARG_WITH(xmodmap,
60a73027baSmrg	 AS_HELP_STRING([--with-xmodmap=XMODMAP], [Path to xmodmap]),
61a73027baSmrg	[XMODMAP="$withval"],
62a73027baSmrg	[XMODMAP="$DEFAULT_XMODMAP"])
63a73027baSmrg
64a73027baSmrgAC_ARG_WITH(twm,
65a73027baSmrg	 AS_HELP_STRING([--with-twm=TWM], [Path to twm]),
66a73027baSmrg	[TWM="$withval"],
67a73027baSmrg	[TWM="$DEFAULT_TWM"])
68a73027baSmrg
69a73027baSmrgAC_ARG_WITH(xclock,
70a73027baSmrg	 AS_HELP_STRING([--with-xclock=XCLOCK], [Path to xclock]),
71a73027baSmrg	[XCLOCK="$withval"],
72a73027baSmrg	[XCLOCK="$DEFAULT_XCLOCK"])
73a73027baSmrg
74a73027baSmrgAC_ARG_WITH(xterm,
75a73027baSmrg	 AS_HELP_STRING([--with-xterm=XTERM], [Path to xterm]),
76a73027baSmrg	[XTERM="$withval"],
77a73027baSmrg	[XTERM="$DEFAULT_XTERM"])
78a73027baSmrg
79a73027baSmrgAC_ARG_WITH(xserver,
80a73027baSmrg	 AS_HELP_STRING([--with-xserver=XSERVER], [Path to default X server]),
81a73027baSmrg	[XSERVER="$withval"],
82a73027baSmrg	[XSERVER="$DEFAULT_XSERVER"])
83a73027baSmrg
84a73027baSmrgAC_ARG_WITH(xauth,
85a73027baSmrg	 AS_HELP_STRING([--with-xauth=XAUTH], [Path to xauth]),
86a73027baSmrg	[XAUTH="$withval"],
87a73027baSmrg	[XAUTH="$DEFAULT_XAUTH"])
88a73027baSmrg
89a73027baSmrgAC_ARG_WITH(xinit,
90a73027baSmrg	 AS_HELP_STRING([--with-xinit=XINIT], [Path to xinit]),
91a73027baSmrg	[XINIT="$withval"],
92a73027baSmrg	[XINIT="$DEFAULT_XINIT"])
93a73027baSmrg
94bf4a254eSmrgAC_ARG_WITH(xinitdir,
95bf4a254eSmrg	 AS_HELP_STRING([--with-xinitdir=XINITDIR], [Path to xinitdir]),
96bf4a254eSmrg	[XINITDIR="$withval"],
97bf4a254eSmrg	[XINITDIR="$DEFAULT_XINITDIR"])
98bf4a254eSmrg
99a73027baSmrgAC_ARG_WITH(launchd,            AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
100a73027baSmrgAC_ARG_WITH(launchagents-dir,   AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
101a73027baSmrg                                [ launchagentsdir="${withval}" ],
102a73027baSmrg                                [ launchagentsdir="/Library/LaunchAgents" ])
10321212451SmrgAC_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)"]),
10421212451Smrg                                 [ launchagentxserver="${withval}" ],
10521212451Smrg                                 [ launchagentxserver="no" ])
106a73027baSmrgAC_ARG_WITH(launchdaemons-dir,  AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
107a73027baSmrg                                [ launchdaemonsdir="${withval}" ],
108a73027baSmrg                                [ launchdaemonsdir="/Library/LaunchDaemons" ])
109c81d8f5eSmrgAC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
110c81d8f5eSmrg                                [ bundleidprefix="${withval}" ],
111c81d8f5eSmrg                                [ bundleidprefix="org.x" ])
112c81d8f5eSmrgAC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
113c81d8f5eSmrg                                [ bundleidprefix="${withval}" ])
114a73027baSmrg
115a73027baSmrgif test "x$LAUNCHD" = "xauto"; then
116a73027baSmrg	unset LAUNCHD
11729004570Smrg	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
118a73027baSmrgfi
119a73027baSmrg
12072e81212SmrgTIGER_LAUNCHD=no
121a73027baSmrgif test "x$LAUNCHD" = "xyes" ; then
122a73027baSmrg	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
12372e81212Smrg	case $host_os in
12472e81212Smrg		darwin8*)
12572e81212Smrg			TIGER_LAUNCHD=yes
12672e81212Smrg		;;
12772e81212Smrg	esac
128c81d8f5eSmrg        AC_CHECK_FUNC(dispatch_async,
129c81d8f5eSmrg                              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
130c81d8f5eSmrg                              [])
131a73027baSmrgfi
132bf4a254eSmrg
133c81d8f5eSmrgAC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$bundleidprefix", [Prefix to use for launchd identifiers])
134a73027baSmrgAC_SUBST([launchagentsdir])
135a73027baSmrgAC_SUBST([launchdaemonsdir])
136c81d8f5eSmrgAC_SUBST([bundleidprefix])
13721212451SmrgAC_SUBST([launchagentxserver])
138a73027baSmrgAM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
13972e81212SmrgAM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
14021212451SmrgAM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
141a73027baSmrg
142a73027baSmrg# Checks for pkg-config packages
1436f02d4e9SmrgPKG_CHECK_MODULES(XINIT, x11 xproto >= 7.0.17)
144a73027baSmrg
145a73027baSmrgcase $host_os in
146a73027baSmrg    *bsd*)
147a73027baSmrg        XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
148a73027baSmrg        ;;
149a73027baSmrgesac
150a73027baSmrg
151a73027baSmrg
152a73027baSmrgAC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
153a73027baSmrg  [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
154a73027baSmrg
1556f02d4e9Smrg# If mcookie not found, try openssl, else per-system fallbacks
1566f02d4e9Smrgif test "x$MCOOKIE" = x ; then
1576f02d4e9Smrg    AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
1586f02d4e9Smrg        [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
1596f02d4e9Smrg    if test "x$OPENSSL" != x ; then
1606f02d4e9Smrg        MCOOKIE="$OPENSSL rand -hex 16"
1616f02d4e9Smrg    else
1626f02d4e9Smrg        case $host_os in
1636f02d4e9Smrg            *solaris*)
1646f02d4e9Smrg                MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
1656f02d4e9Smrg                ;;
1666f02d4e9Smrg        esac
1676f02d4e9Smrg    fi
1686f02d4e9Smrgfi
169a73027baSmrgif test "x$MCOOKIE" != x ; then
170a73027baSmrg	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
1716f02d4e9Smrg	AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
172a73027baSmrgfi
173a73027baSmrgAC_SUBST(STARTX_COOKIE_FLAGS)
174a73027baSmrg
175a73027baSmrg# Additional substitutions in startx, xinitrc & man pages
176bf4a254eSmrgSHELL_CMD="/bin/sh"
177bf4a254eSmrgXSERVERNAME="Xorg"
178bf4a254eSmrgXCONFIGFILE="xorg.conf"
179c81d8f5eSmrgXCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
180a73027baSmrgcase $host_os in
181bf4a254eSmrg    cygwin*)
182bf4a254eSmrg	XSERVERNAME="XWin"
183bf4a254eSmrg	XCONFIGFILE="XWinrc"
184bf4a254eSmrg	;;
185bf4a254eSmrg    darwin*)
186bf4a254eSmrg	XSERVERNAME="Xquartz"
187bf4a254eSmrg	XCONFIGFILE="defaults"
188bf4a254eSmrg	XCONFIGFILEMAN='defaults (1)'
189bf4a254eSmrg	;;
190a73027baSmrg    *solaris*)
191a73027baSmrg	SHELL_CMD="/bin/ksh"
192a73027baSmrg	;;
193a73027baSmrg    *sco*)
194a73027baSmrg	SHELL_CMD="/bin/ksh"
195c81d8f5eSmrg	SCOMAN=1
196a73027baSmrg	;;
197a73027baSmrgesac
198a73027baSmrgAC_SUBST(SHELL_CMD)
199c81d8f5eSmrgAC_SUBST(SCOMAN)
200bf4a254eSmrgAC_SUBST(XSERVERNAME)
201bf4a254eSmrgAC_SUBST(XCONFIGFILE)
202bf4a254eSmrgAC_SUBST(XCONFIGFILEMAN)
203a73027baSmrg
204a73027baSmrgAC_SUBST(XRDB)
205a73027baSmrgAC_SUBST(XMODMAP)
206a73027baSmrgAC_SUBST(TWM)
207a73027baSmrgAC_SUBST(XCLOCK)
208a73027baSmrgAC_SUBST(XTERM)
209a73027baSmrgAC_SUBST(XSERVER)
210a73027baSmrgAC_SUBST(XAUTH)
211a73027baSmrgAC_SUBST(XINIT)
212bf4a254eSmrgAC_SUBST(XINITDIR)
213a73027baSmrg
214c81d8f5eSmrgAC_CONFIG_FILES([Makefile
215c81d8f5eSmrg	man/Makefile
216c81d8f5eSmrg	launchd/Makefile
217c81d8f5eSmrg	launchd/privileged_startx/Makefile
218c81d8f5eSmrg	launchd/user_startx/Makefile])
219c81d8f5eSmrgAC_OUTPUT
220