Prepare for 0.14.0 release
[vd_agent.git] / configure.ac
blob91a24ffb4e6df4f0dcd107f0aa89042d71c80d04
1 AC_PREREQ(2.59)
2 AC_INIT([spice-vdagent], [0.14.0])
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])])
10 AC_PROG_CC
11 AM_PROG_CC_C_O
12 AC_HEADER_STDC
13 AC_PROG_INSTALL
14 AC_PROG_LN_S
15 AC_DEFINE(_GNU_SOURCE, [1], [Enable GNU extensions])
16 PKG_PROG_PKG_CONFIG
18 AC_ARG_WITH([session-info],
19   [AS_HELP_STRING([--with-session-info=@<:@auto/console-kit/systemd/none@:>@],
20                   [Session-info source to use @<:@default=auto@:>@])],
21   [case "$with_session_info" in
22      auto|console-kit|systemd|none) ;;
23      *) AC_MSG_ERROR([invalid session-info type specified]) ;;
24    esac],
25   [with_session_info="auto"])
27 dnl based on libvirt configure --init-script
28 AC_MSG_CHECKING([for init script flavor])
29 AC_ARG_WITH([init-script],
30   [AC_HELP_STRING(
31      [--with-init-script=@<:@redhat/systemd/systemd+redhat/check@:>@],
32      [Style of init script to install @<:@default=check@:>@])],
33      [],[with_init_script=check])
34 init_redhat=no
35 init_systemd=no
36 case "$with_init_script" in
37     systemd+redhat)
38        init_redhat=yes
39        init_systemd=yes
40        ;;
41     systemd)
42        init_systemd=yes
43        ;;
44     redhat)
45        init_redhat=yes
46        ;;
47     none)
48        ;;
49     check)
50        with_init_script=none
51        if test "$cross_compiling" != yes && test -f /etc/redhat-release; then
52           init_redhat=yes
53           with_init_script=redhat
54        fi
55        ;;
56     *)
57        AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
58     ;;
59 esac
60 AM_CONDITIONAL([INIT_SCRIPT_RED_HAT], test "$init_redhat" = "yes")
61 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes")
62 AC_MSG_RESULT($with_init_script)
64 if test "x$init_systemd" = "xyes"; then
65   SYSTEMDSYSTEMUNITDIR=`${PKG_CONFIG} systemd --variable=systemdsystemunitdir`
66   AC_SUBST(SYSTEMDSYSTEMUNITDIR)
69 AC_ARG_ENABLE([pciaccess],
70               [AS_HELP_STRING([--enable-pciaccess], [Enable libpciaccess use for auto generation of Xinerama xorg.conf (default: yes)])],
71               [enable_pciaccess="$enableval"],
72               [enable_pciaccess="yes"])
74 AC_ARG_ENABLE([static-uinput],
75               [AS_HELP_STRING([--enable-statis-uinput], [Enable use of a fixed, static uinput device for X-servers without hotplug support (default: no)])],
76               [enable_static_uinput="$enableval"],
77               [enable_static_uinput="no"])
79 PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.12])
80 PKG_CHECK_MODULES(X, [xfixes xrandr >= 1.3 xinerama x11])
81 PKG_CHECK_MODULES(SPICE, [spice-protocol >= 0.12.5])
83 if test "$with_session_info" = "auto" || test "$with_session_info" = "systemd"; then
84     PKG_CHECK_MODULES([LIBSYSTEMD_LOGIN],
85                       [libsystemd-login >= 42],
86                       [have_libsystemd_login="yes"],
87                       [have_libsystemd_login="no"])
88     if test x"$have_libsystemd_login" = "xno" && test "$with_session_info" = "systemd"; then
89         AC_MSG_ERROR([libsystemd-login support explicitly requested, but some required packages are not available])
90     fi
91     if test x"$have_libsystemd_login" = "xyes"; then
92         AC_DEFINE(HAVE_LIBSYSTEMD_LOGIN, [1], [If defined, vdagentd will be compiled with libsystemd-login support])
93         with_session_info="systemd"
94     fi
95 else
96     have_libsystemd_login="no"
98 AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, test x"$have_libsystemd_login" = "xyes")
100 if test "$with_session_info" = "auto" || test "$with_session_info" = "console-kit"; then
101     PKG_CHECK_MODULES([DBUS],
102                       [dbus-1],
103                       [have_console_kit="yes"],
104                       [have_console_kit="no"])
105     if test x"$have_console_kit" = "xno" && test "$with_session_info" = "console-kit"; then
106         AC_MSG_ERROR([console-kit support explicitly requested, but some required packages are not available])
107     fi
108     if test x"$have_console_kit" = "xyes"; then
109         AC_DEFINE([HAVE_CONSOLE_KIT], [1], [If defined, vdagentd will be compiled with ConsoleKit support])
110         with_session_info="console-kit"
111     else
112         with_session_info="none"
113     fi
114 else
115     have_console_kit="no"
117 AM_CONDITIONAL(HAVE_CONSOLE_KIT, test x"$have_console_kit" = "xyes")
119 if test x"$enable_pciaccess" = "xyes" ; then
120     PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
121     AC_DEFINE([HAVE_PCIACCESS], [1], [If defined, vdagentd will be compiled with pciaccess support] )
123 AM_CONDITIONAL(HAVE_PCIACCESS, test x"$enable_pciaccess" = "xyes")
125 if test x"$enable_static_uinput" = "xyes" ; then
126     AC_DEFINE([WITH_STATIC_UINPUT], [1], [If defined, vdagentd will use a static uinput device] )
129 # If no CFLAGS are set, set some sane default CFLAGS
130 if test "$ac_test_CFLAGS" != set; then
131   DEFAULT_CFLAGS="-Wall -Werror -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4"
132   for F in $DEFAULT_CFLAGS; do
133     AC_MSG_CHECKING([whether $CC supports $F])
134     save_CFLAGS="$CFLAGS"
135     CFLAGS="$CFLAGS $F"
136     AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [cc_flag=yes], [cc_flag=no])
137     if test "x$cc_flag" != "xyes"; then
138       CFLAGS="$save_CFLAGS"
139     fi
140     AC_MSG_RESULT([$cc_flag])
141   done
144 AC_CONFIG_FILES([
145 Makefile
146 data/spice-vdagent.1
147 data/spice-vdagentd.1
149 AC_OUTPUT
151 dnl ==========================================================================
152 AC_MSG_NOTICE([
154         spice-vdagent $VERSION
155         ====================
157         prefix:                   ${prefix}
158         c compiler:               ${CC}
160         session-info:             ${with_session_info}
161         pciaccess:                ${enable_pciaccess}
162         static uinput:            ${enable_static_uinput}
164         install RH initscript:    ${init_redhat}
165         install systemd service:  ${init_systemd}
167         Now type 'make' to build $PACKAGE