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