aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 910bbd5635f5200bb862404b8b61dce6b3a12a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
>AC_PREREQ(2.53)
AC_INIT([libfakekey], 0.3, [yocto@yoctoproject.org])
AC_CONFIG_SRCDIR([src/libfakekey.c])

AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE()
AM_CONFIG_HEADER(config.h)


# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_HEADER_STDC

dnl ------ libtool versioning -----------------------------------------------

LT_CURRENT=0
LT_REVISION=1
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(LT_VERSION_INFO)

LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_CURRENT_MINUS_AGE)

dnl ------ Check for X Stuff ------------------------------------------------

PKG_CHECK_MODULES(X11, x11, [have_libx11pc="yes"], [have_libx11pc="no"])

if test $have_libx11pc = yes; then
   PKG_CHECK_MODULES(XLIBS, x11 xtst)

   FAKEKEY_LIBS="$XLIBS_LIBS"
   FAKEKEY_CFLAGS="$XLIBS_CFLAGS"

else

AC_PATH_XTRA

ALL_X_LIBS="$X_LIBS -lX11"

AC_CHECK_LIB(Xtst, XTestQueryExtension, XTEST_LIBS=-lXtst have_xtest="yes" , have_xtest="no", $ALL_X_LIBS)

if test "x$have_xtest" = "xno"; then
   AC_MSG_ERROR([Cannot find XTest extension library])
   exit 1
fi

FAKEKEY_CFLAGS="$XLIBS_CLAGS"
FAKEKEY_LIBS="$ALL_X_LIBS $XTEST_LIBS"

fi

dnl ------ Debug -----------------------------------------------------------

AC_ARG_ENABLE(debug,
  [  --enable-debug          enable debug ( verbose ) build],
     enable_debug=$enableval, enable_debug=no )

if test x$enable_debug != xno; then
   AC_DEFINE_UNQUOTED(WANT_DEBUG, 1, [Make a debug (Verbose) Build])
fi

dnl ------ Doxygen docs ----------------------------------------------------

AC_ARG_ENABLE(doxygen-docs,     
  [  --enable-doxygen-docs   build DOXYGEN API documentation (requires Doxygen)], 
     enable_doxygen_docs=$enableval,enable_doxygen_docs=no)

if test x$enable_doxygen_docs = xyes ; then

  AC_PATH_PROG(DOXYGEN, doxygen, no)

  AC_MSG_CHECKING([whether to build Doxygen documentation])

  if test x$DOXYGEN = xno ; then
    have_doxygen=no
  else
    have_doxygen=yes
  fi

  if test x$have_doxygen = xno; then
    AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
  fi

  AC_MSG_RESULT(yes)

fi

AM_CONDITIONAL(HAVE_DOXYGEN, test x$enable_doxygen_docs = xyes)	


dnl ------ GCC flags --------------------------------------------------------

if test "x$GCC" = "xyes"; then
        GCC_WARNINGS="-g -Wall -fno-strict-aliasing"
        FAKEKEY_CFLAGS="$GCC_WARNINGS $FAKEKEY_CFLAGS"
fi

dnl -------------------------------------------------------------------------

AC_SUBST(FAKEKEY_CFLAGS)
AC_SUBST(FAKEKEY_LIBS)


AC_OUTPUT([
Makefile
libfakekey.pc
fakekey/Makefile
src/Makefile
doc/Doxyfile
doc/Makefile
tests/Makefile

])

dnl ==========================================================================
echo "
                    LibFakeKey $VERSION
                  ======================

        prefix:                 ${prefix}
        source code location:   ${srcdir}

        Building with Debug:                ${enable_debug}
        Building with API Documentation:    ${enable_doxygen_docs}

"