build: increase version to 3
[platform/upstream/libtsm.git] / configure.ac
1 #
2 # libtsm - build configuration script
3 # Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
4 #
5
6 AC_PREREQ(2.68)
7
8 AC_INIT([libtsm],
9         [1],
10         [https://github.com/dvdhrm/libtsm/issues],
11         [libtsm],
12         [http://dvdhrm.github.io/libtsm])
13 AC_CONFIG_SRCDIR([src/tsm_vte.c])
14 AC_CONFIG_AUX_DIR([build-aux])
15 AC_CONFIG_MACRO_DIR([m4])
16 AC_CONFIG_HEADER(config.h)
17 AC_USE_SYSTEM_EXTENSIONS
18 AC_SYS_LARGEFILE
19 AC_CANONICAL_HOST
20
21 AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects dist-xz no-dist-gzip tar-pax -Wall -Werror -Wno-portability])
22 AM_SILENT_RULES([yes])
23
24 AC_SUBST(PACKAGE_DESCRIPTION, ["terminal-emulator state machine"])
25
26 #
27 # Don't add a default "-g -O2" if CFLAGS wasn't specified. For debugging it is
28 # often more convenient to have "-g -O0". You can still override it by
29 # explicitly setting it on the command line.
30 #
31
32 : ${CFLAGS=""}
33
34 AC_PROG_CC
35 AC_PROG_CC_C99
36 AM_PROG_CC_C_O
37 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
38 AC_PROG_SED
39 AC_PROG_MKDIR_P
40 AC_PROG_LN_S
41 AC_PROG_GREP
42 AC_PROG_AWK
43
44 LT_PREREQ(2.2)
45 LT_INIT
46
47 #
48 # We need xkbcommon for keysym definitions. If it's not found, we use our own
49 # private copy of xkbcommon-keysyms.h.
50 #
51
52 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
53                   [have_xkbcommon=yes], [have_xkbcommon=no])
54 AC_SUBST(XKBCOMMON_CFLAGS)
55 if test "x$have_xkbcommon" = "xyes" ; then
56         AC_DEFINE([BUILD_HAVE_XKBCOMMON], [1], [Have xkbcommon library])
57 fi
58 AM_CONDITIONAL([BUILD_HAVE_XKBCOMMON], [test "x$have_xkbcommon" = "xyes"])
59
60 #
61 # Test for "check" which we use for our test-suite. If not found, we disable
62 # all tests.
63 #
64
65 PKG_CHECK_MODULES([CHECK], [check],
66                   [have_check=yes], [have_check=no])
67 AC_SUBST(CHECK_CFLAGS)
68 AC_SUBST(CHECK_LIBS)
69 AM_CONDITIONAL([BUILD_HAVE_CHECK], [test "x$have_check" = "xyes"])
70
71 #
72 # debug mode
73 # If --enable-debug is given, we enable several non-standard debug options. We
74 # enable a lot of debug options by default, so this option is really only for
75 # extended developer debug modes.
76 #
77
78 AC_MSG_CHECKING([whether to build with debugging on])
79 AC_ARG_ENABLE([debug],
80               [AS_HELP_STRING([--enable-debug],
81                               [whether to build with debugging on])])
82 if test "x$enable_debug" = "x" ; then
83         enable_debug="yes (default)"
84 fi
85 AC_MSG_RESULT([$enable_debug])
86
87 if test "x${enable_debug% *}" = "xyes" ; then
88         enable_debug="yes"
89         AC_DEFINE([BUILD_ENABLE_DEBUG], [1], [Enable debug mode])
90 else
91         enable_debug="no"
92         AC_DEFINE([NDEBUG], [1], [No Debug])
93 fi
94 AM_CONDITIONAL([BUILD_ENABLE_DEBUG],
95                [test "x$enable_debug" = "xyes"])
96
97 #
98 # Enable gcc compiler optimizations. We enable them by default but allow
99 # disabling them for better backtraces during debugging.
100 #
101
102 AC_MSG_CHECKING([whether to enable code optimizations])
103 AC_ARG_ENABLE([optimizations],
104               [AS_HELP_STRING([--disable-optimizations],
105                               [whether to disable code optimizations])])
106 if test "x$enable_optimizations" = "x" ; then
107         enable_optimizations="yes (default)"
108 fi
109 AC_MSG_RESULT([$enable_optimizations])
110
111 if test "x${enable_optimizations% *}" = "xyes" ; then
112         enable_optimizations="yes"
113 else
114         enable_optimizations="no"
115 fi
116 AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
117                [test "x$enable_optimizations" = "xyes"])
118
119 #
120 # Makefile vars
121 # After everything is configured, we create all makefiles.
122 #
123
124 AC_CONFIG_FILES([Makefile
125                  docs/libtsm.pc])
126 AC_OUTPUT
127
128 #
129 # Configuration output
130 # Show configuration to the user so they can check whether everything was
131 # configured as expected.
132 #
133
134 AC_MSG_NOTICE([Build configuration:
135
136                prefix: $prefix
137           exec-prefix: $exec_prefix
138                libdir: $libdir
139            includedir: $includedir
140
141   Miscellaneous Options:
142                 debug: $enable_debug
143         optimizations: $enable_optimizations
144        building tests: $have_check
145
146         Run "${MAKE-make}" to start compilation process])