2 AC_INIT([spice-vdagent], [0.22.1])
3 AC_CONFIG_SRCDIR([configure.ac])
5 AM_CONFIG_HEADER([src/config.h])
7 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip subdir-objects])
8 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
16 AC_DEFINE(_GNU_SOURCE, [1], [Enable GNU extensions])
19 AC_ARG_WITH([session-info],
20 [AS_HELP_STRING([--with-session-info=@<:@auto/console-kit/systemd/none@:>@],
21 [Session-info source to use @<:@default=auto@:>@])],
22 [case "$with_session_info" in
23 auto|console-kit|systemd|none) ;;
24 *) AC_MSG_ERROR([invalid session-info type specified]) ;;
26 [with_session_info="auto"])
28 dnl based on libvirt configure --init-script
29 AC_MSG_CHECKING([for init script flavor])
30 AC_ARG_WITH([init-script],
32 [--with-init-script=@<:@redhat/systemd/systemd+redhat/check@:>@],
33 [Style of init script to install @<:@default=check@:>@])],
34 [],[with_init_script=check])
37 case "$with_init_script" in
52 if test "$cross_compiling" != yes && test -f /etc/redhat-release; then
54 with_init_script=redhat
58 AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
61 AM_CONDITIONAL([INIT_SCRIPT_RED_HAT], test "$init_redhat" = "yes")
62 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes")
63 AC_MSG_RESULT($with_init_script)
65 if test "x$init_systemd" = "xyes"; then
66 SYSTEMDSYSTEMUNITDIR=`${PKG_CONFIG} systemd --variable=systemdsystemunitdir`
67 SYSTEMDUSERUNITDIR=`${PKG_CONFIG} systemd --variable=systemduserunitdir`
68 AC_SUBST(SYSTEMDSYSTEMUNITDIR)
69 AC_SUBST(SYSTEMDUSERUNITDIR)
70 # earlier versions of systemd require a separate libsystemd-daemon library
71 PKG_CHECK_MODULES([LIBSYSTEMD_DAEMON],
73 [have_libsystemd_daemon="yes"],
74 [have_libsystemd_daemon="no"])
75 if test "$have_libsystemd_daemon" = "yes"; then
76 AC_DEFINE([WITH_SYSTEMD_SOCKET_ACTIVATION], [1], [If defined, vdagentd will support socket activation with systemd] )
82 [--with-gtk=@<:@auto/yes/no@:>@],
83 [Use GTK+ instead of Xlib @<:@default=auto@:>@])],
88 [--with-gtk4=@<:@yes/no@:>@],
89 [Use GTK4 instead of Xlib @<:@default=no@:>@])],
92 if test "x$with_gtk4" = "xyes"; then
93 PKG_CHECK_MODULES([GTK], [gtk4 >= 3.98], [
94 AC_DEFINE([WITH_GTK], [1], [If defined, load GTK+ libraries])
95 AC_DEFINE([USE_GTK_FOR_MONITORS], [1], [If defined, use GTK for monitor resolution instead of XRandr])
98 AC_MSG_ERROR([GTK4 requested but not found])
101 if test "x$with_gtk" != "xno"; then
102 PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.22], [
103 AC_DEFINE([WITH_GTK], [1], [If defined, load GTK+ libraries])
104 AC_DEFINE([USE_GTK_FOR_CLIPBOARD], [1], [If defined, use GTK for clipboard features])
107 AS_IF([test "x$with_gtk" = "xyes"], [AC_MSG_ERROR([GTK+ requested but not found])])
112 AC_ARG_ENABLE([pciaccess],
113 [AS_HELP_STRING([--enable-pciaccess], [Enable libpciaccess use for auto generation of Xinerama xorg.conf (default: yes)])],
114 [enable_pciaccess="$enableval"],
115 [enable_pciaccess="yes"])
117 AC_ARG_ENABLE([static-uinput],
118 [AS_HELP_STRING([--enable-static-uinput], [Enable use of a fixed, static uinput device for X-servers without hotplug support (default: no)])],
119 [enable_static_uinput="$enableval"],
120 [enable_static_uinput="no"])
122 PKG_CHECK_MODULES([GIO2], [gio-unix-2.0 >= 2.50])
123 PKG_CHECK_MODULES(X, [xfixes xrandr >= 1.3 xinerama x11])
124 PKG_CHECK_MODULES(SPICE, [spice-protocol >= 0.14.3])
125 PKG_CHECK_MODULES(ALSA, [alsa >= 1.0.22])
126 PKG_CHECK_MODULES([DBUS], [dbus-1])
127 PKG_CHECK_MODULES([DRM], [libdrm])
129 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.68], [], [
130 AC_DEFINE(g_memdup2, g_memdup, [GLib2 < 2.68 compatibility])
133 if test "$with_session_info" = "auto" || test "$with_session_info" = "systemd"; then
134 PKG_CHECK_MODULES([LIBSYSTEMD_LOGIN],
136 [have_libsystemd_login="yes"],
137 [have_libsystemd_login="no"])
138 if test "$have_libsystemd_login" = "no"; then
139 # for backward compatibility with older systemd versions
140 PKG_CHECK_MODULES([LIBSYSTEMD_LOGIN],
141 [libsystemd-login >= 42],
142 [have_libsystemd_login="yes"],
143 [have_libsystemd_login="no"])
145 if test x"$have_libsystemd_login" = "xno" && test "$with_session_info" = "systemd"; then
146 AC_MSG_ERROR([libsystemd-login support explicitly requested, but some required packages are not available])
148 if test x"$have_libsystemd_login" = "xyes"; then
149 AC_DEFINE(HAVE_LIBSYSTEMD_LOGIN, [1], [If defined, vdagentd will be compiled with libsystemd-login support])
150 with_session_info="systemd"
153 have_libsystemd_login="no"
155 AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, test x"$have_libsystemd_login" = "xyes")
158 udevdir=$($PKG_CONFIG --variable=udevdir udev)
161 if test "$with_session_info" = "auto" || test "$with_session_info" = "console-kit"; then
162 AC_DEFINE([HAVE_CONSOLE_KIT], [1], [If defined, vdagentd will be compiled with ConsoleKit support])
163 have_console_kit="yes"
164 with_session_info="console-kit"
166 have_console_kit="no"
168 AM_CONDITIONAL(HAVE_CONSOLE_KIT, test x"$have_console_kit" = "xyes")
170 if test x"$enable_pciaccess" = "xyes" ; then
171 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
172 AC_DEFINE([HAVE_PCIACCESS], [1], [If defined, vdagentd will be compiled with pciaccess support] )
174 AM_CONDITIONAL(HAVE_PCIACCESS, test x"$enable_pciaccess" = "xyes")
176 if test x"$enable_static_uinput" = "xyes" ; then
177 AC_DEFINE([WITH_STATIC_UINPUT], [1], [If defined, vdagentd will use a static uinput device] )
180 # If no CFLAGS are set, set some sane default CFLAGS
181 if test -z "$ac_test_CFLAGS"; then
182 DEFAULT_CFLAGS="-Wall -Werror -Wp,-D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4"
183 for F in $DEFAULT_CFLAGS; do
184 AC_MSG_CHECKING([whether $CC supports $F])
185 save_CFLAGS="$CFLAGS"
187 AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [cc_flag=yes], [cc_flag=no])
188 if test "x$cc_flag" != "xyes"; then
189 CFLAGS="$save_CFLAGS"
191 AC_MSG_RESULT([$cc_flag])
196 AS_HELP_STRING([--enable-pie=@<:@auto/yes/no@:>@],
197 [Enable position-independent-executable support (for spice-vdagentd)@<:@default=auto@:>@]),
201 if test "x$enable_pie" != "xno"; then
202 save_CFLAGS="$CFLAGS"
203 save_LDFLAGS="$LDFLAGS"
204 CFLAGS="$CFLAGS -fPIE"
205 LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
206 AC_MSG_CHECKING([for PIE support])
207 AC_LINK_IFELSE([AC_LANG_SOURCE([int main () { return 0; }])],
210 AC_MSG_RESULT([$have_pie])
211 if test "x$have_pie" = "xno" && test "x$enable_pie" = "xyes"; then
212 AC_MSG_ERROR([pie support explicitly requested, but your toolchain does not support it])
214 if test "x$have_pie" = "xyes"; then
216 PIE_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now"
218 AC_SUBST(PIE_LDFLAGS)
220 CFLAGS="$save_CFLAGS"
221 LDFLAGS="$save_LDFLAGS"
229 data/spice-vdagentd.1
233 dnl ==========================================================================
236 spice-vdagent $VERSION
242 session-info: ${with_session_info}
243 pciaccess: ${enable_pciaccess}
244 static uinput: ${enable_static_uinput}
245 vdagentd pie + relro: ${have_pie}
247 install RH initscript: ${init_redhat}
248 install systemd service: ${init_systemd}
251 use GTK+: ${with_gtk}
253 Now type 'make' to build $PACKAGE