make a few functions static
[vd_agent.git] / configure.ac
blob68ed0e8c065cd2e7afa664cc7b2fb395d131ddf6
1 AC_PREREQ(2.59)
2 AC_INIT([spice-vdagent], [0.12.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(X, [xfixes xrandr xinerama x11])
80 PKG_CHECK_MODULES(SPICE, [spice-protocol >= 0.8.0])
82 if test "$with_session_info" = "auto" || test "$with_session_info" = "systemd"; then
83     PKG_CHECK_MODULES([LIBSYSTEMD_LOGIN],
84                       [libsystemd-login >= 42],
85                       [have_libsystemd_login="yes"],
86                       [have_libsystemd_login="no"])
87     if test x"$have_libsystemd_login" = "xno" && test "$with_session_info" = "systemd"; then
88         AC_MSG_ERROR([libsystemd-login support explicitly requested, but some required packages are not available])
89     fi
90     if test x"$have_libsystemd_login" = "xyes"; then
91         AC_DEFINE(HAVE_LIBSYSTEMD_LOGIN, [1], [If defined, vdagentd will be compiled with libsystemd-login support])
92         with_session_info="systemd"
93     fi
94 else
95     have_libsystemd_login="no"
97 AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, test x"$have_libsystemd_login" = "xyes")
99 if test "$with_session_info" = "auto" || test "$with_session_info" = "console-kit"; then
100     PKG_CHECK_MODULES([DBUS],
101                       [dbus-1],
102                       [have_console_kit="yes"],
103                       [have_console_kit="no"])
104     if test x"$have_console_kit" = "xno" && test "$with_session_info" = "console-kit"; then
105         AC_MSG_ERROR([console-kit support explicitly requested, but some required packages are not available])
106     fi
107     if test x"$have_console_kit" = "xyes"; then
108         AC_DEFINE([HAVE_CONSOLE_KIT], [1], [If defined, vdagentd will be compiled with ConsoleKit support])
109         with_session_info="console-kit"
110     else
111         with_session_info="none"
112     fi
113 else
114     have_console_kit="no"
116 AM_CONDITIONAL(HAVE_CONSOLE_KIT, test x"$have_console_kit" = "xyes")
118 if test x"$enable_pciaccess" = "xyes" ; then
119     PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
120     AC_DEFINE([HAVE_PCIACCESS], [1], [If defined, vdagentd will be compiled with pciaccess support] )
122 AM_CONDITIONAL(HAVE_PCIACCESS, test x"$enable_pciaccess" = "xyes")
124 if test x"$enable_static_uinput" = "xyes" ; then
125     AC_DEFINE([WITH_STATIC_UINPUT], [1], [If defined, vdagentd will use a static uinput device] )
128 AC_CONFIG_FILES([
129 Makefile
131 AC_OUTPUT
133 dnl ==========================================================================
134 AC_MSG_NOTICE([
136         spice-vdagent $VERSION
137         ====================
139         prefix:                   ${prefix}
140         c compiler:               ${CC}
142         session-info:             ${with_session_info}
143         pciaccess:                ${enable_pciaccess}
144         static uinput:            ${enable_static_uinput}
146         install RH initscript:    ${init_redhat}
147         install systemd service:  ${init_systemd}
149         Now type 'make' to build $PACKAGE