summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 8f2587916d88f83b78ac124aeec3a75055538a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
# Copyright (C) 2011 Christophe Fergeau <cfergeau@redhat.com>
AC_PREREQ(2.63)

AC_INIT([vdagent-win],
        m4_esyscmd([build-aux/git-version-gen .tarball-version]))

AC_CONFIG_SRCDIR([vdagent])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([1.11 foreign subdir-objects no-dist-gzip dist-zip dist-xz tar-ustar])

AM_SILENT_RULES([yes])

AC_ARG_WITH([buildid],
AS_HELP_STRING([--with-buildid=id], [Set additional build version details]))
AC_DEFINE_UNQUOTED([BUILDID], "$with_buildid", [Build version details])
if test "x$with_buildid" != x; then
  AC_SUBST([BUILDID], "-$with_buildid")
fi

major=`echo $PACKAGE_VERSION | cut -d. -f1`
minor=`echo $PACKAGE_VERSION | cut -d. -f2`
micro=`echo $PACKAGE_VERSION | cut -d. -f3`
buildid=`echo $with_buildid | cut -d. -f1`
if test "x$buildid" = x; then
  buildid=0
fi
build=`expr $micro \* 256 + $buildid`
WINDOWS_PRODUCTVERSION="$major.$minor.$build"
AC_SUBST([WINDOWS_PRODUCTVERSION])
microdigit=`echo $micro | cut -d- -f1`
RC_PRODUCTVERSION="$major, $minor, $microdigit, 0"
AC_DEFINE_UNQUOTED([RC_PRODUCTVERSION_STR], "$RC_PRODUCTVERSION", [Resource product version])
AC_DEFINE_UNQUOTED([RC_PRODUCTVERSION], [$RC_PRODUCTVERSION], [Resource product version])
BUILD_YEAR=`date +%Y`
AC_DEFINE_UNQUOTED([BUILD_YEAR], "$BUILD_YEAR", [Build year])
RPM_VERSION=`echo $PACKAGE_VERSION | sed 's,-,_,g'`
AC_SUBST([RPM_VERSION])

# Check for programs
AC_PROG_CC
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_CHECK_TOOL(WINDRES, [windres])

case "$host" in
amd64*|x86_64*)
  WIXL_ARCH="x64"
;;
*)
  WIXL_ARCH="x86"
;;
esac
AC_SUBST(WIXL_ARCH)

AC_ARG_ENABLE([debug],
    AS_HELP_STRING([--enable-debug], [Enable debugging]))

AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])

dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------

if test "$GCC" = "yes"; then
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wuninitialized"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
	WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
else
	WARNINGFLAGS_C=""
fi
AC_SUBST(WARNINGFLAGS_C)

dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------

PKG_CHECK_MODULES_STATIC(LIBPNG, [libpng])
PKG_CHECK_MODULES_STATIC(ZLIB, [zlib])
ACX_SET_VAR(CFLAGS, "$CFLAGS $LIBPNG_CFLAGS -Wall",
  ACX_SET_VAR(LDFLAGS, "$LDFLAGS -static",
    ACX_SET_VAR(LIBS, "$LIBS $LIBPNG_LIBS",
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]], [[
        return !!png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)
      ]])], [], AC_MSG_ERROR([static libpng not found]))
    )
  )
)

dnl ---------------------------------------------------------------------------
dnl - Makefiles, etc.
dnl ---------------------------------------------------------------------------
AC_CONFIG_SUBDIRS([spice-protocol])
AC_CONFIG_FILES([
Makefile
mingw-spice-vdagent.spec
spice-vdagent.wxs
])
AC_OUTPUT

dnl ==========================================================================
echo "
                  vdagent-win $VERSION
                  ================

        prefix:                    ${prefix}
        datadir:                   ${datadir}
        compiler:                  ${CXX}
        cxxflags:                  ${CXXFLAGS}
        cppflags:                  ${CPPFLAGS}
"