1 |
AC_INIT(rdesktop, 1.3.1) |
2 |
|
3 |
AC_CONFIG_SRCDIR([rdesktop.c]) |
4 |
|
5 |
AC_PROG_CC |
6 |
if test "$GCC" = yes; then |
7 |
CFLAGS="$CFLAGS -Wall" |
8 |
fi |
9 |
|
10 |
AC_PROG_INSTALL |
11 |
AC_LANG_C |
12 |
AC_HEADER_STDC |
13 |
AC_C_BIGENDIAN([AC_DEFINE(B_ENDIAN)], [AC_DEFINE(L_ENDIAN)]) |
14 |
AC_PATH_XTRA |
15 |
|
16 |
AC_SEARCH_LIBS(socket, socket) |
17 |
AC_SEARCH_LIBS(inet_aton, resolv) |
18 |
|
19 |
rpath="" |
20 |
|
21 |
# |
22 |
# OpenSSL detection borrowed from stunnel |
23 |
# |
24 |
checkssldir() { : |
25 |
if test -f "$1/include/openssl/ssl.h"; then |
26 |
ssldir="$1" |
27 |
return 0 |
28 |
fi |
29 |
return 1 |
30 |
} |
31 |
AC_MSG_CHECKING([for OpenSSL directory]) |
32 |
AC_ARG_WITH(openssl, |
33 |
[ --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib], |
34 |
[ |
35 |
dnl Check the specified location only |
36 |
checkssldir "$withval" |
37 |
], |
38 |
[ |
39 |
dnl Search default locations of OpenSSL library |
40 |
for maindir in /usr/local /usr/lib /usr/pkg /usr /var/ssl /opt; do |
41 |
for dir in $maindir $maindir/openssl $maindir/ssl; do |
42 |
checkssldir $dir && break 2 |
43 |
done |
44 |
done |
45 |
] |
46 |
) |
47 |
if test -z "$ssldir"; then |
48 |
AC_MSG_RESULT([Not found]) |
49 |
echo |
50 |
echo "Couldn't find your OpenSSL library installation dir" |
51 |
echo "Use --with-openssl option to fix this problem" |
52 |
echo |
53 |
exit 1 |
54 |
fi |
55 |
AC_MSG_RESULT([$ssldir]) |
56 |
AC_SUBST(ssldir) |
57 |
AC_DEFINE_UNQUOTED(ssldir, "$ssldir") |
58 |
|
59 |
dnl Add OpenSSL includes and libraries |
60 |
CFLAGS="$CFLAGS -I$ssldir/include" |
61 |
AC_ARG_ENABLE(static-openssl, |
62 |
[ --enable-static-openssl link OpenSSL statically], |
63 |
[ |
64 |
LIBS="$LIBS $ssldir/lib/libcrypto.a" |
65 |
], |
66 |
[ |
67 |
LIBS="$LIBS -L$ssldir/lib -lcrypto" |
68 |
rpath="$rpath:$ssldir/lib" |
69 |
]) |
70 |
|
71 |
|
72 |
# |
73 |
# Alignment |
74 |
# |
75 |
AC_MSG_CHECKING([if architecture needs alignment]) |
76 |
AC_TRY_RUN([ |
77 |
#include <stdlib.h> |
78 |
#include <signal.h> |
79 |
int main(int argc, char **argv) |
80 |
{ |
81 |
unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 }; |
82 |
signal(SIGBUS, exit); |
83 |
signal(SIGABRT, exit); |
84 |
signal(SIGSEGV, exit); |
85 |
if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) { |
86 |
return 1; |
87 |
} |
88 |
return 0; |
89 |
}], |
90 |
[AC_MSG_RESULT(no)], |
91 |
[AC_MSG_RESULT(yes) |
92 |
AC_DEFINE(NEED_ALIGN)], |
93 |
[AC_MSG_RESULT(assuming yes) |
94 |
AC_DEFINE(NEED_ALIGN)]) |
95 |
|
96 |
|
97 |
# |
98 |
# EGD |
99 |
# |
100 |
AC_ARG_WITH(egd-socket, |
101 |
[ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH], |
102 |
[EGD_SOCKET="$withval"], |
103 |
[EGD_SOCKET="/var/run/egd-pool"] |
104 |
) |
105 |
AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET") |
106 |
|
107 |
|
108 |
# |
109 |
# rdp2vnc |
110 |
# |
111 |
vncserverconfig=libvncserver-config |
112 |
AC_ARG_WITH(libvncserver-config, |
113 |
[ --with-libvncserver-config=CMD use CMD as libvncserver-config], |
114 |
[vncserverconfig="$withval"] |
115 |
) |
116 |
AC_ARG_WITH(libvncserver, |
117 |
[ --with-libvncserver make rdp2vnc], |
118 |
[ |
119 |
VNCINC=`$vncserverconfig --cflags` |
120 |
AC_SUBST(VNCINC) |
121 |
LDVNC=`$vncserverconfig --libs` |
122 |
AC_SUBST(LDVNC) |
123 |
VNCLINK=`$vncserverconfig --link` |
124 |
AC_SUBST(VNCLINK) |
125 |
RDP2VNCTARGET="rdp2vnc" |
126 |
AC_SUBST(RDP2VNCTARGET) |
127 |
] |
128 |
) |
129 |
|
130 |
# |
131 |
# sound |
132 |
# |
133 |
sound="yes" |
134 |
AC_ARG_WITH(sound, |
135 |
[ --with-sound select sound system ("oss" or "sun") ], |
136 |
[ |
137 |
sound="$withval" |
138 |
]) |
139 |
if test "$sound" = yes; then |
140 |
AC_CHECK_HEADER(sys/soundcard.h, [sound=oss]) |
141 |
AC_CHECK_HEADER(sys/audioio.h, [sound=sun]) |
142 |
fi |
143 |
if test "$sound" = no; then |
144 |
break |
145 |
elif test "$sound" = oss; then |
146 |
SOUNDOBJ="rdpsnd.o rdpsnd_oss.o" |
147 |
AC_DEFINE(WITH_RDPSND) |
148 |
elif test "$sound" = sun; then |
149 |
SOUNDOBJ="rdpsnd.o rdpsnd_sun.o" |
150 |
AC_DEFINE(WITH_RDPSND) |
151 |
else |
152 |
AC_MSG_WARN([sound support disabled (no sys/soundcard.h or sys/audioio.h)]) |
153 |
AC_MSG_WARN([Currently supported systems are Open Sound System (oss) and Sun/BSD (sun)]) |
154 |
fi |
155 |
AC_SUBST(SOUNDOBJ) |
156 |
|
157 |
# |
158 |
# dirfd |
159 |
# |
160 |
dnl Find out how to get the file descriptor associated with an open DIR*. |
161 |
dnl From Jim Meyering |
162 |
|
163 |
AC_DEFUN([UTILS_FUNC_DIRFD], |
164 |
[ |
165 |
|
166 |
AC_HEADER_DIRENT |
167 |
dirfd_headers=' |
168 |
#if HAVE_DIRENT_H |
169 |
# include <dirent.h> |
170 |
#else /* not HAVE_DIRENT_H */ |
171 |
# define dirent direct |
172 |
# if HAVE_SYS_NDIR_H |
173 |
# include <sys/ndir.h> |
174 |
# endif /* HAVE_SYS_NDIR_H */ |
175 |
# if HAVE_SYS_DIR_H |
176 |
# include <sys/dir.h> |
177 |
# endif /* HAVE_SYS_DIR_H */ |
178 |
# if HAVE_NDIR_H |
179 |
# include <ndir.h> |
180 |
# endif /* HAVE_NDIR_H */ |
181 |
#endif /* HAVE_DIRENT_H */ |
182 |
' |
183 |
AC_CHECK_FUNCS(dirfd) |
184 |
AC_CHECK_DECLS([dirfd], , , $dirfd_headers) |
185 |
|
186 |
AC_CACHE_CHECK([whether dirfd is a macro], |
187 |
jm_cv_func_dirfd_macro, |
188 |
[AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers |
189 |
#ifdef dirfd |
190 |
dirent_header_defines_dirfd |
191 |
#endif], |
192 |
jm_cv_func_dirfd_macro=yes, |
193 |
jm_cv_func_dirfd_macro=no)]) |
194 |
|
195 |
# Use the replacement only if we have no function, macro, |
196 |
# or declaration with that name. |
197 |
if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \ |
198 |
= no,no,no; then |
199 |
AC_REPLACE_FUNCS([dirfd]) |
200 |
AC_CACHE_CHECK( |
201 |
[how to get the file descriptor associated with an open DIR*], |
202 |
gl_cv_sys_dir_fd_member_name, |
203 |
[ |
204 |
dirfd_save_CFLAGS=$CFLAGS |
205 |
for ac_expr in d_fd dd_fd; do |
206 |
|
207 |
CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" |
208 |
AC_TRY_COMPILE( |
209 |
[$dirfd_headers |
210 |
], |
211 |
[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;], |
212 |
dir_fd_found=yes |
213 |
) |
214 |
CFLAGS=$dirfd_save_CFLAGS |
215 |
test "$dir_fd_found" = yes && break |
216 |
done |
217 |
test "$dir_fd_found" = yes || ac_expr=no_such_member |
218 |
|
219 |
gl_cv_sys_dir_fd_member_name=$ac_expr |
220 |
] |
221 |
) |
222 |
if test $gl_cv_sys_dir_fd_member_name != no_such_member; then |
223 |
AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME, |
224 |
$gl_cv_sys_dir_fd_member_name, |
225 |
[the name of the file descriptor member of DIR]) |
226 |
fi |
227 |
AH_VERBATIM(DIR_TO_FD, |
228 |
[#ifdef DIR_FD_MEMBER_NAME |
229 |
# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) |
230 |
#else |
231 |
# define DIR_TO_FD(Dir_p) -1 |
232 |
#endif |
233 |
] |
234 |
) |
235 |
fi |
236 |
]) |
237 |
|
238 |
UTILS_FUNC_DIRFD |
239 |
|
240 |
# |
241 |
# debugging |
242 |
# |
243 |
AC_ARG_WITH(debug, |
244 |
[ --with-debug enable protocol debugging output], |
245 |
[ AC_DEFINE(WITH_DEBUG) ]) |
246 |
|
247 |
AC_ARG_WITH(debug-kbd, |
248 |
[ --with-debug-kbd enable debugging of keyboard handling], |
249 |
[ AC_DEFINE(WITH_DEBUG_KBD) ]) |
250 |
|
251 |
AC_ARG_WITH(debug-rdp5, |
252 |
[ --with-debug-rdp5 enable debugging of RDP5 code], |
253 |
[ AC_DEFINE(WITH_DEBUG_RDP5) ]) |
254 |
|
255 |
AC_ARG_WITH(debug-clipboard, |
256 |
[ --with-debug-clipboard enable debugging of clipboard code], |
257 |
[ AC_DEFINE(WITH_DEBUG_CLIPBOARD) ]) |
258 |
|
259 |
|
260 |
# |
261 |
# target-specific stuff |
262 |
# |
263 |
# strip leading colon from rpath |
264 |
rpath=`echo $rpath |sed 's/^://'` |
265 |
AC_CANONICAL_HOST |
266 |
case "$host" in |
267 |
*-*-solaris*) |
268 |
LDFLAGS="$LDFLAGS -R$rpath" |
269 |
;; |
270 |
*-dec-osf*) |
271 |
LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath" |
272 |
;; |
273 |
*-*-hpux*) |
274 |
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
275 |
;; |
276 |
esac |
277 |
|
278 |
|
279 |
AC_OUTPUT(Makefile) |
280 |
|
281 |
dnl Local Variables: |
282 |
dnl comment-start: "dnl " |
283 |
dnl comment-end: "" |
284 |
dnl comment-start-skip: "\\bdnl\\b\\s *" |
285 |
dnl compile-command: "autoconf" |
286 |
dnl End: |