~ubuntu-branches/ubuntu/raring/freerdp/raring

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2010-06-23 21:39:09 UTC
  • Revision ID: james.westby@ubuntu.com-20100623213909-bb9pvvv03913tdv6
Tags: upstream-0.7.1
ImportĀ upstreamĀ versionĀ 0.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_INIT(freerdp, m4_esyscmd([build-aux/git-version-gen .tarball-version]),
 
2
        [freerdp-devel@lists.sourceforge.net])
 
3
AM_INIT_AUTOMAKE
 
4
AM_CONFIG_HEADER([config.h])
 
5
AC_CONFIG_SRCDIR([libfreerdp/freerdp.c])
 
6
 
 
7
AC_PROG_CC
 
8
AM_PROG_CC_C_O
 
9
if test "$GCC" = yes; then
 
10
    CFLAGS="$CFLAGS -Wall"
 
11
fi
 
12
 
 
13
AH_TEMPLATE(B_ENDIAN, [Big endian])
 
14
AH_TEMPLATE(L_ENDIAN, [Little endian])
 
15
AH_TEMPLATE(EGD_SOCKET, [EGD])
 
16
AH_TEMPLATE(HAVE_LIBSAMPLERATE, [Define if you have libsamplerate])
 
17
AH_TEMPLATE(IPv6, [IPv6])
 
18
AH_TEMPLATE(NEED_ALIGN, [Alignment])
 
19
AH_TEMPLATE(DISABLE_TLS, [Disable TLS encryption])
 
20
AH_TEMPLATE(WITH_SCARD, [Define if smartcard is enabled])
 
21
AH_TEMPLATE(WITH_DEBUG, [Turn on debugging messages])
 
22
AH_TEMPLATE(WITH_DEBUG_CHANNEL, [Turn on debugging messages])
 
23
AH_TEMPLATE(WITH_DEBUG_CLIPBOARD, [Turn on debugging messages])
 
24
AH_TEMPLATE(WITH_DEBUG_KBD, [Turn on debugging messages])
 
25
AH_TEMPLATE(WITH_DEBUG_RDP5, [Turn on debugging messages])
 
26
AH_TEMPLATE(WITH_DEBUG_SCARD, [Turn on debugging messages])
 
27
AH_TEMPLATE(WITH_DEBUG_SEAMLESS, [Turn on debugging messages])
 
28
AH_TEMPLATE(WITH_DEBUG_SERIAL, [Turn on debugging messages])
 
29
AH_TEMPLATE(WITH_DEBUG_SOUND, [Turn on debugging messages])
 
30
 
 
31
AC_PROG_INSTALL
 
32
AC_PROG_LIBTOOL
 
33
AC_LANG_C
 
34
AC_HEADER_STDC
 
35
AC_C_BIGENDIAN([AC_DEFINE(B_ENDIAN)], [AC_DEFINE(L_ENDIAN)])
 
36
 
 
37
AC_PATH_PROG(PKG_CONFIG, pkg-config)
 
38
 
 
39
AC_SEARCH_LIBS(socket, socket)
 
40
AC_SEARCH_LIBS(inet_aton, resolv)
 
41
 
 
42
AC_CHECK_HEADERS(sys/select.h sys/modem.h sys/filio.h sys/strtio.h)
 
43
AC_CHECK_HEADERS(locale.h langinfo.h)
 
44
 
 
45
AC_CHECK_TOOL(STRIP, strip, :)
 
46
 
 
47
dnl Don't depend on pkg-config
 
48
m4_ifdef([PKG_CHECK_MODULES], [], [
 
49
                m4_errprint([warning: pkg-config checks are not available])
 
50
                m4_defun([PKG_CHECK_MODULES], [
 
51
                        AC_MSG_WARN([pkg-config not available, cannot check for $2])
 
52
                        $4
 
53
                ])
 
54
])
 
55
 
 
56
rpath=""
 
57
 
 
58
dnl Define keymap path
 
59
KEYMAP_PATH="${datadir}/freerdp/keymaps"
 
60
AC_SUBST(KEYMAP_PATH)
 
61
 
 
62
dnl Define plugin path
 
63
PLUGIN_PATH='${libdir}/freerdp'
 
64
AC_SUBST(PLUGIN_PATH)
 
65
 
 
66
#
 
67
# Check Crypto libraries
 
68
#
 
69
AC_ARG_WITH([crypto],
 
70
        [AS_HELP_STRING([--with-crypto=ARG],
 
71
                [Choose the crypto library. Valid arguments are openssl, polarssl, no (default is openssl)])],
 
72
        [with_crypto=$withval],
 
73
        [with_crypto=openssl])
 
74
 
 
75
disable_tls=yes
 
76
case $with_crypto in
 
77
        openssl)
 
78
                PKG_CHECK_MODULES(CRYPTO, [openssl >= 0.9.8a])
 
79
                disable_tls=no
 
80
                ;;
 
81
 
 
82
        polarssl)
 
83
                AC_CHECK_LIB(polarssl, ssl_init,
 
84
                        [CRYPTO_LIBS=-lpolarssl],
 
85
                        [AC_MSG_ERROR(PolarSSL library not found)])
 
86
                AC_CHECK_HEADER(polarssl/ssl.h,
 
87
                        [CRYPTO_CFLAGS=],
 
88
                        [AC_MSG_ERROR(PolarSSL development header not found)])
 
