7dac395c67bcfbcffbf9312c5e68a75d8b223d36
[expresskeys.git] / configure.in
1 dnl --- Process this file with autoconf to produce a configure script ---
2
3 dnl --- Style and most code below nicked from the linuxwacom package ;-) ---
4
5 AC_INIT(src-expresskeys/main_setup.c)
6 AM_CONFIG_HEADER(config.h)
7 AM_INIT_AUTOMAKE(expresskeys, 0.2.3)
8 AM_MAINTAINER_MODE
9 AC_PROG_CC
10
11 dnl --- Specify our source directories. OBS: If they change, AC_OUTPUT must
12 dnl also be changed accordingly (at the end of this file) ---
13
14 SRC_DIRS=""
15 SRC_EXPRESSKEYS=src-expresskeys
16 SRC_EXPRESSKEYSCONF=src-expresskeysconf
17
18 dnl --- Begin function for checking Xlib development environment ---
19
20 XLIBDIR_DEFAULT=/usr/X11R6/lib
21 ENV_XLIB=no
22
23 AC_DEFUN([AC_CHECK_XLIB],[
24 XLIBDIR=
25 AC_ARG_WITH(xlib,
26 AS_HELP_STRING([--with-xlib=dir], [uses a specified X11R6 directory]),
27 [XLIBDIR=$withval])
28
29 AC_MSG_CHECKING(for Xlib directory)
30 if test "$XLIBDIR" == "" || test "$XLIBDIR" == "yes"; then
31         if test -d $XLIBDIR_DEFAULT; then
32                 XLIBDIR=$XLIBDIR_DEFAULT
33                 ENV_XLIB=yes
34                 AC_MSG_RESULT(found)
35         else
36                 ENV_XLIB=no
37                 AC_MSG_RESULT(not found - tried $XLIBDIR_DEFAULT)
38         fi
39 elif test -d $XLIBDIR; then
40         ENV_XLIB=yes
41         AC_MSG_RESULT(found)
42 else
43         ENV_XLIB=no
44         AC_MSG_RESULT(not found - tried $XLIBDIR)
45 fi
46 ])
47
48 dnl --- End function for checking Xlib development environment ---
49
50 dnl --- Call function to check Xlib ---
51
52 AC_CHECK_XLIB
53
54 dnl --- Check if we should build expresskeys (default yes) ---
55
56 EXPRESSKEYS_DEFAULT=yes
57 OPTION_EXPRESSKEYS=no
58 AC_ARG_ENABLE(expresskeys,
59 AC_HELP_STRING([--enable-expresskeys], [Enable building expresskeys [[default=yes]]]),
60         , enable_expresskeys=$EXPRESSKEYS_DEFAULT)
61 if test "$enable_expresskeys" != "no"; then
62         if test x$ENV_XLIB != xyes; then
63                 echo "***"; echo "*** WARNING:";
64                 echo "*** expresskeys requires Xlib environment."
65                 echo "*** expresskeys will not be built."
66                 echo "***"
67         else
68                 OPTION_EXPRESSKEYS=yes
69                 EXPRESSKEYS_LIBS="-L$XLIBDIR -lX11 -lXi -lXtst"
70                 SRC_DIRS="$SRC_DIRS $SRC_EXPRESSKEYS"
71         fi
72 fi
73
74 dnl --- Check if we should build expresskeysconf (default no - not ready) ---
75
76 EXPRESSKEYSCONF_DEFAULT=no
77 OPTION_EXPRESSKEYSCONF=no
78 AC_ARG_ENABLE(expresskeysconf,
79 AC_HELP_STRING([--enable-expresskeysconf], [Enable building expresskeysconf [[default=no]]]),
80         , enable_expresskeysconf=$EXPRESSKEYSCONF_DEFAULT)
81 if test "$enable_expresskeysconf" != "no"; then
82         if test x$ENV_XLIB != xyes; then
83                 echo "***"; echo "*** WARNING:";
84                 echo "*** expresskeysconf requires Xlib environment."
85                 echo "*** expresskeysconf will not be built."
86                 echo "***"
87         else
88                 OPTION_EXPRESSKEYSCONF=yes
89                 EXPRESSKEYSCONF_LIBS="-L$XLIBDIR -lX11"
90                 SRC_DIRS="$SRC_DIRS $SRC_EXPRESSKEYSCONF"
91         fi
92 fi
93
94 dnl --- Separate test output from file-generation output ---
95
96 AC_SUBST(SRC_DIRS)
97 AC_SUBST(EXPRESSKEYS_LIBS)
98 AC_SUBST(EXPRESSKEYSCONF_LIBS)
99
100 dnl --- Create the files ---
101
102 AC_OUTPUT(Makefile
103         src-expresskeys/Makefile
104         src-expresskeysconf/Makefile)
105
106 dnl --- Show the result ---
107
108 echo ""
109 echo "----------------------------------------"
110 echo "  BUILD ENVIRONMENT:"
111 echo "             Xlib - $ENV_XLIB $XLIBDIR"
112 echo ""
113 echo "  BUILD OPTIONS:"
114 echo "  expresskeysconf - $OPTION_EXPRESSKEYSCONF <-- OBS Not ready yet!"
115 echo "      expresskeys - $OPTION_EXPRESSKEYS"
116 echo "----------------------------------------"
117 echo ""
118