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", "sgi" 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(dmedia/audio.h, [sound=sgi]) |
142 |
AC_CHECK_HEADER(sys/audioio.h, [sound=sun]) |
143 |
fi |
144 |
if test "$sound" = no; then |
145 |
break |
146 |
elif test "$sound" = oss; then |
147 |
SOUNDOBJ="rdpsnd.o rdpsnd_oss.o" |
148 |
AC_DEFINE(WITH_RDPSND) |
149 |
elif test "$sound" = sgi; then |
150 |
SOUNDOBJ="rdpsnd.o rdpsnd_sgi.o" |
151 |
LDFLAGS="$LDFLAGS -laudio" |
152 |
AC_DEFINE(WITH_RDPSND) |
153 |
elif test "$sound" = sun; then |
154 |
SOUNDOBJ="rdpsnd.o rdpsnd_sun.o" |
155 |
AC_DEFINE(WITH_RDPSND) |
156 |
else |
157 |
AC_MSG_WARN([sound support disabled (no sys/soundcard.h or sys/audioio.h)]) |
158 |
AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi) and Sun/BSD (sun)]) |
159 |
fi |
160 |
AC_SUBST(SOUNDOBJ) |
161 |
|
162 |
# |
163 |
# dirfd |
164 |
# |
165 |
dnl Find out how to get the file descriptor associated with an open DIR*. |
166 |
dnl From Jim Meyering |
167 |
|
168 |
AC_DEFUN([UTILS_FUNC_DIRFD], |
169 |
[ |
170 |
|
171 |
AC_HEADER_DIRENT |
172 |
dirfd_headers=' |
173 |
#if HAVE_DIRENT_H |
174 |
# include <dirent.h> |
175 |
#else /* not HAVE_DIRENT_H */ |
176 |
# define dirent direct |
177 |
# if HAVE_SYS_NDIR_H |
178 |
# include <sys/ndir.h> |
179 |
# endif /* HAVE_SYS_NDIR_H */ |
180 |
# if HAVE_SYS_DIR_H |
181 |
# include <sys/dir.h> |
182 |
# endif /* HAVE_SYS_DIR_H */ |
183 |
# if HAVE_NDIR_H |
184 |
# include <ndir.h> |
185 |
# endif /* HAVE_NDIR_H */ |
186 |
#endif /* HAVE_DIRENT_H */ |
187 |
' |
188 |
AC_CHECK_FUNCS(dirfd) |
189 |
AC_CHECK_DECLS([dirfd], , , $dirfd_headers) |
190 |
|
191 |
AC_CACHE_CHECK([whether dirfd is a macro], |
192 |
jm_cv_func_dirfd_macro, |
193 |
[AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers |
194 |
#ifdef dirfd |
195 |
dirent_header_defines_dirfd |
196 |
#endif], |
197 |
jm_cv_func_dirfd_macro=yes, |
198 |
jm_cv_func_dirfd_macro=no)]) |
199 |
|
200 |
# Use the replacement only if we have no function, macro, |
201 |
# or declaration with that name. |
202 |
if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \ |
203 |
= no,no,no; then |
204 |
AC_REPLACE_FUNCS([dirfd]) |
205 |
AC_CACHE_CHECK( |
206 |
[how to get the file descriptor associated with an open DIR*], |
207 |
gl_cv_sys_dir_fd_member_name, |
208 |
[ |
209 |
dirfd_save_CFLAGS=$CFLAGS |
210 |
for ac_expr in d_fd dd_fd; do |
211 |
|
212 |
CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" |
213 |
AC_TRY_COMPILE( |
214 |
[$dirfd_headers |
215 |
], |
216 |
[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;], |
217 |
dir_fd_found=yes |
218 |
) |
219 |
CFLAGS=$dirfd_save_CFLAGS |
220 |
test "$dir_fd_found" = yes && break |
221 |
done |
222 |
test "$dir_fd_found" = yes || ac_expr=no_such_member |
223 |
|
224 |
gl_cv_sys_dir_fd_member_name=$ac_expr |
225 |
] |
226 |
) |
227 |
if test $gl_cv_sys_dir_fd_member_name != no_such_member; then |
228 |
AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME, |
229 |
$gl_cv_sys_dir_fd_member_name, |
230 |
[the name of the file descriptor member of DIR]) |
231 |
fi |
232 |
AH_VERBATIM(DIR_TO_FD, |
233 |
[#ifdef DIR_FD_MEMBER_NAME |
234 |
# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) |
235 |
#else |
236 |
# define DIR_TO_FD(Dir_p) -1 |
237 |
#endif |
238 |
] |
239 |
) |
240 |
fi |
241 |
]) |
242 |
|
243 |
UTILS_FUNC_DIRFD |
244 |
|
245 |
# |
246 |
# debugging |
247 |
# |
248 |
AC_ARG_WITH(debug, |
249 |
[ --with-debug enable protocol debugging output], |
250 |
[ AC_DEFINE(WITH_DEBUG) ]) |
251 |
|
252 |
AC_ARG_WITH(debug-kbd, |
253 |
[ --with-debug-kbd enable debugging of keyboard handling], |
254 |
[ AC_DEFINE(WITH_DEBUG_KBD) ]) |
255 |
|
256 |
AC_ARG_WITH(debug-rdp5, |
257 |
[ --with-debug-rdp5 enable debugging of RDP5 code], |
258 |
[ AC_DEFINE(WITH_DEBUG_RDP5) ]) |
259 |
|
260 |
AC_ARG_WITH(debug-clipboard, |
261 |
[ --with-debug-clipboard enable debugging of clipboard code], |
262 |
[ AC_DEFINE(WITH_DEBUG_CLIPBOARD) ]) |
263 |
|
264 |
|
265 |
# |
266 |
# target-specific stuff |
267 |
# |
268 |
# strip leading colon from rpath |
269 |
rpath=`echo $rpath |sed 's/^://'` |
270 |
AC_CANONICAL_HOST |
271 |
case "$host" in |
272 |
*-*-solaris*) |
273 |
LDFLAGS="$LDFLAGS -R$rpath" |
274 |
;; |
275 |
*-dec-osf*) |
276 |
LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath" |
277 |
;; |
278 |
*-*-hpux*) |
279 |
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
280 |
;; |
281 |
*-*-irix6.5*) |
282 |
LIBS="$LIBS -L$ssldir/lib32 -lcrypto" |
283 |
CFLAGS="$CFLAGS -D__SGI_IRIX__" |
284 |
;; |
285 |
esac |
286 |
|
287 |
|
288 |
AC_OUTPUT(Makefile) |
289 |
|
290 |
dnl Local Variables: |
291 |
dnl comment-start: "dnl " |
292 |
dnl comment-end: "" |
293 |
dnl comment-start-skip: "\\bdnl\\b\\s *" |
294 |
dnl compile-command: "autoconf" |
295 |
dnl End: |