configure.ac revision d73e0b87
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.4.0],
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])
32
33# Require X.Org macros 1.19 or later for TRADITIONALCPPFLAGS
34m4_ifndef([XORG_MACROS_VERSION],
35          [m4_fatal([must install xorg-macros 1.19 or later before running autoconf/autogen])])
36XORG_MACROS_VERSION(1.19)
37XORG_DEFAULT_OPTIONS
38
39XORG_PROG_RAWCPP
40AC_CANONICAL_HOST
41
42# Build options
43DEFAULT_XRDB=xrdb
44DEFAULT_XMODMAP=xmodmap
45DEFAULT_TWM=twm
46DEFAULT_XCLOCK=xclock
47DEFAULT_XTERM=xterm
48# You always want to specify the full path to the X server
49DEFAULT_XSERVER=${bindir}/X
50DEFAULT_XAUTH=xauth
51DEFAULT_XINIT=xinit
52DEFAULT_XINITDIR=${sysconfdir}/X11/xinit
53
54AC_ARG_WITH(xrdb,
55	 AS_HELP_STRING([--with-xrdb=XRDB], [Path to xrdb]),
56	[XRDB="$withval"],
57	[XRDB="$DEFAULT_XRDB"])
58
59AC_ARG_WITH(xmodmap,
60	 AS_HELP_STRING([--with-xmodmap=XMODMAP], [Path to xmodmap]),
61	[XMODMAP="$withval"],
62	[XMODMAP="$DEFAULT_XMODMAP"])
63
64AC_ARG_WITH(twm,
65	 AS_HELP_STRING([--with-twm=TWM], [Path to twm]),
66	[TWM="$withval"],
67	[TWM="$DEFAULT_TWM"])
68
69AC_ARG_WITH(xclock,
70	 AS_HELP_STRING([--with-xclock=XCLOCK], [Path to xclock]),
71	[XCLOCK="$withval"],
72	[XCLOCK="$DEFAULT_XCLOCK"])
73
74AC_ARG_WITH(xterm,
75	 AS_HELP_STRING([--with-xterm=XTERM], [Path to xterm]),
76	[XTERM="$withval"],
77	[XTERM="$DEFAULT_XTERM"])
78
79AC_ARG_WITH(xserver,
80	 AS_HELP_STRING([--with-xserver=XSERVER], [Path to default X server]),
81	[XSERVER="$withval"],
82	[XSERVER="$DEFAULT_XSERVER"])
83
84AC_ARG_WITH(xauth,
85	 AS_HELP_STRING([--with-xauth=XAUTH], [Path to xauth]),
86	[XAUTH="$withval"],
87	[XAUTH="$DEFAULT_XAUTH"])
88
89AC_ARG_WITH(xinit,
90	 AS_HELP_STRING([--with-xinit=XINIT], [Path to xinit]),
91	[XINIT="$withval"],
92	[XINIT="$DEFAULT_XINIT"])
93
94AC_ARG_WITH(xinitdir,
95	 AS_HELP_STRING([--with-xinitdir=XINITDIR], [Path to xinitdir]),
96	[XINITDIR="$withval"],
97	[XINITDIR="$DEFAULT_XINITDIR"])
98
99AC_ARG_WITH(launchd,            AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
100AC_ARG_WITH(launchagents-dir,   AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
101                                [ launchagentsdir="${withval}" ],
102                                [ launchagentsdir="/Library/LaunchAgents" ])
103AC_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)"]),
104                                 [ launchagentxserver="${withval}" ],
105                                 [ launchagentxserver="no" ])
106AC_ARG_WITH(launchdaemons-dir,  AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
107                                [ launchdaemonsdir="${withval}" ],
108                                [ launchdaemonsdir="/Library/LaunchDaemons" ])
109AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
110                                [ bundleidprefix="${withval}" ],
111                                [ bundleidprefix="org.x" ])
112AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
113                                [ bundleidprefix="${withval}" ])
114
115if test "x$LAUNCHD" = "xauto"; then
116	unset LAUNCHD
117	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
118fi
119
120TIGER_LAUNCHD=no
121if test "x$LAUNCHD" = "xyes" ; then
122	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
123	case $host_os in
124		darwin8*)
125			TIGER_LAUNCHD=yes
126		;;
127	esac
128        AC_CHECK_FUNC(dispatch_async,
129                              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
130                              [])
131fi
132
133AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$bundleidprefix", [Prefix to use for launchd identifiers])
134AC_SUBST([launchagentsdir])
135AC_SUBST([launchdaemonsdir])
136AC_SUBST([bundleidprefix])
137AC_SUBST([launchagentxserver])
138AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
139AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
140AM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
141
142# Checks for pkg-config packages
143PKG_CHECK_MODULES(XINIT, x11 xproto >= 7.0.17)
144
145case $host_os in
146    *bsd*)
147        XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
148        ;;
149esac
150
151
152AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
153  [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
154
155# If mcookie not found, try openssl, else per-system fallbacks
156if test "x$MCOOKIE" = x ; then
157    AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
158        [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
159    if test "x$OPENSSL" != x ; then
160        MCOOKIE="$OPENSSL rand -hex 16"
161    else
162        case $host_os in
163            *solaris*)
164                MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
165                ;;
166        esac
167    fi
168fi
169if test "x$MCOOKIE" != x ; then
170	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
171	AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
172fi
173AC_SUBST(STARTX_COOKIE_FLAGS)
174
175# Additional substitutions in startx, xinitrc & man pages
176SHELL_CMD="/bin/sh"
177XSERVERNAME="Xorg"
178XCONFIGFILE="xorg.conf"
179XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
180case $host_os in
181    cygwin*)
182	XSERVERNAME="XWin"
183	XCONFIGFILE="XWinrc"
184	;;
185    darwin*)
186	XSERVERNAME="Xquartz"
187	XCONFIGFILE="defaults"
188	XCONFIGFILEMAN='defaults (1)'
189	;;
190    *solaris*)
191	SHELL_CMD="/bin/ksh"
192	;;
193esac
194AC_SUBST(SHELL_CMD)
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