Fix periodic focus bug
[wmaker-crm.git] / acinclude.m4
blob4cd15475622011df402ed5c314096a1b807d62da
1 #!/bin/sh
3 dnl
4 dnl WM_CHECK_LIB(NAME, FUNCTION, EXTRALIBS)
5 dnl
6 AC_DEFUN(WM_CHECK_LIB,
8 LDFLAGS_old="$LDFLAGS"
9 LDFLAGS="$LDFLAGS $lib_search_path"
10 AC_CHECK_LIB([$1],[$2],yes=yes,no=no,[$3])
11 LDFLAGS="$LDFLAGS_old"
15 dnl
16 dnl WM_CHECK_HEADER(NAME)
17 dnl
18 AC_DEFUN(WM_CHECK_HEADER,
20 CPPFLAGS_old="$CPPFLAGS"
21 CPPFLAGS="$CPPFLAGS $inc_search_path"
22 AC_CHECK_HEADER([$1])
23 CPPFLAGS="$CPPFLAGS_old"
27 dnl
28 dnl WM_CHECK_XFT_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
29 dnl
30 dnl # $XFTFLAGS should be defined before calling this macro,
31 dnl # else it will not be able to find Xft.h
32 dnl
33 AC_DEFUN(WM_CHECK_XFT_VERSION,
35 CPPFLAGS_old="$CPPFLAGS"
36 CPPFLAGS="$CPPFLAGS $XFTFLAGS $inc_search_path"
37 xft_major_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
38 xft_minor_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
39 xft_micro_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
40 AC_MSG_CHECKING([whether libXft is at least version $1])
41 AC_CACHE_VAL(ac_cv_lib_xft_version_ok,
42 [AC_TRY_LINK(
43 [/* Test version of libXft we have */
44 #include <X11/Xlib.h>
45 #include <X11/Xft/Xft.h>
47 #if !defined(XFT_VERSION) || XFT_VERSION < $xft_major_version*10000 + $xft_minor_version*100 + $xft_micro_version
48 #error libXft on this system is too old. Consider upgrading to at least $1
49 #endif
50 ], [],
51 eval "ac_cv_lib_xft_version_ok=yes",
52 eval "ac_cv_lib_xft_version_ok=no")])
53 if eval "test \"`echo '$ac_cv_lib_xft_version_ok'`\" = yes"; then
54 AC_MSG_RESULT(yes)
55 ifelse([$2], , :, [$2])
56 else
57 AC_MSG_RESULT(no)
58 ifelse([$3], , , [$3])
60 CPPFLAGS="$CPPFLAGS_old"
64 dnl
65 dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
66 dnl
67 AC_DEFUN(WM_CHECK_REDCRAP_BUGS,
69 AC_MSG_CHECKING(for RedHat system)
70 wm_check_flag='no :)'
71 rh_is_redhat=no
72 if test -f /etc/redhat-release; then
73 wm_check_flag=yes
74 rh_is_redhat=yes
76 AC_MSG_RESULT($wm_check_flag)
78 mins_found=no
79 bugs_found=no
80 if test "$wm_check_flag" = yes; then
81 echo
82 AC_MSG_WARN([Red Hat system; checking for Red-Hat-specific bugs.])
83 echo
85 # Check old wmaker from RedHat
87 if test "[$1]" != "/usr/X11R6" -a "$prefix" != "/usr/X11"; then
88 AC_MSG_CHECKING(for multiple installed wmaker versions)
89 if test -f /usr/X11R6/bin/wmaker; then
90 AC_MSG_RESULT(uh oh)
91 mins_found=yes
92 rh_old_wmaker=yes
93 else
94 rh_old_wmaker=no
95 AC_MSG_RESULT(no apparent problems)
99 # Check for infamous en_RN bug
100 # Wont work because autoconf will change LANG in the beginning of the
101 # script.
104 #AC_MSG_CHECKING(for silly en_RN joke that only causes headaches)
105 #echo $LANG
106 #if test "x$LANG" = xen_RN; then
107 #AC_MSG_RESULT(uh oh)
108 #AC_MSG_WARN([the LANG environment variable is set to the en_RN
109 #locale. Please unset it or you will have mysterious problems when
110 #using various software packages.])
111 #bugs_found=yes
112 #else
113 #AC_MSG_RESULT(no problem)
116 # If binary installation path is /usr/local/bin, check if it's in PATH
118 if test "[$2]" = "/usr/local/bin"; then
119 AC_MSG_CHECKING(if /usr/local/bin is in the search PATH)
120 wm_check_flag=no
121 rh_missing_usr_local_bin=yes
122 old_IFS="$IFS"
123 IFS=":"
124 for i in $PATH; do
125 if test "x$i" = "x/usr/local/bin"; then
126 wm_check_flag=yes
127 rh_missing_usr_local_bin=no
128 break;
130 done
131 IFS="$old_IFS"
132 if test "$wm_check_flag" = no; then
133 AC_MSG_RESULT(uh oh)
134 bugs_found=yes
135 else
136 AC_MSG_RESULT(no problem)
140 # If library installation path is /usr/local/lib,
141 # check if it's in /etc/ld.so.conf
143 if test "[$3]" = "/usr/local/lib"; then
144 wm_check_flag=yes
145 rh_missing_usr_local_lib=no
146 AC_MSG_CHECKING(if /usr/local/lib is in /etc/ld.so.conf)
147 test -z "`grep /usr/local/lib /etc/ld.so.conf`"
148 test "$?" -eq 0 && wm_check_flag=no
149 if test "$wm_check_flag" = no; then
150 AC_MSG_RESULT(uh oh)
151 rh_missing_usr_local_lib=yes
152 bugs_found=yes
153 else
154 AC_MSG_RESULT(no problem)
158 # Check for symbolic links
160 AC_MSG_CHECKING(for /usr/include/X11 symbolic link)
161 rh_missing_usr_include_x11=no
162 if test -d "/usr/include/X11"; then
163 AC_MSG_RESULT(found)
164 else
165 AC_MSG_RESULT(uh oh)
166 rh_missing_usr_include_x11=yes
167 mins_found=yes
171 # Check for /lib/cpp
173 AC_MSG_CHECKING(for /lib/cpp)
174 rh_missing_lib_cpp=no
175 if test -f "/lib/cpp"; then
176 AC_MSG_RESULT(found)
177 else
178 AC_MSG_RESULT(uh oh)
179 rh_missing_lib_cpp=yes
180 bugs_found=yes
183 echo
189 dnl WM_PRINT_REDCRAP_BUG_STATUS()
191 AC_DEFUN(WM_PRINT_REDCRAP_BUG_STATUS,
193 if test "$rh_is_redhat" = yes; then
194 if test "$mins_found" = yes -o "$bugs_found" = yes; then
195 echo
196 AC_MSG_WARN([It seems you are using a system packaged by Red Hat.
197 I have done some checks for Red-Hat-specific bugs, and I found some
198 problems. Please read the INSTALL file regarding Red Hat, resolve
199 the problems, and try to run configure again.
201 Here are the problems I found:
203 if test "x$rh_old_wmaker" = xyes; then
204 echo "Problem: Old version of Window Maker in /usr/X11R6/bin."
205 echo "Description: You seem to have an old version of Window Maker"
206 echo " installed in /usr/X11R6/bin. It is recommended"
207 echo " that you uninstall any previously installed"
208 echo " packages of WindowMaker before installing a new one."
209 echo
211 if test "x$rh_missing_usr_local_bin" = xyes; then
212 echo "Problem: PATH is missing /usr/local/bin."
213 echo "Description: Your PATH environment variable does not appear to"
214 echo " contain the directory /usr/local/bin. Please add it."
215 echo
217 if test "x$rh_missing_usr_local_lib" = xyes; then
218 echo "Problem: /etc/ld.so.conf missing /usr/local/lib"
219 echo "Description: Your /etc/ld.so.conf file does not appear to contain"
220 echo " the directory /usr/local/lib. Please add it."
221 echo
223 if test "x$rh_missing_usr_x11" = xyes; then
224 echo "Problem: Missing /usr/X11 symbolic link."
225 echo "Description: Your system is missing a symbolic link from"
226 echo " /usr/X11R6 to /usr/X11. Please create one."
227 echo
229 if test "x$rh_missing_usr_include_x11" = xyes; then
230 echo "Problem: Missing /usr/include/X11 symbolic link."
231 echo "Description: Your system is missing a symbolic link from"
232 echo " /usr/X11R6/include/X11 to /usr/include/X11."
233 echo " Please create one."
234 echo
236 if test "x$rh_missing_lib_cpp" = xyes; then
237 echo "Problem: Missing /lib/cpp symbolic link."
238 echo "Description: Your system is missing a symbolic link from the"
239 echo " cpp (C preprocessor) program to /lib/cpp."
240 echo " Please create one."
241 echo
243 if test "x$bugs_found" = xyes; then
244 AC_MSG_ERROR([One or more of the problems above can potentially
245 cause Window Maker not to install or run properly. Please resolve
246 the problems and try to run configure again.])
247 exit 1
248 elif test "x$mins_found" = xyes; then
249 AC_MSG_WARN([The problems above may or may not cause Window Maker
250 not to install or run properly. If you have any problems during
251 installation or execution, please resolve the problems and try to
252 install Window Maker again.])
253 echo
255 else
256 echo
257 echo "You appear to have a system packaged by Red Hat, but I could"
258 echo "not find any Red-Hat-specific problems that I know about."
259 echo