89
                disable_tls=no
 
90
                ;;
 
91
 
 
92
        no)
 
93
                AC_MSG_WARN([Cryptographic disabled.])
 
94
                ;;
 
95
 
 
96
        *)
 
97
                AC_MSG_ERROR([Invalid --with-crypto argument $with_crypto.])
 
98
                ;;
 
99
esac
 
100
 
 
101
#
 
102
# Disable TLS encryption
 
103
#
 
104
 
 
105
AC_ARG_ENABLE(tls,
 
106
        [AS_HELP_STRING([--disable-tls], [disable TLS encryption])],
 
107
        [
 
108
                if test $enableval = "no";
 
109
                then
 
110
                        disable_tls=yes
 
111
                fi
 
112
    ])
 
113
 
 
114
AM_CONDITIONAL(ENABLE_TLS, true)
 
115
 
 
116
if test "$disable_tls" = "yes"; then
 
117
        AC_DEFINE(DISABLE_TLS,1)
 
118
        AM_CONDITIONAL(ENABLE_TLS, false)
 
119
fi
 
120
 
 
121
#
 
122
# Smartcard
 
123
#
 
124
AC_ARG_ENABLE(smartcard,
 
125
             [  --enable-smartcard        Enables smart-card support.
 
126
             ],
 
127
             [
 
128
                          if test "$enableval" = no; then
 
129
                                  WITH_SCARD=0
 
130
                          else
 
131
                case "$OSTYPE" in
 
132
                        darwin*)
 
133
                                AC_CHECK_HEADER(PCSC/pcsclite.h, [WITH_SCARD=1], [WITH_SCARD=0])
 
134
                                PCSCLITE_CFLAGS=""
 
135
                                PCSCLITE_LIBS="-framework PCSC"
 
136
                                ;;
 
137
                        *)
 
138
                                if test -n "$PKG_CONFIG"; then
 
139
                                        PKG_CHECK_MODULES(PCSCLITE, libpcsclite, [WITH_SCARD=1], [WITH_SCARD=0])
 
140
                                fi
 
141
                                ;;
 
142
                esac
 
143
 
 
144
                if test x"$WITH_SCARD" = "x1"; then
 
145
                        SCARDOBJ="scard.o"
 
146
                        CFLAGS="$CFLAGS $PCSCLITE_CFLAGS"
 
147
                        LIBS="$LIBS $PCSCLITE_LIBS"
 
148
                        AC_DEFINE(WITH_SCARD)
 
149
                fi
 
150
 
 
151
                AC_MSG_CHECKING([for old version of PCSC])
 
152
                AC_TRY_LINK([
 
153
                        #include <stdlib.h>
 
154
                        #ifdef __APPLE__
 
155
                        #include <PCSC/wintypes.h>
 
156
                        #include <PCSC/winscard.h>
 
157
                        #else
 
158
                        #include <winscard.h>
 
159
                        #endif
 
160
                        ],
 
161
                        [SCardControl(NULL, NULL, 0, NULL, NULL);],
 
162
                        [AC_MSG_RESULT(yes) AC_DEFINE(WITH_PCSC120, 1, [old version of PCSC])],
 
163
                        [AC_MSG_RESULT(no)]
 
164
                )
 
165
                fi
 
166
             ])
 
167
 
 
168
AC_SUBST(SCARDOBJ)
 
169
 
 
170
#
 
171
# Alignment
 
172
#
 
173
AC_MSG_CHECKING([if architecture needs alignment])
 
174
AC_TRY_RUN([
 
175
#include <stdlib.h>
 
176
#include <signal.h>
 
177
int main(int argc, char **argv)
 
178
{
 
179
        unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
 
180
        signal(SIGBUS, exit);
 
181
        signal(SIGABRT, exit);
 
182
        signal(SIGSEGV, exit);
 
183
        if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) {
 
184
                return 1;
 
185
        }
 
186
        return 0;
 
187
}],
 
188
 [AC_MSG_RESULT(no)],
 
189
 [AC_MSG_RESULT(yes)
 
190
  AC_DEFINE(NEED_ALIGN)],
 
191
 [AC_MSG_RESULT(assuming yes)
 
192
  AC_DEFINE(NEED_ALIGN)])
 
193
 
 
194
 
 
195
#
 
196
# EGD
 
197
#
 
198
AC_ARG_WITH(egd-socket,
 
199
    [  --with-egd-socket=PATH  look for Entropy Gathering Daemon socket at PATH],
 
200
    [EGD_SOCKET="$withval"],
 
201
    [EGD_SOCKET="/var/run/egd-pool"]
 
202
)
 
203
AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
 
204
 
 
205
 
 
206
#
 
207
# rdp2vnc
 
208
#
 
209
vncserverconfig=libvncserver-config
 
210
AC_ARG_WITH(libvncserver-config,
 
211
    [  --with-libvncserver-config=CMD  use CMD as libvncserver-config],
 
212
    [vncserverconfig="$withval"]
 
213
)
 
214
AC_ARG_WITH(libvncserver,
 
215
    [  --with-libvncserver     make rdp2vnc],
 
216
    [
 
217
    VNCINC=`$vncserverconfig --cflags`
 
218
    AC_SUBST(VNCINC)
 
219
    LDVNC=`$vncserverconfig --libs`
 
220
    AC_SUBST(LDVNC)
 
221
    VNCLINK=`$vncserverconfig --link`
 
222
    AC_SUBST(VNCLINK)
 
223
    RDP2VNCTARGET="rdp2vnc"
 
224
    AC_SUBST(RDP2VNCTARGET)
 
225
    ]
 
226
)
 
