Add gobject introspection
[profile/ivi/GUPnP.git] / configure.ac
1 AC_PREREQ([2.64])
2 AC_INIT([gupnp],
3         [0.20.5],
4         [http://bugzilla.gnome.org/enter_bug.cgi?product=gupnp&component=gupnp],
5         [gupnp],
6         [http://www.gupnp.org/])
7
8 AC_CONFIG_HEADERS([config.h])
9 AC_CONFIG_SRCDIR([libgupnp/gupnp.h])
10 AC_CONFIG_MACRO_DIR([m4])
11 AC_CONFIG_AUX_DIR([build-aux])
12
13 AC_CANONICAL_HOST
14 AC_CANONICAL_TARGET
15
16 AM_INIT_AUTOMAKE([1.11 tar-ustar no-dist-gzip dist-xz])
17 AM_MAINTAINER_MODE([enable])
18
19 AM_SILENT_RULES([yes])
20
21 # Check for programs
22 AC_PROG_CC
23 AC_FUNC_MMAP
24 AC_SYS_LARGEFILE
25
26 # Initialize libtool
27 LT_PREREQ([2.2])
28 LT_INIT
29
30
31 AC_MSG_CHECKING([operating system])
32 os_win32=no
33 case "$target_os" in
34      mingw*|cygwin*)
35         os_win32=yes
36         AC_MSG_RESULT(Win32)
37         UUID=
38         ;;
39      darwin*)
40         AC_MSG_RESULT(Darwin)
41         UUID=
42         ;;
43      *)
44         AC_MSG_RESULT($target_os)
45         UUID=uuid
46         ;;
47 esac
48
49 PKG_CHECK_MODULES(LIBGUPNP, glib-2.0 >= 2.24.0 \
50                             gio-2.0 \
51                             gmodule-2.0 \
52                             gssdp-1.0 >= 0.13.0 \
53                             libsoup-2.4 >= 2.28.2 \
54                             libxml-2.0 \
55                             $UUID)
56 PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
57
58 AM_CONDITIONAL(OS_WIN32, test "x$os_win32" = "xyes")
59 if test "x$os_win32" = "xno"; then
60     AC_ARG_WITH([context_manager],
61             AS_HELP_STRING(
62                         [--with-context-manager=@<:@network-manager/connman/unix/linux@:>@],
63                         [Context Manager backend to use]),,
64             [with_context_manager="none"])
65 else
66     LIBGUPNP_LIBS="$LIBGUPNP_LIBS -lrpcrt4"
67     with_context_manager="windows"
68 fi
69
70 if test "x$with_context_manager" = "xnone"; then
71         case "$target_os" in
72         linux*)
73                 with_context_manager="linux"
74                 ;;
75         *)
76                 with_context_manager="unix"
77                 ;;
78         esac
79 fi
80
81 AC_CHECK_HEADERS([sys/socket.h linux/rtnetlink.h],
82                 [ HAVE_NETLINK=yes ],
83                 [ HAVE_NETLINK=no ],
84                 [ #ifdef HAVE_SYS_SOCKET_H
85                   #include <sys/socket.h>
86                   #endif
87                 ])
88 AM_CONDITIONAL([HAVE_NETLINK], [test "x$HAVE_NETLINK" = "xyes"])
89 AC_SUBST(HAVE_NETLINK)
90
91 AC_CHECK_HEADERS([linux/wireless.h], [], [],
92                 [ #ifdef HAVE_SYS_SOCKET_H
93                   #include <sys/socket.h>
94                   #endif
95                 ])
96
97 AC_MSG_CHECKING([Context Manager backend to use])
98 AC_MSG_RESULT([${with_context_manager}])
99
100 AM_CONDITIONAL([USE_NETWORK_MANAGER],
101                [test "x$with_context_manager" = "xnetwork-manager"])
102 AS_IF([test "x$with_context_manager" = "xnetwork-manager"],
103       [PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.26)])
104
105 AM_CONDITIONAL([USE_CONNMAN],
106                [test "x$with_context_manager" = "xconnman"])
107
108 if test "x$with_context_manager" = "xconnman"; then
109         PKG_CHECK_MODULES(CONNMAN, glib-2.0 >= 2.28 connman >= 0.80)
110 fi
111
112 USE_NETLINK=no
113 AS_IF([test "x$with_context_manager" = "xlinux"],
114       [AS_IF([test "x$HAVE_NETLINK" = "xno"],
115              [AC_MSG_NOTICE([No rtnetlink found, falling back to static context manager])],
116              [USE_NETLINK=yes])
117       ],[])
118
119 AM_CONDITIONAL(USE_NETLINK, test "x$USE_NETLINK" = "xyes")
120 AC_SUBST(USE_NETLINK)
121
122 # glib-genmarshal
123 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
124 AC_SUBST(GLIB_GENMARSHAL)
125
126 # Debugging
127 AC_ARG_ENABLE(debug,
128         AS_HELP_STRING([--enable-debug], [enable debugging]),,
129         enable_debug=no)
130 if test "x$enable_debug" = "xyes"; then
131         CFLAGS="$CFLAGS -g -Wall -Werror"
132 fi
133
134 GOBJECT_INTROSPECTION_CHECK([0.6.4])
135
136 # vapigen
137 have_vapigen=no
138 AS_IF([test "x$found_introspection" = "xyes"],
139       [
140        dnl output of g-i >= 1.36.0 needs vapigen >= 0.20 to process
141        AC_MSG_CHECKING([whether G-I is 1.36 or newer])
142        VAPIGEN_MIN_VERSION=0.14
143        AS_IF([pkg-config --atleast-version=1.36.0 gobject-introspection-1.0],
144              [
145               AC_MSG_RESULT([yes])
146               VAPIGEN_MIN_VERSION=0.20
147              ],[AC_MSG_RESULT([no])]
148        )
149        GUPNP_PROG_VAPIGEN([$VAPIGEN_MIN_VERSION])
150       ]
151 )
152 AS_IF([test "x$VAPIGEN" != "x"], [have_vapigen=yes])
153 AM_CONDITIONAL([HAVE_VAPIGEN], [test "x$VAPIGEN" != "x"])
154
155 # Gtk-doc
156 GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
157
158 AC_CONFIG_FILES([
159 Makefile
160 libgupnp/Makefile
161 examples/Makefile
162 tools/Makefile
163 tests/Makefile
164 tests/gtest/Makefile
165 doc/Makefile
166 doc/version.xml
167 vala/Makefile
168 gupnp-1.0.pc
169 gupnp-1.0-uninstalled.pc
170 ])
171 AC_OUTPUT
172
173 echo "
174     ${PACKAGE} ${VERSION}
175     ---------------------
176
177     Prefix:                ${prefix}
178     GObject-Introspection: ${found_introspection}
179     VALA bindings:         ${have_vapigen}
180     Context manager:       ${with_context_manager}
181 "