aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 963de1efa6056b852f0c8e29de016ae50c116f77 (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
#
# shamelessly stolen from clutter-gtk
#
m4_define([ido_major_version], [12])
m4_define([ido_minor_version], [10])
m4_define([ido_micro_version], [0])

m4_define([ido_api_version],
          [ido_major_version.ido_minor_version])
m4_define([ido_version],
          [ido_major_version.ido_minor_version.ido_micro_version])

m4_define([ido_interface_age], [0])
m4_define([ido_binary_age],
          [m4_eval(100 * ido_minor_version + ido_micro_version)])

AC_PREREQ([2.64])

AC_INIT([ido],
        [ido_version],
        [http://bugs.launchpad.net/ido],
        [ido],
        [http://launchpad.net/ido])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/libido.h])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([1.11 foreign])

AM_SILENT_RULES([yes])

IDO_MAJOR_VERSION=ido_major_version
IDO_MINOR_VERSION=ido_minor_version
IDO_MICRO_VERSION=ido_micro_version
IDO_VERSION=ido_version
AC_SUBST(IDO_MAJOR_VERSION)
AC_SUBST(IDO_MINOR_VERSION)
AC_SUBST(IDO_MICRO_VERSION)
AC_SUBST(IDO_VERSION)

m4_define([lt_current],
          [m4_eval(100 * ido_minor_version + ido_micro_version - ido_interface_age)])
m4_define([lt_revision], [ido_interface_age])
m4_define([lt_age], [m4_eval(ido_binary_age - ido_interface_age)])
IDO_LT_CURRENT=lt_current
IDO_LT_REV=lt_revision
IDO_LT_AGE=lt_age
IDO_LT_VERSION="$IDO_LT_CURRENT:$IDO_LT_REV:$IDO_LT_AGE"
IDO_LT_LDFLAGS="-version-info $IDO_LT_VERSION"

AC_SUBST(IDO_LT_VERSION)
AC_SUBST(IDO_LT_LDFLAGS)

dnl ===========================================================================

# Checks for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])

AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
PKG_PROG_PKG_CONFIG

# Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])

# Checks for typedefs, structures and compiler charecteristics
AC_C_CONST

# Checks for library functions
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([memset munmap strcasecmp strdup])
AC_CHECK_LIBM

GLIB_REQUIRED_VERSION=2.32.0
GTK_REQUIRED_VERSION=3.4.0

PKG_CHECK_MODULES(GTK,[gtk+-3.0 >= $GTK_REQUIRED_VERSION
                       glib-2.0 >= $GLIB_REQUIRED_VERSION])

AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

dnl ===========================================================================

if test "x$GCC" = "xyes"; then
  GCC_FLAGS="-g -Wall"
fi
AC_SUBST(GCC_FLAGS)

# use strict compiler flags only on development releases
m4_define([maintainer_flags_default], [m4_if(m4_eval(ido_minor_version % 2), [1], [yes], [no])])
AC_ARG_ENABLE([maintainer-flags],
              [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],
                              [Use strict compiler flags @<:@default=no@:>@])],
              [],
              [enable_maintainer_flags=maintainer_flags_default])

MAINTAINER_CFLAGS=""
AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
      [
        MAINTAINER_CFLAGS="-Werror -Wall -Wshadow -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self"
      ]
)

AC_SUBST(MAINTAINER_CFLAGS)

dnl = gcov Coverage Reporting =================================================

m4_include([m4/gcov.m4])
AC_TDD_GCOV
AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_CXXFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)

dnl = Google Test Framework ===================================================

m4_include([m4/gtest.m4])
CHECK_GTEST
CHECK_XORG_GTEST

dnl = GTK Doc Check ===========================================================

GTK_DOC_CHECK([1.8])

dnl ===========================================================================

AC_CONFIG_FILES([
  Makefile
  src/Makefile
  example/Makefile
  tests/Makefile
  libido.pc
  libido3.pc
])

AC_OUTPUT

echo ""
echo " ido $VERSION"
echo " ==============================="
echo ""
echo " Prefix       : ${prefix}"
echo " gcov         : ${use_gcov}"
echo ""
echo " Documentation: ${enable_gtk_doc}"
echo ""