build: remove shl_timer.h
[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 PKG_CHECK_MODULES([CHECK], [check],
65                   [have_check=yes], [have_check=no])
66 AC_SUBST(CHECK_CFLAGS)
67 AC_SUBST(CHECK_LIBS)
68 AM_CONDITIONAL([BUILD_HAVE_CHECK], [test "x$have_check" = "xyes"])
69
70 #
71 # Parse arguments
72 # This parses all arguments that are given via "--enable-XY" or "--with-XY" and
73 # saves the results in local variables.
74 #
75
76 # debug
77 AC_MSG_CHECKING([whether to build with debugging on])
78 AC_ARG_ENABLE([debug],
79               [AS_HELP_STRING([--enable-debug],
80                               [whether to build with debugging on])])
81 if test "x$enable_debug" = "x" ; then
82         enable_debug="yes (default)"
83 fi
84 AC_MSG_RESULT([$enable_debug])
85 if test "x${enable_debug% *}" = "xyes" ; then
86         enable_debug="yes"
87         AC_DEFINE([BUILD_ENABLE_DEBUG], [1], [Enable debug mode])
88 else
89         enable_debug="no"
90         AC_DEFINE([NDEBUG], [1], [No Debug])
91 fi
92 AM_CONDITIONAL([BUILD_ENABLE_DEBUG],
93                [test "x$enable_debug" = "xyes"])
94
95 # optimizations
96 AC_MSG_CHECKING([whether to enable code optimizations])
97 AC_ARG_ENABLE([optimizations],
98               [AS_HELP_STRING([--disable-optimizations],
99                               [whether to disable code optimizations])])
100 if test "x$enable_optimizations" = "x" ; then
101         enable_optimizations="yes (default)"
102 fi
103 AC_MSG_RESULT([$enable_optimizations])
104 if test "x${enable_optimizations% *}" = "xyes" ; then
105         enable_optimizations="yes"
106 else
107         enable_optimizations="no"
108 fi
109 AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
110                [test "x$enable_optimizations" = "xyes"])
111
112 #
113 # Makefile vars
114 # After everything is configured, we create all makefiles.
115 #
116
117 AC_CONFIG_FILES([Makefile
118                  docs/libtsm.pc])
119 AC_OUTPUT
120
121 #
122 # Configuration output
123 # Show configuration to the user so they can check whether everything was
124 # configured as expected.
125 #
126
127 AC_MSG_NOTICE([Build configuration:
128
129                prefix: $prefix
130           exec-prefix: $exec_prefix
131                libdir: $libdir
132            includedir: $includedir
133
134   Miscellaneous Options:
135                 debug: $enable_debug
136         optimizations: $enable_optimizations
137        building tests: $have_check
138
139         Run "${MAKE-make}" to start compilation process])