summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 2bee04770d659dd515bf554fd23ba6c4e11a16b4 (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
AC_PREREQ(2.63)

# Package

AC_INIT([tdegtk],[1.0.1],[https://bugs.trinitydesktop.org],[tdegtk])
AC_CONFIG_SRCDIR([tdegtk/tdegtk.h])
AC_CONFIG_MACRO_DIR([build])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

NANO=`echo AC_PACKAGE_VERSION | cut -d'.' -f4`
if test x"$NANO" = x || test "x$NANO" = "x0" ; then
    TDEGTK_TRUNK="no"
    PACKAGE_VERSION_NANO="0"
else
    TDEGTK_TRUNK="yes"
    PACKAGE_VERSION_NANO="$NANO"
fi
AC_SUBST(TDEGTK_TRUNK)
AC_SUBST(PACKAGE_VERSION_NANO)

AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
LT_INIT
AC_C_CONST
AC_C_INLINE

# Build dependencies

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

AC_SUBST(glib_req, 2.26.0)
AC_SUBST(gtk_req, 3.1.10)
AC_SUBST(cairo_req, 1.10)

PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-3.0 >= $gtk_req cairo >= $cairo_req)
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)

# Debug flags

if test x$TDEGTK_TRUNK = xyes; then
    DEFAULT_DEBUG="yes"
else
    DEFAULT_DEBUG="no"
fi
AC_SUBST(DEFAULT_DEBUG)
AC_ARG_ENABLE([debug],
              [AS_HELP_STRING([--enable-debug=@<:@no/yes/full@:>@],[Control debug level @<:@default=debug_default@:>@])],
              [], [enable_debug=$DEFAULT_DEBUG])
AS_CASE([$enable_debug],
        [yes],
        [
          test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
          DEBUG_CFLAGS="-D_DEBUG"
        ],
        [no],
        [DEBUG_CFLAGS="-DNDEBUG"],
        [AC_MSG_ERROR([Unknown argument for --enable-debug])]
)
AC_SUBST(DEBUG_CFLAGS)

# Maintainer flags

if test x$TDEGTK_TRUNK = xyes; then
    DEFAULT_MAINTAINER_FLAGS="yes"
else
    DEFAULT_MAINTAINER_FLAGS="no"
fi
AC_SUBST(DEFAULT_MAINTAINER_FLAGS)
AC_ARG_ENABLE([maintainer-flags],
              [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],[Use strict compiler flags @<:@default=maintainer_flags_default@:>@])],
              [],
              [enable_maintainer_flags=$DEFAULT_MAINTAINER_FLAGS])
AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
      [
        AS_COMPILER_FLAGS([MAINTAINER_CFLAGS],
                          ["-fno-common -Wall -Wextra -Werror -Wempty-body
                            -Wno-missing-field-initializers -Wstrict-aliasing=2
                            -Wno-unused-parameter -Wdeclaration-after-statement
                            -Wpointer-arith -Wcast-align -Wwrite-strings
                            -Wformat-security -Wformat-nonliteral -Winit-self
                            -Wmissing-declarations -Wnested-externs -Wundef
                            -Wold-style-definition -Wswitch-default
                            -Wredundant-decls"])
      ]
)
AC_SUBST(MAINTAINER_CFLAGS)

# Variables

TDEGTK_LIBADD="\$(DEPS_LIBS)"
AC_SUBST(TDEGTK_LIBADD)

TDEGTK_CFLAGS="-I\$(top_srcdir) -DTDEGTK_COMPILATION \$(DEPS_CFLAGS) \$(DEBUG_CFLAGS) \$(MAINTAINER_CFLAGS)"
AC_SUBST(TDEGTK_CFLAGS)

TDEGTK_LDFLAGS="-module -avoid-version -no-undefined"
AC_SUBST(TDEGTK_LDFLAGS)

GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
AC_SUBST(GTK_VERSION)

# Files

AC_CONFIG_FILES([
Makefile
build/Makefile
po/Makefile
tdegtk/Makefile
tests/Makefile
rc/Makefile
])
AC_OUTPUT

# Summary

echo ""
echo "  tdegtk $PACKAGE_VERSION"
echo "  ========================="
echo ""
echo "  Debug:  ${enable_debug}"
echo "  Prefix: ${prefix}"
echo ""
echo "  Compiler flags: ${CPPFLAGS} ${DEBUG_CFLAGS} ${MAINTAINER_CFLAGS}"
echo ""