Gaaah!
[wmaker-crm.git] / acinclude.m4
blob8c9e048b29638e60e5469342995af35e1399cf5b
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_PROPLIST_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
29 dnl
30 AC_DEFUN(WM_CHECK_PROPLIST_VERSION,
32 CPPFLAGS_old="$CPPFLAGS"
33 CPPFLAGS="$CPPFLAGS $inc_search_path"
34 lPL_major_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
35 lPL_minor_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
36 lPL_micro_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
37 AC_MSG_CHECKING([whether libPropList is newer than $1])
38 AC_CACHE_VAL(ac_cv_lib_proplist_version_ok,
39 [AC_TRY_LINK(
40 [/* Test version of libPropList we have */
41 #include <proplist.h>
43 #if !defined(PROPLIST_VERSION) || PROPLIST_VERSION < $lPL_major_version*10000 + $lPL_minor_version*100 + $lPL_micro_version
44 #error libPropList on this system is too old. Consider upgrading to at least $1
45 #endif
46 ], [],
47 eval "ac_cv_lib_proplist_version_ok=yes",
48 eval "ac_cv_lib_proplist_version_ok=no")])
49 if eval "test \"`echo '$ac_cv_lib_proplist_version_ok'`\" = yes"; then
50 AC_MSG_RESULT(yes)
51 ifelse([$2], , :, [$2])
52 else
53 AC_MSG_RESULT(no)
54 ifelse([$3], , , [$3
55 ])dnl
57 CPPFLAGS="$CPPFLAGS_old"
61 dnl
62 dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
63 dnl
64 AC_DEFUN(WM_CHECK_REDCRAP_BUGS,
66 AC_MSG_CHECKING(for RedHat system)
67 wm_check_flag='no :)'
68 rh_is_redhat=no
69 if test -f /etc/redhat-release; then
70 wm_check_flag=yes
71 rh_is_redhat=yes
73 AC_MSG_RESULT($wm_check_flag)
75 mins_found=no
76 bugs_found=no
77 if test "$wm_check_flag" = yes; then
78 echo
79 AC_MSG_WARN([Red Hat system; checking for Red-Hat-specific bugs.])
80 echo
82 # Check old wmaker from RedHat
84 if test "[$1]" != "/usr/X11R6" -a "$prefix" != "/usr/X11"; then
85 AC_MSG_CHECKING(for multiple installed wmaker versions)
86 if test -f /usr/X11R6/bin/wmaker; then
87 AC_MSG_RESULT(uh oh)
88 mins_found=yes
89 rh_old_wmaker=yes
90 else
91 rh_old_wmaker=no
92 AC_MSG_RESULT(no apparent problems)
96 # Check for infamous en_RN bug
97 # Wont work because autoconf will change LANG in the beginning of the
98 # script.
101 #AC_MSG_CHECKING(for silly en_RN joke that only causes headaches)
102 #echo $LANG
103 #if test "x$LANG" = xen_RN; then
104 #AC_MSG_RESULT(uh oh)
105 #AC_MSG_WARN([the LANG environment variable is set to the en_RN
106 #locale. Please unset it or you will have mysterious problems when
107 #using various software packages.])
108 #bugs_found=yes
109 #else
110 #AC_MSG_RESULT(no problem)
113 # If binary installation path is /usr/local/bin, check if it's in PATH
115 if test "[$2]" = "/usr/local/bin"; then
116 AC_MSG_CHECKING(if /usr/local/bin is in the search PATH)
117 wm_check_flag=no
118 rh_missing_usr_local_bin=yes
119 old_IFS="$IFS"
120 IFS=":"
121 for i in $PATH; do
122 if test "x$i" = "x/usr/local/bin"; then
123 wm_check_flag=yes
124 rh_missing_usr_local_bin=no
125 break;
127 done
128 IFS="$old_IFS"
129 if test "$wm_check_flag" = no; then
130 AC_MSG_RESULT(uh oh)
131 bugs_found=yes
132 else
133 AC_MSG_RESULT(no problem)
137 # If library installation path is /usr/local/lib,
138 # check if it's in /etc/ld.so.conf
140 if test "[$3]" = "/usr/local/lib"; then
141 wm_check_flag=yes
142 rh_missing_usr_local_lib=no
143 AC_MSG_CHECKING(if /usr/local/lib is in /etc/ld.so.conf)
144 test -z "`grep /usr/local/lib /etc/ld.so.conf`"
145 test "$?" -eq 0 && wm_check_flag=no
146 if test "$wm_check_flag" = no; then
147 AC_MSG_RESULT(uh oh)
148 rh_missing_usr_local_lib=yes
149 bugs_found=yes
150 else
151 AC_MSG_RESULT(no problem)
155 # Check for symbolic links
157 AC_MSG_CHECKING(for /usr/include/X11 symbolic link)
158 rh_missing_usr_include_x11=no
159 if test -d "/usr/include/X11"; then
160 AC_MSG_RESULT(found)
161 else
162 AC_MSG_RESULT(uh oh)
163 rh_missing_usr_include_x11=yes
164 mins_found=yes
168 # Check for /lib/cpp
170 AC_MSG_CHECKING(for /lib/cpp)
171 rh_missing_lib_cpp=no
172 if test -f "/lib/cpp"; then
173 AC_MSG_RESULT(found)
174 else
175 AC_MSG_RESULT(uh oh)
176 rh_missing_lib_cpp=yes
177 bugs_found=yes
180 echo
186 dnl WM_PRINT_REDCRAP_BUG_STATUS()
188 AC_DEFUN(WM_PRINT_REDCRAP_BUG_STATUS,
190 if test "$rh_is_redhat" = yes; then
191 if test "$mins_found" = yes -o "$bugs_found" = yes; then
192 echo
193 AC_MSG_WARN([It seems you are using a system packaged by Red Hat.
194 I have done some checks for Red-Hat-specific bugs, and I found some
195 problems. Please read the INSTALL file regarding Red Hat, resolve
196 the problems, and try to run configure again.
198 Here are the problems I found:
200 if test "x$rh_old_wmaker" = xyes; then
201 echo "Problem: Old version of Window Maker in /usr/X11R6/bin."
202 echo "Description: You seem to have an old version of Window Maker"
203 echo " installed in /usr/X11R6/bin. It is recommended"
204 echo " that you uninstall any previously installed"
205 echo " packages of WindowMaker before installing a new one."
206 echo
208 if test "x$rh_missing_usr_local_bin" = xyes; then
209 echo "Problem: PATH is missing /usr/local/bin."
210 echo "Description: Your PATH environment variable does not appear to"
211 echo " contain the directory /usr/local/bin. Please add it."
212 echo
214 if test "x$rh_missing_usr_local_lib" = xyes; then
215 echo "Problem: /etc/ld.so.conf missing /usr/local/lib"
216 echo "Description: Your /etc/ld.so.conf file does not appear to contain"
217 echo " the directory /usr/local/lib. Please add it."
218 echo
220 if test "x$rh_missing_usr_x11" = xyes; then
221 echo "Problem: Missing /usr/X11 symbolic link."
222 echo "Description: Your system is missing a symbolic link from"
223 echo " /usr/X11R6 to /usr/X11. Please create one."
224 echo
226 if test "x$rh_missing_usr_include_x11" = xyes; then
227 echo "Problem: Missing /usr/include/X11 symbolic link."
228 echo "Description: Your system is missing a symbolic link from"
229 echo " /usr/X11R6/include/X11 to /usr/include/X11."
230 echo " Please create one."
231 echo
233 if test "x$rh_missing_lib_cpp" = xyes; then
234 echo "Problem: Missing /lib/cpp symbolic link."
235 echo "Description: Your system is missing a symbolic link from the"
236 echo " cpp (C preprocessor) program to /lib/cpp."
237 echo " Please create one."
238 echo
240 if test "x$bugs_found" = xyes; then
241 AC_MSG_ERROR([One or more of the problems above can potentially
242 cause Window Maker not to install or run properly. Please resolve
243 the problems and try to run configure again.])
244 exit 1
245 elif test "x$mins_found" = xyes; then
246 AC_MSG_WARN([The problems above may or may not cause Window Maker
247 not to install or run properly. If you have any problems during
248 installation or execution, please resolve the problems and try to
249 install Window Maker again.])
250 echo
252 else
253 echo
254 echo "You appear to have a system packaged by Red Hat, but I could"
255 echo "not find any Red-Hat-specific problems that I know about."
256 echo