summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 2a03704e500a1774c843afb69fe2eaae5e9d6785 (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
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 2017  Patrick McDermott
#
# This file is part of Marquee.

# Marquee is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Marquee is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Marquee.  If not, see <http://www.gnu.org/licenses/>.

AC_INIT([Marquee], [0.1.0],
	[mailto:pj@pehjota.net], [marquee])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])

AM_INIT_AUTOMAKE([gnu check-news dist-bzip2 dist-xz subdir-objects])
AM_SILENT_RULES([yes])

AM_CONDITIONAL([IN_GIT],
	[test -d "${srcdir}/.git" && command -v git >/dev/null 2>&1])

AC_PROG_CC()
AM_PROG_CC_C_O()
AC_PROG_LN_S()

AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="${CFLAGS} -std=c11"], [
	AX_CHECK_COMPILE_FLAG([-std=c1x], [CFLAGS="${CFLAGS} -std=c1x"], [], [])
], [])

AX_CFLAGS_WARN_ALL()  dnl Adds -Wall or equivalent
AX_CHECK_COMPILE_FLAG([-Wpedantic], [AX_APPEND_FLAG([-Wpedantic])])
AX_CHECK_COMPILE_FLAG([-Wextra],    [AX_APPEND_FLAG([-Wextra])])

AC_ARG_ENABLE([gcc-warnings],
	[AS_HELP_STRING([--enable-gcc-warnings], [turn on many GCC warnings])],
	[case "${enableval}" in yes|no);; *) AC_MSG_ERROR(
		[bad value ${enableval} for gcc-warnings option]);; esac],
	[
		gcc_warnings=no
		gl_GCC_VERSION_IFELSE([4], [6],
			[test -d "${srcdir}/.git" && gcc_warnings=yes])
	]
)
if test "x${gcc_warnings}" = 'xyes'; then
	nowarns=''
	nowarns="${nowarns} -Wsystem-headers"
	gl_MANYWARN_ALL_GCC([warns])
	gl_MANYWARN_COMPLEMENT([warns], [${warns}], [${nowarns}])
	for warn in ${warns}; do
		gl_WARN_ADD([${warn}])
	done
	AC_SUBST([WARN_CFLAGS])
fi

AX_CHECK_COMPILE_FLAG([-fdiagnostics-color=auto],
	[AX_APPEND_FLAG([-fdiagnostics-color=auto])])

PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES([GTK], [gtk+-3.0])
PKG_CHECK_MODULES([WEBKIT2GTK], [webkit2gtk-4.0])
PKG_CHECK_MODULES([LIBRSVG], [librsvg-2.0])
GTK_CFLAGS="$(printf ' %s' "${GTK_CFLAGS}" | \
	sed 's/ -I/ -isystem/g;')"
WEBKIT2GTK_CFLAGS="$(printf ' %s' "${WEBKIT2GTK_CFLAGS}" | \
	sed 's/ -I/ -isystem/g;')"
LIBRSVG_CFLAGS="$(printf ' %s' "${LIBRSVG_CFLAGS}" | \
	sed 's/ -I/ -isystem/g;')"

AC_ARG_ENABLE(
	[debug],
	[AS_HELP_STRING([--enable-debug], [enable debugging])],
	,
	[enable_debug=no])
if test "x${enable_debug}" = 'xyes'; then
	AC_SEARCH_LIBS([logl], [m], [],
		[AC_MSG_ERROR([unable to find the logl() function])])
	AC_DEFINE([MQ_TREE_DEBUG], [1], [Define to 1 to enable tree debugging.])
else
	AC_DEFINE([MQ_TREE_DEBUG], [0], [Define to 1 to enable tree debugging.])
fi

AC_ARG_ENABLE(
	[in-place],
	[AS_HELP_STRING([--enable-in-place],
		[run executable in place from build directory])],
	,
	[enable_in_place=no])
if test "x${enable_in_place}" = 'xyes'; then
	AC_DEFINE([RUN_IN_PLACE], [1],
		[Define to 1 to run executable in place from build directory.])
else
	AC_DEFINE([RUN_IN_PLACE], [0],
		[Define to 1 to run executable in place from build directory.])
fi

AC_CONFIG_FILES([Makefile data/Makefile])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT()