summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 50bc4be3bd127dfb81fe25666569d137c6f1de6c (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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
AC_PREREQ([2.59])

# Making releases:
#   set the new version number:
#     odd minor -> development series
#     even minor -> stable series
#     increment micro for each release within a series
#   set salut_nano_version to 0.

m4_define([salut_major_version], [0])
m4_define([salut_minor_version], [3])
m4_define([salut_micro_version], [2])
m4_define([salut_nano_version], [1])

# Some magic
m4_define([salut_base_version],
          [salut_major_version.salut_minor_version.salut_micro_version])
m4_define([salut_version],
          [m4_if(salut_nano_version, 0, [salut_base_version], [salut_base_version].[salut_nano_version])])dnl

AC_INIT([Telepathy Salut], [salut_version],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=telepathy-salut])

AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([1.8 -Wno-portability])
AM_PROG_LIBTOOL
AM_CONFIG_HEADER(config.h)

dnl check for tools
AC_PROG_CC
AC_PROG_CC_STDC
AM_PROG_AS
AM_PROG_MKDIR_P

dnl add common command line switches
SALUT_ARG_DEBUG
SALUT_ARG_VALGRIND
SALUT_ARG_COVERAGE

dnl decide error flags
AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")

ifelse(salut_nano_version, 0,
    [],
    [AS_COMPILER_FLAG(-Werror,ERROR_CFLAGS="$ERROR_CFLAGS -Werror",ERROR_CFLAGS="$ERROR_CFLAGS")
    ])
AC_SUBST(ERROR_CFLAGS)

dnl Check for code generation tools
XSLTPROC=
AC_CHECK_PROGS([XSLTPROC], [xsltproc])
if test -z "$XSLTPROC"; then
  AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])
fi
DBUS_BINDING_TOOL=
AC_CHECK_PROGS([DBUS_BINDING_TOOL], [dbus-binding-tool])
if test -z "$DBUS_BINDING_TOOL"; then
  AC_MSG_ERROR([dbus-binding-tool (from dbus-glib) is required])
fi
PYTHON=
AC_CHECK_PROGS([PYTHON], [python2.3 python2.4 python2.5 python])
if test -z "$PYTHON"; then
  AC_MSG_ERROR([Python is required to compile this package])
fi

dnl olpc specific code switch
AC_ARG_ENABLE(olpc,
  AC_HELP_STRING([--enable-olpc],[compile with olpc specific code]),
    enable_olpc=$enableval, enable_olpc=no )

if test x$enable_olpc = xyes; then
  AC_DEFINE(ENABLE_OLPC, [], [Enable olpc code])
fi

AM_CONDITIONAL(ENABLE_OLPC, test "x$enable_olpc" = "xyes")

AC_SUBST(ENABLE_OLPC)


AC_HEADER_STDC([])
AC_C_INLINE

dnl Check endianness (Needed for the sha1 implementation)
AC_C_BIGENDIAN

dnl GTK docs
GTK_DOC_CHECK

dnl Check for Glib 
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.4, gobject-2.0 >= 2.4])

AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)

dnl Check for D-Bus
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0.0, dbus-glib-1 >= 0.61])

AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

dnl Check for D-Bus tubes
AC_CHECK_LIB(dbus-1, dbus_message_marshal,
             [have_dbus_message_marshal=yes],
             [have_dbus_message_marshal=no],
             [$DBUS_LIBS])

have_dbus_tube=no
if test x$have_dbus_message_marshal = xyes; then
  have_dbus_tube=yes
  AC_DEFINE(ENABLE_DBUS_TUBES, 1, [Define if we have D-Bus tubes support])
fi

AM_CONDITIONAL(ENABLE_DBUS_TUBES, test x$have_dbus_tube = xyes)

if test x$have_dbus_tube = xno; then
  AC_MSG_WARN("Not building support for D-Bus tubes! (libdbus >= 1.1 required)")
fi

dnl Check for libxml2
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])

AC_SUBST(LIBXML2_CFLAGS)
AC_SUBST(LIBXML2_LIBS)

dnl Check for telepathy-glib
PKG_CHECK_MODULES(TELEPATHY_GLIB, [telepathy-glib >= 0.7.3])

