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

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.59)

AC_INIT([ido],
        [ido_version],
        [https://bugs.launchpad.net/avani])
AC_CONFIG_SRCDIR([src/libido.h])
AC_CONFIG_MACRO_DIR([build/autotools])

AM_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE([1.9 foreign])

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_DISABLE_STATIC
AC_PROG_LIBTOOL
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_ARG_WITH([gtk],
  [AS_HELP_STRING([--with-gtk],
    [Which version of gtk to use @<:@default=3@:>@])],
  [],
  [with_gtk=3])
AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3])

if test "x$with_gtk" = "x2"; then
  PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.19.7)
else
  PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0)
fi
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],
              [AC_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 = GTK Doc Check ===========================================================

GTK_DOC_CHECK([1.8])

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

SHAVE_INIT([build/autotools], [enable])

AC_CONFIG_FILES([
  Makefile
  build/Makefile
  build/autotools/Makefile
  build/autotools/shave-libtool
  build/autotools/shave
  src/Makefile
  example/Makefile
  libido.pc
  libido3.pc
])

AC_OUTPUT

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