1
dnl $Id: acinclude.m4,v 1.3 2004/10/21 22:02:25 danmc Exp $
3
dnl the FC_* macros were copied from the freeciv program. The use here
4
dnl is to figure out if we need -DNARROWPROTO and the correct setting
5
dnl for FUNCPROTO. Without these set right, it has been observed that
6
dnl the sliders don't work right on some systems.
10
dnl FC_CHECK_X_PROTO_DEFINE(DEFINED-VARIABLE)
12
dnl This macro determines the value of the given defined
13
dnl variable needed by Xfuncproto.h in order to compile correctly.
15
dnl Typical DEFINED-VARIABLEs are:
19
dnl The following variables are output:
20
dnl fc_x_proto_value -- contains the value to which
21
dnl the DEFINED-VARIABLE is set,
22
dnl or "" if it has no known value.
25
dnl FC_CHECK_X_PROTO_DEFINE(FUNCPROTO)
26
dnl if test -n "$fc_x_proto_value"; then
27
dnl AC_DEFINE_UNQUOTED(FUNCPROTO, $fc_x_proto_value)
30
AC_DEFUN([FC_CHECK_X_PROTO_DEFINE],
31
[AC_REQUIRE([FC_CHECK_X_PROTO_FETCH])dnl
32
AC_MSG_CHECKING(for Xfuncproto control definition $1)
33
# Search for the requested defined variable; return it's value:
35
for fc_x_define in $fc_x_proto_defines; do
37
eval `echo $fc_x_define | sed -e 's/=/ ; fc_x_val=/' | sed -e 's/^/fc_x_var=/'`
38
if test "x$fc_x_var" = "x$1"; then
39
fc_x_proto_value=$fc_x_val
43
if test -n "$fc_x_proto_value"; then
44
AC_MSG_RESULT([yes: $fc_x_proto_value])
50
dnl FC_CHECK_X_PROTO_FETCH
52
dnl This macro fetches the Xfuncproto control definitions.
53
dnl (Intended to be called once from FC_CHECK_X_PROTO_DEFINE.)
55
dnl The following variables are output:
56
dnl fc_x_proto_defines -- contains the list of defines of
57
dnl Xfuncproto control definitions
58
dnl (defines may or may not include
59
dnl the -D prefix, or an =VAL part).
62
dnl AC_REQUIRE([FC_CHECK_X_PROTO_FETCH])
64
AC_DEFUN([FC_CHECK_X_PROTO_FETCH],
65
[AC_REQUIRE([AC_PATH_X])dnl
66
AC_MSG_CHECKING(whether Xfuncproto was supplied)
67
dnl May override determined defines with explicit argument:
68
AC_ARG_WITH(x-funcproto,
69
[ --with-x-funcproto=DEFS Xfuncproto control definitions are DEFS
70
(e.g.: --with-x-funcproto='FUNCPROTO=15 NARROWPROTO']dnl
72
if test "x$with_x_funcproto" = "x"; then
75
if mkdir conftestdir; then
77
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
78
cat > Imakefile <<'EOF'
80
@echo 'fc_x_proto_defines=" ${PROTO_DEFINES}"'
82
if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
83
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
84
eval `${MAKE-make} fcfindpd 2>/dev/null | grep -v make | sed -e 's/ -D/ /g'`
85
AC_MSG_RESULT([no, found: $fc_x_proto_defines])
89
dnl Oops -- no/bad xmkmf... Time to go a-guessing...
93
dnl First, guess something for FUNCPROTO:
94
AC_MSG_CHECKING([for compilable FUNCPROTO definition])
95
dnl Try in order of preference...
96
for fc_x_value in 15 11 3 1 ""; do
97
FC_CHECK_X_PROTO_FUNCPROTO_COMPILE($fc_x_value)
98
if test "x$fc_x_proto_FUNCPROTO" != "xno"; then
102
if test "x$fc_x_proto_FUNCPROTO" != "xno"; then
103
fc_x_proto_defines="$fc_x_proto_defines FUNCPROTO=$fc_x_proto_FUNCPROTO"
104
AC_MSG_RESULT([yes, determined: $fc_x_proto_FUNCPROTO])
106
AC_MSG_RESULT([no, cannot determine])
108
dnl Second, guess something for NARROWPROTO:
109
AC_MSG_CHECKING([for workable NARROWPROTO definition])
110
dnl Try in order of preference...
111
for fc_x_value in 1 ""; do
112
FC_CHECK_X_PROTO_NARROWPROTO_WORKS($fc_x_value)
113
if test "x$fc_x_proto_NARROWPROTO" != "xno"; then
117
if test "x$fc_x_proto_NARROWPROTO" != "xno"; then
118
fc_x_proto_defines="$fc_x_proto_defines NARROWPROTO=$fc_x_proto_NARROWPROTO"
119
AC_MSG_RESULT([yes, determined: $fc_x_proto_NARROWPROTO])
121
AC_MSG_RESULT([no, cannot determine])
123
AC_MSG_CHECKING(whether Xfuncproto was determined)
124
if test -n "$fc_x_proto_defines"; then
125
AC_MSG_RESULT([yes: $fc_x_proto_defines])
131
AC_MSG_RESULT([no, examination failed])
134
fc_x_proto_defines=$with_x_funcproto
135
AC_MSG_RESULT([yes, given: $fc_x_proto_defines])
139
dnl FC_CHECK_X_PROTO_FUNCPROTO_COMPILE(FUNCPROTO-VALUE)
141
dnl This macro determines whether or not Xfuncproto.h will
142
dnl compile given a value to use for the FUNCPROTO definition.
144
dnl Typical FUNCPROTO-VALUEs are:
147
dnl The following variables are output:
148
dnl fc_x_proto_FUNCPROTO -- contains the passed-in
149
dnl FUNCPROTO-VALUE if Xfuncproto.h
150
dnl compiled, or "no" if it did not.
153
dnl FC_CHECK_X_PROTO_FUNCPROTO_COMPILE($fc_x_value)
154
dnl if test "x$fc_x_proto_FUNCPROTO" != "xno"; then
155
dnl echo Compile using FUNCPROTO=$fc_x_proto_FUNCPROTO
158
AC_DEFUN([FC_CHECK_X_PROTO_FUNCPROTO_COMPILE],
159
[AC_REQUIRE([AC_PATH_XTRA])dnl
162
fc_x_proto_FUNCPROTO=no
163
if test "x$1" = "x"; then
164
fc_x_compile="#undef FUNCPROTO"
166
fc_x_compile="#define FUNCPROTO $1"
168
fc_x_save_CFLAGS="$CFLAGS"
169
CFLAGS="$CFLAGS $X_CFLAGS"
172
#include <X11/Xfuncproto.h>
176
[fc_x_proto_FUNCPROTO=$1])
177
CFLAGS="$fc_x_save_CFLAGS"
181
dnl FC_CHECK_X_PROTO_NARROWPROTO_WORKS(NARROWPROTO-VALUE)
183
dnl This macro determines whether or not NARROWPROTO is required
184
dnl to get a typical X function (XawScrollbarSetThumb) to work.
186
dnl Typical NARROWPROTO-VALUEs are:
189
dnl The following variables are required for input:
190
dnl fc_x_proto_FUNCPROTO -- the value to use for FUNCPROTO.
192
dnl The following variables are output:
193
dnl fc_x_proto_NARROWPROTO -- contains the passed-in
194
dnl NARROWPROTO-VALUE if the test
195
dnl worked, or "no" if it did not.
198
dnl FC_CHECK_X_PROTO_NARROWPROTO_WORKS($fc_x_value)
199
dnl if test "x$fc_x_proto_NARROWPROTO" != "xno"; then
200
dnl echo Compile using NARROWPROTO=$fc_x_proto_NARROWPROTO
203
AC_DEFUN([FC_CHECK_X_PROTO_NARROWPROTO_WORKS],
204
[AC_REQUIRE([AC_PATH_XTRA])dnl
207
fc_x_proto_NARROWPROTO=no
208
if test "x$1" = "x"; then
209
fc_x_works="#undef NARROWPROTO"
211
fc_x_works="#define NARROWPROTO $1"
213
if test "x$fc_x_proto_FUNCPROTO" = "x"; then
214
fc_x_compile="#define FUNCPROTO 1"
216
fc_x_compile="#define FUNCPROTO $fc_x_proto_FUNCPROTO"
218
fc_x_save_CFLAGS="$CFLAGS"
219
CFLAGS="$CFLAGS $X_CFLAGS $X_LIBS $X_PRE_LIBS -l$LIBXAW -lXt -lX11 $X_EXTRA_LIBS"
223
#include <X11/Xfuncproto.h>
224
#include <X11/Intrinsic.h>
225
#include <X11/StringDefs.h>
226
#include <X11/$XAWINC/Scrollbar.h>
227
#define TOP_VAL 0.125
228
#define SHOWN_VAL 0.25
229
int main (int argc, char ** argv)
236
float * top = (float *)(&topbuf);
237
float * shown = (float *)(&shownbuf);
249
XtVaCreateManagedWidget
252
scrollbarWidgetClass,
256
XawScrollbarSetThumb (scrollbar, TOP_VAL, SHOWN_VAL);
264
if ((*top == TOP_VAL) && (*shown == SHOWN_VAL))
275
[fc_x_proto_NARROWPROTO=$1])
276
CFLAGS="$fc_x_save_CFLAGS"