Debian Codegraph @

contrib/acsite.m4

raw
1 dnl ---------------------------------------------------------------------------
2 dnl Determine if the system has System V IPC. ie sys/ipc.h and sys/shm.h
3 dnl headers.
4 dnl ---------------------------------------------------------------------------
5 AC_DEFUN([MH_IPC],
6 [
7 AC_MSG_CHECKING(for System V IPC support)
8 AC_CHECK_HEADER(sys/ipc.h)
9 if test $ac_cv_header_sys_ipc_h = no; then
10 AC_MSG_ERROR(Cannot find required header file sys/ipc.h; XCurses cannot be configured)
11 fi
12 ])dnl
13 dnl ---------------------------------------------------------------------------
14 dnl Set up the correct X header file location
15 dnl ---------------------------------------------------------------------------
16 AC_DEFUN([MH_CHECK_X_INC],
17 [
18 AC_MSG_CHECKING(for location of X headers)
19 mh_x11_dir=""
20 dnl
21 dnl specify latest release of X directories first
22 dnl
23 mh_inc_dirs="\
24 $HOME/include/X11 \
25 $HOME/include \
26 /tmp/include/X11 \
27 /tmp/include \
28 /usr/X11R6/include \
29 /usr/include/X11R6 \
30 /usr/local/X11R6/include \
31 /usr/local/include/X11R6 \
32
33 /usr/X11R5/include \
34 /usr/include/X11R5 \
35 /usr/local/X11R5/include \
36 /usr/local/include/X11R5 \
37 /usr/local/x11r5/include \
38
39 /usr/X11R4/include \
40 /usr/include/X11R4 \
41 /usr/local/X11R4/include \
42 /usr/local/include/X11R4 \
43 \
44 /usr/X11/include \
45 /usr/include/X11 \
46 /usr/local/X11/include \
47 /usr/local/include/X11 \
48 \
49 /usr/X386/include \
50 /usr/x386/include \
51 /usr/XFree86/include/X11 \
52 \
53 /usr/include \
54 /usr/local/include \
55 /usr/unsupported/include \
56 /usr/athena/include \
57 /usr/lpp/Xamples/include \
58 \
59 /usr/openwin/include \
60 /usr/openwin/share/include"
61 dnl
62 dnl Provide for user supplying directory
63 dnl
64 if test "x$x_includes" != xNONE ; then
65 mh_inc_dirs="$x_includes $mh_inc_dirs"
66 fi
67
68 dnl
69 dnl Try to determine the directory containing X headers
70 dnl We will append X11 to all the paths above as an extra check
71 dnl
72 for ac_dir in $mh_inc_dirs ; do
73 if test -r $ac_dir/Intrinsic.h; then
74 mh_x11_dir=$ac_dir
75 break
76 fi
77 if test -r $ac_dir/X11/Intrinsic.h; then
78 mh_x11_dir="$ac_dir/X11"
79 break
80 fi
81 done
82
83 if test "x$mh_x11_dir" != "x" ; then
84 mh_x11_dir_no_x11=`echo $mh_x11_dir | sed 's/\/X11$//'`
85 if test "$mh_x11_dir_no_x11" != "$mh_x11_dir" ; then
86 MH_XINC_DIR="-I$mh_x11_dir -I$mh_x11_dir_no_x11"
87 else
88 MH_XINC_DIR="-I$mh_x11_dir"
89 fi
90 AC_MSG_RESULT(found in $mh_x11_dir)
91 AC_SUBST(MH_XINC_DIR)
92 else
93 AC_MSG_ERROR(Cannot find required header file Intrinsic.h; XCurses cannot be configured)
94 fi
95 ])dnl
96 dnl ---------------------------------------------------------------------------
97 dnl Set up the correct X library file location
98 dnl ---------------------------------------------------------------------------
99 AC_DEFUN([MH_CHECK_X_LIB],
100 [
101 dnl
102 dnl Some systems require extra libraries...
103 dnl
104 mh_solaris_flag=no
105 mh_hpux9_flag=no
106 AC_REQUIRE([AC_CANONICAL_SYSTEM])
107 case "$target" in
108 *solaris*)
109 mh_solaris_flag=yes
110 ;;
111 *pc-sco*)
112 extra_x_libs="Xext"
113 ;;
114 sparc*sunos*)
115 extra_x_libs="Xext"
116 if test "$ac_cv_prog_CC" = "gcc" ; then
117 extra_ld_flags="-Wl,-Bstatic"
118 extra_ld_flags2="-Wl,-Bdynamic"
119 else
120 extra_ld_flags="-Bstatic"
121 extra_ld_flags2="-Bdynamic"
122 fi
123 ;;
124 *hpux9*)
125 mh_hpux9_flag=yes
126 ;;
127 esac
128
129 AC_MSG_CHECKING(for location of X libraries)
130 if test "$with_xaw3d" = yes; then
131 MH_X11_LIBS="Xaw3d Xmu Xt X11"
132 else
133 MH_X11_LIBS="Xaw Xmu Xt X11"
134 fi
135 MH_X11R6_LIBS="SM ICE Xext"
136 mh_x11r6=no
137 dnl
138 dnl specify latest release of X directories first
139 dnl
140 mh_lib_dirs="\
141 $HOME/lib \
142 /tmp/lib \
143 /usr/X11R6/lib \
144 /usr/lib/X11R6 \
145 /usr/local/X11R6/lib \
146 /usr/local/lib/X11R6 \
147
148 /usr/X11R5/lib \
149 /usr/lib/X11R5 \
150 /usr/local/X11R5/lib \
151 /usr/local/lib/X11R5 \
152 /usr/local/x11r5/lib \
153
154 /usr/X11R4/lib \
155 /usr/lib/X11R4 \
156 /usr/local/X11R4/lib \
157 /usr/local/lib/X11R4 \
158 \
159 /usr/X11/lib \
160 /usr/lib/X11 \
161 /usr/local/X11/lib \
162 /usr/local/lib/X11 \
163 \
164 /usr/X386/lib \
165 /usr/x386/lib \
166 /usr/XFree86/lib/X11 \
167 \
168 /usr/lib \
169 /usr/local/lib \
170 /usr/unsupported/lib \
171 /usr/athena/lib \
172 /usr/lpp/Xamples/lib \
173 \
174 /usr/openwin/lib \
175 /usr/openwin/share/lib"
176 dnl
177 dnl Provide for user supplying directory
178 dnl
179 if test "x$x_libraries" != xNONE ; then
180 mh_lib_dirs="$x_libraries $mh_lib_dirs"
181 fi
182
183 dnl
184 dnl try to find libSM.[a,sl,so]. If we find it we are using X11R6
185 dnl
186 for ac_dir in $mh_lib_dirs ; do
187 for mh_xsm in libSM.a libSM.so libSM.sl; do
188 if test -r $ac_dir/$mh_xsm; then
189 mh_x11r6=yes
190 break 2
191 fi
192 done
193 done
194
195 if test "$mh_x11r6" = yes ; then
196 mh_libs="$MH_X11_LIBS $MH_X11R6_LIBS"
197 else
198 mh_libs="$MH_X11_LIBS $extra_x_libs"
199 fi
200
201 dnl
202 dnl Ensure that all required X libraries are found
203 dnl
204 mh_prev_dir=""
205 mh_where_found=""
206 mh_where_found_dirs=""
207 mh_solaris_path=""
208 for mh_lib in $mh_libs; do
209 mh_lib_found=no
210 for ac_dir in $mh_lib_dirs ; do
211 for mh_ext in a so sl; do
212 if test -r $ac_dir/lib$mh_lib.$mh_ext; then
213 if test "x$mh_prev_dir" != "x$ac_dir" ; then
214 if test "x$mh_prev_dir" = "x" ; then
215 mh_where_found="$mh_where_found found in $ac_dir"
216 else
217 mh_where_found="$mh_where_found and in $ac_dir"
218 fi
219 mh_prev_dir=$ac_dir
220 mh_where_found_dirs="$mh_where_found_dirs $ac_dir"
221 MH_XLIBS="$MH_XLIBS -L$ac_dir"
222 mh_solaris_path="${mh_solaris_path}:$ac_dir"
223 fi
224 MH_XLIBS="$MH_XLIBS -l$mh_lib"
225 mh_lib_found=yes
226 break 2
227 fi
228 done
229 done
230 if test "$mh_lib_found" = no; then
231 AC_MSG_ERROR(Cannot find required X library; lib$mh_lib. XCurses cannot be configured)
232 fi
233 done
234 AC_MSG_RESULT($mh_where_found)
235 mh_solaris_path=`echo $mh_solaris_path | sed 's/^://'`
236 if test "$mh_solaris_flag" = yes ; then
237 MH_XLIBS="-R$mh_solaris_path $extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2"
238 else
239 MH_XLIBS="$extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2"
240 fi
241 if test "$mh_hpux9_flag" = yes ; then
242 grep -q XtSetLanguageProc $mh_x11_dir/Intrinsic.h
243 if test $? -eq 0 ; then
244 mh_found_xtshellstrings=no
245 for mh_acdir in $mh_where_found_dirs ; do
246 for mh_xaw in `ls $mh_acdir/libXaw.*` ; do
247 nm $mh_xaw | grep XtShellStrings | grep -qv extern
248 if test $? -eq 0 ; then
249 mh_found_xtshellstrings=yes
250 fi
251 done
252 done
253 if test "$mh_found_xtshellstrings" = no ; then
254 AC_MSG_WARN(The X11 development environment has not been installed correctly.)
255 AC_MSG_WARN(The header file; Intrinsic.h, is for X11R5 while the Athena Widget)
256 AC_MSG_WARN(Set library; libXaw is for X11R4. This is a common problem with)
257 AC_MSG_WARN(HP-UX 9.x.)
258 AC_MSG_WARN(A set of required X11R5 library files can be obtained from the)
259 AC_MSG_WARN(anonymous ftp sites listed on the PDCurses WWW home page:)
260 AC_MSG_WARN(http://www.lightlink.com/hessling/)
261 AC_MSG_WARN(The file is called HPUX-9.x-libXaw-libXmu.tar.Z)
262 AC_MSG_ERROR(X11 installation incomplete; cannot continue)
263 fi
264 fi
265 fi
266 AC_SUBST(MH_XLIBS)
267 ])dnl
268 dnl ---------------------------------------------------------------------------
269 dnl Determine if C compiler handles ANSI prototypes
270 dnl ---------------------------------------------------------------------------
271 AC_DEFUN([MH_HAVE_PROTO],
272 [
273 AC_MSG_CHECKING(if compiler supports ANSI prototypes)
274 dnl
275 dnl override existing value of $ac_compile so we use the correct compiler
276 dnl SHOULD NOT NEED THIS
277 dnl
278 ac_compile='$ac_cv_prog_CC conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5'
279 AC_TRY_COMPILE([#include <stdio.h>],
280 [extern int xxx(int, char *);],
281 mh_have_proto=yes; AC_DEFINE(HAVE_PROTO), mh_have_proto=no )
282 AC_MSG_RESULT($mh_have_proto)
283 ])dnl
284 dnl ---------------------------------------------------------------------------
285 dnl Determine the best C compiler to use given a list
286 dnl ---------------------------------------------------------------------------
287 AC_DEFUN([MH_PROG_CC],
288 [
289 mh_sysv_incdir=""
290 mh_sysv_libdir=""
291 all_words="$CC_LIST"
292 ac_dir=""
293 AC_MSG_CHECKING(for one of the following C compilers: $all_words)
294 AC_CACHE_VAL(ac_cv_prog_CC,[
295 if test -n "$CC"; then
296 ac_cv_prog_CC="$CC" # Let the user override the test.
297 else
298 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
299 for mh_cc in $all_words; do
300 for ac_dir in $PATH; do
301 test -z "$ac_dir" && ac_dir=.
302 if test -f $ac_dir/$mh_cc; then
303 ac_cv_prog_CC="$mh_cc"
304 if test "$ac_dir" = "/usr/5bin"; then
305 mh_sysv_incdir="/usr/5include"
306 mh_sysv_libdir="/usr/5lib"
307 fi
308 break 2
309 fi
310 done
311 done
312 IFS="$ac_save_ifs"
313 test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
314 fi
315 CC="$ac_cv_prog_CC"
316 ])
317 AC_SUBST(CC)
318 if test "$ac_dir" = ""; then
319 AC_MSG_RESULT(using $ac_cv_prog_CC specified in CC env variable)
320 else
321 AC_MSG_RESULT(using $ac_dir/$ac_cv_prog_CC)
322 fi
323 ])dnl
324
325 dnl ---------------------------------------------------------------------------
326 dnl Determine if the supplied X headers exist.
327 dnl ---------------------------------------------------------------------------
328 AC_DEFUN([MH_CHECK_X_HEADERS],
329 [
330 save_CPPFLAGS="$CPPFLAGS"
331 CPPFLAGS="$CPPFLAGS $MH_XINC_DIR"
332 for mh_header in $1; do
333 AC_CHECK_HEADERS($mh_header)
334 done
335 CPPFLAGS="$save_CPPFLAGS"
336 ])dnl
337
338 dnl ---------------------------------------------------------------------------
339 dnl Determine if various key definitions exist in keysym.h
340 dnl ---------------------------------------------------------------------------
341 AC_DEFUN([MH_CHECK_X_KEYDEFS],
342 [
343 save_CPPFLAGS="$CPPFLAGS"
344 CPPFLAGS="$CPPFLAGS $MH_XINC_DIR"
345 for mh_keydef in $1; do
346 AC_MSG_CHECKING(for $mh_keydef in keysym.h)
347 mh_upper_name="HAVE_`echo $mh_keydef | tr '[a-z]' '[A-Z]'`"
348 AC_TRY_COMPILE([#include <keysym.h>],
349 [int i = $mh_keydef;],
350 mh_have_key=yes; AC_DEFINE_UNQUOTED($mh_upper_name,1), mh_have_key=no )
351 AC_MSG_RESULT($mh_have_key)
352 done
353 CPPFLAGS="$save_CPPFLAGS"
354 ])dnl
355
356 dnl ---------------------------------------------------------------------------
357 dnl Provide our own AC_TRY_LINK
358 dnl ---------------------------------------------------------------------------
359 AC_DEFUN([MH_TRY_LINK],
360 [
361 mh_link='${LD-ld} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
362 save_CPPFLAGS="$CPPFLAGS"
363 CPPFLAGS="$CPPFLAGS $MH_XINC_DIR"
364 for mh_keydef in $1; do
365 AC_MSG_CHECKING(for $mh_keydef in keysym.h)
366 mh_upper_name="HAVE_`echo $mh_keydef | tr '[a-z]' '[A-Z]'`"
367 AC_TRY_COMPILE([#include <keysym.h>],
368 [int i = $mh_keydef;],
369 mh_have_key=yes; AC_DEFINE_UNQUOTED($mh_upper_name,1), mh_have_key=no )
370 AC_MSG_RESULT($mh_have_key)
371 done
372 CPPFLAGS="$save_CPPFLAGS"
373 ])dnl