AC_SUBST(TELEPATHY_GLIB_CFLAGS)
AC_SUBST(TELEPATHY_GLIB_LIBS)

dnl Check for OpenSSL
AC_ARG_ENABLE(ssl,
  AC_HELP_STRING([--enable-ssl],[enable gibber ssl transport [[default=no]]]),
    enable_ssl=$enableval, enable_ssl=no )

if test x$enable_ssl = xyes; then
  PKG_CHECK_MODULES(LIBSSL, [openssl], 
              [ HAVE_LIBSSL="yes" ],
              [ AC_MSG_ERROR(openssl not found) ] )
else
  AC_MSG_NOTICE([openssl support disabled by default])
fi

AC_SUBST(LIBSSL_CFLAGS)
AC_SUBST(LIBSSL_LIBS)
AM_CONDITIONAL(HAVE_LIBSSL, test "x$HAVE_LIBSSL" = "xyes")

AC_CHECK_FUNC(res_query, ,
  [AC_CHECK_LIB(resolv, res_query, [ RESOLV_LIBS="-lresolv" ],
    [ save_libs="$LIBS"
      LIBS="-lresolv $LIBS"
      AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
      AC_LINK_IFELSE(
        [AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])],
        [ AC_MSG_RESULT(yes)
          LIBS="$save_libs"
          RESOLV_LIBS="-lresolv"
        ],
        [ AC_MSG_RESULT(no)
          LIBS="$save_libs"
          AC_CHECK_LIB(bind, res_query,
            [ RESOLV_LIBS="-lbind" ],
            [ AC_MSG_ERROR(res_query not found) ] ) ] ) ] )
  ]
)

AC_SUBST(RESOLV_LIBS)

dnl Check for libasyncns
PKG_CHECK_MODULES(LIBASYNCNS, [libasyncns >= 0.3],
  [ HAVE_LIBASYNCNS="yes"
    AC_DEFINE(HAVE_LIBASYNCNS, 1, [Define if asyncns support is available])
  ],
  [ AC_WARN(libasyncns not found: Resolving will be synchronous!) ] )

AC_SUBST(LIBASYNCNS_CFLAGS)
AC_SUBST(LIBASYNCNS_LIBS)
AM_CONDITIONAL(HAVE_LIBASYNCNS, test "x$HAVE_LIBASYNCNS" = "xyes")

dnl Check for Avahi
PKG_CHECK_MODULES(AVAHI, [ avahi-gobject ])
AC_SUBST(AVAHI_CFLAGS)
AC_SUBST(AVAHI_LIBS)

dnl glibc backtrace functions
AC_CHECK_FUNCS(backtrace backtrace_symbols_fd)
AC_CHECK_HEADERS(execinfo.h)

dnl check for libsasl2 (for sasl test)
AC_CHECK_LIB(sasl2, sasl_server_new,
             [LIBSASL2_LIBS="-lsasl2"
              LIBSASL2_CFLAGS=""
              HAVE_LIBSASL2=yes
              AC_DEFINE(HAVE_LIBSASL2, 1,
                        [Define if libsasl2 support is available])
             ],
             [ AC_MSG_WARN(libsasl2 not found: not building sasl tests) ] )

AC_SUBST(LIBSASL2_LIBS)
AC_SUBST(LIBSASL2_CFLAGS)
AM_CONDITIONAL(HAVE_LIBSASL2, test "x$HAVE_LIBSASL2" = "xyes")

dnl signal functions
AC_CHECK_FUNCS(signal)
AC_CHECK_HEADERS(signal.h)

# Checks for the 'check' unit testing library
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], 
                   [ HAVE_CHECK=yes ],
                   [ HAVE_CHECK=no ] )
AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")

AC_OUTPUT( Makefile                       \
           docs/Makefile                  \
           lib/Makefile                   \
           lib/gibber/Makefile            \
           lib/gibber/examples/Makefile   \
           src/Makefile                   \
           m4/Makefile                    \
           data/Makefile                  \
           extensions/Makefile            \
           extensions/tools/Makefile      \
           tests/Makefile                 \
           tests/inputs/Makefile
)