/[rdesktop]/sourceforge.net/trunk/rdesktop/configure.ac
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sourceforge.net/trunk/rdesktop/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 872 - (show annotations)
Thu Mar 31 10:49:59 2005 UTC (19 years, 2 months ago) by stargo
File size: 11784 byte(s)
Real fix for socklen_t

1 AC_INIT(rdesktop, 1.4.0)
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 AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
20 AC_CHECK_HEADER(sys/modem.h, AC_DEFINE(HAVE_SYS_MODEM_H))
21 AC_CHECK_HEADER(sys/filio.h, AC_DEFINE(HAVE_SYS_FILIO_H))
22 AC_CHECK_HEADER(sys/strtio.h, AC_DEFINE(HAVE_SYS_STRTIO_H))
23 AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
24 AC_CHECK_HEADER(langinfo.h, AC_DEFINE(HAVE_LANGINFO_H))
25 AC_CHECK_HEADER(iconv.h, AC_DEFINE(HAVE_ICONV_H))
26
27 rpath=""
28
29 #
30 # OpenSSL detection borrowed from stunnel
31 #
32 checkssldir() { :
33 if test -f "$1/include/openssl/ssl.h"; then
34 ssldir="$1"
35 return 0
36 fi
37 return 1
38 }
39 AC_MSG_CHECKING([for OpenSSL directory])
40 AC_ARG_WITH(openssl,
41 [ --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib],
42 [
43 dnl Check the specified location only
44 checkssldir "$withval"
45 ],
46 [
47 dnl Search default locations of OpenSSL library
48 for maindir in /usr/local /usr/lib /usr/pkg /usr /var/ssl /opt; do
49 for dir in $maindir $maindir/openssl $maindir/ssl; do
50 checkssldir $dir && break 2
51 done
52 done
53 ]
54 )
55 if test -z "$ssldir"; then
56 AC_MSG_RESULT([Not found])
57 echo
58 echo "Couldn't find your OpenSSL library installation dir"
59 echo "Use --with-openssl option to fix this problem"
60 echo
61 exit 1
62 fi
63 AC_MSG_RESULT([$ssldir])
64 AC_SUBST(ssldir)
65 AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
66
67 dnl Add OpenSSL includes and libraries
68 CFLAGS="$CFLAGS -I$ssldir/include"
69 AC_ARG_ENABLE(static-openssl,
70 [ --enable-static-openssl link OpenSSL statically],
71 [
72 LIBS="$LIBS $ssldir/lib/libcrypto.a"
73 ],
74 [
75 LIBS="$LIBS -L$ssldir/lib -lcrypto"
76 rpath="$rpath:$ssldir/lib"
77 ])
78
79
80 #
81 # Alignment
82 #
83 AC_MSG_CHECKING([if architecture needs alignment])
84 AC_TRY_RUN([
85 #include <stdlib.h>
86 #include <signal.h>
87 int main(int argc, char **argv)
88 {
89 unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
90 signal(SIGBUS, exit);
91 signal(SIGABRT, exit);
92 signal(SIGSEGV, exit);
93 if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) {
94 return 1;
95 }
96 return 0;
97 }],
98 [AC_MSG_RESULT(no)],
99 [AC_MSG_RESULT(yes)
100 AC_DEFINE(NEED_ALIGN)],
101 [AC_MSG_RESULT(assuming yes)
102 AC_DEFINE(NEED_ALIGN)])
103
104
105 #
106 # EGD
107 #
108 AC_ARG_WITH(egd-socket,
109 [ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH],
110 [EGD_SOCKET="$withval"],
111 [EGD_SOCKET="/var/run/egd-pool"]
112 )
113 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
114
115
116 #
117 # rdp2vnc
118 #
119 vncserverconfig=libvncserver-config
120 AC_ARG_WITH(libvncserver-config,
121 [ --with-libvncserver-config=CMD use CMD as libvncserver-config],
122 [vncserverconfig="$withval"]
123 )
124 AC_ARG_WITH(libvncserver,
125 [ --with-libvncserver make rdp2vnc],
126 [
127 VNCINC=`$vncserverconfig --cflags`
128 AC_SUBST(VNCINC)
129 LDVNC=`$vncserverconfig --libs`
130 AC_SUBST(LDVNC)
131 VNCLINK=`$vncserverconfig --link`
132 AC_SUBST(VNCLINK)
133 RDP2VNCTARGET="rdp2vnc"
134 AC_SUBST(RDP2VNCTARGET)
135 ]
136 )
137
138 #
139 # sound
140 #
141 AC_ARG_WITH(libao,
142 [ --with-libao=DIR look for libao at DIR/include, DIR/lib],
143 [
144 CFLAGS="$CFLAGS -I$withval/include"
145 CPPFLAGS="$CPPFLAGS -I$withval/include"
146 LIBS="$LIBS -L$withval/lib"
147 rpath="$rpath:$withval/lib"
148 ]
149 )
150
151 sound="yes"
152 AC_ARG_WITH(sound,
153 [ --with-sound select sound system ("oss", "sgi", "sun" or "libao") ],
154 [
155 sound="$withval"
156 ])
157 if test "$sound" = yes; then
158 AC_CHECK_HEADER(ao/ao.h, [sound=libao])
159 AC_CHECK_HEADER(sys/soundcard.h, [sound=oss])
160 AC_CHECK_HEADER(dmedia/audio.h, [sound=sgi])
161 AC_CHECK_HEADER(sys/audioio.h, [sound=sun])
162 fi
163 if test "$sound" = no; then
164 break
165 elif test "$sound" = oss; then
166 SOUNDOBJ="rdpsnd.o rdpsnd_oss.o"
167 AC_DEFINE(WITH_RDPSND)
168 elif test "$sound" = sgi; then
169 SOUNDOBJ="rdpsnd.o rdpsnd_sgi.o"
170 LDFLAGS="$LDFLAGS -laudio"
171 AC_DEFINE(WITH_RDPSND)
172 elif test "$sound" = sun; then
173 SOUNDOBJ="rdpsnd.o rdpsnd_sun.o"
174 AC_DEFINE(WITH_RDPSND)
175 elif test "$sound" = libao; then
176 SOUNDOBJ="rdpsnd.o rdpsnd_libao.o"
177 LDFLAGS="$LDFLAGS -lao"
178 AC_DEFINE(WITH_RDPSND)
179 else
180 AC_MSG_WARN([sound support disabled])
181 AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun) and libao])
182 fi
183 AC_SUBST(SOUNDOBJ)
184
185 #
186 # dirfd
187 #
188 dnl Find out how to get the file descriptor associated with an open DIR*.
189 dnl From Jim Meyering
190
191 AC_DEFUN([UTILS_FUNC_DIRFD],
192 [
193
194 AC_HEADER_DIRENT
195 dirfd_headers='
196 #if HAVE_DIRENT_H
197 # include <dirent.h>
198 #else /* not HAVE_DIRENT_H */
199 # define dirent direct
200 # if HAVE_SYS_NDIR_H
201 # include <sys/ndir.h>
202 # endif /* HAVE_SYS_NDIR_H */
203 # if HAVE_SYS_DIR_H
204 # include <sys/dir.h>
205 # endif /* HAVE_SYS_DIR_H */
206 # if HAVE_NDIR_H
207 # include <ndir.h>
208 # endif /* HAVE_NDIR_H */
209 #endif /* HAVE_DIRENT_H */
210 '
211 AC_CHECK_FUNCS(dirfd)
212 AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
213
214 AC_CACHE_CHECK([whether dirfd is a macro],
215 jm_cv_func_dirfd_macro,
216 [AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers
217 #ifdef dirfd
218 dirent_header_defines_dirfd
219 #endif],
220 jm_cv_func_dirfd_macro=yes,
221 jm_cv_func_dirfd_macro=no)])
222
223 # Use the replacement only if we have no function, macro,
224 # or declaration with that name.
225 if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \
226 = no,no,no; then
227 AC_REPLACE_FUNCS([dirfd])
228 AC_CACHE_CHECK(
229 [how to get the file descriptor associated with an open DIR*],
230 gl_cv_sys_dir_fd_member_name,
231 [
232 dirfd_save_CFLAGS=$CFLAGS
233 for ac_expr in d_fd dd_fd; do
234
235 CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
236 AC_TRY_COMPILE(
237 [$dirfd_headers
238 ],
239 [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
240 dir_fd_found=yes
241 )
242 CFLAGS=$dirfd_save_CFLAGS
243 test "$dir_fd_found" = yes && break
244 done
245 test "$dir_fd_found" = yes || ac_expr=no_such_member
246
247 gl_cv_sys_dir_fd_member_name=$ac_expr
248 ]
249 )
250 if test $gl_cv_sys_dir_fd_member_name != no_such_member; then
251 AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
252 $gl_cv_sys_dir_fd_member_name,
253 [the name of the file descriptor member of DIR])
254 fi
255 AH_VERBATIM(DIR_TO_FD,
256 [#ifdef DIR_FD_MEMBER_NAME
257 # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
258 #else
259 # define DIR_TO_FD(Dir_p) -1
260 #endif
261 ]
262 )
263 fi
264 ])
265
266 UTILS_FUNC_DIRFD
267
268 #
269 # iconv
270 #
271
272 dnl This macros shamelessly stolen from
273 dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
274 dnl Written by Bruno Haible.
275
276 AC_DEFUN([UTILS_FUNC_ICONV],
277 [
278 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
279 dnl those with the standalone portable GNU libiconv installed).
280
281 AC_ARG_WITH([libiconv-prefix],
282 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
283 for dir in `echo "$withval" | tr : ' '`; do
284 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
285 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
286 done
287 ])
288
289 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
290 am_cv_func_iconv="no, consider installing GNU libiconv"
291 am_cv_lib_iconv=no
292 AC_TRY_LINK([#include <stdlib.h>
293 #include <iconv.h>],
294 [iconv_t cd = iconv_open("","");
295 iconv(cd,NULL,NULL,NULL,NULL);
296 iconv_close(cd);],
297 am_cv_func_iconv=yes)
298 if test "$am_cv_func_iconv" != yes; then
299 am_save_LIBS="$LIBS"
300 LIBS="$LIBS -liconv"
301 AC_TRY_LINK([#include <stdlib.h>
302 #include <iconv.h>],
303 [iconv_t cd = iconv_open("","");
304 iconv(cd,NULL,NULL,NULL,NULL);
305 iconv_close(cd);],
306 am_cv_lib_iconv=yes
307 am_cv_func_iconv=yes)
308 LIBS="$am_save_LIBS"
309 fi
310 ])
311 if test "$am_cv_func_iconv" = yes; then
312 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
313 AC_MSG_CHECKING([for iconv declaration])
314 AC_CACHE_VAL(am_cv_proto_iconv, [
315 AC_TRY_COMPILE([
316 #include <stdlib.h>
317 #include <iconv.h>
318 extern
319 #ifdef __cplusplus
320 "C"
321 #endif
322 #if defined(__STDC__) || defined(__cplusplus)
323 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
324 #else
325 size_t iconv();
326 #endif
327 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
328 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
329 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
330 AC_MSG_RESULT([$]{ac_t:-
331 }[$]am_cv_proto_iconv)
332 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
333 [Define as const if the declaration of iconv() needs const.])
334 fi
335 LIBICONV=
336 if test "$am_cv_lib_iconv" = yes; then
337 LIBICONV="-liconv"
338 fi
339 AC_SUBST(LIBICONV)
340 ])
341
342 UTILS_FUNC_ICONV
343 LIBS="$LIBS $LIBICONV"
344
345 #
346 # socklen_t
347 # from curl
348
349 dnl Check for socklen_t: historically on BSD it is an int, and in
350 dnl POSIX 1g it is a type of its own, but some platforms use different
351 dnl types for the argument to getsockopt, getpeername, etc. So we
352 dnl have to test to find something that will work.
353 AC_DEFUN([TYPE_SOCKLEN_T],
354 [
355 AC_CHECK_TYPE([socklen_t], ,[
356 AC_MSG_CHECKING([for socklen_t equivalent])
357 AC_CACHE_VAL([socklen_t_equiv],
358 [
359 # Systems have either "struct sockaddr *" or
360 # "void *" as the second argument to getpeername
361 socklen_t_equiv=
362 for arg2 in "struct sockaddr" void; do
363 for t in int size_t unsigned long "unsigned long"; do
364 AC_TRY_COMPILE([
365 #include <sys/types.h>
366 #include <sys/socket.h>
367
368 int getpeername (int, $arg2 *, $t *);
369 ],[
370 $t len;
371 getpeername(0,0,&len);
372 ],[
373 socklen_t_equiv="$t"
374 break
375 ])
376 done
377 done
378
379 if test "x$socklen_t_equiv" = x; then
380 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
381 fi
382 ])
383 AC_MSG_RESULT($socklen_t_equiv)
384 AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv,
385 [type to use in place of socklen_t if not defined])],
386 [#include <sys/types.h>
387 #include <sys/socket.h>])
388 ])
389
390 TYPE_SOCKLEN_T
391
392 #
393 # IPv6
394 #
395 AC_ARG_WITH(ipv6,
396 [ --with-ipv6 enable IPv6-support],
397 [ AC_DEFINE(IPv6) ])
398
399
400 #
401 # debugging
402 #
403 AC_ARG_WITH(debug,
404 [ --with-debug enable protocol debugging output],
405 [ AC_DEFINE(WITH_DEBUG) ])
406
407 AC_ARG_WITH(debug-kbd,
408 [ --with-debug-kbd enable debugging of keyboard handling],
409 [ AC_DEFINE(WITH_DEBUG_KBD) ])
410
411 AC_ARG_WITH(debug-rdp5,
412 [ --with-debug-rdp5 enable debugging of RDP5 code],
413 [ AC_DEFINE(WITH_DEBUG_RDP5) ])
414
415 AC_ARG_WITH(debug-clipboard,
416 [ --with-debug-clipboard enable debugging of clipboard code],
417 [ AC_DEFINE(WITH_DEBUG_CLIPBOARD) ])
418
419
420 #
421 # target-specific stuff
422 #
423 # strip leading colon from rpath
424 rpath=`echo $rpath |sed 's/^://'`
425 AC_CANONICAL_HOST
426 case "$host" in
427 *-*-solaris*)
428 LDFLAGS="$LDFLAGS -R$rpath"
429 ;;
430 *-dec-osf*)
431 LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath"
432 ;;
433 *-*-hpux*)
434 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
435 ;;
436 *-*-irix6.5*)
437 LIBS="$LIBS -L$ssldir/lib32 -lcrypto"
438 CFLAGS="$CFLAGS -D__SGI_IRIX__"
439 ;;
440 esac
441
442
443 AC_OUTPUT(Makefile)
444
445 dnl Local Variables:
446 dnl comment-start: "dnl "
447 dnl comment-end: ""
448 dnl comment-start-skip: "\\bdnl\\b\\s *"
449 dnl compile-command: "autoconf"
450 dnl End:

  ViewVC Help
Powered by ViewVC 1.1.26