Home | History | Annotate | Download | only in libvncserver
      1 # Process this file with autoconf to produce a configure script.
      2 AC_INIT(LibVNCServer, 0.9.10, https://github.com/LibVNC/libvncserver)
      3 AM_INIT_AUTOMAKE([subdir-objects])
      4 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
      5 AM_CONFIG_HEADER(rfbconfig.h)
      6 AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])
      7 AC_CONFIG_MACRO_DIR([m4])
      8 
      9 
     10 # set detailed version info
     11 AC_DEFINE(VERSION_MAJOR, 0, LibVNCServer major version)
     12 AC_DEFINE(VERSION_MINOR, 9, LibVNCServer minor version)
     13 AC_DEFINE(VERSION_PATCHLEVEL, 10, LibVNCServer patchlevel)
     14 
     15 # Checks for programs.
     16 AC_PROG_CC
     17 AM_PROG_CC_C_O
     18 if test -z "$CC"; then
     19 	CCLD="\$(CC)"
     20 else
     21 	CCLD="$CC"
     22 fi
     23 test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall"
     24 AC_PROG_MAKE_SET
     25 AC_LIBTOOL_WIN32_DLL
     26 AC_PROG_LIBTOOL
     27 AC_PATH_PROG([AR], [ar], [/usr/bin/ar],
     28                   [$PATH:/usr/ccs/bin])
     29 
     30 # Options
     31 AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol])
     32 AC_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
     38 AC_CHECK_FUNC(__b64_ntop, HAVE_B64_IN_LIBC="true", HAVE_B64_IN_LIBC="false")
     39 if 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
     45 else
     46 	HAVE_B64="true"
     47 fi
     48 AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support])
     49 AC_ARG_WITH(websockets,
     50 	[  --without-websockets    disable WebSockets support],
     51 	, [ with_websockets=yes ])
     52 # AC_DEFINE moved to after libresolve check.
     53 
     54 AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
     55 AC_ARG_WITH(24bpp,
     56 	[  --without-24bpp         disable 24 bpp framebuffers],
     57 	, [ with_24bpp=yes ])
     58 if test "x$with_24bpp" = "xyes"; then
     59 	AC_DEFINE(ALLOW24BPP)
     60 fi
     61 AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)])
     62 AC_ARG_WITH(ffmpeg,
     63 	[  --with-ffmpeg=dir       set ffmpeg home directory],,)
     64 AC_SUBST(with_ffmpeg)
     65 AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
     66 if test ! -z "$with_ffmpeg"; then
     67 	AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" )
     68 fi
     69 AM_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. 
     73 AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true")
     74 
     75 # set some ld -R nonsense
     76 #
     77 uname_s=`(uname -s) 2>/dev/null`
     78 ld_minus_R="yes"
     79 if test "x$uname_s" = "xHP-UX"; then
     80 	ld_minus_R="no"
     81 elif test "x$uname_s" = "xOSF1"; then
     82 	ld_minus_R="no"
     83 elif test "x$uname_s" = "xDarwin"; then
     84 	ld_minus_R="no"
     85 fi
     86 
     87 # Check for OpenSSL
     88 AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
     89 AC_ARG_WITH(crypt,
     90 [  --without-crypt         disable support for libcrypt],,)
     91 if 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
     98 fi
     99 AC_SUBST(CRYPT_LIBS)
    100 
    101 # some OS's need both -lssl and -lcrypto on link line:
    102 AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present])
    103 AC_ARG_WITH(crypto,
    104 [  --without-crypto        disable support for openssl libcrypto],,)
    105 
    106 AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present])
    107 AC_ARG_WITH(ssl,
    108 [  --without-ssl           disable support for openssl libssl]
    109 [  --with-ssl=DIR          use openssl include/library files in DIR],,)
    110 
    111 if 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
    133 fi
    134 
    135 AH_TEMPLATE(HAVE_X509_PRINT_EX_FP, [open ssl X509_print_ex_fp available])
    136 if 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
    147 fi
    148 AC_SUBST(SSL_LIBS)
    149 AM_CONDITIONAL(HAVE_LIBSSL, test ! -z "$SSL_LIBS")
    150 
    151 
    152 # See if we want libva support
    153 # TODO: check if library actually exists
    154 AH_TEMPLATE(CONFIG_LIBVA, [Build libva support])
    155 AC_ARG_WITH(libva,
    156 [  --with-libva                   build libva support],,)
    157 if 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"], ,)
    161 fi
    162 AC_SUBST(VA_LIBS)
    163 AM_CONDITIONAL(CONFIG_LIBVA, test ! -z "$VA_LIBS")
    164 
    165 
    166 
    167 AC_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 
    177 HAVE_LIBJPEG_TURBO="false"
    178 
    179 if 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. ***
    220 This may lead to reduced performance, especially over slow links.
    221 If libjpeg is in a non-standard location use --with-jpeg=DIR to
    222 indicate the header file is in DIR/include/jpeglib.h and the library
    223 in DIR/lib/libjpeg.a.  You can also set the JPEG_LDFLAGS variable to
    224 specify more detailed linker flags.  A copy of libjpeg-turbo may be
    225 obtained from:  https://sourceforge.net/projects/libjpeg-turbo/files/
    226 A 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.
    262 Performance will be reduced.  You can obtain libjpeg-turbo from:
    263 https://sourceforge.net/projects/libjpeg-turbo/files/ ***
    264 ==========================================================================
    265 ])
    266   fi
    267 
    268 fi
    269 
    270 AC_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 
    280 if 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
    307 		if test "x$HAVE_PNGLIB_H" != "xtrue"; then
    308 			AC_MSG_WARN([
    309 ==========================================================================
    310 *** The libpng compression library was not found. ***
    311 This may lead to reduced performance, especially over slow links.
    312 If libpng is in a non-standard location use --with-png=DIR to
    313 indicate the header file is in DIR/include/png.h and the library
    314 in DIR/lib/libpng.a.  A copy of libpng may be obtained from:
    315 http://www.libpng.org/pub/png/libpng.html
    316 ==========================================================================
    317 ])
    318 			sleep 5
    319 		fi
    320 fi
    321 
    322 AC_ARG_WITH(libz,
    323 [  --without-libz          disable support for deflate],,)
    324 AC_ARG_WITH(zlib,
    325 [  --without-zlib          disable support for deflate]
    326 [  --with-zlib=DIR         use zlib include/library files in DIR],,)
    327 
    328 if 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
    352 		if test "x$HAVE_ZLIB_H" != "xtrue"; then
    353 			AC_MSG_WARN([
    354 ==========================================================================
    355 *** The libz compression library was not found. ***
    356 This may lead to reduced performance, especially over slow links.
    357 If libz is in a non-standard location use --with-zlib=DIR to indicate the
    358 header file is in DIR/include/zlib.h and the library in DIR/lib/libz.a.
    359 A copy of libz may be obtained from: http://www.gzip.org/zlib/
    360 ==========================================================================
    361 ])
    362 			sleep 5
    363 		fi
    364 fi
    365 
    366 AC_ARG_WITH(pthread,
    367 [  --without-pthread       disable support for libpthread],,)
    368 
    369 if 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
    375 fi
    376 AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
    377 
    378 AC_MSG_CHECKING([for __thread])
    379 AC_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:
    386 if test -z "$HAVE_LIBPTHREAD"; then
    387 	with_tightvnc_filetransfer=""
    388 fi
    389 if test "x$with_tightvnc_filetransfer" = "xyes"; then
    390 	AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
    391 fi
    392 AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes")
    393 
    394 # websockets implemented using base64 from resolve
    395 if test "x$HAVE_B64" != "xtrue"; then
    396 	with_websockets=""
    397 fi
    398 if test "x$with_websockets" = "xyes"; then
    399 	LIBS="$LIBS $RESOLV_LIB $SSL_LIBS"
    400 	AC_DEFINE(WITH_WEBSOCKETS)
    401 fi
    402 AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes")
    403 
    404 AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H")
    405 AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H")
    406 AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H")
    407 
    408 
    409 SDLCONFIG="sdl-config"
    410 AC_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 
    420 if 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
    428 fi
    429 AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes")
    430 AC_SUBST(SDL_CFLAGS)
    431 AC_SUBST(SDL_LIBS)
    432 
    433 
    434 # Check for GTK+. if present, build the GTK+ vnc viewer example
    435 PKG_CHECK_MODULES([GTK], [gtk+-2.0],,:)
    436 AM_CONDITIONAL(HAVE_LIBGTK, test ! -z "$GTK_LIBS")
    437 
    438 AC_CANONICAL_HOST
    439 MINGW=`echo $host_os | grep mingw32  2>/dev/null`
    440 AM_CONDITIONAL(MINGW, test ! -z "$MINGW" )
    441 if test ! -z "$MINGW"; then
    442 	WSOCKLIB="-lws2_32"
    443 	LDFLAGS="$LDFLAGS -no-undefined"
    444 fi
    445 AC_SUBST(WSOCKLIB)
    446 
    447 # Check for libgcrypt
    448 AH_TEMPLATE(WITH_CLIENT_GCRYPT, [Enable support for libgcrypt in libvncclient])
    449 AC_ARG_WITH(gcrypt,
    450 [  --without-gcrypt        disable support for gcrypt],,)
    451 AC_ARG_WITH(client-gcrypt,
    452 [  --without-client-gcrypt disable support for gcrypt in libvncclient],,)
    453 
    454 if 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
    461 fi
    462 
    463 # Checks for GnuTLS
    464 AH_TEMPLATE(HAVE_GNUTLS, [GnuTLS library present])
    465 AC_ARG_WITH(gnutls,
    466 [  --without-gnutls        disable support for gnutls]
    467 [  --with-gnutls=DIR       use gnutls include/library files in DIR],,)
    468 
    469 if 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"
    473 fi
    474 AM_CONDITIONAL(HAVE_GNUTLS, test ! -z "$GNUTLS_LIBS")
    475 if test ! -z "$GNUTLS_LIBS" ; then
    476   AC_DEFINE(HAVE_GNUTLS)
    477 fi
    478 
    479 
    480 # warn if neither GnuTLS nor OpenSSL are available
    481 if test -z "$SSL_LIBS" -a -z "$GNUTLS_LIBS"; then
    482 		AC_MSG_WARN([
    483 ==========================================================================
    484 *** No encryption library could be found. ***
    485 A libvncserver/libvncclient built this way will not support SSL encryption.
    486 To enable SSL install the necessary development packages (perhaps it is named
    487 something like libssl-dev or gnutls-dev) and run configure again.
    488 ==========================================================================
    489 ])
    490 	sleep 5
    491 fi
    492 
    493 
    494 # IPv6
    495 AH_TEMPLATE(IPv6, [Enable IPv6 support])
    496 AC_ARG_WITH(ipv6,
    497 [  --without-ipv6          disable IPv6 support],,)
    498 if 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                    ]))
    509 fi
    510 
    511 
    512 
    513 # Checks for header files.
    514 AC_HEADER_STDC
    515 AC_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])
    516 
    517 # Checks for typedefs, structures, and compiler characteristics.
    518 AC_C_CONST
    519 AC_C_INLINE
    520 AC_C_BIGENDIAN
    521 AC_TYPE_SIZE_T
    522 AC_HEADER_TIME
    523 AC_HEADER_SYS_WAIT
    524 AX_TYPE_SOCKLEN_T
    525 if test ! -d ./rfb; then
    526 	echo "creating subdir ./rfb for rfbint.h"
    527 	mkdir ./rfb 
    528 fi
    529 AX_CREATE_STDINT_H(rfb/rfbint.h)
    530 AC_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         ])
    538 AH_TEMPLATE(NEED_INADDR_T, [Need a typedef for in_addr_t])
    539 if test $inaddrt = no ; then
    540   AC_DEFINE(NEED_INADDR_T)
    541 fi
    542 # Checks for library functions.
    543 AC_FUNC_MEMCMP
    544 AC_FUNC_STAT
    545 AC_FUNC_STRFTIME
    546 AC_FUNC_VPRINTF
    547 AC_FUNC_FORK
    548 AC_CHECK_LIB(nsl,gethostbyname)
    549 AC_CHECK_LIB(socket,socket)
    550 
    551 uname_s=`(uname -s) 2>/dev/null`
    552 if test "x$uname_s" = "xHP-UX"; then
    553 	# need -lsec for getspnam()
    554 	LDFLAGS="$LDFLAGS -lsec"
    555 fi
    556 
    557 AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr])
    558 
    559 # check, if shmget is in cygipc.a
    560 AC_CHECK_LIB(cygipc,shmget)
    561 AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true")
    562 
    563 # Check if /usr/include/linux exists, if so, define LINUX
    564 AM_CONDITIONAL(LINUX, test -d /usr/include/linux)
    565 
    566 # Check for OS X specific header
    567 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true")
    568 AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true")
    569 
    570 # Check for Android specific header
    571 AC_CHECK_HEADER(android/api-level.h, HAVE_ANDROID="true")
    572 AM_CONDITIONAL(ANDROID, test "$HAVE_ANDROID" = "true")
    573 if test "$HAVE_ANDROID" = "true"; then
    574 	AC_DEFINE(HAVE_ANDROID, 1, [Android host system detected])
    575 fi
    576 
    577 # On Solaris 2.7, write() returns ENOENT when it really means EAGAIN
    578 AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it])
    579 case `(uname -sr) 2>/dev/null` in
    580     "SunOS 5.7")
    581 	AC_DEFINE(ENOENT_WORKAROUND)
    582     ;;
    583 esac
    584 
    585 # Check for rpm SOURCES path
    586 printf "checking for rpm sources path... "
    587 RPMSOURCEDIR="NOT-FOUND"
    588 for 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
    592 done
    593 echo "$RPMSOURCEDIR"
    594 AM_CONDITIONAL(HAVE_RPM, test "$RPMSOURCEDIR" != "NOT-FOUND")
    595 AC_SUBST(RPMSOURCEDIR)
    596 
    597 AC_CONFIG_FILES([Makefile
    598 	libvncserver.pc
    599 	libvncclient.pc
    600 	libvncserver/Makefile
    601 	examples/Makefile
    602 	examples/android/Makefile
    603 	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])
    611 
    612 
    613 AC_CONFIG_COMMANDS([chmod-libvncserver-config],[chmod a+x libvncserver-config])
    614 AC_OUTPUT
    615 chmod a+x ./libvncserver-config
    616 
    617