227
 
 
228
#
 
229
# sound
 
230
#
 
231
 
 
232
sound="yes"
 
233
AC_ARG_WITH(sound,
 
234
    [  --with-sound            select sound system ("oss", "sgi", "sun", "alsa" or "libao") ],
 
235
    [
 
236
    sound="$withval"
 
237
    ])
 
238
 
 
239
AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=1], [HAVE_OSS=0])
 
240
AC_CHECK_HEADER(dmedia/audio.h, [HAVE_SGI=1], [HAVE_SGI=0])
 
241
AC_CHECK_HEADER(sys/audioio.h, [HAVE_SUN=1], [HAVE_SUN=0])
 
242
 
 
243
AC_ARG_ENABLE(static-libsamplerate,
 
244
    [  --enable-static-libsamplerate link libsamplerate statically],
 
245
    [static_libsamplerate=yes],
 
246
    [static_libsamplerate=no])
 
247
 
 
248
if test -n "$PKG_CONFIG"; then
 
249
    PKG_CHECK_MODULES(LIBAO, ao, [HAVE_LIBAO=1], [HAVE_LIBAO=0])
 
250
    PKG_CHECK_MODULES(ALSA, alsa, [HAVE_ALSA=1], [HAVE_ALSA=0])
 
251
    AC_ARG_WITH(libsamplerate,
 
252
        [  --without-libsamplerate disable libsamplerate support])
 
253
    if test "x$with_libsamplerate" != "xno"; then
 
254
        PKG_CHECK_MODULES(LIBSAMPLERATE, samplerate, [HAVE_LIBSAMPLERATE=1], [HAVE_LIBSAMPLERATE=0])
 
255
    fi
 
256
    if test x"$HAVE_LIBSAMPLERATE" = "x1"; then
 
257
        AC_DEFINE(HAVE_LIBSAMPLERATE)
 
258
        if test x"$static_libsamplerate" = "xyes"; then
 
259
            _libsamplerate_libdir=`$PKG_CONFIG --errors-to-stdout --variable=libdir samplerate`
 
260
            LIBSAMPLERATE_LIBS="$_libsamplerate_libdir""/libsamplerate.a"
 
261
        fi
 
262
        LIBSAMPLERATE_LIBS="$LIBSAMPLERATE_LIBS -lm"
 
263
    fi
 
264
fi
 
265
 
 
266
AM_CONDITIONAL(WITH_RDPSND, [test "$sound" != "no"])
 
267
AM_CONDITIONAL(RDPSND_OSS, false)
 
268
AM_CONDITIONAL(RDPSND_SGI, false)
 
269
AM_CONDITIONAL(RDPSND_SUN, false)
 
270
AM_CONDITIONAL(RDPSND_ALSA, false)
 
271
AM_CONDITIONAL(RDPSND_LIBAO, false)
 
272
 
 
273
case $sound in
 
274
    yes)
 
275
        AM_CONDITIONAL(RDPSND_OSS, [test x"$HAVE_OSS" = "x1"])
 
276
        AM_CONDITIONAL(RDPSND_SGI, [test x"$HAVE_SGI" = "x1"])
 
277
        AM_CONDITIONAL(RDPSND_SUN, [test x"$HAVE_SUN" = "x1"])
 
278
        AM_CONDITIONAL(RDPSND_ALSA, [test x"$HAVE_ALSA" = "x1"])
 
279
        AM_CONDITIONAL(RDPSND_LIBAO, [test x"$HAVE_LIBAO" = "x1"])
 
280
        ;;
 
281
 
 
282
    oss)
 
283
        if test x"$HAVE_OSS" = "x1"; then
 
284
            AM_CONDITIONAL(RDPSND_OSS, true)
 
285
        else
 
286
            AC_MSG_ERROR([Selected sound system is not available.])
 
287
        fi
 
288
        ;;
 
289
 
 
290
    sgi)
 
291
        if test x"$HAVE_SGI" = "x1"; then
 
292
            AM_CONDITIONAL(RDPSND_SGI, true)
 
293
        else
 
294
            AC_MSG_ERROR([Selected sound system is not available.])
 
295
        fi
 
296
        ;;
 
297
 
 
298
    sun)
 
299
        if test x"$HAVE_SUN" = "x1"; then
 
300
            AM_CONDITIONAL(RDPSND_SUN, true)
 
301
        else
 
302
            AC_MSG_ERROR([Selected sound system is not available.])
 
303
        fi
 
304
        ;;
 
305
 
 
306
    alsa)
 
307
        if test x"$HAVE_ALSA" = "x1"; then
 
308
            AM_CONDITIONAL(RDPSND_ALSA, true)
 
309
        else
 
310
            AC_MSG_ERROR([Selected sound system is not available.])
 
311
        fi
 
312
        ;;
 
313
 
 
314
    libao)
 
315
        if test x"$HAVE_LIBAO" = "x1"; then
 
316
            AM_CONDITIONAL(RDPSND_LIBAO, true)
 
317
        else
 
318
            AC_MSG_ERROR([Selected sound system is not available.])
 
