summaryrefslogtreecommitdiff
path: root/proto/x11proto/configure.ac
blob: e616105abeaa8da4c83777cc479f27d367a4c66d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
AC_PREREQ([2.57])
AC_INIT([Xproto], [7.0.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
AM_INIT_AUTOMAKE([foreign dist-bzip2])

AC_CONFIG_HEADER([do-not-use-config.h])
AC_CONFIG_HEADER([Xfuncproto.h])

AC_CANONICAL_HOST

m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])

# Check for enable/disable options
AC_ARG_ENABLE(function-prototypes,
	AS_HELP_STRING([--enable-function-prototypes],
		       [force function prototypes (default: auto)]),
	[FUNCPROTO=$enableval], [FUNCPROTO=auto])
AC_ARG_ENABLE(varargs-prototypes,
	AS_HELP_STRING([--enable-varargs-prototypes],
		       [varargs prototypes are supported (default: auto)]),
	[VAPROTO=$enableval], [VAPROTO=auto])
AC_ARG_ENABLE(const-prototypes,
	AS_HELP_STRING([--enable-const-prototypes],
		       [const is supported (default: auto)]),
	[CONSTPROTO=$enableval], [CONSTPROTO=auto])
AC_ARG_ENABLE(nested-prototypes,
	AS_HELP_STRING([--enable-nested-prototypes],
		       [nested prototypes are supported (default: auto)]),
	[NESTEDPROTO=$enableval], [NESTEDPROTO=auto])
AC_ARG_ENABLE(wide-prototypes,
	AS_HELP_STRING([--enable-wide-prototypes],
		       [widen function prototypes (default: auto)]),
	[WIDEPROTO=$enableval], [WIDEPROTO=auto])


# Handle Xpoll.h.in
fds_bits_found=false;

if test "x$fds_bits_found" = xfalse ; then
   AC_CHECK_MEMBER(fd_set.fds_bits, 
			   [
			       fds_bits_found=plain
			       USE_FDS_BITS="fds_bits"
			   ],,
			   [
                               #include <sys/types.h>
			       #include <sys/select.h>
			   ])
fi

if test "x$fds_bits_found" = xfalse ; then
   AC_CHECK_MEMBER(fd_set.__fds_bits,
			[
			    fds_bits_found=underscores
			    USE_FDS_BITS="__fds_bits"
			],,
			[
                            #include <sys/types.h>
			    #include <sys/select.h>
			])
fi

if test "x$fds_bits_found" = xfalse ; then
    AC_MSG_ERROR([Could not determine how to access the fds_bits or equivalent
                  structure in fd_set on your platform.])
fi

AC_SUBST([USE_FDS_BITS])


# Handle Xfuncproto.h
AC_MSG_CHECKING([whether const prototypes are supported])
if test "x$CONSTPROTO" = xauto; then
	case $host_os in
		linux*)		CONSTPROTO=yes ;;
		freebsd*)	CONSTPROTO=yes ;;
		netbsd*)	CONSTPROTO=yes ;;
		openbsd*)	CONSTPROTO=yes ;;
		solaris*)	CONSTPROTO=yes ;;
		*)		CONSTPROTO=no ;;
	esac
fi
AC_MSG_RESULT([$CONSTPROTO])

AC_MSG_CHECKING([whether varargs prototypes are supported])
if test "x$VAPROTO" = xauto; then
	case $host_os in
		linux*)		VAPROTO=yes ;;
		freebsd*)	VAPROTO=yes ;;
		netbsd*)	VAPROTO=yes ;;
		openbsd*)	VAPROTO=yes ;;
		solaris*)	VAPROTO=yes ;;
		*)		VAPROTO=no ;;
	esac
fi
AC_MSG_RESULT([$VAPROTO])

AC_MSG_CHECKING([whether nested prototypes are supported])
if test "x$NESTEDPROTO" = xauto; then
	case $host_os in
		linux*)		NESTEDPROTO=yes ;;
		freebsd*)	NESTEDPROTO=yes ;;
		netbsd*)	NESTEDPROTO=yes ;;
		openbsd*)	NESTEDPROTO=yes ;;
		solaris*)	NESTEDPROTO=yes ;;
		*)		NESTEDPROTO=no ;;
	esac
fi
AC_MSG_RESULT([$NESTEDPROTO])

AC_MSG_CHECKING([whether to force function prototypes])
if test "x$FUNCPROTO" = xauto; then
	case $host_os in
	    linux*)	FUNCPROTO=yes ;;
	    freebsd*)	FUNCPROTO=yes ;;
	    netbsd*)	FUNCPROTO=yes ;;
	    openbsd*)	FUNCPROTO=yes ;;
	    *)
		if test "x$VAPROTO" = xyes && test "x$NESTEDPROTO" = xyes; then
			FUNCPROTO=yes
		else
			FUNCPROTO=no
		fi
		;;
	esac
fi
AC_MSG_RESULT([$FUNCPROTO])

# Logic for this was taken from Imake.tmpl
if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes && test "x$NESTEDPROTO" = xyes && test "x$CONSTPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [15], [FUNCPROTO])
else
  if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes && test "x$NESTEDPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [11], [FUNCPROTO])
  else
    if test "x$FUNCPROTO" = xyes && test "x$NESTEDPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [9], [FUNCPROTO])
    else
      if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes && test "x$CONSTPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [7], [FUNCPROTO])
      else
        if test "x$FUNCPROTO" = xyes && test "x$CONSTPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [5], [FUNCPROTO])
        else
          if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [3], [FUNCPROTO])
          else
            if test "x$FUNCPROTO" = xyes; then
		AC_DEFINE(FUNCPROTO, [], [FUNCPROTO])
            fi
          fi
        fi
      fi
    fi
  fi
fi

AC_MSG_CHECKING([whether to widen function prototypes])
if test "x$WIDEPROTO" = xauto; then
	case $host_os in
		linux*)		WIDEPROTO=no ;;
		freebsd*)	WIDEPROTO=no ;;
		netbsd*)	WIDEPROTO=no ;;
		openbsd*)	WIDEPROTO=no ;;
		*)		WIDEPROTO=yes ;;
	esac
fi
AC_MSG_RESULT([$WIDEPROTO])

if test "x$WIDEPROTO" = xno; then
	AC_DEFINE(NARROWPROTO, [], [Narrow prototypes])
fi

XORG_RELEASE_VERSION

AC_OUTPUT([Makefile
           Xpoll.h
           xproto.pc])