blob: ca9f3b31a62b600289776e24acf7be31d2e0d9dc [file] [log] [blame]
San Mehata430b2b2014-09-23 08:30:51 -07001# Process this file with autoconf to produce a configure script.
Greg Hartman1d80c6a2015-06-17 22:16:13 -07002AC_INIT(LibVNCServer, 0.9.10, https://github.com/LibVNC/libvncserver)
3AM_INIT_AUTOMAKE([subdir-objects])
San Mehata430b2b2014-09-23 08:30:51 -07004m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
5AM_CONFIG_HEADER(rfbconfig.h)
6AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])
Greg Hartman1d80c6a2015-06-17 22:16:13 -07007AC_CONFIG_MACRO_DIR([m4])
8
9
10# set detailed version info
11AC_DEFINE(VERSION_MAJOR, 0, LibVNCServer major version)
12AC_DEFINE(VERSION_MINOR, 9, LibVNCServer minor version)
13AC_DEFINE(VERSION_PATCHLEVEL, 10, LibVNCServer patchlevel)
San Mehata430b2b2014-09-23 08:30:51 -070014
15# Checks for programs.
16AC_PROG_CC
17AM_PROG_CC_C_O
18if test -z "$CC"; then
19 CCLD="\$(CC)"
20else
21 CCLD="$CC"
22fi
23test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall"
24AC_PROG_MAKE_SET
25AC_LIBTOOL_WIN32_DLL
26AC_PROG_LIBTOOL
27AC_PATH_PROG([AR], [ar], [/usr/bin/ar],
28 [$PATH:/usr/ccs/bin])
29
30# Options
31AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol])
32AC_ARG_WITH(tightvnc-filetransfer,
33 [ --without-filetransfer disable TightVNC file transfer protocol],
34 , [ with_tightvnc_filetransfer=yes ])
35# AC_DEFINE moved to after libpthread check.
36
37# WebSockets support
Greg Hartman1d80c6a2015-06-17 22:16:13 -070038AC_CHECK_FUNC(__b64_ntop, HAVE_B64_IN_LIBC="true", HAVE_B64_IN_LIBC="false")
39if test "x$HAVE_B64_IN_LIBC" != "xtrue"; then
40 AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64_IN_LIBRESOLV="true", HAVE_B64_IN_LIBRESOLV="false")
41 if test "x$HAVE_B64_IN_LIBRESOLV" = "xtrue"; then
42 RESOLV_LIB="-lresolv"
43 HAVE_B64="true"
44 fi
45else
46 HAVE_B64="true"
47fi
San Mehata430b2b2014-09-23 08:30:51 -070048AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support])
49AC_ARG_WITH(websockets,
50 [ --without-websockets disable WebSockets support],
51 , [ with_websockets=yes ])
52# AC_DEFINE moved to after libresolve check.
53
54AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
55AC_ARG_WITH(24bpp,
56 [ --without-24bpp disable 24 bpp framebuffers],
57 , [ with_24bpp=yes ])
58if test "x$with_24bpp" = "xyes"; then
59 AC_DEFINE(ALLOW24BPP)
60fi
61AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)])
62AC_ARG_WITH(ffmpeg,
63 [ --with-ffmpeg=dir set ffmpeg home directory],,)
64AC_SUBST(with_ffmpeg)
65AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
66if test ! -z "$with_ffmpeg"; then
67 AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" )
68fi
69AM_CONDITIONAL(HAVE_MP3LAME, test "$HAVE_MP3LAME" = "true")
70
71# Seem to need this dummy here to induce the 'checking for egrep... grep -E', etc.
72# before it seemed to be inside the with_jpeg conditional.
73AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true")
74
75# set some ld -R nonsense
76#
77uname_s=`(uname -s) 2>/dev/null`
78ld_minus_R="yes"
79if test "x$uname_s" = "xHP-UX"; then
80 ld_minus_R="no"
81elif test "x$uname_s" = "xOSF1"; then
82 ld_minus_R="no"
83elif test "x$uname_s" = "xDarwin"; then
84 ld_minus_R="no"
85fi
86
87# Check for OpenSSL
88AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
89AC_ARG_WITH(crypt,
90[ --without-crypt disable support for libcrypt],,)
91if test "x$with_crypt" != "xno"; then
92 AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true")
93 if test -z "$HAVE_LIBC_CRYPT"; then
94 AC_CHECK_LIB(crypt, crypt,
95 CRYPT_LIBS="-lcrypt"
96 [AC_DEFINE(HAVE_LIBCRYPT)], ,)
97 fi
98fi
99AC_SUBST(CRYPT_LIBS)
100
101# some OS's need both -lssl and -lcrypto on link line:
102AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present])
103AC_ARG_WITH(crypto,
104[ --without-crypto disable support for openssl libcrypto],,)
105
106AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present])
107AC_ARG_WITH(ssl,
108[ --without-ssl disable support for openssl libssl]
109[ --with-ssl=DIR use openssl include/library files in DIR],,)
110
111if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then
112 if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then
113 saved_CPPFLAGS="$CPPFLAGS"
114 saved_LDFLAGS="$LDFLAGS"
115 CPPFLAGS="$CPPFLAGS -I$with_ssl/include"
116 LDFLAGS="$LDFLAGS -L$with_ssl/lib"
117 if test "x$ld_minus_R" = "xno"; then
118 :
119 elif test "x$GCC" = "xyes"; then
120 LDFLAGS="$LDFLAGS -Xlinker -R$with_ssl/lib"
121 else
122 LDFLAGS="$LDFLAGS -R$with_ssl/lib"
123 fi
124 fi
125 AC_CHECK_LIB(crypto, RAND_file_name,
126 [AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,)
127 if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then
128 if test "x$HAVE_LIBCRYPTO" != "xtrue"; then
129 CPPFLAGS="$saved_CPPFLAGS"
130 LDFLAGS="$saved_LDFLAGS"
131 fi
132 fi
133fi
134
135AH_TEMPLATE(HAVE_X509_PRINT_EX_FP, [open ssl X509_print_ex_fp available])
136if test "x$with_ssl" != "xno"; then
137 if test "x$HAVE_LIBCRYPTO" = "xtrue"; then
138 AC_CHECK_LIB(ssl, SSL_library_init,
139 SSL_LIBS="-lssl -lcrypto"
140 [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,
141 -lcrypto)
142 else
143 AC_CHECK_LIB(ssl, SSL_library_init,
144 SSL_LIBS="-lssl"
145 [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,)
146 fi
147fi
148AC_SUBST(SSL_LIBS)
149AM_CONDITIONAL(HAVE_LIBSSL, test ! -z "$SSL_LIBS")
150
San Mehata430b2b2014-09-23 08:30:51 -0700151
Greg Hartman1d80c6a2015-06-17 22:16:13 -0700152# See if we want libva support
153# TODO: check if library actually exists
154AH_TEMPLATE(CONFIG_LIBVA, [Build libva support])
155AC_ARG_WITH(libva,
156[ --with-libva build libva support],,)
157if test "x$with_libva" != "xno"; then
158 AC_CHECK_LIB(va, vaInitialize,
159 VA_LIBS="-lva -lva-x11"
160 [AC_DEFINE(CONFIG_LIBVA) CONFIG_LIBVA="true"], ,)
San Mehata430b2b2014-09-23 08:30:51 -0700161fi
Greg Hartman1d80c6a2015-06-17 22:16:13 -0700162AC_SUBST(VA_LIBS)
163AM_CONDITIONAL(CONFIG_LIBVA, test ! -z "$VA_LIBS")
San Mehata430b2b2014-09-23 08:30:51 -0700164
San Mehata430b2b2014-09-23 08:30:51 -0700165
166
167AC_ARG_WITH(jpeg,
168[ --without-jpeg disable support for jpeg]
169[ --with-jpeg=DIR use jpeg include/library files in DIR],,)
170
171# At this point:
172# no jpeg on command line with_jpeg=""
173# -with-jpeg with_jpeg="yes"
174# -without-jpeg with_jpeg="no"
175# -with-jpeg=/foo/dir with_jpeg="/foo/dir"
176
177HAVE_LIBJPEG_TURBO="false"
178
179if test "x$with_jpeg" != "xno"; then
180 AC_ARG_VAR(JPEG_LDFLAGS,
181 [Linker flags to use when linking with libjpeg, e.g. -L/foo/dir/lib -Wl,-static -ljpeg -Wl,-shared. This overrides the linker flags set by --with-jpeg.])
182 saved_CPPFLAGS="$CPPFLAGS"
183 saved_LDFLAGS="$LDFLAGS"
184 saved_LIBS="$LIBS"
185 if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then
186 # add user supplied directory to flags:
187 CPPFLAGS="$CPPFLAGS -I$with_jpeg/include"
188 LDFLAGS="$LDFLAGS -L$with_jpeg/lib"
189 if test "x$ld_minus_R" = "xno"; then
190 :
191 elif test "x$GCC" = "xyes"; then
192 # this is not complete... in general a rat's nest.
193 LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib"
194 else
195 LDFLAGS="$LDFLAGS -R$with_jpeg/lib"
196 fi
197 fi
198 if test "x$JPEG_LDFLAGS" != "x"; then
199 LDFLAGS="$saved_LDFLAGS"
200 LIBS="$LIBS $JPEG_LDFLAGS"
201 else
202 LIBS="-ljpeg"
203 fi
204 AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true")
205 AC_MSG_CHECKING(for jpeg_CreateCompress in libjpeg)
206 if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
207 AC_LINK_IFELSE([AC_LANG_CALL([], [jpeg_CreateCompress])],
208 [AC_MSG_RESULT(yes);
209 AC_DEFINE(HAVE_LIBJPEG, 1, libjpeg support enabled)],
210 [AC_MSG_RESULT(no); HAVE_JPEGLIB_H=""])
211 fi
212 if test "x$HAVE_JPEGLIB_H" != "xtrue"; then
213 # restore old flags on failure:
214 CPPFLAGS="$saved_CPPFLAGS"
215 LDFLAGS="$saved_LDFLAGS"
216 LIBS="$saved_LIBS"
217 AC_MSG_WARN([
218==========================================================================
219*** The libjpeg compression library was not found. ***
220This may lead to reduced performance, especially over slow links.
221If libjpeg is in a non-standard location use --with-jpeg=DIR to
222indicate the header file is in DIR/include/jpeglib.h and the library
223in DIR/lib/libjpeg.a. You can also set the JPEG_LDFLAGS variable to
224specify more detailed linker flags. A copy of libjpeg-turbo may be
225obtained from: https://sourceforge.net/projects/libjpeg-turbo/files/
226A copy of libjpeg may be obtained from: http://ijg.org/files/
227==========================================================================
228])
229 sleep 5
230 fi
231
232 if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
233 AC_MSG_CHECKING(whether JPEG library is libjpeg-turbo)
234 m4_define([LJT_TEST],
235 [AC_LANG_PROGRAM([#include <stdio.h>
236 #include <jpeglib.h>],
237 [struct jpeg_compress_struct cinfo;
238 struct jpeg_error_mgr jerr;
239 cinfo.err=jpeg_std_error(&jerr);
240 jpeg_create_compress(&cinfo);
241 cinfo.input_components = 3;
242 jpeg_set_defaults(&cinfo);
243 cinfo.in_color_space = JCS_EXT_RGB;
244 jpeg_default_colorspace(&cinfo);
245 return 0;])]
246 )
247 if test "x$cross_compiling" != "xyes"; then
248 AC_RUN_IFELSE([LJT_TEST],
249 [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
250 [AC_MSG_RESULT(no)])
251 else
252 AC_LINK_IFELSE([LJT_TEST],
253 [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
254 [AC_MSG_RESULT(no)])
255 fi
256 fi
257
258 if test "x$HAVE_JPEGLIB_H" = "xtrue" -a "x$HAVE_LIBJPEG_TURBO" != "xtrue"; then
259 AC_MSG_WARN([
260==========================================================================
261*** The libjpeg library you are building against is not libjpeg-turbo.
262Performance will be reduced. You can obtain libjpeg-turbo from:
263https://sourceforge.net/projects/libjpeg-turbo/files/ ***
264==========================================================================
265])
266 fi
267
268fi
269
270AC_ARG_WITH(png,
271[ --without-png disable support for png]
272[ --with-png=DIR use png include/library files in DIR],,)
273
274# At this point:
275# no png on command line with_png=""
276# -with-png with_png="yes"
277# -without-png with_png="no"
278# -with-png=/foo/dir with_png="/foo/dir"
279
280if test "x$with_png" != "xno"; then
281 if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
282 # add user supplied directory to flags:
283 saved_CPPFLAGS="$CPPFLAGS"
284 saved_LDFLAGS="$LDFLAGS"
285 CPPFLAGS="$CPPFLAGS -I$with_png/include"
286 LDFLAGS="$LDFLAGS -L$with_png/lib"
287 if test "x$ld_minus_R" = "xno"; then
288 :
289 elif test "x$GCC" = "xyes"; then
290 # this is not complete... in general a rat's nest.
291 LDFLAGS="$LDFLAGS -Xlinker -R$with_png/lib"
292 else
293 LDFLAGS="$LDFLAGS -R$with_png/lib"
294 fi
295 fi
296 AC_CHECK_HEADER(png.h, HAVE_PNGLIB_H="true")
297 if test "x$HAVE_PNGLIB_H" = "xtrue"; then
298 AC_CHECK_LIB(png, png_create_write_struct, , HAVE_PNGLIB_H="")
299 fi
300 if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
301 if test "x$HAVE_PNGLIB_H" != "xtrue"; then
302 # restore old flags on failure:
303 CPPFLAGS="$saved_CPPFLAGS"
304 LDFLAGS="$saved_LDFLAGS"
305 fi
306 fi
San Mehata430b2b2014-09-23 08:30:51 -0700307 if test "x$HAVE_PNGLIB_H" != "xtrue"; then
308 AC_MSG_WARN([
309==========================================================================
310*** The libpng compression library was not found. ***
311This may lead to reduced performance, especially over slow links.
312If libpng is in a non-standard location use --with-png=DIR to
313indicate the header file is in DIR/include/png.h and the library
314in DIR/lib/libpng.a. A copy of libpng may be obtained from:
315http://www.libpng.org/pub/png/libpng.html
316==========================================================================
317])
318 sleep 5
319 fi
San Mehata430b2b2014-09-23 08:30:51 -0700320fi
321
322AC_ARG_WITH(libz,
323[ --without-libz disable support for deflate],,)
324AC_ARG_WITH(zlib,
325[ --without-zlib disable support for deflate]
326[ --with-zlib=DIR use zlib include/library files in DIR],,)
327
328if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then
329 if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then
330 saved_CPPFLAGS="$CPPFLAGS"
331 saved_LDFLAGS="$LDFLAGS"
332 CPPFLAGS="$CPPFLAGS -I$with_zlib/include"
333 LDFLAGS="$LDFLAGS -L$with_zlib/lib"
334 if test "x$ld_minus_R" = "xno"; then
335 :
336 elif test "x$GCC" = "xyes"; then
337 LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib"
338 else
339 LDFLAGS="$LDFLAGS -R$with_zlib/lib"
340 fi
341 fi
342 AC_CHECK_HEADER(zlib.h, HAVE_ZLIB_H="true")
343 if test "x$HAVE_ZLIB_H" = "xtrue"; then
344 AC_CHECK_LIB(z, deflate, , HAVE_ZLIB_H="")
345 fi
346 if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then
347 if test "x$HAVE_ZLIB_H" != "xtrue"; then
348 CPPFLAGS="$saved_CPPFLAGS"
349 LDFLAGS="$saved_LDFLAGS"
350 fi
351 fi
San Mehata430b2b2014-09-23 08:30:51 -0700352 if test "x$HAVE_ZLIB_H" != "xtrue"; then
353 AC_MSG_WARN([
354==========================================================================
355*** The libz compression library was not found. ***
356This may lead to reduced performance, especially over slow links.
357If libz is in a non-standard location use --with-zlib=DIR to indicate the
358header file is in DIR/include/zlib.h and the library in DIR/lib/libz.a.
359A copy of libz may be obtained from: http://www.gzip.org/zlib/
360==========================================================================
361])
362 sleep 5
363 fi
San Mehata430b2b2014-09-23 08:30:51 -0700364fi
365
366AC_ARG_WITH(pthread,
367[ --without-pthread disable support for libpthread],,)
368
369if test "x$with_pthread" != "xno"; then
370 AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true")
371 if test ! -z "$HAVE_PTHREAD_H"; then
372 AC_CHECK_LIB(pthread, pthread_mutex_lock)
373 AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
374 fi
375fi
376AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
377
378AC_MSG_CHECKING([for __thread])
379AC_LINK_IFELSE([AC_LANG_PROGRAM(, [static __thread int p = 0])],
380 [AC_DEFINE(HAVE_TLS, 1,
381 Define to 1 if compiler supports __thread)
382 AC_MSG_RESULT([yes])],
383 [AC_MSG_RESULT([no])])
384
385# tightvnc-filetransfer implemented using threads:
386if test -z "$HAVE_LIBPTHREAD"; then
387 with_tightvnc_filetransfer=""
388fi
389if test "x$with_tightvnc_filetransfer" = "xyes"; then
390 AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
391fi
392AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes")
393
394# websockets implemented using base64 from resolve
395if test "x$HAVE_B64" != "xtrue"; then
396 with_websockets=""
397fi
398if test "x$with_websockets" = "xyes"; then
Greg Hartman1d80c6a2015-06-17 22:16:13 -0700399 LIBS="$LIBS $RESOLV_LIB $SSL_LIBS"
San Mehata430b2b2014-09-23 08:30:51 -0700400 AC_DEFINE(WITH_WEBSOCKETS)
401fi
402AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes")
403
404AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H")
405AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H")
406AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H")
407
408
409SDLCONFIG="sdl-config"
410AC_ARG_WITH(sdl-config,
411[[ --with-sdl-config=FILE
412 Use the given path to sdl-config when determining
413 SDL configuration; defaults to "sdl-config"]],
414[
415 if test "$withval" != "yes" -a "$withval" != ""; then
416 SDLCONFIG=$withval
417 fi
418])
419
420if test -z "$with_sdl"; then
421 if $SDLCONFIG --version >/dev/null 2>&1; then
422 with_sdl=yes
423 SDL_CFLAGS=`$SDLCONFIG --cflags`
424 SDL_LIBS=`$SDLCONFIG --libs`
425 else
426 with_sdl=no
427 fi
428fi
429AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes")
430AC_SUBST(SDL_CFLAGS)
431AC_SUBST(SDL_LIBS)
432
433
434# Check for GTK+. if present, build the GTK+ vnc viewer example
435PKG_CHECK_MODULES([GTK], [gtk+-2.0],,:)
436AM_CONDITIONAL(HAVE_LIBGTK, test ! -z "$GTK_LIBS")
437
438AC_CANONICAL_HOST
439MINGW=`echo $host_os | grep mingw32 2>/dev/null`
440AM_CONDITIONAL(MINGW, test ! -z "$MINGW" )
441if test ! -z "$MINGW"; then
442 WSOCKLIB="-lws2_32"
443 LDFLAGS="$LDFLAGS -no-undefined"
444fi
445AC_SUBST(WSOCKLIB)
446
447# Check for libgcrypt
448AH_TEMPLATE(WITH_CLIENT_GCRYPT, [Enable support for libgcrypt in libvncclient])
449AC_ARG_WITH(gcrypt,
450[ --without-gcrypt disable support for gcrypt],,)
451AC_ARG_WITH(client-gcrypt,
452[ --without-client-gcrypt disable support for gcrypt in libvncclient],,)
453
454if test "x$with_gcrypt" != "xno"; then
455 AM_PATH_LIBGCRYPT(1.4.0, , with_client_gcrypt=no)
456 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
457 LIBS="$LIBS $LIBGCRYPT_LIBS"
458 if test "x$with_client_gcrypt" != "xno"; then
459 AC_DEFINE(WITH_CLIENT_GCRYPT)
460 fi
461fi
462
463# Checks for GnuTLS
464AH_TEMPLATE(HAVE_GNUTLS, [GnuTLS library present])
465AC_ARG_WITH(gnutls,
466[ --without-gnutls disable support for gnutls]
467[ --with-gnutls=DIR use gnutls include/library files in DIR],,)
468
469if test "x$with_gnutls" != "xno"; then
470 PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.4.0,,:)
471 CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
472 LIBS="$LIBS $GNUTLS_LIBS"
473fi
474AM_CONDITIONAL(HAVE_GNUTLS, test ! -z "$GNUTLS_LIBS")
475if test ! -z "$GNUTLS_LIBS" ; then
476 AC_DEFINE(HAVE_GNUTLS)
477fi
478
479
480# warn if neither GnuTLS nor OpenSSL are available
481if test -z "$SSL_LIBS" -a -z "$GNUTLS_LIBS"; then
482 AC_MSG_WARN([
483==========================================================================
484*** No encryption library could be found. ***
485A libvncserver/libvncclient built this way will not support SSL encryption.
486To enable SSL install the necessary development packages (perhaps it is named
487something like libssl-dev or gnutls-dev) and run configure again.
488==========================================================================
489])
490 sleep 5
491fi
492
493
494# IPv6
495AH_TEMPLATE(IPv6, [Enable IPv6 support])
496AC_ARG_WITH(ipv6,
497[ --without-ipv6 disable IPv6 support],,)
498if test "x$with_ipv6" != "xno"; then
499 AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(IPv6,1),
500 AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(IPv6,1), [
501 AC_MSG_CHECKING([for getaddrinfo in -lws2_32])
502 LIBS="$LIBS -lws2_32"
503 AC_TRY_LINK([#include <ws2tcpip.h>], [getaddrinfo(0, 0, 0, 0);], [
504 AC_DEFINE(IPv6,1)
505 AC_MSG_RESULT([yes])
506 ],
507 AC_MSG_RESULT([no]))
508 ]))
509fi
510
511
512
513# Checks for header files.
514AC_HEADER_STDC
Greg Hartman1d80c6a2015-06-17 22:16:13 -0700515AC_CHECK_HEADERS([arpa/inet.h endian.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/endian.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h ws2tcpip.h])
San Mehata430b2b2014-09-23 08:30:51 -0700516
517# Checks for typedefs, structures, and compiler characteristics.
518AC_C_CONST
519AC_C_INLINE
520AC_C_BIGENDIAN
521AC_TYPE_SIZE_T
522AC_HEADER_TIME
523AC_HEADER_SYS_WAIT
Greg Hartman1d80c6a2015-06-17 22:16:13 -0700524AX_TYPE_SOCKLEN_T
San Mehata430b2b2014-09-23 08:30:51 -0700525if test ! -d ./rfb; then
526 echo "creating subdir ./rfb for rfbint.h"
527 mkdir ./rfb
528fi
Greg Hartman1d80c6a2015-06-17 22:16:13 -0700529AX_CREATE_STDINT_H(rfb/rfbint.h)
San Mehata430b2b2014-09-23 08:30:51 -0700530AC_CACHE_CHECK([for in_addr_t],
531 vnc_cv_inaddrt, [
532 AC_TRY_COMPILE([#include <sys/types.h>
533#include <netinet/in.h>],
534 [in_addr_t foo; return 0;],
535 [inaddrt=yes],
536 [inaddrt=no]),
537 ])
538AH_TEMPLATE(NEED_INADDR_T, [Need a typedef for in_addr_t])
539if test $inaddrt = no ; then
540 AC_DEFINE(NEED_INADDR_T)
541fi
542# Checks for library functions.
543AC_FUNC_MEMCMP
544AC_FUNC_STAT
545AC_FUNC_STRFTIME
546AC_FUNC_VPRINTF
547AC_FUNC_FORK
548AC_CHECK_LIB(nsl,gethostbyname)
549AC_CHECK_LIB(socket,socket)
550
551uname_s=`(uname -s) 2>/dev/null`
552if test "x$uname_s" = "xHP-UX"; then
553 # need -lsec for getspnam()
554 LDFLAGS="$LDFLAGS -lsec"
555fi
556
557AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr])
San Mehata430b2b2014-09-23 08:30:51 -0700558
559# check, if shmget is in cygipc.a
560AC_CHECK_LIB(cygipc,shmget)
561AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true")
562
563# Check if /usr/include/linux exists, if so, define LINUX
564AM_CONDITIONAL(LINUX, test -d /usr/include/linux)
565
566# Check for OS X specific header
567AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true")
568AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true")
569
570# Check for Android specific header
571AC_CHECK_HEADER(android/api-level.h, HAVE_ANDROID="true")
572AM_CONDITIONAL(ANDROID, test "$HAVE_ANDROID" = "true")
573if test "$HAVE_ANDROID" = "true"; then
574 AC_DEFINE(HAVE_ANDROID, 1, [Android host system detected])
575fi
576
577# On Solaris 2.7, write() returns ENOENT when it really means EAGAIN
578AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it])
579case `(uname -sr) 2>/dev/null` in
580 "SunOS 5.7")
581 AC_DEFINE(ENOENT_WORKAROUND)
582 ;;
583esac
584
585# Check for rpm SOURCES path
586printf "checking for rpm sources path... "
587RPMSOURCEDIR="NOT-FOUND"
588for directory in packages OpenLinux redhat RedHat rpm RPM "" ; do
589 if test -d /usr/src/${directory}/SOURCES; then
590 RPMSOURCEDIR="/usr/src/${directory}/SOURCES/"
591 fi
592done
593echo "$RPMSOURCEDIR"
594AM_CONDITIONAL(HAVE_RPM, test "$RPMSOURCEDIR" != "NOT-FOUND")
San Mehata430b2b2014-09-23 08:30:51 -0700595AC_SUBST(RPMSOURCEDIR)
596
597AC_CONFIG_FILES([Makefile
598 libvncserver.pc
599 libvncclient.pc
600 libvncserver/Makefile
601 examples/Makefile
602 examples/android/Makefile
San Mehata430b2b2014-09-23 08:30:51 -0700603 webclients/Makefile
604 webclients/java-applet/Makefile
605 webclients/java-applet/ssl/Makefile
606 libvncclient/Makefile
607 client_examples/Makefile
608 test/Makefile
609 libvncserver-config
610 LibVNCServer.spec])
San Mehata430b2b2014-09-23 08:30:51 -0700611
San Mehata430b2b2014-09-23 08:30:51 -0700612
613AC_CONFIG_COMMANDS([chmod-libvncserver-config],[chmod a+x libvncserver-config])
614AC_OUTPUT
615chmod a+x ./libvncserver-config
616