Home | History | Annotate | Download | only in libvncserver
      1 # Process this file with autoconf to produce a configure script.
      2 AC_INIT(LibVNCServer, 0.9.9, http://sourceforge.net/projects/libvncserver)
      3 AM_INIT_AUTOMAKE(LibVNCServer, 0.9.9)
      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 
      8 # Checks for programs.
      9 AC_PROG_CC
     10 AM_PROG_CC_C_O
     11 if test -z "$CC"; then
     12 	CCLD="\$(CC)"
     13 else
     14 	CCLD="$CC"
     15 fi
     16 test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall"
     17 AC_PROG_MAKE_SET
     18 AC_LIBTOOL_WIN32_DLL
     19 AC_PROG_LIBTOOL
     20 AC_PATH_PROG([AR], [ar], [/usr/bin/ar],
     21                   [$PATH:/usr/ccs/bin])
     22 
     23 # Options
     24 AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol])
     25 AC_ARG_WITH(tightvnc-filetransfer,
     26 	[  --without-filetransfer  disable TightVNC file transfer protocol],
     27 	, [ with_tightvnc_filetransfer=yes ])
     28 # AC_DEFINE moved to after libpthread check.
     29 
     30 # WebSockets support
     31 AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64="true", HAVE_B64="false")
     32 AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support])
     33 AC_ARG_WITH(websockets,
     34 	[  --without-websockets    disable WebSockets support],
     35 	, [ with_websockets=yes ])
     36 # AC_DEFINE moved to after libresolve check.
     37 
     38 AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
     39 AC_ARG_WITH(24bpp,
     40 	[  --without-24bpp         disable 24 bpp framebuffers],
     41 	, [ with_24bpp=yes ])
     42 if test "x$with_24bpp" = "xyes"; then
     43 	AC_DEFINE(ALLOW24BPP)
     44 fi
     45 AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)])
     46 AC_ARG_WITH(ffmpeg,
     47 	[  --with-ffmpeg=dir       set ffmpeg home directory],,)
     48 AC_SUBST(with_ffmpeg)
     49 AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
     50 if test ! -z "$with_ffmpeg"; then
     51 	AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" )
     52 fi
     53 AM_CONDITIONAL(HAVE_MP3LAME, test "$HAVE_MP3LAME" = "true")
     54 
     55 # Seem to need this dummy here to induce the 'checking for egrep... grep -E', etc.
     56 # before it seemed to be inside the with_jpeg conditional. 
     57 AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true")
     58 
     59 # set some ld -R nonsense
     60 #
     61 uname_s=`(uname -s) 2>/dev/null`
     62 ld_minus_R="yes"
     63 if test "x$uname_s" = "xHP-UX"; then
     64 	ld_minus_R="no"
     65 elif test "x$uname_s" = "xOSF1"; then
     66 	ld_minus_R="no"
     67 elif test "x$uname_s" = "xDarwin"; then
     68 	ld_minus_R="no"
     69 fi
     70 
     71 # Check for OpenSSL
     72 AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
     73 AC_ARG_WITH(crypt,
     74 [  --without-crypt         disable support for libcrypt],,)
     75 if test "x$with_crypt" != "xno"; then
     76 	AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true")
     77 	if test -z "$HAVE_LIBC_CRYPT"; then
     78 		AC_CHECK_LIB(crypt, crypt,
     79 			CRYPT_LIBS="-lcrypt"
     80 			[AC_DEFINE(HAVE_LIBCRYPT)], ,)
     81 	fi
     82 fi
     83 AC_SUBST(CRYPT_LIBS)
     84 
     85 # some OS's need both -lssl and -lcrypto on link line:
     86 AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present])
     87 AC_ARG_WITH(crypto,
     88 [  --without-crypto        disable support for openssl libcrypto],,)
     89 
     90 AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present])
     91 AC_ARG_WITH(ssl,
     92 [  --without-ssl           disable support for openssl libssl]
     93 [  --with-ssl=DIR          use openssl include/library files in DIR],,)
     94 
     95 if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then
     96 	if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then
     97 		saved_CPPFLAGS="$CPPFLAGS"
     98 		saved_LDFLAGS="$LDFLAGS"
     99 		CPPFLAGS="$CPPFLAGS -I$with_ssl/include"
    100 		LDFLAGS="$LDFLAGS -L$with_ssl/lib"
    101 		if test "x$ld_minus_R" = "xno"; then
    102 			:
    103 		elif test "x$GCC" = "xyes"; then
    104 			LDFLAGS="$LDFLAGS -Xlinker -R$with_ssl/lib"
    105 		else
    106 			LDFLAGS="$LDFLAGS -R$with_ssl/lib"
    107 		fi
    108 	fi
    109 	AC_CHECK_LIB(crypto, RAND_file_name,
    110 		[AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,)
    111 	if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then
    112 		if test "x$HAVE_LIBCRYPTO" != "xtrue"; then
    113 			CPPFLAGS="$saved_CPPFLAGS"
    114 			LDFLAGS="$saved_LDFLAGS"
    115 		fi
    116 	fi
    117 fi
    118 
    119 AH_TEMPLATE(HAVE_X509_PRINT_EX_FP, [open ssl X509_print_ex_fp available])
    120 if test "x$with_ssl" != "xno"; then
    121 	if test "x$HAVE_LIBCRYPTO" = "xtrue"; then
    122 		AC_CHECK_LIB(ssl, SSL_library_init,
    123 			SSL_LIBS="-lssl -lcrypto"
    124 			[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,
    125 			-lcrypto)
    126 	else
    127 		AC_CHECK_LIB(ssl, SSL_library_init,
    128 			SSL_LIBS="-lssl"
    129 			[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,)
    130 	fi
    131 fi
    132 AC_SUBST(SSL_LIBS)
    133 AM_CONDITIONAL(HAVE_LIBSSL, test ! -z "$SSL_LIBS")
    134 
    135 # Checks for X libraries
    136 HAVE_X11="false"
    137 AC_PATH_XTRA
    138 AH_TEMPLATE(HAVE_X11, [X11 build environment present])
    139 
    140 # See if we are to build x11vnc:
    141 AH_TEMPLATE(HAVE_SYSTEM_LIBVNCSERVER, [Use the system libvncserver build environment for x11vnc.])
    142 AC_ARG_WITH(system-libvncserver,
    143 [  --with-system-libvncserver     use installed libvncserver for x11vnc]
    144 [  --with-system-libvncserver=DIR use libvncserver installed in DIR for x11vnc],,)
    145 AC_ARG_WITH(x11vnc,
    146 [  --with-x11vnc           configure for building the x11vnc subdir (if present)]
    147 [                          you will need to cd to x11vnc and run 'make' etc.],,)
    148 
    149 if test ! -z "$with_x11vnc" -a "$with_x11vnc" = "yes"; then
    150 	build_x11vnc="yes"
    151 elif test "$PACKAGE_NAME" = "x11vnc"; then
    152 	build_x11vnc="yes"
    153 else
    154 	build_x11vnc="no"
    155 fi
    156 	
    157 # x11vnc only:
    158 if test "$build_x11vnc" = "yes"; then
    159 
    160 AH_TEMPLATE(HAVE_XSHM, [MIT-SHM extension build environment present])
    161 AH_TEMPLATE(HAVE_XTEST, [XTEST extension build environment present])
    162 AH_TEMPLATE(HAVE_XTESTGRABCONTROL, [XTEST extension has XTestGrabControl])
    163 AH_TEMPLATE(HAVE_XKEYBOARD, [XKEYBOARD extension build environment present])
    164 AH_TEMPLATE(HAVE_LIBXINERAMA, [XINERAMA extension build environment present])
    165 AH_TEMPLATE(HAVE_LIBXRANDR, [XRANDR extension build environment present])
    166 AH_TEMPLATE(HAVE_LIBXFIXES, [XFIXES extension build environment present])
    167 AH_TEMPLATE(HAVE_LIBXDAMAGE, [XDAMAGE extension build environment present])
    168 AH_TEMPLATE(HAVE_LIBXTRAP, [DEC-XTRAP extension build environment present])
    169 AH_TEMPLATE(HAVE_RECORD, [RECORD extension build environment present])
    170 AH_TEMPLATE(HAVE_SOLARIS_XREADSCREEN, [Solaris XReadScreen available])
    171 AH_TEMPLATE(HAVE_IRIX_XREADDISPLAY, [IRIX XReadDisplay available])
    172 AH_TEMPLATE(HAVE_FBPM, [FBPM extension build environment present])
    173 AH_TEMPLATE(HAVE_DPMS, [DPMS extension build environment present])
    174 AH_TEMPLATE(HAVE_LINUX_VIDEODEV_H, [video4linux build environment present])
    175 AH_TEMPLATE(HAVE_LINUX_FB_H, [linux fb device build environment present])
    176 AH_TEMPLATE(HAVE_LINUX_INPUT_H, [linux/input.h present])
    177 AH_TEMPLATE(HAVE_LINUX_UINPUT_H, [linux uinput device build environment present])
    178 AH_TEMPLATE(HAVE_MACOSX_NATIVE_DISPLAY, [build MacOS X native display support])
    179 AH_TEMPLATE(HAVE_MACOSX_OPENGL_H, [MacOS X OpenGL present])
    180 
    181 AC_ARG_WITH(xkeyboard,
    182 [  --without-xkeyboard     disable xkeyboard extension support],,)
    183 AC_ARG_WITH(xinerama,
    184 [  --without-xinerama      disable xinerama extension support],,)
    185 AC_ARG_WITH(xrandr,
    186 [  --without-xrandr        disable xrandr extension support],,)
    187 AC_ARG_WITH(xfixes,
    188 [  --without-xfixes        disable xfixes extension support],,)
    189 AC_ARG_WITH(xdamage,
    190 [  --without-xdamage       disable xdamage extension support],,)
    191 AC_ARG_WITH(xtrap,
    192 [  --without-xtrap         disable xtrap extension support],,)
    193 AC_ARG_WITH(xrecord,
    194 [  --without-xrecord       disable xrecord extension support],,)
    195 AC_ARG_WITH(fbpm,
    196 [  --without-fbpm          disable fbpm extension support],,)
    197 AC_ARG_WITH(dpms,
    198 [  --without-dpms          disable dpms extension support],,)
    199 AC_ARG_WITH(v4l,
    200 [  --without-v4l           disable video4linux support],,)
    201 AC_ARG_WITH(fbdev,
    202 [  --without-fbdev         disable linux fb device support],,)
    203 AC_ARG_WITH(uinput,
    204 [  --without-uinput        disable linux uinput device support],,)
    205 AC_ARG_WITH(macosx-native,
    206 [  --without-macosx-native disable MacOS X native display support],,)
    207 
    208 fi
    209 # end x11vnc only.
    210 
    211 if test "x$with_x" = "xno"; then
    212 	HAVE_X11="false"
    213 elif test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
    214 	AC_CHECK_LIB(X11, XGetImage, [AC_DEFINE(HAVE_X11) HAVE_X11="true"],
    215 		HAVE_X11="false",
    216 		$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    217 
    218 	# x11vnc only:
    219 	if test $HAVE_X11 = "true" -a "$build_x11vnc" = "yes"; then
    220 		X_PRELIBS="$X_PRELIBS -lXext"
    221 
    222 		AC_CHECK_LIB(Xext, XShmGetImage, 
    223 			[AC_DEFINE(HAVE_XSHM)], ,
    224 			$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    225 
    226 		AC_CHECK_LIB(Xext, XReadScreen, 
    227 			[AC_DEFINE(HAVE_SOLARIS_XREADSCREEN)], ,
    228 			$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    229 
    230 		AC_CHECK_HEADER(X11/extensions/readdisplay.h,
    231 			[AC_DEFINE(HAVE_IRIX_XREADDISPLAY)], ,
    232 			[#include <X11/Xlib.h>])
    233 
    234 		if test "x$with_fbpm" != "xno"; then
    235 			AC_CHECK_LIB(Xext, FBPMForceLevel, 
    236 				[AC_DEFINE(HAVE_FBPM)], ,
    237 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    238 		fi
    239 
    240 		if test "x$with_dpms" != "xno"; then
    241 			AC_CHECK_LIB(Xext, DPMSForceLevel, 
    242 				[AC_DEFINE(HAVE_DPMS)], ,
    243 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    244 		fi
    245 
    246 		AC_CHECK_LIB(Xtst, XTestGrabControl, 
    247 			X_PRELIBS="-lXtst $X_PRELIBS"
    248 			[AC_DEFINE(HAVE_XTESTGRABCONTROL) HAVE_XTESTGRABCONTROL="true"], ,
    249 			$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    250 
    251 		AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, 
    252 			X_PRELIBS="-lXtst $X_PRELIBS"
    253 			[AC_DEFINE(HAVE_XTEST) HAVE_XTEST="true"], ,
    254 			$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    255 
    256 		if test "x$with_xrecord" != "xno"; then
    257 			AC_CHECK_LIB(Xtst, XRecordEnableContextAsync, 
    258 				X_PRELIBS="-lXtst $X_PRELIBS"
    259 				[AC_DEFINE(HAVE_RECORD)], ,
    260 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    261 		fi
    262 
    263 		# we use XTRAP on X11R5, or user can set X11VNC_USE_XTRAP
    264 		if test "x$with_xtrap" != "xno"; then
    265 		    if test ! -z "$X11VNC_USE_XTRAP" -o -z "$HAVE_XTESTGRABCONTROL"; then
    266 			AC_CHECK_LIB(XTrap, XETrapSetGrabServer, 
    267 				X_PRELIBS="$X_PRELIBS -lXTrap"
    268 				[AC_DEFINE(HAVE_LIBXTRAP)], ,
    269 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    270 			# tru64 uses libXETrap.so
    271 			AC_CHECK_LIB(XETrap, XETrapSetGrabServer, 
    272 				X_PRELIBS="$X_PRELIBS -lXETrap"
    273 				[AC_DEFINE(HAVE_LIBXTRAP)], ,
    274 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    275 		    fi
    276 		fi
    277 
    278 		if test "x$with_xkeyboard" != "xno"; then
    279 			saved_CPPFLAGS="$CPPFLAGS"
    280 			CPPFLAGS="$CPPFLAGS $X_CFLAGS"
    281 			AC_CHECK_HEADER(X11/XKBlib.h, HAVE_XKBLIB_H="true",
    282 				HAVE_XKBLIB_H="false", [#include <X11/Xlib.h>])
    283 			CPPFLAGS="$saved_CPPFLAGS"
    284 			if test $HAVE_XKBLIB_H = "true"; then
    285 				AC_CHECK_LIB(X11, XkbSelectEvents,
    286 					[AC_DEFINE(HAVE_XKEYBOARD)], ,
    287 					$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    288 			fi
    289 		fi
    290 
    291 		if test "x$with_xinerama" != "xno"; then
    292 			AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
    293 				X_PRELIBS="$X_PRELIBS -lXinerama"
    294 				[AC_DEFINE(HAVE_LIBXINERAMA)], ,
    295 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    296 		fi
    297 
    298 		if test "x$with_xrandr" != "xno"; then
    299 			AC_CHECK_LIB(Xrandr, XRRSelectInput,
    300 				X_PRELIBS="$X_PRELIBS -lXrandr"
    301 				[AC_DEFINE(HAVE_LIBXRANDR) HAVE_LIBXRANDR="true"], ,
    302 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    303 		fi
    304 
    305 		if test "x$with_xfixes" != "xno"; then
    306 			AC_CHECK_LIB(Xfixes, XFixesGetCursorImage,
    307 				X_PRELIBS="$X_PRELIBS -lXfixes"
    308 				[AC_DEFINE(HAVE_LIBXFIXES) HAVE_LIBXFIXES="true"], ,
    309 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    310 		fi
    311 
    312 		if test "x$with_xdamage" != "xno"; then
    313 			AC_CHECK_LIB(Xdamage, XDamageQueryExtension,
    314 				X_PRELIBS="$X_PRELIBS -lXdamage"
    315 				[AC_DEFINE(HAVE_LIBXDAMAGE) HAVE_LIBXDAMAGE="true"], ,
    316 				$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
    317 		fi
    318 
    319 		if test ! -z "$HAVE_LIBXFIXES" -o ! -z "$HAVE_LIBXDAMAGE"; then
    320 			# need /usr/sfw/lib in RPATH for Solaris 10 and later
    321 			case `(uname -sr) 2>/dev/null` in
    322 			"SunOS 5"*) X_EXTRA_LIBS="$X_EXTRA_LIBS -R/usr/sfw/lib" ;;
    323 			esac
    324 		fi
    325 		if test ! -z "$HAVE_LIBXRANDR"; then
    326 			# also need /usr/X11/include for Solaris 10 10/08 and later
    327 			case `(uname -sr) 2>/dev/null` in
    328 			"SunOS 5"*) CPPFLAGS="$CPPFLAGS -I/usr/X11/include" ;;
    329 			esac
    330 		fi
    331 
    332 		X_LIBS="$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS"
    333 	fi
    334 	# end x11vnc only.
    335 fi
    336 
    337 AC_SUBST(X_LIBS)
    338 AM_CONDITIONAL(HAVE_X11, test $HAVE_X11 != "false")
    339 
    340 # x11vnc only:
    341 if test "$build_x11vnc" = "yes"; then
    342 
    343 if test "x$HAVE_X11" = "xfalse" -a "x$with_x" != "xno"; then
    344 	AC_MSG_ERROR([
    345 ==========================================================================
    346 *** A working X window system build environment is required to build ***
    347 x11vnc.  Make sure any required X development packages are installed.
    348 If they are installed in non-standard locations, one can use the
    349 --x-includes=DIR and --x-libraries=DIR configure options or set the
    350 CPPFLAGS and LDFLAGS environment variables to indicate where the X
    351 window system header files and libraries may be found.  On 64+32 bit
    352 machines you may need to point to lib64 or lib32 directories to pick up
    353 the correct word size.
    354 
    355 If you want to build x11vnc without X support (e.g. for -rawfb use only
    356 or for native Mac OS X), specify the --without-x configure option.
    357 ==========================================================================
    358 ])
    359 fi
    360 
    361 if test "x$HAVE_X11" = "xtrue" -a "x$HAVE_XTEST" != "xtrue"; then
    362 	AC_MSG_WARN([
    363 ==========================================================================
    364 *** A working build environment for the XTEST extension was not found ***
    365 (libXtst).  An x11vnc built this way will be *ONLY BARELY USABLE*.
    366 You will be able to move the mouse but not click or type.  There can
    367 also be deadlocks if an application grabs the X server.
    368 
    369 It is recommended that you install the necessary development packages
    370 for XTEST (perhaps it is named something like libxtst-dev) and run
    371 configure again.
    372 ==========================================================================
    373 ])
    374 	sleep 5
    375 fi
    376 
    377 if test "x$with_v4l" != "xno"; then
    378 	AC_CHECK_HEADER(linux/videodev.h,
    379 		[AC_DEFINE(HAVE_LINUX_VIDEODEV_H)],,)
    380 fi
    381 if test "x$with_fbdev" != "xno"; then
    382 	AC_CHECK_HEADER(linux/fb.h,
    383 		[AC_DEFINE(HAVE_LINUX_FB_H)],,)
    384 fi
    385 if test "x$with_uinput" != "xno"; then
    386 	AC_CHECK_HEADER(linux/input.h,
    387 		[AC_DEFINE(HAVE_LINUX_INPUT_H) HAVE_LINUX_INPUT_H="true"],,)
    388 	if test "x$HAVE_LINUX_INPUT_H" = "xtrue"; then
    389 		AC_CHECK_HEADER(linux/uinput.h,
    390 			[AC_DEFINE(HAVE_LINUX_UINPUT_H)],, [#include <linux/input.h>])
    391 	fi
    392 fi
    393 
    394 if test "x$with_macosx_native" != "xno"; then
    395 	AC_DEFINE(HAVE_MACOSX_NATIVE_DISPLAY)
    396 fi
    397 
    398 # Check for OS X opengl header
    399 AC_CHECK_HEADER(OpenGL/OpenGL.h,
    400 	[AC_DEFINE(HAVE_MACOSX_OPENGL_H) HAVE_MACOSX_OPENGL_H="true"],,)
    401 
    402 AH_TEMPLATE(HAVE_AVAHI, [Avahi/mDNS client build environment present])
    403 AC_ARG_WITH(avahi,
    404 [  --without-avahi         disable support for Avahi/mDNS]
    405 [  --with-avahi=DIR        use avahi include/library files in DIR],,)
    406 if test "x$with_avahi" != "xno"; then
    407 	printf "checking for avahi... "
    408 	if test ! -z "$with_avahi" -a "x$with_avahi" != "xyes"; then
    409 		AVAHI_CFLAGS="-I$with_avahi/include"
    410 		AVAHI_LIBS="-L$with_avahi/lib -lavahi-common -lavahi-client"
    411 		echo "using $with_avahi"
    412 		with_avahi=yes
    413 	elif pkg-config --atleast-version=0.6.4 avahi-client >/dev/null 2>&1; then
    414 		AVAHI_CFLAGS=`pkg-config --cflags avahi-client`
    415 		AVAHI_LIBS=`pkg-config --libs avahi-client`
    416 		with_avahi=yes
    417 		echo yes
    418 	else
    419 		with_avahi=no
    420 		echo no
    421 	fi
    422 fi
    423 if test "x$with_avahi" = "xyes"; then
    424 	AC_DEFINE(HAVE_AVAHI)
    425 	AC_SUBST(AVAHI_CFLAGS)
    426 	AC_SUBST(AVAHI_LIBS)
    427 fi
    428 
    429 fi
    430 # end x11vnc only.
    431 
    432 # only used in x11vnc/Makefile.am but needs to always be defined:
    433 AM_CONDITIONAL(OSX_OPENGL, test "$HAVE_MACOSX_OPENGL_H" = "true")
    434 
    435 # Checks for libraries.
    436 
    437 if test ! -z "$with_system_libvncserver" -a "x$with_system_libvncserver" != "xno"; then
    438 	printf "checking for system libvncserver... "
    439 	vneed="0.9.1"
    440 	if test "X$VNEED" != "X"; then
    441 		vneed=$VNEED
    442 	fi
    443 	if test "x$with_system_libvncserver" != "xyes"; then
    444 		rflag=""
    445 		if test "x$ld_minus_R" = "xno"; then
    446 			:
    447 		elif test "x$GCC" = "xyes"; then
    448 			rflag="-Xlinker -R$with_system_libvncserver/lib"
    449 		else
    450 			rflag="-R$with_system_libvncserver/lib"
    451 		fi
    452 		cmd="$with_system_libvncserver/bin/libvncserver-config"
    453 		if $cmd --version 1>/dev/null 2>&1; then
    454 			cvers=`$cmd --version 2>/dev/null`
    455 			cscore=`echo "$cvers" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
    456 			nscore=`echo "$vneed" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
    457 
    458 			if test $cscore -lt $nscore; then
    459 				echo "no"
    460 				with_system_libvncserver=no
    461 				AC_MSG_ERROR([
    462 ==========================================================================
    463 *** Need libvncserver version $vneed, have version $cvers ***
    464 You are building with a system installed libvncserver and it is not
    465 new enough.
    466 ==========================================================================
    467 ])
    468 			else
    469 				SYSTEM_LIBVNCSERVER_CFLAGS="-I$with_system_libvncserver/include"
    470 				SYSTEM_LIBVNCSERVER_LIBS="-L$with_system_libvncserver/lib $rflag -lvncserver -lvncclient"
    471 				echo "using $with_system_libvncserver"
    472 				with_system_libvncserver=yes
    473 			fi
    474 		else
    475 			echo " *** cannot run $cmd *** " 1>&2
    476 			with_system_libvncserver=no
    477 			echo no
    478 		fi
    479 	elif libvncserver-config --version 1>/dev/null 2>&1; then
    480 		rflag=""
    481 		rprefix=`libvncserver-config --prefix`
    482 		if test "x$ld_minus_R" = "xno"; then
    483 			:
    484 		elif test "x$GCC" = "xyes"; then
    485 			rflag=" -Xlinker -R$rprefix/lib "
    486 		else
    487 			rflag=" -R$rprefix/lib "
    488 		fi
    489 		cvers=`libvncserver-config --version 2>/dev/null`
    490 		cscore=`echo "$cvers" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
    491 		nscore=`echo "$vneed" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
    492 
    493 		if test $cscore -lt $nscore; then
    494 			echo "no"
    495 				AC_MSG_ERROR([
    496 ==========================================================================
    497 *** Need libvncserver version $vneed, have version $cvers ***
    498 You are building with a system installed libvncserver and it is not
    499 new enough.
    500 ==========================================================================
    501 ])
    502 		else
    503 			SYSTEM_LIBVNCSERVER_CFLAGS=`libvncserver-config --cflags`
    504 			SYSTEM_LIBVNCSERVER_LIBS="$rflag"`libvncserver-config --libs`
    505 			with_system_libvncserver=yes
    506 			echo yes
    507 		fi
    508 	else
    509 		with_system_libvncserver=no
    510 		echo no
    511 	fi
    512 fi
    513 
    514 if test "x$with_system_libvncserver" = "xyes"; then
    515 	AC_DEFINE(HAVE_SYSTEM_LIBVNCSERVER)
    516 	AC_SUBST(SYSTEM_LIBVNCSERVER_CFLAGS)
    517 	AC_SUBST(SYSTEM_LIBVNCSERVER_LIBS)
    518 fi
    519 AM_CONDITIONAL(HAVE_SYSTEM_LIBVNCSERVER, test "x$with_system_libvncserver" = "xyes")
    520 
    521 
    522 AC_ARG_WITH(jpeg,
    523 [  --without-jpeg          disable support for jpeg]
    524 [  --with-jpeg=DIR         use jpeg include/library files in DIR],,)
    525 
    526 # At this point:
    527 #	no jpeg on command line   with_jpeg=""
    528 #	-with-jpeg                with_jpeg="yes"
    529 #	-without-jpeg             with_jpeg="no"
    530 #	-with-jpeg=/foo/dir       with_jpeg="/foo/dir"
    531 
    532 HAVE_LIBJPEG_TURBO="false"
    533 
    534 if test "x$with_jpeg" != "xno"; then
    535 	AC_ARG_VAR(JPEG_LDFLAGS,
    536 		[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.])
    537 	saved_CPPFLAGS="$CPPFLAGS"
    538 	saved_LDFLAGS="$LDFLAGS"
    539 	saved_LIBS="$LIBS"
    540 	if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then
    541 		# add user supplied directory to flags:
    542 		CPPFLAGS="$CPPFLAGS -I$with_jpeg/include"
    543 		LDFLAGS="$LDFLAGS -L$with_jpeg/lib"
    544 		if test "x$ld_minus_R" = "xno"; then
    545 			:
    546 		elif test "x$GCC" = "xyes"; then
    547 			# this is not complete... in general a rat's nest.
    548 			LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib"
    549 		else
    550 			LDFLAGS="$LDFLAGS -R$with_jpeg/lib"
    551 		fi
    552 	fi
    553 	if test "x$JPEG_LDFLAGS" != "x"; then
    554 		LDFLAGS="$saved_LDFLAGS"
    555 		LIBS="$LIBS $JPEG_LDFLAGS"
    556 	else
    557 		LIBS="-ljpeg"
    558 	fi
    559 	AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true")
    560 	AC_MSG_CHECKING(for jpeg_CreateCompress in libjpeg)
    561 	if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
    562 		AC_LINK_IFELSE([AC_LANG_CALL([], [jpeg_CreateCompress])],
    563 			[AC_MSG_RESULT(yes);
    564 				AC_DEFINE(HAVE_LIBJPEG, 1, libjpeg support enabled)],
    565 			[AC_MSG_RESULT(no); HAVE_JPEGLIB_H=""])
    566 	fi
    567 	if test "x$HAVE_JPEGLIB_H" != "xtrue"; then
    568 			# restore old flags on failure:
    569 			CPPFLAGS="$saved_CPPFLAGS"
    570 			LDFLAGS="$saved_LDFLAGS"
    571 			LIBS="$saved_LIBS"
    572 			AC_MSG_WARN([
    573 ==========================================================================
    574 *** The libjpeg compression library was not found. ***
    575 This may lead to reduced performance, especially over slow links.
    576 If libjpeg is in a non-standard location use --with-jpeg=DIR to
    577 indicate the header file is in DIR/include/jpeglib.h and the library
    578 in DIR/lib/libjpeg.a.  You can also set the JPEG_LDFLAGS variable to
    579 specify more detailed linker flags.  A copy of libjpeg-turbo may be
    580 obtained from:  https://sourceforge.net/projects/libjpeg-turbo/files/
    581 A copy of libjpeg may be obtained from:  http://ijg.org/files/
    582 ==========================================================================
    583 ])
    584 			sleep 5
    585 		fi
    586 
    587 	if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
    588 		AC_MSG_CHECKING(whether JPEG library is libjpeg-turbo)
    589 		m4_define([LJT_TEST],
    590 			[AC_LANG_PROGRAM([#include <stdio.h>
    591 				#include <jpeglib.h>],
    592 			[struct jpeg_compress_struct cinfo;
    593 				struct jpeg_error_mgr jerr;
    594 				cinfo.err=jpeg_std_error(&jerr);
    595 				jpeg_create_compress(&cinfo);
    596 				cinfo.input_components = 3;
    597 				jpeg_set_defaults(&cinfo);
    598 				cinfo.in_color_space = JCS_EXT_RGB;
    599 				jpeg_default_colorspace(&cinfo);
    600 				return 0;])]
    601 		)
    602 		if test "x$cross_compiling" != "xyes"; then
    603 			AC_RUN_IFELSE([LJT_TEST],
    604 				[HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
    605 				[AC_MSG_RESULT(no)])
    606 		else
    607 			AC_LINK_IFELSE([LJT_TEST],
    608 				[HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
    609 				[AC_MSG_RESULT(no)])
    610 		fi
    611 	fi
    612 
    613 	if test "x$HAVE_JPEGLIB_H" = "xtrue" -a "x$HAVE_LIBJPEG_TURBO" != "xtrue"; then
    614 		AC_MSG_WARN([
    615 ==========================================================================
    616 *** The libjpeg library you are building against is not libjpeg-turbo.
    617 Performance will be reduced.  You can obtain libjpeg-turbo from:
    618 https://sourceforge.net/projects/libjpeg-turbo/files/ ***
    619 ==========================================================================
    620 ])
    621   fi
    622 
    623 fi
    624 
    625 AC_ARG_WITH(png,
    626 [  --without-png           disable support for png]
    627 [  --with-png=DIR          use png include/library files in DIR],,)
    628 
    629 # At this point:
    630 #	no png on command line    with_png=""
    631 #	-with-png                 with_png="yes"
    632 #	-without-png              with_png="no"
    633 #	-with-png=/foo/dir        with_png="/foo/dir"
    634 
    635 if test "x$with_png" != "xno"; then
    636 	if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
    637 		# add user supplied directory to flags:
    638 		saved_CPPFLAGS="$CPPFLAGS"
    639 		saved_LDFLAGS="$LDFLAGS"
    640 		CPPFLAGS="$CPPFLAGS -I$with_png/include"
    641 		LDFLAGS="$LDFLAGS -L$with_png/lib"
    642 		if test "x$ld_minus_R" = "xno"; then
    643 			:
    644 		elif test "x$GCC" = "xyes"; then
    645 			# this is not complete... in general a rat's nest.
    646 			LDFLAGS="$LDFLAGS -Xlinker -R$with_png/lib"
    647 		else
    648 			LDFLAGS="$LDFLAGS -R$with_png/lib"
    649 		fi
    650 	fi
    651 	AC_CHECK_HEADER(png.h, HAVE_PNGLIB_H="true")
    652 	if test "x$HAVE_PNGLIB_H" = "xtrue"; then
    653 		AC_CHECK_LIB(png, png_create_write_struct, , HAVE_PNGLIB_H="")
    654 	fi
    655 	if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
    656 		if test "x$HAVE_PNGLIB_H" != "xtrue"; then
    657 			# restore old flags on failure:
    658 			CPPFLAGS="$saved_CPPFLAGS"
    659 			LDFLAGS="$saved_LDFLAGS"
    660 		fi
    661 	fi
    662 	if test "$build_x11vnc" = "yes"; then
    663 		if test "x$HAVE_PNGLIB_H" != "xtrue"; then
    664 			AC_MSG_WARN([
    665 ==========================================================================
    666 *** The libpng compression library was not found. ***
    667 This may lead to reduced performance, especially over slow links.
    668 If libpng is in a non-standard location use --with-png=DIR to
    669 indicate the header file is in DIR/include/png.h and the library
    670 in DIR/lib/libpng.a.  A copy of libpng may be obtained from:
    671 http://www.libpng.org/pub/png/libpng.html
    672 ==========================================================================
    673 ])
    674 			sleep 5
    675 		fi
    676 	fi
    677 fi
    678 
    679 AC_ARG_WITH(libz,
    680 [  --without-libz          disable support for deflate],,)
    681 AC_ARG_WITH(zlib,
    682 [  --without-zlib          disable support for deflate]
    683 [  --with-zlib=DIR         use zlib include/library files in DIR],,)
    684 
    685 if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then
    686 	if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then
    687 		saved_CPPFLAGS="$CPPFLAGS"
    688 		saved_LDFLAGS="$LDFLAGS"
    689 		CPPFLAGS="$CPPFLAGS -I$with_zlib/include"
    690 		LDFLAGS="$LDFLAGS -L$with_zlib/lib"
    691 		if test "x$ld_minus_R" = "xno"; then
    692 			:
    693 		elif test "x$GCC" = "xyes"; then
    694 			LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib"
    695 		else
    696 			LDFLAGS="$LDFLAGS -R$with_zlib/lib"
    697 		fi
    698 	fi
    699 	AC_CHECK_HEADER(zlib.h, HAVE_ZLIB_H="true")
    700 	if test "x$HAVE_ZLIB_H" = "xtrue"; then
    701 		AC_CHECK_LIB(z, deflate, , HAVE_ZLIB_H="")
    702 	fi
    703 	if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then
    704 		if test "x$HAVE_ZLIB_H" != "xtrue"; then
    705 			CPPFLAGS="$saved_CPPFLAGS"
    706 			LDFLAGS="$saved_LDFLAGS"
    707 		fi
    708 	fi
    709 	if test "$build_x11vnc" = "yes"; then
    710 		if test "x$HAVE_ZLIB_H" != "xtrue"; then
    711 			AC_MSG_WARN([
    712 ==========================================================================
    713 *** The libz compression library was not found. ***
    714 This may lead to reduced performance, especially over slow links.
    715 If libz is in a non-standard location use --with-zlib=DIR to indicate the
    716 header file is in DIR/include/zlib.h and the library in DIR/lib/libz.a.
    717 A copy of libz may be obtained from: http://www.gzip.org/zlib/
    718 ==========================================================================
    719 ])
    720 			sleep 5
    721 		fi
    722 	fi
    723 fi
    724 
    725 AC_ARG_WITH(pthread,
    726 [  --without-pthread       disable support for libpthread],,)
    727 
    728 if test "x$with_pthread" != "xno"; then
    729 	AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true")
    730 	if test ! -z "$HAVE_PTHREAD_H"; then
    731 		AC_CHECK_LIB(pthread, pthread_mutex_lock)
    732 		AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
    733 	fi
    734 fi
    735 AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
    736 
    737 AC_MSG_CHECKING([for __thread])
    738 AC_LINK_IFELSE([AC_LANG_PROGRAM(, [static __thread int p = 0])],
    739 	       [AC_DEFINE(HAVE_TLS, 1,
    740 		      Define to 1 if compiler supports __thread)
    741 		AC_MSG_RESULT([yes])],
    742 	       [AC_MSG_RESULT([no])])
    743 
    744 # tightvnc-filetransfer implemented using threads:
    745 if test -z "$HAVE_LIBPTHREAD"; then
    746 	with_tightvnc_filetransfer=""
    747 fi
    748 if test "x$with_tightvnc_filetransfer" = "xyes"; then
    749 	AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
    750 fi
    751 AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes")
    752 
    753 # websockets implemented using base64 from resolve
    754 if test "x$HAVE_B64" != "xtrue"; then
    755 	with_websockets=""
    756 fi
    757 if test "x$with_websockets" = "xyes"; then
    758 	LIBS="$LIBS -lresolv $SSL_LIBS"
    759 	AC_DEFINE(WITH_WEBSOCKETS)
    760 fi
    761 AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes")
    762 
    763 AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H")
    764 AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H")
    765 AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H")
    766 
    767 
    768 SDLCONFIG="sdl-config"
    769 AC_ARG_WITH(sdl-config,
    770 [[  --with-sdl-config=FILE
    771     Use the given path to sdl-config when determining
    772     SDL configuration; defaults to "sdl-config"]],
    773 [
    774     if test "$withval" != "yes" -a "$withval" != ""; then
    775         SDLCONFIG=$withval
    776     fi
    777 ])
    778 
    779 if test -z "$with_sdl"; then
    780 	if $SDLCONFIG --version >/dev/null 2>&1; then
    781 		with_sdl=yes
    782 		SDL_CFLAGS=`$SDLCONFIG --cflags`
    783 		SDL_LIBS=`$SDLCONFIG --libs`
    784 	else
    785 		with_sdl=no
    786 	fi
    787 fi
    788 AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes")
    789 AC_SUBST(SDL_CFLAGS)
    790 AC_SUBST(SDL_LIBS)
    791 
    792 
    793 # Check for GTK+. if present, build the GTK+ vnc viewer example
    794 PKG_CHECK_MODULES([GTK], [gtk+-2.0],,:)
    795 AM_CONDITIONAL(HAVE_LIBGTK, test ! -z "$GTK_LIBS")
    796 
    797 AC_CANONICAL_HOST
    798 MINGW=`echo $host_os | grep mingw32  2>/dev/null`
    799 AM_CONDITIONAL(MINGW, test ! -z "$MINGW" )
    800 if test ! -z "$MINGW"; then
    801 	WSOCKLIB="-lws2_32"
    802 	LDFLAGS="$LDFLAGS -no-undefined"
    803 fi
    804 AC_SUBST(WSOCKLIB)
    805 
    806 # Check for libgcrypt
    807 AH_TEMPLATE(WITH_CLIENT_GCRYPT, [Enable support for libgcrypt in libvncclient])
    808 AC_ARG_WITH(gcrypt,
    809 [  --without-gcrypt        disable support for gcrypt],,)
    810 AC_ARG_WITH(client-gcrypt,
    811 [  --without-client-gcrypt disable support for gcrypt in libvncclient],,)
    812 
    813 if test "x$with_gcrypt" != "xno"; then
    814 	AM_PATH_LIBGCRYPT(1.4.0, , with_client_gcrypt=no)
    815 	CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
    816 	LIBS="$LIBS $LIBGCRYPT_LIBS"
    817 	if test "x$with_client_gcrypt" != "xno"; then
    818 		AC_DEFINE(WITH_CLIENT_GCRYPT)
    819 	fi
    820 fi
    821 
    822 # Checks for GnuTLS
    823 AH_TEMPLATE(HAVE_GNUTLS, [GnuTLS library present])
    824 AC_ARG_WITH(gnutls,
    825 [  --without-gnutls        disable support for gnutls]
    826 [  --with-gnutls=DIR       use gnutls include/library files in DIR],,)
    827 
    828 if test "x$with_gnutls" != "xno"; then
    829 	PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.4.0,,:)
    830 	CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
    831 	LIBS="$LIBS $GNUTLS_LIBS"
    832 fi
    833 AM_CONDITIONAL(HAVE_GNUTLS, test ! -z "$GNUTLS_LIBS")
    834 if test ! -z "$GNUTLS_LIBS" ; then
    835   AC_DEFINE(HAVE_GNUTLS)
    836 fi
    837 
    838 
    839 # warn if neither GnuTLS nor OpenSSL are available
    840 if test -z "$SSL_LIBS" -a -z "$GNUTLS_LIBS"; then
    841 		AC_MSG_WARN([
    842 ==========================================================================
    843 *** No encryption library could be found. ***
    844 A libvncserver/libvncclient built this way will not support SSL encryption.
    845 To enable SSL install the necessary development packages (perhaps it is named
    846 something like libssl-dev or gnutls-dev) and run configure again.
    847 ==========================================================================
    848 ])
    849 	sleep 5
    850 fi
    851 
    852 
    853 # IPv6
    854 AH_TEMPLATE(IPv6, [Enable IPv6 support])
    855 AC_ARG_WITH(ipv6,
    856 [  --without-ipv6          disable IPv6 support],,)
    857 if test "x$with_ipv6" != "xno"; then
    858 	AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(IPv6,1),
    859 		AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(IPv6,1), [
    860 			AC_MSG_CHECKING([for getaddrinfo in -lws2_32])
    861 		        LIBS="$LIBS -lws2_32"
    862 		        AC_TRY_LINK([#include <ws2tcpip.h>], [getaddrinfo(0, 0, 0, 0);], [
    863 				      AC_DEFINE(IPv6,1)
    864 		                      AC_MSG_RESULT([yes])
    865 				      ],
    866 				    AC_MSG_RESULT([no]))
    867                    ]))
    868 fi
    869 
    870 
    871 
    872 # Checks for header files.
    873 AC_HEADER_STDC
    874 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h ws2tcpip.h])
    875 
    876 # x11vnc only:
    877 if test "$build_x11vnc" = "yes"; then
    878 	AC_CHECK_HEADERS([pwd.h sys/wait.h utmpx.h termios.h sys/ioctl.h sys/stropts.h])
    879 fi
    880 
    881 # Checks for typedefs, structures, and compiler characteristics.
    882 AC_C_CONST
    883 AC_C_INLINE
    884 AC_C_BIGENDIAN
    885 AC_TYPE_SIZE_T
    886 AC_HEADER_TIME
    887 AC_HEADER_SYS_WAIT
    888 AC_TYPE_SOCKLEN_T
    889 if test ! -d ./rfb; then
    890 	echo "creating subdir ./rfb for rfbint.h"
    891 	mkdir ./rfb 
    892 fi
    893 AC_CREATE_STDINT_H(rfb/rfbint.h)
    894 AC_CACHE_CHECK([for in_addr_t],
    895         vnc_cv_inaddrt, [
    896                 AC_TRY_COMPILE([#include <sys/types.h>
    897 #include <netinet/in.h>],
    898                         [in_addr_t foo; return 0;],
    899                                         [inaddrt=yes],
    900                                         [inaddrt=no]),
    901         ])
    902 AH_TEMPLATE(NEED_INADDR_T, [Need a typedef for in_addr_t])
    903 if test $inaddrt = no ; then
    904   AC_DEFINE(NEED_INADDR_T)
    905 fi
    906 # Checks for library functions.
    907 AC_FUNC_MEMCMP
    908 AC_FUNC_STAT
    909 AC_FUNC_STRFTIME
    910 AC_FUNC_VPRINTF
    911 AC_FUNC_FORK
    912 AC_CHECK_LIB(nsl,gethostbyname)
    913 AC_CHECK_LIB(socket,socket)
    914 
    915 uname_s=`(uname -s) 2>/dev/null`
    916 if test "x$uname_s" = "xHP-UX"; then
    917 	# need -lsec for getspnam()
    918 	LDFLAGS="$LDFLAGS -lsec"
    919 fi
    920 
    921 AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr])
    922 # x11vnc only:
    923 if test "$build_x11vnc" = "yes"; then
    924 	AC_CHECK_FUNCS([setsid setpgrp getpwuid getpwnam getspnam getuid geteuid setuid setgid seteuid setegid initgroups waitpid setutxent grantpt shmat])
    925 fi
    926 
    927 # check, if shmget is in cygipc.a
    928 AC_CHECK_LIB(cygipc,shmget)
    929 AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true")
    930 
    931 # Check if /usr/include/linux exists, if so, define LINUX
    932 AM_CONDITIONAL(LINUX, test -d /usr/include/linux)
    933 
    934 # Check for OS X specific header
    935 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true")
    936 AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true")
    937 
    938 # Check for Android specific header
    939 AC_CHECK_HEADER(android/api-level.h, HAVE_ANDROID="true")
    940 AM_CONDITIONAL(ANDROID, test "$HAVE_ANDROID" = "true")
    941 if test "$HAVE_ANDROID" = "true"; then
    942 	AC_DEFINE(HAVE_ANDROID, 1, [Android host system detected])
    943 fi
    944 
    945 # On Solaris 2.7, write() returns ENOENT when it really means EAGAIN
    946 AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it])
    947 case `(uname -sr) 2>/dev/null` in
    948     "SunOS 5.7")
    949 	AC_DEFINE(ENOENT_WORKAROUND)
    950     ;;
    951 esac
    952 
    953 # Check for rpm SOURCES path
    954 printf "checking for rpm sources path... "
    955 RPMSOURCEDIR="NOT-FOUND"
    956 for directory in packages OpenLinux redhat RedHat rpm RPM "" ; do
    957 	if test -d /usr/src/${directory}/SOURCES; then
    958 		RPMSOURCEDIR="/usr/src/${directory}/SOURCES/"
    959 	fi
    960 done
    961 echo "$RPMSOURCEDIR"
    962 AM_CONDITIONAL(HAVE_RPM, test "$RPMSOURCEDIR" != "NOT-FOUND")
    963 AM_CONDITIONAL(WITH_X11VNC,  test "$build_x11vnc" = "yes")
    964 AC_SUBST(RPMSOURCEDIR)
    965 
    966 AC_CONFIG_FILES([Makefile
    967 	libvncserver.pc
    968 	libvncclient.pc
    969 	libvncserver/Makefile
    970 	examples/Makefile
    971 	examples/android/Makefile
    972 	vncterm/Makefile
    973 	webclients/Makefile
    974 	webclients/java-applet/Makefile
    975 	webclients/java-applet/ssl/Makefile
    976 	libvncclient/Makefile
    977 	client_examples/Makefile
    978 	test/Makefile
    979 	libvncserver-config
    980 	LibVNCServer.spec])
    981 #
    982 # x11vnc only:
    983 #
    984 if test "$build_x11vnc" = "yes"; then
    985 	#
    986 	# NOTE: if you are using the LibVNCServer-X.Y.Z.tar.gz source
    987 	# tarball and nevertheless want to run autoconf (i.e. aclocal,
    988 	# autoheader, automake, autoconf) AGAIN (perhaps you have a
    989 	# special target system, e.g. embedded) then you will need to
    990 	# comment out the following 'AC_CONFIG_FILES' line to avoid
    991 	# automake error messages like:
    992 	#
    993 	# configure.ac:690: required file `x11vnc/Makefile.in' not found
    994 	#
    995 	AC_CONFIG_FILES([x11vnc/Makefile x11vnc/misc/Makefile x11vnc/misc/turbovnc/Makefile])
    996 
    997 	if test ! -z "$with_system_libvncserver" -a "x$with_system_libvncserver" != "xno"; then
    998 		# need to move local tarball rfb headers aside:
    999 		hdrs="rfb.h rfbclient.h rfbproto.h rfbregion.h rfbint.h"
   1000 		echo "with-system-libvncserver: moving aside headers $hdrs"
   1001 		for hdr in $hdrs
   1002 		do
   1003 			if test -f "rfb/$hdr"; then
   1004 				echo "with-system-libvncserver: moving rfb/$hdr to rfb/$hdr.ORIG"
   1005 				mv rfb/$hdr rfb/$hdr.ORIG
   1006 			fi
   1007 		done
   1008 		echo "with-system-libvncserver: *NOTE* move them back manually to start over."
   1009 	fi
   1010 fi
   1011 
   1012 AC_CONFIG_COMMANDS([chmod-libvncserver-config],[chmod a+x libvncserver-config])
   1013 AC_OUTPUT
   1014 chmod a+x ./libvncserver-config
   1015 
   1016