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([xdm], [1.1.17],
26        [https://gitlab.freedesktop.org/xorg/app/xdm/-/issues], [xdm])
27AC_USE_SYSTEM_EXTENSIONS
28AC_CONFIG_SRCDIR([Makefile.am])
29AC_CONFIG_MACRO_DIR([m4])
30AC_CONFIG_HEADERS(config.h)
31
32# Initialize Automake
33AM_INIT_AUTOMAKE([foreign dist-xz])
34
35# Initialize libtool
36LT_INIT([disable-static dlopen])
37
38# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
39m4_ifndef([XORG_MACROS_VERSION],
40          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
41XORG_MACROS_VERSION(1.8)
42XORG_DEFAULT_OPTIONS
43XORG_PROG_RAWCPP
44XORG_WITH_LINT
45
46# Checks for programs.
47# Check for mktemp to prevent security issue noted in Xorg bug #5898
48# See https://bugs.freedesktop.org/show_bug.cgi?id=5898 for details.
49AC_PATH_PROG(MKTEMP_COMMAND, mktemp)
50AM_CONDITIONAL(HAVE_MKTEMP_COMMAND, test x$MKTEMP_COMMAND != x)
51
52#------------------------------------------------------------------------------
53#			Check for system libraries
54#
55# AC_SEARCH_LIBS: tests using $LIBS and tests again with each listed library.
56#                 pre-pends the found library to $LIBS.
57#
58#------------------------------------------------------------------------------
59
60PKG_CHECK_MODULES([XDM], [xmu x11 xau xproto >= 7.0.17])
61PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [:], [:])
62
63dnl Check in libbsd for functions that might be there if not already found
64dnl XDM_SEARCH_LIBBSD(FUNCTION, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
65AC_DEFUN([XDM_SEARCH_LIBBSD],[
66if test "x$ac_cv_search_$1" = "xno"; then
67    if test "x$LIBBSD_LIBS" != "x"; then
68        AC_MSG_CHECKING([for $1 in libbsd])
69        xdm_save_LIBS="$LIBS"
70        LIBS="$LIBS $[$2]_LIBS $LIBBSD_LIBS"
71        AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], [xdm_res="yes"], [xdm_res="no"])
72        LIBS="$xdm_save_LIBS"
73        AS_IF([test "x$xdm_res" = "xyes"], [
74            $2_CFLAGS="$[$2]_CFLAGS $LIBBSD_CFLAGS"
75            $2_LIBS="$[$2]_LIBS $LIBBSD_LIBS"
76            [$3]], [$4])
77        AC_MSG_RESULT([$xdm_res])
78    fi
79fi])
80
81# Function getifaddrs() comes from the C library, Solaris 11 -lsocket, or
82# the -lnsl name service library
83AC_SEARCH_LIBS([getifaddrs], [socket nsl])
84
85# Function getspnam() comes from the C library, System V -lsec, UnixWare 7 -lgen
86# or Old Linux versions -lshadow
87AC_SEARCH_LIBS([getspnam], [sec gen shadow])
88
89# Function setproctitle() is in BSD -lutil or GNU systems -lbsd but N/A on Solaris
90AC_SEARCH_LIBS([setproctitle], [util])
91XDM_SEARCH_LIBBSD([setproctitle], [XDM])
92
93# Function setusercontext() is in BSD -lutil but N/A on Solaris or GNU systems
94AC_SEARCH_LIBS([setusercontext], [util])
95
96# Function arc4random() is in BSD standard C, glibc 2.36+, or GNU systems -lbsd
97AC_SEARCH_LIBS([arc4random], [], [HAVE_ARC4RANDOM="yes"])
98XDM_SEARCH_LIBBSD([arc4random], [XDM], [HAVE_ARC4RANDOM="yes"])
99AC_SUBST(HAVE_ARC4RANDOM)
100AM_CONDITIONAL(HAVE_ARC4RANDOM, test x$HAVE_ARC4RANDOM = xyes)
101
102# Function crypt() comes from the C library or the -lcrypt data encryption library
103AC_SEARCH_LIBS(crypt, crypt)
104
105# Function dl() comes from the C library or -ldl
106AC_SEARCH_LIBS([dlopen], [dl])
107
108# Find needed libraries for TCP sockets (pre-pended in $LIBS)
109XTRANS_CONNECTION_FLAGS
110
111# Sets $SECURE_RPC to "yes" or "no" using libraries found above from $LIBS
112XTRANS_SECURE_RPC_FLAGS
113AM_CONDITIONAL(HAS_SECURE_RPC, test x$SECURE_RPC = xyes)
114
115#------------------------------------------------------------------------------
116
117# Checks for header files.
118AC_CHECK_HEADERS([grp.h syslog.h sys/param.h])
119AC_CHECK_DECL(key_setnet,
120	AC_DEFINE(HAVE_DECL_KEY_SETNET,1,
121	     [Define to 1 if your headers define the key_setnet() function.]),
122	[],[
123#include <rpc/rpc.h>
124#include <rpc/key_prot.h>
125])
126
127AC_CHECK_TYPES([struct sockaddr_storage], [], [], [
128AC_INCLUDES_DEFAULT
129#include <sys/socket.h>
130])
131
132# Check for system library functions
133# Required system libraries have been searched for and are listed in $LIBS
134AC_FUNC_FORK
135xdm_save_LIBS="$LIBS"
136LIBS="$LIBS $XDM_LIBS"
137AC_CHECK_FUNCS([daemon sigaction openlog asprintf setproctitle setusercontext \
138                mkstemp getifaddrs getspnam arc4random getaddrinfo inet_ntop])
139LIBS="$xdm_save_LIBS"
140
141# Check for pluggable authentication modules (PAM) support
142AC_ARG_WITH(pam, AS_HELP_STRING([--with-pam],
143	[Use PAM for authentication (default is autodetected)]),
144	[USE_PAM=$withval], [USE_PAM=auto])
145if test "x$USE_PAM" != "xno" ; then
146    AC_CHECK_HEADERS([security/pam_appl.h pam/pam_appl.h],
147                     [found=yes ; break ;], [found=no])
148    AS_IF([test "x$USE_PAM" = "xyes" -a  "x$found" = "xno"],
149	[AC_MSG_ERROR([PAM support requested, but we could not find the pam headers.])])
150    AC_SEARCH_LIBS([pam_open_session], [pam],
151	[AC_CHECK_FUNC([pam_open_session],
152	    [AC_DEFINE(USE_PAM,1,[Use PAM for authentication])]
153	)],
154	[AS_IF([test "x$USE_PAM" = "xyes"],
155	    [AC_MSG_ERROR([PAM support requested, but pam_open_session not found.])]
156	)]
157    )
158fi
159
160# Check for Security-Enhanced Linux (SELinux) support
161AC_ARG_WITH(selinux, AS_HELP_STRING([--with-selinux],
162	[Add support for SELinux (default is no support)]),
163	[USE_SELINUX=$withval], [USE_SELINUX=no])
164if test "x$USE_SELINUX" != "xno" ; then
165    AC_SEARCH_LIBS(is_selinux_enabled, [selinux],
166	[AC_CHECK_FUNC([is_selinux_enabled],
167	    [AC_DEFINE(USE_SELINUX,1,[Use Security-Enhanced Linux (SELinux) support])]
168	)],
169	[AS_IF([test "x$USE_SELINUX" = "xyes"],
170	    [AC_MSG_ERROR([SELinux support requested, but is_selinux_enabled not found.])]
171	)]
172    )
173fi
174
175# Check whether to install systemd unit files, as suggested in daemon(7).
176# When a full path is specified, this does not require systemd installed.
177AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
178	[Directory for systemd service files (default from the System and Service Manager)]),,
179	[with_systemdsystemunitdir=auto])
180AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
181    def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
182
183    AS_IF([test "x$def_systemdsystemunitdir" = "x"], [
184	AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], [
185	    AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])
186	])
187	with_systemdsystemunitdir=no
188    ], [
189	with_systemdsystemunitdir=$def_systemdsystemunitdir
190    ])
191])
192AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
193	AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
194])
195AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$with_systemdsystemunitdir" != "xno"])
196
197# Check whether to enable systemd startup notification.
198# This requires libsystemd.
199AC_ARG_WITH([systemd-daemon], AS_HELP_STRING([--with-systemd-daemon],
200	[Add support for systemd startup notification (default is autodetected)]),
201	[USE_SYSTEMD_DAEMON=$withval],
202        PKG_CHECK_EXISTS(libsystemd, [USE_SYSTEMD_DAEMON="yes"], [USE_SYSTEMD_DAEMON="no"]))
203AS_IF([test "x$USE_SYSTEMD_DAEMON" != "xno"], [
204    PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd],
205	[AC_DEFINE(USE_SYSTEMD_DAEMON,1 ,[Use systemd startup notification])],
206	[AS_IF([test "x$USE_SYSTEMD_DAEMON" = "xyes"],
207	    [AC_MSG_ERROR([systemd startup notification support requested, but libsystemd not found.])]
208	)]
209    )
210])
211AM_CONDITIONAL(USE_SYSTEMD_DAEMON, [test "x$USE_SYSTEMD_DAEMON" = "xyes"])
212
213# FIXME: Find better test for which OS'es use su -m  - for now, just try to
214# mirror the Imakefile setting of:
215# if  defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || defined(FreeBSDArchitecture) || defined(DarwinArchitecture)
216
217
218case $host_os in
219    linux*|gnu*|*-gnu)
220	SU="su"
221        ;;
222    darwin*)
223	SU="su -m"
224        ;;
225    *bsd*|dragonfly*)
226	SU="su -m"
227        ;;
228    solaris*|sysv4*)
229	SU="su"
230	;;
231    *)
232	SU="su"
233        ;;
234esac
235AC_SUBST(SU)
236
237# Define a configure option to locate a special file (/dev/random or /dev/urandom)
238# that serves as a random or a pseudorandom number generator
239AC_ARG_WITH(random-device, AS_HELP_STRING([--with-random-device\[=<pathname>\]],
240	[Use <pathname> as a source of randomness (default is auto-detected)]),
241	[USE_DEVICE="$withval"], [USE_DEVICE="auto"])
242if test x$USE_DEVICE != xno ; then
243    if test x$USE_DEVICE = xyes -o x$USE_DEVICE = xauto ; then
244	AC_CHECK_FILE([/dev/urandom], [DEV_RANDOM=/dev/urandom],
245	    [AC_CHECK_FILE([/dev/random], [DEV_RANDOM=/dev/random],
246		[AS_IF([test "x$USE_DEVICE" = "xyes"],
247		    [AC_MSG_ERROR([random device support requested, but no random device was found.])]
248		)]
249	    )]
250	)
251    else
252	# assume the user input is a valid path to a random number generator
253	DEV_RANDOM=$USE_DEVICE
254    fi
255    if test x$DEV_RANDOM != x ; then
256	AC_DEFINE_UNQUOTED(DEV_RANDOM,"$DEV_RANDOM", [Define to device that provides random data source])
257    fi
258fi
259AC_SUBST(DEV_RANDOM)
260
261# FIXME: find out how to check for these things. Note that Kerberos was
262# turned off everywhere but on OpenBSD.
263AM_CONDITIONAL(HAS_KERBEROS_FIVE, false)
264
265
266# Figure out where everything goes in the filesystem
267
268AC_ARG_WITH(xdmlibdir,
269	AS_HELP_STRING([--with-xdmlibdir=<pathname>],
270	  [specify directory for xdm scripts and modules (default=${libdir}/X11/xdm)]),
271	[XDMLIBDIR="$withval"], [XDMLIBDIR="${libdir}/X11/xdm"])
272AC_SUBST(XDMLIBDIR)
273
274AC_ARG_WITH(xdmconfigdir,
275	AS_HELP_STRING([--with-xdmconfigdir=<pathname>],
276	  [specify directory for xdm config files (default is same as xdmlibdir)]),
277	[XDMCONFIGDIR="$withval"], [XDMCONFIGDIR="${XDMLIBDIR}"])
278AC_SUBST(XDMCONFIGDIR)
279
280AC_ARG_WITH(xdmscriptdir,
281	AS_HELP_STRING([--with-xdmscriptdir=<pathname>],
282	  [specify directory for xdm scripts (default is same as xdmlibdir)]),
283	[XDMSCRIPTDIR="$withval"], [XDMSCRIPTDIR="${XDMLIBDIR}"])
284AC_SUBST(XDMSCRIPTDIR)
285
286AC_ARG_WITH(logdir,
287	AS_HELP_STRING([--with-logdir=<pathname>],
288	  [specify directory for xdm log files (default=/var/log)]),
289	[XDMLOGDIR="$withval"], [XDMLOGDIR="/var/log"])
290AC_SUBST(XDMLOGDIR)
291
292AC_ARG_WITH(piddir,
293	AS_HELP_STRING([--with-piddir=<pathname>],
294	  [specify directory for xdm pid files (default=/var/run)]),
295	[XDMPIDDIR="$withval"], [XDMPIDDIR="/var/run"])
296AC_SUBST(XDMPIDDIR)
297
298AC_ARG_WITH(default-vt,
299	AS_HELP_STRING([--with-default-vt=<vtname>],
300	  [specify default vt to start xdm on (default=none)]),
301	[DEFAULTVT="$withval"], [[DEFAULTVT=""]])
302AC_SUBST(DEFAULTVT)
303
304AC_ARG_WITH(config-type,
305	AS_HELP_STRING([--with-config-type={ws|fs}],
306	 [default config file type to use - workstation (ws) or fileserver (fs) (default=ws)]),
307	[SERVERSTYPE="$withval"], [SERVERSTYPE="ws"])
308AC_SUBST(SERVERSTYPE)
309
310AC_ARG_WITH(utmp_file,
311	AS_HELP_STRING([--with-utmp-file=<pathname>],
312	 [specify file to pass to sessreg -u for current logins])
313AS_HELP_STRING([--without-utmp-file],
314	 [specify passing "none" to sessreg -u to not record logins in utmp]),
315	[UTMP_FILE="$withval"])
316if test "x$UTMP_FILE" = "xyes" ; then
317	UTMP_FILE=""
318elif test "x$UTMP_FILE" = "xno" ; then
319	UTMP_FILE="none"
320fi
321AC_MSG_CHECKING([for path to file listing current logins for sessreg])
322if test "x$UTMP_FILE" = "x" ; then
323	AC_MSG_RESULT([use sessreg default])
324else
325	AC_MSG_RESULT([$UTMP_FILE])
326fi
327AM_CONDITIONAL(SET_UTMP_FILE, test x$UTMP_FILE != x)
328AC_SUBST(UTMP_FILE)
329
330AC_ARG_WITH(wtmp_file,
331	AS_HELP_STRING([--with-wtmp-file=<pathname>],
332	 [specify file to pass to sessreg -w for login history])
333AS_HELP_STRING([--without-wtmp-file],
334	 [specify passing "none" to sessreg -w to not record logins in wtmp]),
335	[WTMP_FILE="$withval"])
336if test "x$WTMP_FILE" = "xyes" ; then
337	WTMP_FILE=""
338elif test "x$WTMP_FILE" = "xno" ; then
339	WTMP_FILE="none"
340fi
341AC_MSG_CHECKING([for path to file listing login history for sessreg])
342if test "x$WTMP_FILE" = "x" ; then
343	AC_MSG_RESULT([use sessreg default])
344else
345	AC_MSG_RESULT([$WTMP_FILE])
346fi
347AM_CONDITIONAL(SET_WTMP_FILE, test x$WTMP_FILE != x)
348AC_SUBST(WTMP_FILE)
349
350case $host_os in
351    *sco*|*solaris*)
352		SHELL_CMD="/bin/ksh"	;;
353    *)		SHELL_CMD="/bin/sh"	;;
354esac
355AC_SUBST(SHELL_CMD)
356
357# Checks for pkg-config packages
358
359AC_ARG_WITH(xinerama,
360	AS_HELP_STRING([--with-xinerama],
361			[Use Xinerama (default is YES if installed)]),
362	[USE_XINERAMA="$withval"],
363	PKG_CHECK_EXISTS(xinerama, [USE_XINERAMA="yes"], [USE_XINERAMA="no"]))
364
365if test "x$USE_XINERAMA" = "xyes" ; then
366	AC_DEFINE([USE_XINERAMA], 1,
367		[Define to 1 to use XINERAMA in greeter & chooser])
368	PKG_CHECK_MODULES(XINERAMA, xinerama)
369	CHOOSER_CFLAGS="$CHOOSER_CFLAGS $XINERAMA_CFLAGS"
370	CHOOSER_LIBS="$CHOOSER_LIBS $XINERAMA_LIBS"
371	GREETER_CFLAGS="$GREETER_CFLAGS $XINERAMA_CFLAGS"
372	GREETER_LIBS="$GREETER_LIBS $XINERAMA_LIBS"
373fi
374
375# Xft text drawing for the greeter screen
376AC_ARG_WITH(xft,
377	AS_HELP_STRING([--with-xft],
378			[Use Xft to draw text (default is YES if installed)]),
379	[USE_XFT="$withval"],
380	PKG_CHECK_EXISTS(xft xrender, [USE_XFT="yes"], [USE_XFT="no"]))
381
382if test "x$USE_XFT" = "xyes" ; then
383	PKG_CHECK_MODULES(XFT, xft xrender)
384	GREETER_CFLAGS="$GREETER_CFLAGS $XFT_CFLAGS"
385	GREETER_LIBS="$GREETER_LIBS $XFT_LIBS"
386	AC_DEFINE([USE_XFT], 1,
387	    [Define to 1 to use Xft for text on greeter screen])
388fi
389
390# XPM logos for the greeter screen
391AC_ARG_ENABLE(xpm-logos,
392	AS_HELP_STRING([--enable-xpm-logos],
393			[Display xpm logos in greeter (default is YES)]),
394	[USE_XPM="$enableval"],
395	PKG_CHECK_EXISTS(xpm, [USE_XPM="yes"], [USE_XPM="no"]))
396if test "x$USE_XPM" = "xyes" ; then
397	PKG_CHECK_MODULES(XPM, xpm)
398	GREETER_CFLAGS="$GREETER_CFLAGS $XPM_CFLAGS"
399	GREETER_LIBS="$GREETER_LIBS $XPM_LIBS"
400	AC_DEFINE([XPM], 1,
401		[Define to 1 to display XPM logos on greeter screen])
402fi
403AM_CONDITIONAL(USE_XPM, test "x$USE_XPM" = "xyes")
404
405AC_ARG_WITH(color-pixmap,
406	AS_HELP_STRING([--with-color-pixmap=<filename>],
407		[specify xpm file to use as color logo (default=xorg.xpm)]),
408	[XDM_PIXMAP="$withval"], [XDM_PIXMAP="xorg.xpm"])
409AC_ARG_WITH(bw-pixmap,
410	AS_HELP_STRING([--with-bw-pixmap=<filename>],
411      [specify xpm file to use as black-and-white logo (default=xorg-bw.xpm)]),
412	[XDM_BWPIXMAP="$withval"], [XDM_BWPIXMAP="xorg-bw.xpm"])
413AC_ARG_WITH(pixmapdir,
414	AS_HELP_STRING([--with-pixmapdir=<pathname>],
415	[specify directory for xpm files (default=xdmlibdir/pixmaps)]),
416	[XDM_PIXMAPDIR="$withval"],
417	[XDM_PIXMAPDIR='${XDMLIBDIR}/pixmaps'])
418
419AC_SUBST(XDM_PIXMAP)
420AC_SUBST(XDM_BWPIXMAP)
421AC_SUBST(XDM_PIXMAPDIR)
422
423# Packages used by multiple programs
424
425PKG_CHECK_MODULES(XDM_TOOLKIT, xaw7)
426XDM_TOOLKIT_CFLAGS="$XDM_TOOLKIT_CFLAGS -D_CONST_X_STRING"
427PKG_CHECK_MODULES(DMCP, xdmcp)
428PKG_CHECK_MODULES(XLIB, x11)
429PKG_CHECK_MODULES(AUTH, xau)
430
431#
432# Greeter
433#
434
435PKG_CHECK_MODULES(XDMGREET, xt >= 1.0 x11 xext)
436
437GREETERLIB="${XDMLIBDIR}/libXdmGreet.so"
438AX_DEFINE_DIR(DEF_GREETER_LIB, GREETERLIB, [Location of Xdm Greeter library])
439
440XDMGREET_CFLAGS="$XDMGREET_CFLAGS $XDM_TOOLKIT_CFLAGS $DMCP_CFLAGS $XLIB_CFLAGS $GREETER_CFLAGS $AUTH_CFLAGS"
441XDMGREET_LIBS="$XDMGREET_LIBS $XDM_TOOLKIT_LIBS $DMCP_LIBS $GREETER_LIBS"
442
443#
444#  XDM
445#
446
447XDM_CFLAGS="$XDM_CFLAGS $DMCP_CFLAGS $XLIB_CFLAGS $AUTH_CFLAGS"
448XDM_LIBS="$XDM_LIBS $DMCP_LIBS"
449
450AC_CHECK_LIB(Xdmcp, XdmcpWrap, [xdmauth="yes"], [xdmauth="no"], [$DMCP_LIBS])
451
452AC_ARG_ENABLE(xdm-auth,
453	AS_HELP_STRING([--enable-xdm-auth],
454       [Support XDM-AUTHENTICATION-1 and XDM-AUTHORIZATION-1 (default: auto)]),
455	[xdmauth_enable="$enableval"], [xdmauth_enable="auto"])
456if test "x$xdmauth_enable" = "xyes" -a "x$xdmauth" = "xno" ; then
457	AC_MSG_ERROR([XDM-AUTH support requested, but XdmcpWrap not found in libXdmcp.])
458fi
459
460AM_CONDITIONAL(HAS_XDM_AUTH, test x$xdmauth = xyes -a x$xdmauth_enable != xno)
461
462AC_SUBST(XDM_CFLAGS)
463AC_SUBST(XDM_LIBS)
464
465#
466# xdmshell
467#
468
469AC_ARG_ENABLE(xdmshell,
470	AS_HELP_STRING([--enable-xdmshell],
471         [Install xdmshell (default: disabled)]),
472	[INSTALL_XDMSHELL="$enableval"], [INSTALL_XDMSHELL="no"])
473AM_CONDITIONAL(INSTALL_XDMSHELL, test x$INSTALL_XDMSHELL = xyes)
474
475PKG_CHECK_MODULES(XT, xt)
476XDMSHELL_CFLAGS="$XDM_CFLAGS $XDM_TOOLKIT_CFLAGS $AUTH_CFLAGS $DMCP_CFLAGS $XLIB_CFLAGS $XT_CFLAGS"
477XDMSHELL_LIBS="$XDM_LIBS $XDM_TOOLKIT_LIBS $DMCP_LIBS"
478
479AC_SUBST(XDMSHELL_CFLAGS)
480AC_SUBST(XDMSHELL_LIBS)
481
482#
483# Chooser
484#
485
486CHOOSER_CFLAGS="$CHOOSER_CFLAGS $XDM_TOOLKIT_CFLAGS $XLIB_CFLAGS $DMCP_CFLAGS $AUTH_CFLAGS"
487CHOOSER_LIBS="$CHOOSER_LIBS $XDM_TOOLKIT_LIBS $DMCP_LIBS"
488
489AC_SUBST(CHOOSER_CFLAGS)
490AC_SUBST(CHOOSER_LIBS)
491
492# Defaults for X session - should probably be configure --with-* flags
493# Currently just trying to mirror what defaults were set in Imake
494
495# -DDEF_SERVER_LINE=":0 local $(DEF_SERVER) :0"
496if test -z "$DEF_SERVER" ; then
497	DEF_SERVER="${bindir}/X"
498fi
499if test -z "$DEF_SERVER_LINE" ; then
500	DEF_SERVER_LINE=":0 local ${DEF_SERVER} :0"
501fi
502AX_DEFINE_DIR(DEF_SERVER_LINE, DEF_SERVER_LINE,
503	[Define to default Xserver file entry for local X server])
504
505# -DXRDB_PROGRAM="$(BINDIR)/xrdb"
506AC_ARG_WITH(xrdb, AS_HELP_STRING([--with-xrdb=path],
507			[Use path for xrdb (default: bindir/xrdb)]),
508	    [XRDB=$withval], [XRDB=${bindir}/xrdb])
509AX_DEFINE_DIR(XRDB_PROGRAM, XRDB,
510	[Define to pathname for xrdb program])
511
512# -DDEF_SESSION="$(BINDIR)/xterm -ls"
513AC_ARG_WITH(default-session, AS_HELP_STRING([--with-default-session=command],
514		[Use command for default session (default: bindir/xterm -ls)]),
515	    [DEF_SESSION=$withval], [DEF_SESSION="${bindir}/xterm -ls"])
516AX_DEFINE_DIR(DEF_SESSION, DEF_SESSION,
517	[Define to default command to start X session])
518
519# -DDEF_USER_PATH="$(DEF_USER_PATH)"
520# Default values taken from DefaultUserPath setting in the
521# old Imake *.cf files for each platform
522if test -z "$DEF_USER_PATH" ; then
523	case $host_os in
524	    dragonfly*)
525		DEF_USER_PATH="/bin:/usr/bin:/sbin:/usr/sbin:${bindir}:/usr/local/bin"
526		;;
527	    freebsd*)
528		DEF_USER_PATH="/bin:/usr/bin:/sbin:/usr/sbin:${bindir}:/usr/gnu/bin:/usr/local/bin"
529		;;
530	    netbsd*)
531		DEF_USER_PATH="/bin:/usr/bin:/usr/pkg/bin:/usr/local/bin:${bindir}"
532		;;
533	    openbsd*|bsdi*)
534		DEF_USER_PATH="/bin:/usr/bin:/usr/local/bin:${bindir}"
535		;;
536	    solaris*)
537		DEF_USER_PATH="/usr/bin:${bindir}"
538		;;
539	    *)
540		DEF_USER_PATH="/bin:/usr/bin:${bindir}:/usr/ucb"
541		;;
542	esac
543fi
544AX_DEFINE_DIR(DEF_USER_PATH, DEF_USER_PATH,
545	[Define to default PATH environment variable for user sessions])
546
547# -DDEF_SYSTEM_PATH="$(DEF_SYSTEM_PATH)"
548# Default values taken from DefaultSystemPath setting in the
549# old Imake *.cf files for each platform
550if test -z "$DEF_SYSTEM_PATH" ; then
551	case $host_os in
552	    freebsd*|dragonfly*)
553		DEF_SYSTEM_PATH="/bin:/usr/bin:/sbin:/usr/sbin:${bindir}"
554		;;
555	    netbsd*|openbsd*|bsdi*)
556		DEF_SYSTEM_PATH="/sbin:/usr/sbin:/bin:/usr/bin:${bindir}"
557		;;
558	    solaris*)
559		DEF_SYSTEM_PATH="/sbin:/usr/sbin:/usr/bin:${bindir}"
560		;;
561	    *)
562		DEF_SYSTEM_PATH="/etc:/bin:/usr/bin:${bindir}:/usr/ucb"
563		;;
564	esac
565fi
566AX_DEFINE_DIR(DEF_SYSTEM_PATH, DEF_SYSTEM_PATH,
567	[Define to default PATH environment variable for system commands])
568
569# -DDEF_SYSTEM_SHELL="$(BOURNE_SHELL)"
570if test -z "$BOURNE_SHELL" ; then
571	BOURNE_SHELL=/bin/sh
572fi
573AX_DEFINE_DIR(DEF_SYSTEM_SHELL, BOURNE_SHELL,
574	[Define to default shell])
575
576# -DDEF_FAILSAFE_CLIENT="$(BINDIR)/xterm"
577
578AX_DEFINE_DIR(DEF_FAILSAFE_CLIENT, bindir/xterm,
579	[Define to default command to start failsafe X session])
580
581# -DDEF_XDM_CONFIG="$(XDMDIR)/xdm-config"
582
583AX_DEFINE_DIR(DEF_XDM_CONFIG, XDMCONFIGDIR/xdm-config,
584	[Define to pathname of default xdm-config file])
585
586# -DDEF_CHOOSER="$(CHOOSERPATH)"
587
588AX_DEFINE_DIR(DEF_CHOOSER, XDMLIBDIR/chooser,
589	[Define to pathname of where chooser binary is installed])
590
591# -DDEF_AUTH_DIR="$(XDMDIR)"
592
593AC_ARG_WITH(authdir,
594	AS_HELP_STRING([--with-authdir=<pathname>],
595	  [specify directory for X auth files (default=/var/lib/xdm)]),
596	[XDMXAUTHDIR="$withval"], [XDMXAUTHDIR="/var/lib/xdm"])
597AC_SUBST(XDMXAUTHDIR)
598
599AX_DEFINE_DIR(DEF_AUTH_DIR, XDMXAUTHDIR,
600	[Define to pathname where authentication cookie files should be stored])
601
602# -DDEF_GREETER_LIB="$(XDMDIR)/libXdmGreet.so"
603
604AX_DEFINE_DIR(DEF_GREETER_LIB, XDMLIBDIR/libXdmGreet.so,
605	[Define to pathname where greeter shared object is installed (if used)])
606
607PKG_CHECK_MODULES(APPDEFS, xt)
608xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`
609AC_ARG_WITH(appdefaultdir,
610	AS_HELP_STRING([--with-appdefaultdir=<pathname>],
611	  [specify directory for app-defaults files (default is autodetected)]),
612	[appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
613AC_SUBST(appdefaultdir)
614
615AC_SUBST(MKTEMP_COMMAND)
616
617AC_CONFIG_FILES([Makefile
618		app-defaults/Makefile
619		chooser/Makefile
620		config/Makefile
621		greeter/Makefile
622		include/Makefile
623		man/Makefile
624		xdm/Makefile
625		xdmshell/Makefile])
626AC_OUTPUT
627