1dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.52)
3
4dnl AC_INIT(src/main.c)
5dnl AM_INIT_AUTOMAKE(wmcpuload, 0.9.0)
6AC_INIT(wmcpuload, 1.1.1, wmaker-dev@lists.windowmaker.org)
7AC_CANONICAL_HOST
8AC_CANONICAL_TARGET
9AM_INIT_AUTOMAKE
10
11AC_CONFIG_SRCDIR(src/main.c)
12AM_CONFIG_HEADER(config.h)
13
14dnl Checks for programs.
15AC_PROG_AWK
16AC_PROG_CC
17AC_PROG_INSTALL
18AC_PROG_LN_S
19
20dnl
21dnl Specify paths to look for libraries and headers
22dnl ===============================================
23AC_ARG_WITH(libs-from,
24       [  --with-libs-from        pass compiler flags to look for libraries],
25       [lib_search_path="$withval $lib_search_path"])
26
27AC_ARG_WITH(incs-from,
28       [  --with-incs-from        pass compiler flags to look for header files],
29       [inc_search_path="$withval $inc_search_path"])
30
31
32dnl ===========================================
33dnl             Stuff that uses X
34dnl ===========================================
35
36AC_PATH_XTRA
37
38X_LIBRARY_PATH=$x_libraries
39
40XCFLAGS="$X_CFLAGS"
41
42XLFLAGS="$X_LIBS"
43
44XLIBS="-lX11 $X_EXTRA_LIBS"
45
46lib_search_path="$lib_search_path $XLFLAGS"
47inc_search_path="$inc_search_path $XCFLAGS"
48
49AC_SUBST(X_LIBRARY_PATH)
50
51dnl Shape extension
52dnl ===============
53AC_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)
57
58dnl XPM library
59dnl ===========
60AC_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)
64
65AC_SUBST(XCFLAGS)
66AC_SUBST(XLFLAGS)
67AC_SUBST(XLIBS)
68
69AC_SUBST(X_EXTRA_LIBS)
70
71dnl ===============================================
72dnl             End of stuff that uses X
73dnl ===============================================
74
75
76dnl =========
77dnl Debugging
78dnl =========
79AC_ARG_ENABLE(debug,
80             [  --enable-debug          turn on debugging [default=no]],, enable_debug=no)
81if test "$enable_debug" = yes; then
82  DFLAGS="-Wall -g -ansi -pedantic"
83fi
84AC_SUBST(DFLAGS)
85
86
87dnl ============
88dnl Determine OS
89dnl ============
90
91ignore_nice=no
92use_smp=no
93
94case ${target_os} in
95linux*)
96  OS=linux
97  ignore_nice=yes
98  use_smp=yes
99  ;;
100freebsd*)
101  OS=freebsd
102  ignore_nice=yes
103  LIBS="$LIBS -lkvm"
104  SETGID_FLAGS="-g kmem -m 2755 -o  root"
105  ;;
106openbsd*)
107  OS=openbsd
108  ignore_nice=yes
109  ;;
110netbsd*)
111  OS=netbsd
112  ignore_nice=yes
113  ;;
114bsdi*)
115  OS=bsdi
116  ignore_nice=yes
117  ;;
118solaris*)
119  OS=solaris
120  LIBS="$LIBS -lkstat"
121  ;;
122cygwin*)
123  OS=cygwin
124  ;;
125irix*)
126  OS=irix
127  use_smp=yes
128  ;;
129darwin*)
130  OS=darwin
131  ;;
132*)
133  echo ""
134  echo "Sorry, ${target_os} is not supported yet"
135  echo ""
136  exit 1
137  ;;
138esac
139
140AC_SUBST(OS)
141AC_SUBST(SETGID_FLAGS)
142AC_SUBST(LIBS)
143
144if test "$ignore_nice" = yes; then
145  AC_DEFINE(IGNORE_NICE, 1, [use '--ignore-nice' option])
146fi
147if test "$use_smp" = yes; then
148  AC_DEFINE(USE_SMP, 1, [use SMP support])
149fi
150
151
152dnl =============================
153dnl Checks for library functions.
154dnl =============================
155
156LIBRARY_SEARCH_PATH="$lib_search_path"
157HEADER_SEARCH_PATH="$inc_search_path"
158
159AC_SUBST(LIBRARY_SEARCH_PATH)
160AC_SUBST(HEADER_SEARCH_PATH)
161
162dnl Checks for header files.
163AC_HEADER_STDC
164AC_HEADER_SYS_WAIT
165AC_HEADER_TIME
166AC_CHECK_HEADERS(fcntl.h memory.h stddef.h stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h)
167
168dnl Checks for library functions.
169AC_FUNC_MALLOC
170AC_CHECK_FUNCS(select)
171
172AC_CONFIG_FILES([Makefile
173		 src/Makefile
174		 libdockapp/Makefile
175		 doc/Makefile
176		 icons/Makefile
177		 contrib/Makefile
178		 contrib/wmcpuload.spec])
179AC_OUTPUT
180
181