319
        fi
 
320
        ;;
 
321
 
 
322
    no)
 
323
        ;;
 
324
 
 
325
    *)
 
326
        AC_MSG_WARN([sound support disabled])
 
327
        AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa) and libao])
 
328
        ;;
 
329
esac
 
330
 
 
331
#
 
332
# printer
 
333
#
 
334
 
 
335
AC_ARG_WITH([printer],
 
336
        [AS_HELP_STRING([--with-printer=ARG],
 
337
                [Choose the printer module. Valid arguments are cups, no (default is cups)])],
 
338
        [printer=$withval],
 
339
        [printer=cups])
 
340
 
 
341
AM_CONDITIONAL(RDPDR_PRINTER_CUPS, false)
 
342
 
 
343
case $printer in
 
344
        cups)
 
345
                AC_CHECK_PROG(HAVE_CUPS, cups-config, 1, 0)
 
346
                if test x"$HAVE_CUPS" = "x1"; then
 
347
                        CUPS_CFLAGS=`cups-config --cflags`
 
348
                        AC_SUBST(CUPS_CFLAGS)
 
349
                        CUPS_LIBS=`cups-config --libs`
 
350
                        AC_SUBST(CUPS_LIBS)
 
351
                        AM_CONDITIONAL(RDPDR_PRINTER_CUPS, true)
 
352
                else
 
353
                        AC_MSG_WARN([Printer support disabled. CUPS development package not found.])
 
354
                        printer=no
 
355
                fi
 
356
                ;;
 
357
 
 
358
        no)
 
359
                AC_MSG_WARN([Printer support disabled.])
 
360
                ;;
 
361
 
 
362
        *)
 
363
                AC_MSG_ERROR([Invalid --with-printer argument $with_printer.])
 
364
                ;;
 
365
esac
 
366
 
 
367
# Checks for time zones
 
368
AC_STRUCT_TIMEZONE
 
369
 
 
370
#
 
371
# dirfd
 
372
#
 
373
dnl Find out how to get the file descriptor associated with an open DIR*.
 
374
dnl From Jim Meyering
 
375
 
 
376
AC_DEFUN([UTILS_FUNC_DIRFD],
 
377
[
 
378
 
 
379
  AC_HEADER_DIRENT
 
380
  dirfd_headers='
 
381
#if HAVE_DIRENT_H
 
382
# include <dirent.h>
 
383
#else /* not HAVE_DIRENT_H */
 
384
# define dirent direct
 
385
# if HAVE_SYS_NDIR_H
 
386
#  include <sys/ndir.h>
 
387
# endif /* HAVE_SYS_NDIR_H */
 
388
# if HAVE_SYS_DIR_H
 
389
#  include <sys/dir.h>
 
390
# endif /* HAVE_SYS_DIR_H */
 
391
# if HAVE_NDIR_H
 
392
#  include <ndir.h>
 
393
# endif /* HAVE_NDIR_H */
 
394
#endif /* HAVE_DIRENT_H */
 
395
'
 
396
  AC_CHECK_FUNCS(dirfd)
 
397
  AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
 
398
 
 
399
  AC_CACHE_CHECK([whether dirfd is a macro],
 
400
    jm_cv_func_dirfd_macro,
 
401
    [AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers
 
402
#ifdef dirfd
 
403
 dirent_header_defines_dirfd
 
404
#endif],
 
405
       jm_cv_func_dirfd_macro=yes,
 
406
       jm_cv_func_dirfd_macro=no)])
 
407
 
 
408
  # Use the replacement only if we have no function, macro,
 
409
  # or declaration with that name.
 
410
  if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \
 
411
      = no,no,no; then
 
412
    AC_REPLACE_FUNCS([dirfd])
 
413
    AC_CACHE_CHECK(
 
414
              [how to get the file descriptor associated with an open DIR*],
 
415
                   gl_cv_sys_dir_fd_member_name,
 
416
      [
 
417
        dirfd_save_CFLAGS=$CFLAGS
 
418
        for ac_expr in d_fd dd_fd; do
 
419
 
 
420
          CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
 
421
          AC_TRY_COMPILE(
 
422
            [$dirfd_headers
 
423
            ],
 
424
            [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
 
425
            dir_fd_found=yes
 
426
          )
 
427
          CFLAGS=$dirfd_save_CFLAGS
 
428
          test "$dir_fd_found" = yes && break
 
429
        done
 
430
        test "$dir_fd_found" = yes || ac_expr=no_such_member
 
431
 
 
432
        gl_cv_sys_dir_fd_member_name=$ac_expr
 
433
      ]
 
434
    )
 
435
    if test $gl_cv_sys_dir_fd_member_name != no_such_member; then
 
436
      AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
 
437
        $gl_cv_sys_dir_fd_member_name,
 
438
        [the name of the file descriptor member of DIR])
 
439
    fi
 
440
    AH_VERBATIM(DIR_TO_FD,
 
441
                [#ifdef DIR_FD_MEMBER_NAME
 
442
# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
 
443
#else
 
444
# define DIR_TO_FD(Dir_p) -1
 
445
#endif
 
446
]
 
447
    )
 
448
  fi
 
449
])
 
450
 
 
451
UTILS_FUNC_DIRFD
 
452
 
 
453
#
 
454
# iconv
 
455
#
 
456
 
 
457
dnl This macros shamelessly stolen from
 
