wmclockmon: update autotools files
[dockapps.git] / wmclockmon / configure.ac
blob06a5760384ad52abe6a02ab9d21d4ba7f0a6688b
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.52)
4 dnl AC_INIT(src/main.c)
5 dnl AM_INIT_AUTOMAKE(wmclockmon, 0.8.1)
6 AC_INIT(wmclockmon, 0.8.1, tnemeth@free.fr)
7 AC_CANONICAL_HOST
8 AC_CANONICAL_TARGET
9 AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
11 AC_CONFIG_SRCDIR(src/main.c)
12 AM_CONFIG_HEADER(config.h)
14 dnl Checks for programs.
15 AC_PROG_AWK
16 AC_PROG_CC
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
20 dnl
21 dnl Specify paths to look for libraries and headers
22 dnl ===============================================
23 AC_ARG_WITH(libs-from,
24        [  --with-libs-from        pass compiler flags to look for libraries],
25        [lib_search_path="$withval $lib_search_path"])
27 AC_ARG_WITH(incs-from,
28        [  --with-incs-from        pass compiler flags to look for header files],
29        [inc_search_path="$withval $inc_search_path"])
32 dnl ===========================================
33 dnl             Stuff that uses X
34 dnl ===========================================
36 AC_PATH_XTRA
38 X_LIBRARY_PATH=$x_libraries
40 XCFLAGS="$X_CFLAGS"
42 XLFLAGS="$X_LIBS"
44 XLIBS="-lX11 $X_EXTRA_LIBS"
46 lib_search_path="$lib_search_path $XLFLAGS -L/usr/local/lib"
47 inc_search_path="$inc_search_path $XCFLAGS -I/usr/local/include"
49 AC_SUBST(X_LIBRARY_PATH)
51 dnl Shape extension
52 dnl ===============
53 AC_CHECK_LIB(Xext, XShapeCombineMask, [XLIBS="$XLIBS -lXext"],
54     [echo "The shape extension stuff could not be found in the X client libraries"
55      exit 1],
56     $X_LIBS $X_EXTRA_LIBS -lX11)
58 dnl XPM library
59 dnl ===========
60 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [XLIBS="$XLIBS -lXpm"],
61     [echo "The libXpm library was not found, but is necessary to build this library"
62      exit 1],
63     $X_LIBS $X_EXTRA_LIBS -lX11)
65 AC_SUBST(XCFLAGS)
66 AC_SUBST(XLFLAGS)
67 AC_SUBST(XLIBS)
69 AC_SUBST(X_EXTRA_LIBS)
71 dnl ===============================================
72 dnl             End of stuff that uses X
73 dnl ===============================================
75 dnl =========
76 dnl Debugging
77 dnl =========
78 AC_ARG_ENABLE(debug,
79              [  --enable-debug          turn on debugging [default=on]],,enable_debug=no)
80 if test "$enable_debug" = yes; then
81   DFLAGS="-Wall -g -ansi -pedantic"
82   AC_DEFINE(DEBUG, 1, [use debug code])
84 AC_SUBST(DFLAGS)
87 dnl ============
88 dnl Check for OS
89 dnl ============
91 ignore_buffers=no
92 ignore_cached=no
93 ignore_wired=no
95 case ${host_os} in
96 linux*)
97   OS=linux
98   ignore_buffers=yes
99   ignore_cached=yes
100   ;;
101 freebsd*)
102   OS=freebsd
103   ignore_wired=yes
104   ignore_cached=yes
105   LIBS="$LIBS -lkvm"
106   SETGID_FLAGS="-g kmem -m 2755 -o root"
107   ;;
108 openbsd*)
109   OS=openbsd
110   ;;
111 netbsd*)
112   OS=netbsd
113   ;;
114 solaris*)
115   OS=solaris
116   ;;
118   echo ""
119   echo "Sorry, ${host_os} is not supported yet"
120   echo ""
121   exit 1
122   ;;
123 esac
125 AC_SUBST(OS)
126 AC_SUBST(SETGID_FLAGS)
127 AC_SUBST(LIBS)
129 if test "$ignore_buffers" = yes; then
130   AC_DEFINE(IGNORE_BUFFERS, 1, [use '--ignore-buffers' option])
132 if test "$ignore_cached" = yes; then
133   AC_DEFINE(IGNORE_CACHED, 1, [use '--ignore-cached' option])
135 if test "$ignore_wired" = yes; then
136   AC_DEFINE(IGNORE_WIRED, 1, [use '--ignore-wired' option])
140 dnl =============================
141 dnl Checks for library functions.
142 dnl =============================
144 LIBRARY_SEARCH_PATH="$lib_search_path"
145 HEADER_SEARCH_PATH="$inc_search_path"
147 AC_SUBST(LIBRARY_SEARCH_PATH)
148 AC_SUBST(HEADER_SEARCH_PATH)
150 dnl Checks for header files.
151 AC_HEADER_STDC
152 AC_CHECK_HEADERS([fcntl.h memory.h stddef.h stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h])
154 dnl Checks for typedefs, structures, and compiler characteristics.
155 AC_C_CONST
156 AC_TYPE_SIZE_T
157 AC_HEADER_TIME
159 dnl Checks for library functions.
160 AC_FUNC_MALLOC
161 AC_CHECK_FUNCS(select strtoul uname)
163 AC_CONFIG_FILES(Makefile \
164                 src/Makefile \
165                 doc/Makefile \
166                 wmclockmon-config/Makefile\
167                 wmclockmon-cal/Makefile\
168                 styles/Makefile)
169 AC_OUTPUT