Bump to kbd 2.2.0
[platform/upstream/kbd.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3 AC_INIT([kbd],[2.2.0],[gladkov.alexey@gmail.com],[],[http://kbd-project.org/])
4
5 AC_PREREQ([2.69])
6
7 AC_CONFIG_AUX_DIR(config)
8 AC_CONFIG_MACRO_DIR([m4])
9
10 AM_INIT_AUTOMAKE([1.9 -Wall -Wno-portability color-tests dist-xz])
11 AC_CONFIG_SRCDIR([src/loadkeys.c])
12 AC_CONFIG_HEADERS(config.h)
13 PKG_PROG_PKG_CONFIG
14 AX_CODE_COVERAGE
15
16 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
17 AM_SILENT_RULES([yes])
18
19 # Checks for programs.
20 CFLAGS="${CFLAGS:-}"
21
22 AC_PROG_CC
23 AC_PROG_CC_C99
24 AM_PROG_CC_C_O
25 AC_PROG_YACC
26 AC_PROG_LEX
27 AC_PROG_SED
28 AC_PROG_INSTALL
29 AC_PROG_LN_S
30 AC_PROG_MAKE_SET
31 AC_CANONICAL_HOST
32
33 dnl older versions of automake didn't include this macro
34 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
35 LT_INIT
36
37 AM_GNU_GETTEXT_VERSION([0.14.1])
38 AM_GNU_GETTEXT([external])
39 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
40
41 # Checks for header files.
42 AC_HEADER_DIRENT
43 AC_HEADER_STDC
44 AC_HEADER_SYS_WAIT
45 AC_CHECK_HEADERS([fcntl.h libintl.h locale.h memory.h stdlib.h string.h \
46 sys/file.h sys/ioctl.h termios.h unistd.h])
47
48 # Checks for typedefs, structures, and compiler characteristics.
49 AC_C_CONST
50 AC_C_INLINE
51 AC_TYPE_SIZE_T
52 AC_STRUCT_TM
53 AC_TYPE_UID_T
54
55 # Checks for library functions.
56 AC_PROG_GCC_TRADITIONAL
57 AC_FUNC_CHOWN
58 AC_FUNC_CLOSEDIR_VOID
59 AC_FUNC_FORK
60 AC_FUNC_STAT
61
62 AC_CHECK_FUNCS([alarm memset setlocale strcasecmp strchr strdup strerror \
63 strspn strstr strtol strtoul setpgrp malloc realloc])
64
65 # Optimization level
66 CC_O_LEVEL="-O2"
67 FORTIFY_SOURCE="-D_FORTIFY_SOURCE=2"
68
69 if test "$enable_code_coverage" = yes; then
70         CC_O_LEVEL="-O0"
71         FORTIFY_SOURCE=
72 fi
73
74 case "$GCC,$ac_cv_prog_cc_g" in
75         yes,yes) CFLAGS="-g $CC_O_LEVEL $FORTIFY_SOURCE" ;;
76         yes,)    CFLAGS="$CC_O_LEVEL $FORTIFY_SOURCE" ;;
77            ,yes) CFLAGS="-g" ;;
78 esac
79
80 CC_CHECK_CFLAGS_APPEND([\
81         -Waggregate-return \
82         -Wall \
83         -Wcast-align \
84         -Wconversion \
85         -Wdisabled-optimization \
86         -Wextra \
87         -Wmissing-declarations \
88         -Wmissing-format-attribute \
89         -Wmissing-noreturn \
90         -Wmissing-prototypes \
91         -Wpointer-arith \
92         -Wredundant-decls \
93         -Wshadow \
94         -Wstrict-prototypes \
95         -Wwrite-strings \
96 ])
97
98 case $host_cpu in
99         m68*) KEYCODES_PROGS=no ;;
100         *)    KEYCODES_PROGS=yes ;;
101 esac
102 AM_CONDITIONAL(KEYCODES_PROGS, test "$KEYCODES_PROGS" = "yes")
103
104 case $host_cpu in
105         i?86*)   RESIZECONS_PROGS=yes ;;
106         x86_64*) RESIZECONS_PROGS=yes ;;
107         *)       RESIZECONS_PROGS=no  ;;
108 esac
109 AM_CONDITIONAL(RESIZECONS_PROGS, test "$RESIZECONS_PROGS" = "yes")
110
111 AC_ARG_ENABLE(optional-progs,
112         AS_HELP_STRING(--enable-optional-progs, [Build and install a optional programs]),
113         [OPTIONAL_PROGS=$enableval],[OPTIONAL_PROGS=no])
114 AM_CONDITIONAL(OPTIONAL_PROGS, test "$OPTIONAL_PROGS" = "yes")
115
116 AC_ARG_ENABLE(libkeymap,
117         AS_HELP_STRING(--enable-libkeymap, [Build and install a libkeymap]),
118         [BUILD_LIBKEYMAP=$enableval],[BUILD_LIBKEYMAP=no])
119 AM_CONDITIONAL(BUILD_LIBKEYMAP, test "$BUILD_LIBKEYMAP" = "yes")
120
121 AC_ARG_ENABLE(vlock,
122         AS_HELP_STRING(--disable-vlock, [do not build vlock]),
123         [VLOCK_PROG=$enableval],[VLOCK_PROG=yes])
124 AM_CONDITIONAL(VLOCK, test "$VLOCK_PROG" = "yes")
125
126 if test "$VLOCK_PROG" = "yes"; then
127         AC_CHECK_LIB(pam, pam_start, [
128                         AC_CHECK_HEADER([security/pam_appl.h],
129                                 [have_pam=1],
130                                 AC_MSG_ERROR([Can't find required header files.]))])
131         AC_CHECK_LIB(pam_misc, misc_conv, [
132                 AC_CHECK_HEADER([security/pam_misc.h],
133                                 [have_pam_misc=1],
134                                 AC_MSG_ERROR([Can't find required header files.]))])
135         if test -z "$have_pam" -o -z "$have_pam_misc"; then
136                 AC_MSG_ERROR([libpam-devel required.])
137         fi
138         AC_SUBST(PAM_LIBS, "-lpam -lpam_misc")
139 fi
140
141 AC_ARG_ENABLE(tests,
142         [AS_HELP_STRING([--disable-tests], [do not build tests])],
143         [build_tests=$enableval], [build_tests=auto])
144 AM_CONDITIONAL(BUILD_TESTS, test "$build_tests" != "no")
145
146 AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
147 AM_CONDITIONAL(HAVE_DOXYGEN, test "$HAVE_DOXYGEN" = "yes")
148
149 AC_CONFIG_FILES([Makefile
150                 data/Makefile
151                 docs/Makefile
152                 docs/man/Makefile
153                 docs/man/man1/Makefile
154                 docs/man/man1/dumpkeys.1
155                 docs/man/man1/loadkeys.1
156                 docs/man/man1misc/Makefile
157                 docs/man/man5/Makefile
158                 docs/man/man8/Makefile
159                 docs/man/man8/loadunimap.8
160                 docs/man/man8/mapscrn.8
161                 docs/man/man8/setfont.8
162                 docs/man/man8misc/Makefile
163                 docs/reference/Makefile
164                 docs/reference/libkeymap/Makefile
165                 po/Makefile.in
166                 src/Makefile
167                 src/libcommon/Makefile
168                 src/libkbdfile/Makefile
169                 src/libkeymap/Makefile
170                 src/vlock/Makefile
171                 tests/Makefile])
172 AC_OUTPUT
173
174 AC_MSG_RESULT([
175         $PACKAGE $VERSION
176         ======
177
178         prefix:                 ${prefix}
179         libdir:                 ${libdir}
180         bindir:                 ${bindir}
181         datadir:                ${datadir}
182
183         compiler:               ${CC}
184         cflags:                 ${CFLAGS}
185
186         {get,set}keycodes:      ${KEYCODES_PROGS}
187         resizecons:             ${RESIZECONS_PROGS}
188         optional progs:         ${OPTIONAL_PROGS}
189         vlock:                  ${VLOCK_PROG}
190         libkbdfile:             ${BUILD_LIBKEYMAP}
191         libkeymap:              ${BUILD_LIBKEYMAP}
192 ])