458
dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
 
459
dnl Written by Bruno Haible.
 
460
 
 
461
AC_DEFUN([UTILS_FUNC_ICONV],
 
462
[
 
463
  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
 
464
  dnl those with the standalone portable GNU libiconv installed).
 
465
 
 
466
  AC_ARG_WITH([libiconv-prefix],
 
467
[  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
 
468
    for dir in `echo "$withval" | tr : ' '`; do
 
469
      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
 
470
      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
 
471
    done
 
472
   ])
 
473
  AC_CHECK_HEADERS(iconv.h)
 
474
 
 
475
  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
 
476
    am_cv_func_iconv="no, consider installing GNU libiconv"
 
477
    am_cv_lib_iconv=no
 
478
    AC_TRY_LINK([#include <stdlib.h>
 
479
#include <iconv.h>],
 
480
      [iconv_t cd = iconv_open("","");
 
481
       iconv(cd,NULL,NULL,NULL,NULL);
 
482
       iconv_close(cd);],
 
483
      am_cv_func_iconv=yes)
 
484
    if test "$am_cv_func_iconv" != yes; then
 
485
      am_save_LIBS="$LIBS"
 
486
      LIBS="$LIBS -liconv"
 
487
      AC_TRY_LINK([#include <stdlib.h>
 
488
#include <iconv.h>],
 
489
        [iconv_t cd = iconv_open("","");
 
490
         iconv(cd,NULL,NULL,NULL,NULL);
 
491
         iconv_close(cd);],
 
492
        am_cv_lib_iconv=yes
 
493
        am_cv_func_iconv=yes)
 
494
      LIBS="$am_save_LIBS"
 
495
    fi
 
496
  ])
 
497
  if test "$am_cv_func_iconv" = yes; then
 
498
    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
 
499
    AC_MSG_CHECKING([for iconv declaration])
 
500
    AC_CACHE_VAL(am_cv_proto_iconv, [
 
501
      AC_TRY_COMPILE([
 
502
#include <stdlib.h>
 
503
#include <iconv.h>
 
504
extern
 
505
#ifdef __cplusplus
 
506
"C"
 
507
#endif
 
508
#if defined(__STDC__) || defined(__cplusplus)
 
509
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
 
510
#else
 
511
size_t iconv();
 
512
#endif
 
513
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
 
514
      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);"])
 
515
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
 
516
    AC_MSG_RESULT([$]{ac_t:-
 
517
         }[$]am_cv_proto_iconv)
 
518
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
 
519
      [Define as const if the declaration of iconv() needs const.])
 
520
  fi
 
521
  LIBICONV=
 
522
  if test "$am_cv_lib_iconv" = yes; then
 
523
    LIBICONV="-liconv"
 
524
  fi
 
525
  AC_SUBST(LIBICONV)
 
526
])
 
527
 
 
528
AC_ARG_ENABLE(iconv,
 
529
        [AS_HELP_STRING([--disable-iconv], [disable iconv support])],
 
530
        [
 
531
                if test $enableval != "no";
 
532
                then
 
533
                        UTILS_FUNC_ICONV
 
534
                fi
 
535
    ],
 
536
        [
 
537
                UTILS_FUNC_ICONV
 
538
        ])
 
539
LIBS="$LIBS $LIBICONV"
 
540
 
 
541
#
 
542
# socklen_t
 
543
# from curl
 
544
 
 
545
dnl Check for socklen_t: historically on BSD it is an int, and in
 
546
dnl POSIX 1g it is a type of its own, but some platforms use different
 
547
dnl types for the argument to getsockopt, getpeername, etc.  So we
 
548
dnl have to test to find something that will work.
 
549
AC_DEFUN([TYPE_SOCKLEN_T],
 
550
[
 
551
   AC_CHECK_TYPE([socklen_t], ,[
 
552
      AC_MSG_CHECKING([for socklen_t equivalent])
 
553
      AC_CACHE_VAL([socklen_t_cv_equiv],
 
554
      [
 
555
         # Systems have either "struct sockaddr *" or
 
556
         # "void *" as the second argument to getpeername
 
557
         socklen_t_cv_equiv=
 
558
         for arg2 in "struct sockaddr" void; do
 
559
            for t in int size_t unsigned long "unsigned long"; do
 
560
               AC_TRY_COMPILE([
 
561
                  #include <sys/types.h>
 
562
                  #include <sys/socket.h>
 
563
 
 
564
                  int getpeername (int, $arg2 *, $t *);
 
565
               ],[
 
566
                  $t len;
 
567
                  getpeername(0,0,&len);
 
568
               ],[
 
569
                  socklen_t_cv_equiv="$t"
 
570
                  break
 
571
               ])
 
572
            done
 
573
         done
 
574
 
 
575
         if test "x$socklen_t_cv_equiv" = x; then
 
576
            AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
 
577
         fi
 
578
      ])
 
579
      AC_MSG_RESULT($socklen_t_cv_equiv)
 
580
      AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_cv_equiv,
 
581
                        [type to use in place of socklen_t if not defined])],
 
582
      [#include <sys/types.h>
 
583
#include <sys/socket.h>])
 
584
])
 
585
 
 
586
TYPE_SOCKLEN_T
 
587
 
 
588
#
 
589
# statfs stuff
 
590
#
 
591
AC_CHECK_HEADERS(sys/vfs.h)
 
592
AC_CHECK_HEADERS(sys/statvfs.h)
 
593
AC_CHECK_HEADERS(sys/statfs.h)
 
594
AC_CHECK_HEADERS(sys/param.h)
 
595
 
 
596
mount_includes="\
 
597
  $ac_includes_default
 
598
  #if HAVE_SYS_PARAM_H
 
599
  # include <sys/param.h>
 
600
  #endif
 
601
  "
 
602
 
 
603
AC_CHECK_HEADERS(sys/mount.h,,,[$mount_includes])
 
604
 
 
605
#################################################
 
606
# these tests are taken from the GNU fileutils package
 
607
AC_CHECKING(how to get filesystem space usage)
 
608
space=no
 
609
 
 
610
# Test for statvfs64.
 
611
if test $space = no; then
 
612
  # SVR4
 
613
  AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
 
614
  [AC_TRY_RUN([
 
615
#if defined(HAVE_UNISTD_H)
 
616
#include <unistd.h>
 
617
#endif
 
618
#include <sys/types.h>
 
619
#include <sys/statvfs.h>
 
620
  main ()
 
621
  {
 
622
    struct statvfs64 fsd;
 
623
    exit (statvfs64 (".", &fsd));
 
624
  }],
 
625
  fu_cv_sys_stat_statvfs64=yes,
 
626
  fu_cv_sys_stat_statvfs64=no,
 
627
  fu_cv_sys_stat_statvfs64=cross)])
 
628
  if test $fu_cv_sys_stat_statvfs64 = yes; then
 
629
    space=yes
 
630
    AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
 
631
  fi
 
632
fi
 
633
 
 
634
# Perform only the link test since it seems there are no variants of the
 
635
# statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
 
636
# because that got a false positive on SCO OSR5.  Adding the declaration
 
637
# of a `struct statvfs' causes this test to fail (as it should) on such
 
638
# systems.  That system is reported to work fine with STAT_STATFS4 which
 
639
# is what it gets when this test fails.
 
640
if test $space = no; then
 
641
  # SVR4
 
642
  AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
 
643
                 [AC_TRY_LINK([#include <sys/types.h>
 
644
#include <sys/statvfs.h>],
 
645
                              [struct statvfs fsd; statvfs (0, &fsd);],
 
646
                              fu_cv_sys_stat_statvfs=yes,
 
647
                              fu_cv_sys_stat_statvfs=no)])
 
648
  if test $fu_cv_sys_stat_statvfs = yes; then
 
649
    space=yes
 
650
    AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
 
651
  fi
 
652
fi
 
653
 
 
654
if test $space = no; then
 
655
  # DEC Alpha running OSF/1
 
656
  AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
 
657
  AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
 
658
  [AC_TRY_RUN([
 
659
#include <sys/param.h>
 
660
#include <sys/types.h>
 
661
#include <sys/mount.h>
 
662
  main ()
 
663
  {
 
664
    struct statfs fsd;
 
665
    fsd.f_fsize = 0;
 
666
    exit (statfs (".", &fsd, sizeof (struct statfs)));
 
667
  }],
 
668
  fu_cv_sys_stat_statfs3_osf1=yes,
 
669
  fu_cv_sys_stat_statfs3_osf1=no,
 
670
  fu_cv_sys_stat_statfs3_osf1=no)])
 
