initial commit
[profile/ivi/xorg-x11-xinit.git] / configure.ac
1 dnl  Copyright 2005 Red Hat, Inc.
2 dnl 
3 dnl  Permission to use, copy, modify, distribute, and sell this software and its
4 dnl  documentation for any purpose is hereby granted without fee, provided that
5 dnl  the above copyright notice appear in all copies and that both that
6 dnl  copyright notice and this permission notice appear in supporting
7 dnl  documentation, and that the name of Red Hat not be used in
8 dnl  advertising or publicity pertaining to distribution of the software without
9 dnl  specific, written prior permission.  Red Hat makes no
10 dnl  representations about the suitability of this software for any purpose.  It
11 dnl  is provided "as is" without express or implied warranty.
12 dnl 
13 dnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14 dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15 dnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16 dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17 dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 dnl  PERFORMANCE OF THIS SOFTWARE.
20 dnl
21 dnl Process this file with autoconf to create configure.
22
23 AC_PREREQ([2.57])
24 AC_INIT(xinit,[1.1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
25 AM_INIT_AUTOMAKE([dist-bzip2])
26 AM_MAINTAINER_MODE
27
28 AM_CONFIG_HEADER(config.h)
29
30 AC_PROG_CC
31 AM_PROG_CC_C_O
32 XORG_PROG_RAWCPP
33 AC_PROG_INSTALL
34 AC_PATH_PROG(SED,sed)
35 AC_CANONICAL_HOST
36
37 AC_TYPE_SIGNAL
38 AC_FUNC_FORK
39
40 AC_CHECK_FUNCS([killpg])
41
42 m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
43
44 # Build options
45 DEFAULT_XRDB=xrdb
46 DEFAULT_XMODMAP=xmodmap
47 DEFAULT_TWM=twm
48 DEFAULT_XCLOCK=xclock
49 DEFAULT_XTERM=xterm
50 # You always want to specify the full path to the X server
51 DEFAULT_XSERVER=${bindir}/X
52 DEFAULT_XAUTH=xauth
53 DEFAULT_XINIT=xinit
54
55 AC_ARG_WITH(xrdb,
56          AS_HELP_STRING([--with-xrdb=XRDB], [Path to xrdb]),
57         [XRDB="$withval"],
58         [XRDB="$DEFAULT_XRDB"])
59
60 AC_ARG_WITH(xmodmap,
61          AS_HELP_STRING([--with-xmodmap=XMODMAP], [Path to xmodmap]),
62         [XMODMAP="$withval"],
63         [XMODMAP="$DEFAULT_XMODMAP"])
64
65 AC_ARG_WITH(twm,
66          AS_HELP_STRING([--with-twm=TWM], [Path to twm]),
67         [TWM="$withval"],
68         [TWM="$DEFAULT_TWM"])
69
70 AC_ARG_WITH(xclock,
71          AS_HELP_STRING([--with-xclock=XCLOCK], [Path to xclock]),
72         [XCLOCK="$withval"],
73         [XCLOCK="$DEFAULT_XCLOCK"])
74
75 AC_ARG_WITH(xterm,
76          AS_HELP_STRING([--with-xterm=XTERM], [Path to xterm]),
77         [XTERM="$withval"],
78         [XTERM="$DEFAULT_XTERM"])
79
80 AC_ARG_WITH(xserver,
81          AS_HELP_STRING([--with-xserver=XSERVER], [Path to default X server]),
82         [XSERVER="$withval"],
83         [XSERVER="$DEFAULT_XSERVER"])
84
85 AC_ARG_WITH(xauth,
86          AS_HELP_STRING([--with-xauth=XAUTH], [Path to xauth]),
87         [XAUTH="$withval"],
88         [XAUTH="$DEFAULT_XAUTH"])
89
90 AC_ARG_WITH(xinit,
91          AS_HELP_STRING([--with-xinit=XINIT], [Path to xinit]),
92         [XINIT="$withval"],
93         [XINIT="$DEFAULT_XINIT"])
94
95 AC_ARG_WITH(launchd,            AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
96 AC_ARG_WITH(launchagents-dir,   AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
97                                 [ launchagentsdir="${withval}" ],
98                                 [ launchagentsdir="/Library/LaunchAgents" ])
99 AC_ARG_WITH(launchdaemons-dir,  AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
100                                 [ launchdaemonsdir="${withval}" ],
101                                 [ launchdaemonsdir="/Library/LaunchDaemons" ])
102
103 if test "x$LAUNCHD" = "xauto"; then
104         unset LAUNCHD
105         case $host_os in
106                 darwin8*)
107                         LAUNCHD=no
108                 ;;
109                 *)
110                         AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
111                 ;;
112         esac
113 fi
114
115 if test "x$LAUNCHD" = "xyes" ; then
116         AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
117 else
118         launchagentsdir=""
119         launchdaemonsdir=""
120 fi
121 AC_SUBST([launchagentsdir])
122 AC_SUBST([launchdaemonsdir])
123 AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
124
125 # Checks for pkg-config packages
126 PKG_CHECK_MODULES(XINIT, x11)
127
128 case $host_os in
129     *bsd*)
130         XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
131         ;;
132 esac
133
134 AC_SUBST(XINIT_CFLAGS)
135 AC_SUBST(XINIT_LIBS)
136
137 AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
138   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
139
140 case $host_os in
141         *openbsd*)
142         MCOOKIE='/usr/sbin/openssl rand -hex 16'
143         ;;
144         *solaris*)
145         MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
146         ;;
147 esac
148
149 if test "x$MCOOKIE" != x ; then
150         STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
151 fi
152 AC_SUBST(STARTX_COOKIE_FLAGS)
153
154 # Additional substitutions in startx, xinitrc & man pages
155 case $host_os in
156     *solaris*)
157         SHELL_CMD="/bin/ksh"
158         ARCHMANDEFS=""
159         ;;
160     *sco*)
161         SHELL_CMD="/bin/ksh"
162         ARCHMANDEFS="-D__SCOMAN__"
163         ;;
164     *)
165         SHELL_CMD="/bin/sh"
166         ARCHMANDEFS=""
167         ;;
168 esac
169 AC_SUBST(SHELL_CMD)
170 AC_SUBST(ARCHMANDEFS)
171
172 AC_SUBST(XRDB)
173 AC_SUBST(XMODMAP)
174 AC_SUBST(TWM)
175 AC_SUBST(XCLOCK)
176 AC_SUBST(XTERM)
177 AC_SUBST(XSERVER)
178 AC_SUBST(XAUTH)
179 AC_SUBST(XINIT)
180
181 # Defines which X servers are listed in help output in xinit.c
182 # Cheat, lie, and assume all the world is Xorg for now
183 AC_DEFINE(XORG, 1, [Define if you have Xorg X server])
184
185 XORG_MANPAGE_SECTIONS
186 XORG_RELEASE_VERSION
187
188 AC_OUTPUT([Makefile])
189 AC_OUTPUT([privileged_startx/Makefile])