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