671
 
 
672
 
 
673
#C_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
 
674
  if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
 
675
    space=yes
 
676
    AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
 
677
  fi
 
678
fi
 
679
 
 
680
if test $space = no; then
 
681
# AIX
 
682
  AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
 
683
member (AIX, 4.3BSD)])
 
684
  AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
 
685
  [AC_TRY_RUN([
 
686
#ifdef HAVE_SYS_PARAM_H
 
687
#include <sys/param.h>
 
688
#endif
 
689
#ifdef HAVE_SYS_MOUNT_H
 
690
#include <sys/mount.h>
 
691
#endif
 
692
#ifdef HAVE_SYS_VFS_H
 
693
#include <sys/vfs.h>
 
694
#endif
 
695
  main ()
 
696
  {
 
697
  struct statfs fsd;
 
698
  fsd.f_bsize = 0;
 
699
  exit (statfs (".", &fsd));
 
700
  }],
 
701
  fu_cv_sys_stat_statfs2_bsize=yes,
 
702
  fu_cv_sys_stat_statfs2_bsize=no,
 
703
  fu_cv_sys_stat_statfs2_bsize=no)])
 
704
  AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
 
705
  if test $fu_cv_sys_stat_statfs2_bsize = yes; then
 
706
    space=yes
 
707
    AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
 
708
  fi
 
709
fi
 
710
 
 
711
if test $space = no; then
 
712
# SVR3
 
713
  AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
 
714
  AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
 
715
  [AC_TRY_RUN([#include <sys/types.h>
 
716
#include <sys/statfs.h>
 
717
  main ()
 
718
  {
 
719
  struct statfs fsd;
 
720
  exit (statfs (".", &fsd, sizeof fsd, 0));
 
721
  }],
 
722
    fu_cv_sys_stat_statfs4=yes,
 
723
    fu_cv_sys_stat_statfs4=no,
 
724
    fu_cv_sys_stat_statfs4=no)])
 
725
  AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
 
726
  if test $fu_cv_sys_stat_statfs4 = yes; then
 
