summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 95ad0e3c13ead5d05de62206f35779e7c939ad83 (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
AC_PREREQ(2.59)

m4_define([yts_major_version], [0])
m4_define([yts_minor_version], [4])
m4_define([yts_micro_version], [0])
m4_define([yts_version],
  [yts_major_version.yts_minor_version.yts_micro_version])

AC_INIT(ytstenut, [yts_version],
  [https://bugs.freedesktop.org/enter_bug.cgi?product=Ytstenut])
AC_CONFIG_SRCDIR(ytstenut/ytstenut.h)
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build])

AC_SUBST(YTS_MAJOR_VERSION, yts_major_version)
AC_SUBST(YTS_MINOR_VERSION, yts_minor_version)
AC_SUBST(YTS_MICRO_VERSION, yts_micro_version)

dnl PONDERING maybe rename to YTS_EPOCH
AC_SUBST(YTS_API_VERSION, [1])

dnl Version info for libraries = CURRENT:REVISION:AGE
dnl
dnl Within each x.y.*, ABI is maintained backward compatible.
dnl We strive for forward compatibility too, except that we sometimes
dnl add new functions.
dnl
m4_define([version_iface],
	m4_eval(100 * yts_major_version + yts_minor_version))

AC_SUBST([VERSION_INFO], [version_iface:yts_micro_version:0])

AM_INIT_AUTOMAKE(dist-bzip2)

AC_CONFIG_HEADERS(config.h)

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)

AC_PROG_CC
AM_PROG_CC_C_O
AC_ISC_POSIX
AC_HEADER_STDC
AM_PROG_LIBTOOL

AC_CHECK_TOOL([NM], [nm])

GTK_DOC_CHECK([1.11], [--flavour no-tmpl])

AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])

# prefixes for fixing gtk-doc references
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
AC_SUBST(GLIB_PREFIX)

TELEPATHY_VERSION=">= 0.18.0"
AC_SUBST(TELEPATHY_VERSION)

AC_MSG_CHECKING([for operating system])
case "$host" in
  *-*-*mingw*|*-*-*cygwin*)
    platform=win32
    ;;
  *)
    platform=generic
    ;;
esac

AC_MSG_RESULT($platform)

AM_CONDITIONAL([OS_WINDOWS], [test "$platform" = "win32"])

YTS_PC_MODULES="$YTS_PC_MODULES telepathy-glib $TELEPATHY_VERSION telepathy-ytstenut-glib >= 0.2.0 rest-0.7 >= 0.7 glib-2.0 >= 2.30 gobject-2.0"

AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_30], [Ignore post 2.30 deprecations])
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_30], [Prevent post 2.30 APIs])

AC_DEFINE([TP_VERSION_MIN_REQUIRED], [TP_VERSION_0_18], [Ignore post 0.18 deprecations])
AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_0_18], [Prevent post 0.18 APIs])

if test "$platform" = "win32"; then
YTS_PC_MODULES="$YTS_PC_MODULES gio-windows-2.0"
else
YTS_PC_MODULES="$YTS_PC_MODULES gio-unix-2.0"
fi

AC_ARG_ENABLE([debug],
              [AC_HELP_STRING([--enable-debug],
                              [Enable debugging code])],
              [ enable_debug=$enableval ]
)
AC_MSG_CHECKING([whether to enable debugging code])
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" != "no"; then
  enable_debug="yes"
  AC_DEFINE([YTS_ENABLE_DEBUG], [1], [Defined when debugging code is enabled])
fi

CFLAGS="$CFLAGS $WARN_CFLAGS -DG_DISABLE_DEPRECATED"
if test "$GCC" = "yes"; then
  for option in -std=c99 -Wno-system-headers -Wfloat-equal -Wpointer-arith \
                -Wbad-function-cast -Wwrite-strings -Wsign-compare \
                -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes \
                -Wmissing-declarations -Wformat=2 -Wnested-externs -Winline \
                -Wdeclaration-after-statement -Wundef -Wmissing-noreturn \
                -Wmissing-format-attribute -Wno-pointer-sign -Wbitwise \
                -Wcast-to-as -Wdefault-bitfield-sign -Wdo-while -Wparen-string \
                -Wptr-subtraction-blows -Wreturn-void -Wtypesign \
                -Wclobbered -Wempty-body -Woverride-init -Wsign-compare \
                -Wtype-limits -Wuninitialized -Wall; do
    SAVE_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $option"
    AC_MSG_CHECKING([whether gcc understands $option])
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
      has_option=yes,
      has_option=no)
    if test $has_option = no; then
      CFLAGS="$SAVE_CFLAGS"
    fi
    AC_MSG_RESULT($has_option)
    unset has_option
    unset SAVE_CFLAGS
  done
  unset option
fi

have_introspection=no
AC_ARG_WITH(introspection,
  AC_HELP_STRING([--with-introspection],
                 [enable the use of GObject introspection]),
		 [with_introspection=$withval],
		 [with_introspection=auto])

if test x$with_introspection != xno; then
  PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0, have_introspection=yes, have_introspection=no)
  if test x$have_introspection = xyes; then
    YTS_PC_MODULES="$YTS_PC_MODULES gobject-introspection-1.0"
    AC_DEFINE(HAVE_INTROSPECTION, 1, [Define if GObject introspection is available])
    G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
    AC_SUBST(G_IR_SCANNER)
    G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
    AC_SUBST(G_IR_COMPILER)
    G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
    AC_SUBST(G_IR_GENERATE)
    GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
    AC_SUBST(GIRDIR)
    TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
    AC_SUBST(TYPELIBDIR)
  else
    if test x$with_introspection = xyes; then
       AC_ERROR($INTROSPECTION_PKG_ERRORS)
    fi
  fi
fi
AM_CONDITIONAL(WITH_INTROSPECTION, test "$have_introspection" = "yes")

PKG_CHECK_MODULES(YTS, $YTS_PC_MODULES)

# glib-genmarshal
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)

AC_ARG_ENABLE([integration-tests],
              [AC_HELP_STRING([--enable-integration-tests],
                              [Requires salut and gabble running, and accounts configured])],
[
],[
  enable_integration_tests="no"
])

AC_MSG_CHECKING(whether to enable integration tests)
AC_MSG_RESULT($enable_integration_tests)
AM_CONDITIONAL(ENABLE_INTEGRATION_TESTS, test "$enable_integration_tests" = "yes")

AC_OUTPUT([
  Makefile
  docs/Makefile
  docs/reference/Makefile
  docs/reference/ytstenut/Makefile
  docs/reference/ytstenut/ytstenut-docs.xml
  examples/Makefile
  examples/video-profile/Makefile
  ytstenut/Makefile
  ytstenut/yts-version.h
  ytstenut.pc
  ytstenut-1-uninstalled.pc
  tests/Makefile
])

echo "
        ytstenut
        ===================================================

        Configuration:
        Prefix           :    ${prefix}
        Debug            :    ${enable_debug}
        API Reference    :    ${enable_gtk_doc}
        Introspection    :    ${have_introspection}
        Platform         :    ${platform}

        CFLAGS: ${CFLAGS}

        Type make to build.
"