16e37115e5746923d17581d77793ffa9002f1a73
[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 #
25 # Don't add a default "-g -O2" if CFLAGS wasn't specified. For debugging it is
26 # often more convenient to have "-g -O0". You can still override it by
27 # explicitly setting it on the command line.
28 #
29
30 : ${CFLAGS=""}
31
32 AC_PROG_CC
33 AC_PROG_CC_C99
34 AM_PROG_CC_C_O
35 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
36 AC_PROG_SED
37 AC_PROG_MKDIR_P
38 AC_PROG_LN_S
39 AC_PROG_GREP
40 AC_PROG_AWK
41
42 LT_PREREQ(2.2)
43 LT_INIT
44
45 #
46 # pkg-config dependencies
47 # This unconditionally checks for all dependencies even if they are disabled. We
48 # later look whether all required depedencies are met and finish the
49 # configuration. We group similar packages into one logical group here to avoid
50 # having variables for each single library.
51 # This, however, makes ./configure output very unintuitive error messages if a
52 # package is not found so we must make sure we print more verbose messages
53 # ourself.
54 #
55
56 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
57                   [have_xkbcommon=yes], [have_xkbcommon=no])
58 AC_SUBST(XKBCOMMON_CFLAGS)
59 if test "x$have_xkbcommon" = "xyes" ; then
60         AC_DEFINE([BUILD_HAVE_XKBCOMMON], [1], [Have xkbcommon library])
61 fi
62 AM_CONDITIONAL([BUILD_HAVE_XKBCOMMON], [test "x$have_xkbcommon" = "xyes"])
63
64 #
65 # Parse arguments
66 # This parses all arguments that are given via "--enable-XY" or "--with-XY" and
67 # saves the results in local variables.
68 #
69
70 # debug
71 AC_MSG_CHECKING([whether to build with debugging on])
72 AC_ARG_ENABLE([debug],
73               [AS_HELP_STRING([--enable-debug],
74                               [whether to build with debugging on])])
75 if test "x$enable_debug" = "x" ; then
76         enable_debug="yes (default)"
77 fi
78 AC_MSG_RESULT([$enable_debug])
79 if test "x${enable_debug% *}" = "xyes" ; then
80         enable_debug="yes"
81         AC_DEFINE([BUILD_ENABLE_DEBUG], [1], [Enable debug mode])
82 else
83         enable_debug="no"
84         AC_DEFINE([NDEBUG], [1], [No Debug])
85 fi
86 AM_CONDITIONAL([BUILD_ENABLE_DEBUG],
87                [test "x$enable_debug" = "xyes"])
88
89 # optimizations
90 AC_MSG_CHECKING([whether to enable code optimizations])
91 AC_ARG_ENABLE([optimizations],
92               [AS_HELP_STRING([--disable-optimizations],
93                               [whether to disable code optimizations])])
94 if test "x$enable_optimizations" = "x" ; then
95         enable_optimizations="yes (default)"
96 fi
97 AC_MSG_RESULT([$enable_optimizations])
98 if test "x${enable_optimizations% *}" = "xyes" ; then
99         enable_optimizations="yes"
100 else
101         enable_optimizations="no"
102 fi
103 AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
104                [test "x$enable_optimizations" = "xyes"])
105
106 #
107 # Makefile vars
108 # After everything is configured, we create all makefiles.
109 #
110
111 AC_CONFIG_FILES([Makefile
112                  docs/libtsm.pc])
113 AC_OUTPUT
114
115 #
116 # Configuration output
117 # Show configuration to the user so they can check whether everything was
118 # configured as expected.
119 #
120
121 AC_MSG_NOTICE([Build configuration:
122
123                prefix: $prefix
124           exec-prefix: $exec_prefix
125                libdir: $libdir
126            includedir: $includedir
127
128   Miscellaneous Options:
129                 debug: $enable_debug
130         optimizations: $enable_optimizations
131
132         Run "${MAKE-make}" to start compilation process])