727
    space=yes
 
728
    AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
 
729
  fi
 
730
fi
 
731
 
 
732
if test $space = no; then
 
733
# 4.4BSD and NetBSD
 
734
  AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
 
735
member (4.4BSD and NetBSD)])
 
736
  AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
 
737
  [AC_TRY_RUN([#include <sys/types.h>
 
738
#ifdef HAVE_SYS_PARAM_H
 
739
#include <sys/param.h>
 
740
#endif
 
741
#ifdef HAVE_SYS_MOUNT_H
 
742
#include <sys/mount.h>
 
743
#endif
 
744
  main ()
 
745
  {
 
746
  struct statfs fsd;
 
747
  fsd.f_fsize = 0;
 
748
  exit (statfs (".", &fsd));
 
749
  }],
 
750
  fu_cv_sys_stat_statfs2_fsize=yes,
 
751
  fu_cv_sys_stat_statfs2_fsize=no,
 
752
  fu_cv_sys_stat_statfs2_fsize=no)])
 
753
  AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
 
754
  if test $fu_cv_sys_stat_statfs2_fsize = yes; then
 
755
    space=yes
 
756
        AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
 
757
  fi
 
758
fi
 
759
 
 
760
if test $space = no; then
 
761
  # Ultrix
 
762
  AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
 
763
  AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
 
764
  [AC_TRY_RUN([#include <sys/types.h>
 
765
#ifdef HAVE_SYS_PARAM_H
 
766
#include <sys/param.h>
 
767
#endif
 
768
#ifdef HAVE_SYS_MOUNT_H
 
769
#include <sys/mount.h>
 
770
#endif
 
771
#ifdef HAVE_SYS_FS_TYPES_H
 
772
#include <sys/fs_types.h>
 
773
#endif
 
774
  main ()
 
775
  {
 
776
  struct fs_data fsd;
 
777
  /* Ultrix's statfs returns 1 for success,
 
778
     0 for not mounted, -1 for failure.  */
 
779
  exit (statfs (".", &fsd) != 1);
 
780
  }],
 
781
  fu_cv_sys_stat_fs_data=yes,
 
782
  fu_cv_sys_stat_fs_data=no,
 
783
  fu_cv_sys_stat_fs_data=no)])
 
784
  AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
 
785
  if test $fu_cv_sys_stat_fs_data = yes; then
 
786
    space=yes
 
787
    AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
 
788
  fi
 
789
fi
 
790
 
 
791
  statxfs_includes="\
 
792
$ac_includes_default
 
793
#if HAVE_SYS_STATVFS_H
 
794
# include <sys/statvfs.h>
 
795
#endif
 
796
#if HAVE_SYS_VFS_H
 
797
# include <sys/vfs.h>
 
798
#endif
 
799
#if !HAVE_SYS_STATVFS_H && !HAVE_SYS_VFS_H
 
800
# if HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
 
801
/* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
 
802
#  include <sys/param.h>
 
803
#  include <sys/mount.h>
 
804
# elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
 
805
/* Ultrix 4.4 needs these for the declaration of struct statfs.  */
 
806
#  include <netinet/in.h>
 
807
#  include <nfs/nfs_clnt.h>
 
808
#  include <nfs/vfs.h>
 
809
# endif
 
810
#endif
 
811
"
 
812
 
 
813
AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes])
 
814
AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes])
 
815
AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
 
816
AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
 
817
 
 
818
#
 
819
# Large file support
 
820
#
 
821
AC_SYS_LARGEFILE
 
822
 
 
823
#
 
824
# mntent
 
825
#
 
826
AC_CHECK_HEADERS(mntent.h)
 
827
AC_CHECK_FUNCS(setmntent)
 
828
 
 
829
#
 
830
# IPv6
 
831
#
 
