configure.ac revision fd549268
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.3],
26        [https://gitlab.freedesktop.org/xorg/app/xinit/-/issues], [xinit])
27AC_CONFIG_SRCDIR([Makefile.am])
28AC_CONFIG_HEADERS([config.h])
29AC_USE_SYSTEM_EXTENSIONS
30
31# Initialize Automake
32AM_INIT_AUTOMAKE([foreign dist-xz])
33
34# Require X.Org macros 1.19 or later for TRADITIONALCPPFLAGS
35m4_ifndef([XORG_MACROS_VERSION],
36          [m4_fatal([must install xorg-macros 1.19 or later before running autoconf/autogen])])
37XORG_MACROS_VERSION(1.19)
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
121AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$bundleidprefix", [Prefix to use for launchd identifiers])
122AC_SUBST([launchagentsdir])
123AC_SUBST([launchdaemonsdir])
124AC_SUBST([bundleidprefix])
125AC_SUBST([launchagentxserver])
126AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
127AM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
128
129# Checks for library functions.
130AC_CHECK_FUNCS([asprintf])
131
132# Checks for pkg-config packages
133PKG_CHECK_MODULES(XINIT, x11 xproto >= 7.0.22)
134
135case $host_os in
136    *bsd*)
137        XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
138        ;;
139esac
140
141
142AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
143  [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
144
145# If mcookie not found, try openssl, else per-system fallbacks
146if test "x$MCOOKIE" = x ; then
147    AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
148        [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
149    if test "x$OPENSSL" != x ; then
150        MCOOKIE="$OPENSSL rand -hex 16"
151    else
152        case $host_os in
153            *solaris*)
154                MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
155                ;;
156        esac
157    fi
158fi
159if test "x$MCOOKIE" != x ; then
160	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
161	AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
162fi
163AC_SUBST(STARTX_COOKIE_FLAGS)
164
165# Additional substitutions in startx, xinitrc & man pages
166SHELL_CMD="/bin/sh"
167XSERVERNAME="Xorg"
168XCONFIGFILE="xorg.conf"
169XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
170case $host_os in
171    cygwin*)
172	XSERVERNAME="XWin"
173	XCONFIGFILE="XWinrc"
174	;;
175    darwin*)
176	XSERVERNAME="Xquartz"
177	XCONFIGFILE="defaults"
178	XCONFIGFILEMAN='defaults (1)'
179	;;
180    *solaris*)
181	SHELL_CMD="/bin/ksh"
182	;;
183esac
184AC_SUBST(SHELL_CMD)
185AC_SUBST(XSERVERNAME)
186AC_SUBST(XCONFIGFILE)
187AC_SUBST(XCONFIGFILEMAN)
188
189AC_SUBST(XRDB)
190AC_SUBST(XMODMAP)
191AC_SUBST(TWM)
192AC_SUBST(XCLOCK)
193AC_SUBST(XTERM)
194AC_SUBST(XSERVER)
195AC_SUBST(XAUTH)
196AC_SUBST(XINIT)
197AC_SUBST(XINITDIR)
198
199AC_CONFIG_FILES([Makefile
200	man/Makefile
201	launchd/Makefile
202	launchd/privileged_startx/Makefile
203	launchd/user_startx/Makefile])
204AC_OUTPUT
205