1# Copyright 2014-2016 James Geboski <jgeboski@gmail.com>
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16AC_INIT(
17    [bitlbee-facebook],
18    [1.2.2],
19    [https://github.com/bitlbee/bitlbee-facebook/issues],
20    [bitlbee-facebook],
21    [https://github.com/bitlbee/bitlbee-facebook],
22    []
23)
24
25AC_CONFIG_AUX_DIR([build-aux])
26AC_CONFIG_MACRO_DIR([m4])
27AM_INIT_AUTOMAKE([no-define])
28
29AC_PROG_CC
30AM_PROG_CC_C_O
31
32LT_INIT([disable-static])
33
34m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
35m4_ifdef([AC_PROG_CC],  [AC_PROG_CC])
36
37# Define PKG_CHECK_VAR() for pkg-config < 0.28
38m4_define_default(
39    [PKG_CHECK_VAR],
40    [AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
41     AS_IF([test -z "$$1"], [$1=`$PKG_CONFIG --variable="$3" "$2"`])
42     AS_IF([test -n "$$1"], [$4], [$5])]
43)
44
45AC_ARG_ENABLE(
46    [warnings],
47    [AS_HELP_STRING(
48        [--enable-warnings],
49        [Enable additional compile-time (GCC) warnings]
50    )],
51    [WARNINGS="$enableval"],
52    [WARNINGS="no"]
53)
54
55AS_IF(
56    [test "x$WARNINGS" = "xyes"],
57    [CFLAGS="$CFLAGS -Wall -Wextra \
58     -Waggregate-return \
59     -Wdeclaration-after-statement \
60     -Wfloat-equal \
61     -Wformat \
62     -Winit-self \
63     -Wmissing-declarations \
64     -Wmissing-prototypes \
65     -Wno-unused-parameter \
66     -Wpointer-arith"]
67)
68
69AC_ARG_WITH(
70    [plugindir],
71    [AS_HELP_STRING(
72        [--with-plugindir],
73        [BitlBee plugin directory]
74    )],
75    [plugindir="$withval"]
76)
77
78PKG_CHECK_MODULES([BITLBEE], [bitlbee >= 3.4])
79PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28.0 gio-2.0 gobject-2.0])
80PKG_CHECK_MODULES([JSON], [json-glib-1.0 >= 0.14.0])
81
82PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal])
83AS_IF(
84    [test -z "$GLIB_GENMARSHAL"],
85    [AC_MSG_ERROR([The `glib-genmarshal' tool is missing.])]
86)
87
88AS_IF(
89    [test -z "$plugindir"],
90    [PKG_CHECK_VAR(
91        [BITLBEE_PLUGINDIR],
92        [bitlbee],
93        [plugindir],
94        [plugindir="$BITLBEE_PLUGINDIR"],
95        [plugindir="$libdir/bitlbee"]
96    )]
97)
98
99AC_CONFIG_FILES([Makefile facebook/Makefile])
100AC_SUBST([plugindir])
101AC_OUTPUT
102