832
AC_ARG_ENABLE(ipv6,
 
833
        [AS_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
 
834
        [
 
835
                if test $enableval != "no";
 
836
                then
 
837
                        AC_DEFINE(IPv6,1)
 
838
                fi
 
839
    ],
 
840
        [
 
841
                AC_DEFINE(IPv6,1)
 
842
        ])
 
843
 
 
844
#
 
845
# debugging
 
846
#
 
847
AC_ARG_WITH(debug,
 
848
    [  --with-debug            enable protocol debugging output],
 
849
    [
 
850
        if test $withval != "no";
 
851
        then
 
852
            AC_DEFINE(WITH_DEBUG,1)
 
853
        fi
 
854
    ])
 
855
 
 
856
AC_ARG_WITH(debug-kbd,
 
857
    [  --with-debug-kbd        enable debugging of keyboard handling],
 
858
    [
 
859
        if test $withval != "no";
 
860
        then
 
861
            AC_DEFINE(WITH_DEBUG_KBD,1)
 
862
        fi
 
863
    ])
 
864
 
 
865
AC_ARG_WITH(debug-rdp5,
 
866
    [  --with-debug-rdp5       enable debugging of RDP5 code],
 
867
    [
 
868
        if test $withval != "no";
 
869
        then
 
870
            AC_DEFINE(WITH_DEBUG_RDP5,1)
 
871
        fi
 
872
    ])
 
873
 
 
874
AC_ARG_WITH(debug-clipboard,
 
875
    [  --with-debug-clipboard  enable debugging of clipboard code],
 
876
    [
 
877
        if test $withval != "no";
 
878
        then
 
879
            AC_DEFINE(WITH_DEBUG_CLIPBOARD,1)
 
880
        fi
 
881
    ])
 
882
 
 
883
AC_ARG_WITH(debug-sound,
 
884
    [  --with-debug-sound  enable debugging of sound code],
 
885
    [
 
886
        if test $withval != "no";
 
887
        then
 
888
            AC_DEFINE(WITH_DEBUG_SOUND,1)
 
889
        fi
 
890
    ])
 
891
 
 
892
AC_ARG_WITH(debug-channel,
 
893
    [  --with-debug-channel  enable debugging of virtual channel code],
 
894
    [
 
895
        if test $withval != "no";
 
896
        then
 
897
            AC_DEFINE(WITH_DEBUG_CHANNEL,1)
 
898
        fi
 
899
    ])
 
900
 
 
901
AC_ARG_WITH(debug-seamless,
 
902
    [  --with-debug-seamless  enable debugging of SeamlessRDP code],
 
903
    [
 
904
        if test $withval != "no";
 
905
        then
 
906
            AC_DEFINE(WITH_DEBUG_SEAMLESS,1)
 
907
        fi
 
908
    ])
 
909
 
 
910
AC_ARG_WITH(debug-serial,
 
911
    [  --with-debug-serial  enable debugging of Serial code],
 
912
    [
 
913
        if test $withval != "no";
 
914
        then
 
915
            AC_DEFINE(WITH_DEBUG_SERIAL,1)
 
916
        fi
 
917
    ])
 
918
 
 
919
AC_ARG_WITH(debug-smartcard,
 
920
    [  --with-debug-smartcard  enable debugging of smart-card code],
 
921
    [
 
922
        if test $withval != "no";
 
923
        then
 
924
                if test x"$WITH_SCARD" = "x1"; then
 
925
                        AC_DEFINE(WITH_DEBUG_SCARD,1)
 
926
                fi
 
927
        fi
 
928
    ])
 
929
 
 
930
#
 
931
# target-specific stuff
 
932
#
 
933
# strip leading colon from rpath
 
934
rpath=`echo $rpath |sed 's/^://'`
 
935
AC_CANONICAL_HOST
 
936
case "$host" in
 
937
*-*-solaris*)
 
938
    LDFLAGS="$LDFLAGS -R$rpath"
 
939
    ;;
 
940
*-dec-osf*)
 
941
    LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath"
 
942
    ;;
 
943
*-*-hpux*)
 
944
    CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
 
945
    ;;
 
946
*-*-irix6.5*)
 
947
    CFLAGS="$CFLAGS -D__SGI_IRIX__"
 
948
    ;;
 
949
esac
 
950
 
 
951
#
 
952
# Optional build targets
 
953
#
 
954
EXTRA_SUBDIRS=""
 
955
 
 
956
#
 
957
# X11
 
958
#
 
959
AC_PATH_XTRA
 
960
if test "$no_x" = "yes"; then
 
961
        x11="no"
 
962
else
 
963
        AC_CHECK_LIB(X11, XOpenDisplay, [X_LIBS="$X_LIBS -lX11"])
 
964
        PKG_CHECK_MODULES(XCURSOR, [xcursor])
 
965
        x11="yes"
 
966
        EXTRA_SUBDIRS="$EXTRA_SUBDIRS X11"
 
967
fi
 
968
 
 
969
#
 
970
# DirectFB (optionally built when --with-dfb specified)
 
971
#
 
972
dfb="no"
 
973
AC_ARG_WITH([dfb],
 
974
        [AS_HELP_STRING([--with-dfb], [Build DirectFB UI])],
 
975
        [
 
976
                # Put dependency check here
 
977
                EXTRA_SUBDIRS="$EXTRA_SUBDIRS dfb"
 
978
                
 
979
                # DirectFB
 
980
                PKG_CHECK_MODULES(DFB, [directfb >= 1.0.0])
 
981
                dfb="yes"
 
982
        ])
 
983
 
 
984
AC_SUBST(EXTRA_SUBDIRS)
 
985
 
 
986
AC_CONFIG_FILES([
 
987
Makefile
 
988
freerdp.pc
 
989
asn1/Makefile
 
990
libfreerdp/Makefile
 
991
doc/Makefile
 
992
include/Makefile
 
993
libfreerdpkbd/Makefile
 
994
keymaps/Makefile
 
995
libfreerdpchanman/Makefile
 
996
X11/Makefile
 
997
dfb/Makefile
 
998
channels/common/Makefile
 
999
channels/rdpsnd/Makefile
 
1000
channels/cliprdr/Makefile
 
1001
channels/rdpdr/Makefile
 
1002
channels/rdpdr/disk/Makefile
 
1003
channels/rdpdr/printer/Makefile
 
1004
])
 
1005
 
 
1006
AC_OUTPUT
 
1007
 
 
1008
echo
 
1009
echo "FreeRDP configure result:"
 
1010
echo
 
1011
echo "Cryptography : $with_crypto"
 
1012
if test "x$disable_tls" = "xyes"; then
 
1013
        echo "               (TLS disabled)"
 
1014
fi
 
1015
echo "Sound        : $sound"
 
1016
echo "Printer      : $printer"
 
1017
echo "X11          : $x11"
 
1018
echo "DirectFB     : $dfb"
 
1019