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