1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(LibVNCServer, 0.9.10, http://sourceforge.net/projects/libvncserver)
3 AM_INIT_AUTOMAKE(LibVNCServer, 0.9.10)
4 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
5 AM_CONFIG_HEADER(rfbconfig.h)
6 AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])
8 # set detailed version info
9 AC_DEFINE(VERSION_MAJOR, 0, LibVNCServer major version)
10 AC_DEFINE(VERSION_MINOR, 9, LibVNCServer minor version)
11 AC_DEFINE(VERSION_PATCHLEVEL, 10, LibVNCServer patchlevel)
13 # Checks for programs.
16 if test -z "$CC"; then
21 test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall"
25 AC_PATH_PROG([AR], [ar], [/usr/bin/ar],
29 AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol])
30 AC_ARG_WITH(tightvnc-filetransfer,
31 [ --without-filetransfer disable TightVNC file transfer protocol],
32 , [ with_tightvnc_filetransfer=yes ])
33 # AC_DEFINE moved to after libpthread check.
36 AC_CHECK_FUNC(__b64_ntop, HAVE_B64_IN_LIBC="true", HAVE_B64_IN_LIBC="false")
37 if test "x$HAVE_B64_IN_LIBC" != "xtrue"; then
38 AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64_IN_LIBRESOLV="true", HAVE_B64_IN_LIBRESOLV="false")
39 if test "x$HAVE_B64_IN_LIBRESOLV" = "xtrue"; then
46 AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support])
47 AC_ARG_WITH(websockets,
48 [ --without-websockets disable WebSockets support],
49 , [ with_websockets=yes ])
50 # AC_DEFINE moved to after libresolve check.
52 AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
54 [ --without-24bpp disable 24 bpp framebuffers],
56 if test "x$with_24bpp" = "xyes"; then
59 AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)])
61 [ --with-ffmpeg=dir set ffmpeg home directory],,)
63 AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
64 if test ! -z "$with_ffmpeg"; then
65 AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" )
67 AM_CONDITIONAL(HAVE_MP3LAME, test "$HAVE_MP3LAME" = "true")
69 # Seem to need this dummy here to induce the 'checking for egrep... grep -E', etc.
70 # before it seemed to be inside the with_jpeg conditional.
71 AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true")
73 # set some ld -R nonsense
75 uname_s=`(uname -s) 2>/dev/null`
77 if test "x$uname_s" = "xHP-UX"; then
79 elif test "x$uname_s" = "xOSF1"; then
81 elif test "x$uname_s" = "xDarwin"; then
86 AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
88 [ --without-crypt disable support for libcrypt],,)
89 if test "x$with_crypt" != "xno"; then
90 AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true")
91 if test -z "$HAVE_LIBC_CRYPT"; then
92 AC_CHECK_LIB(crypt, crypt,
94 [AC_DEFINE(HAVE_LIBCRYPT)], ,)
99 # some OS's need both -lssl and -lcrypto on link line:
100 AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present])
102 [ --without-crypto disable support for openssl libcrypto],,)
104 AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present])
106 [ --without-ssl disable support for openssl libssl]
107 [ --with-ssl=DIR use openssl include/library files in DIR],,)
109 if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then
110 if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then
111 saved_CPPFLAGS="$CPPFLAGS"
112 saved_LDFLAGS="$LDFLAGS"
113 CPPFLAGS="$CPPFLAGS -I$with_ssl/include"
114 LDFLAGS="$LDFLAGS -L$with_ssl/lib"
115 if test "x$ld_minus_R" = "xno"; then
117 elif test "x$GCC" = "xyes"; then
118 LDFLAGS="$LDFLAGS -Xlinker -R$with_ssl/lib"
120 LDFLAGS="$LDFLAGS -R$with_ssl/lib"
123 AC_CHECK_LIB(crypto, RAND_file_name,
124 [AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,)
125 if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then
126 if test "x$HAVE_LIBCRYPTO" != "xtrue"; then
127 CPPFLAGS="$saved_CPPFLAGS"
128 LDFLAGS="$saved_LDFLAGS"
133 AH_TEMPLATE(HAVE_X509_PRINT_EX_FP, [open ssl X509_print_ex_fp available])
134 if test "x$with_ssl" != "xno"; then
135 if test "x$HAVE_LIBCRYPTO" = "xtrue"; then
136 AC_CHECK_LIB(ssl, SSL_library_init,
137 SSL_LIBS="-lssl -lcrypto"
138 [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,
141 AC_CHECK_LIB(ssl, SSL_library_init,
143 [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,)
147 AM_CONDITIONAL(HAVE_LIBSSL, test ! -z "$SSL_LIBS")
149 # Checks for X libraries
152 AH_TEMPLATE(HAVE_X11, [X11 build environment present])
154 # See if we want libva support
155 # TODO: check if library actually exists
156 AH_TEMPLATE(CONFIG_LIBVA, [Build libva support])
158 [ --with-libva build libva support],,)
159 if test "x$with_libva" != "xno"; then
160 AC_CHECK_LIB(va, vaInitialize,
161 VA_LIBS="-lva -lva-x11"
162 [AC_DEFINE(CONFIG_LIBVA) CONFIG_LIBVA="true"], ,)
165 AM_CONDITIONAL(CONFIG_LIBVA, test ! -z "$VA_LIBS")
168 # See if we are to build x11vnc:
169 AH_TEMPLATE(HAVE_SYSTEM_LIBVNCSERVER, [Use the system libvncserver build environment for x11vnc.])
170 AC_ARG_WITH(system-libvncserver,
171 [ --with-system-libvncserver use installed libvncserver for x11vnc]
172 [ --with-system-libvncserver=DIR use libvncserver installed in DIR for x11vnc],,)
174 [ --with-x11vnc configure for building the x11vnc subdir (if present)]
175 [ you will need to cd to x11vnc and run 'make' etc.],,)
177 if test ! -z "$with_x11vnc" -a "$with_x11vnc" = "yes"; then
179 elif test "$PACKAGE_NAME" = "x11vnc"; then
186 if test "$build_x11vnc" = "yes"; then
188 AH_TEMPLATE(HAVE_XSHM, [MIT-SHM extension build environment present])
189 AH_TEMPLATE(HAVE_XTEST, [XTEST extension build environment present])
190 AH_TEMPLATE(HAVE_XTESTGRABCONTROL, [XTEST extension has XTestGrabControl])
191 AH_TEMPLATE(HAVE_XKEYBOARD, [XKEYBOARD extension build environment present])
192 AH_TEMPLATE(HAVE_LIBXINERAMA, [XINERAMA extension build environment present])
193 AH_TEMPLATE(HAVE_LIBXRANDR, [XRANDR extension build environment present])
194 AH_TEMPLATE(HAVE_LIBXFIXES, [XFIXES extension build environment present])
195 AH_TEMPLATE(HAVE_LIBXDAMAGE, [XDAMAGE extension build environment present])
196 AH_TEMPLATE(HAVE_LIBXTRAP, [DEC-XTRAP extension build environment present])
197 AH_TEMPLATE(HAVE_RECORD, [RECORD extension build environment present])
198 AH_TEMPLATE(HAVE_SOLARIS_XREADSCREEN, [Solaris XReadScreen available])
199 AH_TEMPLATE(HAVE_IRIX_XREADDISPLAY, [IRIX XReadDisplay available])
200 AH_TEMPLATE(HAVE_FBPM, [FBPM extension build environment present])
201 AH_TEMPLATE(HAVE_DPMS, [DPMS extension build environment present])
202 AH_TEMPLATE(HAVE_LINUX_VIDEODEV_H, [video4linux build environment present])
203 AH_TEMPLATE(HAVE_LINUX_FB_H, [linux fb device build environment present])
204 AH_TEMPLATE(HAVE_LINUX_INPUT_H, [linux/input.h present])
205 AH_TEMPLATE(HAVE_LINUX_UINPUT_H, [linux uinput device build environment present])
206 AH_TEMPLATE(HAVE_MACOSX_NATIVE_DISPLAY, [build MacOS X native display support])
207 AH_TEMPLATE(HAVE_MACOSX_OPENGL_H, [MacOS X OpenGL present])
209 AC_ARG_WITH(xkeyboard,
210 [ --without-xkeyboard disable xkeyboard extension support],,)
211 AC_ARG_WITH(xinerama,
212 [ --without-xinerama disable xinerama extension support],,)
214 [ --without-xrandr disable xrandr extension support],,)
216 [ --without-xfixes disable xfixes extension support],,)
218 [ --without-xdamage disable xdamage extension support],,)
220 [ --without-xtrap disable xtrap extension support],,)
222 [ --without-xrecord disable xrecord extension support],,)
224 [ --without-fbpm disable fbpm extension support],,)
226 [ --without-dpms disable dpms extension support],,)
228 [ --without-v4l disable video4linux support],,)
230 [ --without-fbdev disable linux fb device support],,)
232 [ --without-uinput disable linux uinput device support],,)
233 AC_ARG_WITH(macosx-native,
234 [ --without-macosx-native disable MacOS X native display support],,)
239 if test "x$with_x" = "xno"; then
241 elif test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
242 AC_CHECK_LIB(X11, XGetImage, [AC_DEFINE(HAVE_X11) HAVE_X11="true"],
244 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
247 if test $HAVE_X11 = "true" -a "$build_x11vnc" = "yes"; then
248 X_PRELIBS="$X_PRELIBS -lXext"
250 AC_CHECK_LIB(Xext, XShmGetImage,
251 [AC_DEFINE(HAVE_XSHM)], ,
252 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
254 AC_CHECK_LIB(Xext, XReadScreen,
255 [AC_DEFINE(HAVE_SOLARIS_XREADSCREEN)], ,
256 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
258 AC_CHECK_HEADER(X11/extensions/readdisplay.h,
259 [AC_DEFINE(HAVE_IRIX_XREADDISPLAY)], ,
260 [#include <X11/Xlib.h>])
262 if test "x$with_fbpm" != "xno"; then
263 AC_CHECK_LIB(Xext, FBPMForceLevel,
264 [AC_DEFINE(HAVE_FBPM)], ,
265 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
268 if test "x$with_dpms" != "xno"; then
269 AC_CHECK_LIB(Xext, DPMSForceLevel,
270 [AC_DEFINE(HAVE_DPMS)], ,
271 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
274 AC_CHECK_LIB(Xtst, XTestGrabControl,
275 X_PRELIBS="-lXtst $X_PRELIBS"
276 [AC_DEFINE(HAVE_XTESTGRABCONTROL) HAVE_XTESTGRABCONTROL="true"], ,
277 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
279 AC_CHECK_LIB(Xtst, XTestFakeKeyEvent,
280 X_PRELIBS="-lXtst $X_PRELIBS"
281 [AC_DEFINE(HAVE_XTEST) HAVE_XTEST="true"], ,
282 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
284 if test "x$with_xrecord" != "xno"; then
285 AC_CHECK_LIB(Xtst, XRecordEnableContextAsync,
286 X_PRELIBS="-lXtst $X_PRELIBS"
287 [AC_DEFINE(HAVE_RECORD)], ,
288 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
291 # we use XTRAP on X11R5, or user can set X11VNC_USE_XTRAP
292 if test "x$with_xtrap" != "xno"; then
293 if test ! -z "$X11VNC_USE_XTRAP" -o -z "$HAVE_XTESTGRABCONTROL"; then
294 AC_CHECK_LIB(XTrap, XETrapSetGrabServer,
295 X_PRELIBS="$X_PRELIBS -lXTrap"
296 [AC_DEFINE(HAVE_LIBXTRAP)], ,
297 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
298 # tru64 uses libXETrap.so
299 AC_CHECK_LIB(XETrap, XETrapSetGrabServer,
300 X_PRELIBS="$X_PRELIBS -lXETrap"
301 [AC_DEFINE(HAVE_LIBXTRAP)], ,
302 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
306 if test "x$with_xkeyboard" != "xno"; then
307 saved_CPPFLAGS="$CPPFLAGS"
308 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
309 AC_CHECK_HEADER(X11/XKBlib.h, HAVE_XKBLIB_H="true",
310 HAVE_XKBLIB_H="false", [#include <X11/Xlib.h>])
311 CPPFLAGS="$saved_CPPFLAGS"
312 if test $HAVE_XKBLIB_H = "true"; then
313 AC_CHECK_LIB(X11, XkbSelectEvents,
314 [AC_DEFINE(HAVE_XKEYBOARD)], ,
315 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
319 if test "x$with_xinerama" != "xno"; then
320 AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
321 X_PRELIBS="$X_PRELIBS -lXinerama"
322 [AC_DEFINE(HAVE_LIBXINERAMA)], ,
323 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
326 if test "x$with_xrandr" != "xno"; then
327 AC_CHECK_LIB(Xrandr, XRRSelectInput,
328 X_PRELIBS="$X_PRELIBS -lXrandr"
329 [AC_DEFINE(HAVE_LIBXRANDR) HAVE_LIBXRANDR="true"], ,
330 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
333 if test "x$with_xfixes" != "xno"; then
334 AC_CHECK_LIB(Xfixes, XFixesGetCursorImage,
335 X_PRELIBS="$X_PRELIBS -lXfixes"
336 [AC_DEFINE(HAVE_LIBXFIXES) HAVE_LIBXFIXES="true"], ,
337 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
340 if test "x$with_xdamage" != "xno"; then
341 AC_CHECK_LIB(Xdamage, XDamageQueryExtension,
342 X_PRELIBS="$X_PRELIBS -lXdamage"
343 [AC_DEFINE(HAVE_LIBXDAMAGE) HAVE_LIBXDAMAGE="true"], ,
344 $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
347 if test ! -z "$HAVE_LIBXFIXES" -o ! -z "$HAVE_LIBXDAMAGE"; then
348 # need /usr/sfw/lib in RPATH for Solaris 10 and later
349 case `(uname -sr) 2>/dev/null` in
350 "SunOS 5"*) X_EXTRA_LIBS="$X_EXTRA_LIBS -R/usr/sfw/lib" ;;
353 if test ! -z "$HAVE_LIBXRANDR"; then
354 # also need /usr/X11/include for Solaris 10 10/08 and later
355 case `(uname -sr) 2>/dev/null` in
356 "SunOS 5"*) CPPFLAGS="$CPPFLAGS -I/usr/X11/include" ;;
360 X_LIBS="$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS"
366 AM_CONDITIONAL(HAVE_X11, test $HAVE_X11 != "false")
369 if test "$build_x11vnc" = "yes"; then
371 if test "x$HAVE_X11" = "xfalse" -a "x$with_x" != "xno"; then
373 ==========================================================================
374 *** A working X window system build environment is required to build ***
375 x11vnc. Make sure any required X development packages are installed.
376 If they are installed in non-standard locations, one can use the
377 --x-includes=DIR and --x-libraries=DIR configure options or set the
378 CPPFLAGS and LDFLAGS environment variables to indicate where the X
379 window system header files and libraries may be found. On 64+32 bit
380 machines you may need to point to lib64 or lib32 directories to pick up
381 the correct word size.
383 If you want to build x11vnc without X support (e.g. for -rawfb use only
384 or for native Mac OS X), specify the --without-x configure option.
385 ==========================================================================
389 if test "x$HAVE_X11" = "xtrue" -a "x$HAVE_XTEST" != "xtrue"; then
391 ==========================================================================
392 *** A working build environment for the XTEST extension was not found ***
393 (libXtst). An x11vnc built this way will be *ONLY BARELY USABLE*.
394 You will be able to move the mouse but not click or type. There can
395 also be deadlocks if an application grabs the X server.
397 It is recommended that you install the necessary development packages
398 for XTEST (perhaps it is named something like libxtst-dev) and run
400 ==========================================================================
405 if test "x$with_v4l" != "xno"; then
406 AC_CHECK_HEADER(linux/videodev.h,
407 [AC_DEFINE(HAVE_LINUX_VIDEODEV_H)],,)
409 if test "x$with_fbdev" != "xno"; then
410 AC_CHECK_HEADER(linux/fb.h,
411 [AC_DEFINE(HAVE_LINUX_FB_H)],,)
413 if test "x$with_uinput" != "xno"; then
414 AC_CHECK_HEADER(linux/input.h,
415 [AC_DEFINE(HAVE_LINUX_INPUT_H) HAVE_LINUX_INPUT_H="true"],,)
416 if test "x$HAVE_LINUX_INPUT_H" = "xtrue"; then
417 AC_CHECK_HEADER(linux/uinput.h,
418 [AC_DEFINE(HAVE_LINUX_UINPUT_H)],, [#include <linux/input.h>])
422 if test "x$with_macosx_native" != "xno"; then
423 AC_DEFINE(HAVE_MACOSX_NATIVE_DISPLAY)
426 # Check for OS X opengl header
427 AC_CHECK_HEADER(OpenGL/OpenGL.h,
428 [AC_DEFINE(HAVE_MACOSX_OPENGL_H) HAVE_MACOSX_OPENGL_H="true"],,)
430 AH_TEMPLATE(HAVE_AVAHI, [Avahi/mDNS client build environment present])
432 [ --without-avahi disable support for Avahi/mDNS]
433 [ --with-avahi=DIR use avahi include/library files in DIR],,)
434 if test "x$with_avahi" != "xno"; then
435 printf "checking for avahi... "
436 if test ! -z "$with_avahi" -a "x$with_avahi" != "xyes"; then
437 AVAHI_CFLAGS="-I$with_avahi/include"
438 AVAHI_LIBS="-L$with_avahi/lib -lavahi-common -lavahi-client"
439 echo "using $with_avahi"
441 elif pkg-config --atleast-version=0.6.4 avahi-client >/dev/null 2>&1; then
442 AVAHI_CFLAGS=`pkg-config --cflags avahi-client`
443 AVAHI_LIBS=`pkg-config --libs avahi-client`
451 if test "x$with_avahi" = "xyes"; then
452 AC_DEFINE(HAVE_AVAHI)
453 AC_SUBST(AVAHI_CFLAGS)
460 # only used in x11vnc/Makefile.am but needs to always be defined:
461 AM_CONDITIONAL(OSX_OPENGL, test "$HAVE_MACOSX_OPENGL_H" = "true")
463 # Checks for libraries.
465 if test ! -z "$with_system_libvncserver" -a "x$with_system_libvncserver" != "xno"; then
466 printf "checking for system libvncserver... "
468 if test "X$VNEED" != "X"; then
471 if test "x$with_system_libvncserver" != "xyes"; then
473 if test "x$ld_minus_R" = "xno"; then
475 elif test "x$GCC" = "xyes"; then
476 rflag="-Xlinker -R$with_system_libvncserver/lib"
478 rflag="-R$with_system_libvncserver/lib"
480 cmd="$with_system_libvncserver/bin/libvncserver-config"
481 if $cmd --version 1>/dev/null 2>&1; then
482 cvers=`$cmd --version 2>/dev/null`
483 cscore=`echo "$cvers" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
484 nscore=`echo "$vneed" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
486 if test $cscore -lt $nscore; then
488 with_system_libvncserver=no
490 ==========================================================================
491 *** Need libvncserver version $vneed, have version $cvers ***
492 You are building with a system installed libvncserver and it is not
494 ==========================================================================
497 SYSTEM_LIBVNCSERVER_CFLAGS="-I$with_system_libvncserver/include"
498 SYSTEM_LIBVNCSERVER_LIBS="-L$with_system_libvncserver/lib $rflag -lvncserver -lvncclient"
499 echo "using $with_system_libvncserver"
500 with_system_libvncserver=yes
503 echo " *** cannot run $cmd *** " 1>&2
504 with_system_libvncserver=no
507 elif libvncserver-config --version 1>/dev/null 2>&1; then
509 rprefix=`libvncserver-config --prefix`
510 if test "x$ld_minus_R" = "xno"; then
512 elif test "x$GCC" = "xyes"; then
513 rflag=" -Xlinker -R$rprefix/lib "
515 rflag=" -R$rprefix/lib "
517 cvers=`libvncserver-config --version 2>/dev/null`
518 cscore=`echo "$cvers" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
519 nscore=`echo "$vneed" | tr '.' ' ' | awk '{print 10000 * $1 + 100 * $2 + $3}'`
521 if test $cscore -lt $nscore; then
524 ==========================================================================
525 *** Need libvncserver version $vneed, have version $cvers ***
526 You are building with a system installed libvncserver and it is not
528 ==========================================================================
531 SYSTEM_LIBVNCSERVER_CFLAGS=`libvncserver-config --cflags`
532 SYSTEM_LIBVNCSERVER_LIBS="$rflag"`libvncserver-config --libs`
533 with_system_libvncserver=yes
537 with_system_libvncserver=no
542 if test "x$with_system_libvncserver" = "xyes"; then
543 AC_DEFINE(HAVE_SYSTEM_LIBVNCSERVER)
544 AC_SUBST(SYSTEM_LIBVNCSERVER_CFLAGS)
545 AC_SUBST(SYSTEM_LIBVNCSERVER_LIBS)
547 AM_CONDITIONAL(HAVE_SYSTEM_LIBVNCSERVER, test "x$with_system_libvncserver" = "xyes")
551 [ --without-jpeg disable support for jpeg]
552 [ --with-jpeg=DIR use jpeg include/library files in DIR],,)
555 # no jpeg on command line with_jpeg=""
556 # -with-jpeg with_jpeg="yes"
557 # -without-jpeg with_jpeg="no"
558 # -with-jpeg=/foo/dir with_jpeg="/foo/dir"
560 HAVE_LIBJPEG_TURBO="false"
562 if test "x$with_jpeg" != "xno"; then
563 AC_ARG_VAR(JPEG_LDFLAGS,
564 [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.])
565 saved_CPPFLAGS="$CPPFLAGS"
566 saved_LDFLAGS="$LDFLAGS"
568 if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then
569 # add user supplied directory to flags:
570 CPPFLAGS="$CPPFLAGS -I$with_jpeg/include"
571 LDFLAGS="$LDFLAGS -L$with_jpeg/lib"
572 if test "x$ld_minus_R" = "xno"; then
574 elif test "x$GCC" = "xyes"; then
575 # this is not complete... in general a rat's nest.
576 LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib"
578 LDFLAGS="$LDFLAGS -R$with_jpeg/lib"
581 if test "x$JPEG_LDFLAGS" != "x"; then
582 LDFLAGS="$saved_LDFLAGS"
583 LIBS="$LIBS $JPEG_LDFLAGS"
587 AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true")
588 AC_MSG_CHECKING(for jpeg_CreateCompress in libjpeg)
589 if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
590 AC_LINK_IFELSE([AC_LANG_CALL([], [jpeg_CreateCompress])],
592 AC_DEFINE(HAVE_LIBJPEG, 1, libjpeg support enabled)],
593 [AC_MSG_RESULT(no); HAVE_JPEGLIB_H=""])
595 if test "x$HAVE_JPEGLIB_H" != "xtrue"; then
596 # restore old flags on failure:
597 CPPFLAGS="$saved_CPPFLAGS"
598 LDFLAGS="$saved_LDFLAGS"
601 ==========================================================================
602 *** The libjpeg compression library was not found. ***
603 This may lead to reduced performance, especially over slow links.
604 If libjpeg is in a non-standard location use --with-jpeg=DIR to
605 indicate the header file is in DIR/include/jpeglib.h and the library
606 in DIR/lib/libjpeg.a. You can also set the JPEG_LDFLAGS variable to
607 specify more detailed linker flags. A copy of libjpeg-turbo may be
608 obtained from: https://sourceforge.net/projects/libjpeg-turbo/files/
609 A copy of libjpeg may be obtained from: http://ijg.org/files/
610 ==========================================================================
615 if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
616 AC_MSG_CHECKING(whether JPEG library is libjpeg-turbo)
617 m4_define([LJT_TEST],
618 [AC_LANG_PROGRAM([#include <stdio.h>
619 #include <jpeglib.h>],
620 [struct jpeg_compress_struct cinfo;
621 struct jpeg_error_mgr jerr;
622 cinfo.err=jpeg_std_error(&jerr);
623 jpeg_create_compress(&cinfo);
624 cinfo.input_components = 3;
625 jpeg_set_defaults(&cinfo);
626 cinfo.in_color_space = JCS_EXT_RGB;
627 jpeg_default_colorspace(&cinfo);
630 if test "x$cross_compiling" != "xyes"; then
631 AC_RUN_IFELSE([LJT_TEST],
632 [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
635 AC_LINK_IFELSE([LJT_TEST],
636 [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
641 if test "x$HAVE_JPEGLIB_H" = "xtrue" -a "x$HAVE_LIBJPEG_TURBO" != "xtrue"; then
643 ==========================================================================
644 *** The libjpeg library you are building against is not libjpeg-turbo.
645 Performance will be reduced. You can obtain libjpeg-turbo from:
646 https://sourceforge.net/projects/libjpeg-turbo/files/ ***
647 ==========================================================================
654 [ --without-png disable support for png]
655 [ --with-png=DIR use png include/library files in DIR],,)
658 # no png on command line with_png=""
659 # -with-png with_png="yes"
660 # -without-png with_png="no"
661 # -with-png=/foo/dir with_png="/foo/dir"
663 if test "x$with_png" != "xno"; then
664 if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
665 # add user supplied directory to flags:
666 saved_CPPFLAGS="$CPPFLAGS"
667 saved_LDFLAGS="$LDFLAGS"
668 CPPFLAGS="$CPPFLAGS -I$with_png/include"
669 LDFLAGS="$LDFLAGS -L$with_png/lib"
670 if test "x$ld_minus_R" = "xno"; then
672 elif test "x$GCC" = "xyes"; then
673 # this is not complete... in general a rat's nest.
674 LDFLAGS="$LDFLAGS -Xlinker -R$with_png/lib"
676 LDFLAGS="$LDFLAGS -R$with_png/lib"
679 AC_CHECK_HEADER(png.h, HAVE_PNGLIB_H="true")
680 if test "x$HAVE_PNGLIB_H" = "xtrue"; then
681 AC_CHECK_LIB(png, png_create_write_struct, , HAVE_PNGLIB_H="")
683 if test ! -z "$with_png" -a "x$with_png" != "xyes"; then
684 if test "x$HAVE_PNGLIB_H" != "xtrue"; then
685 # restore old flags on failure:
686 CPPFLAGS="$saved_CPPFLAGS"
687 LDFLAGS="$saved_LDFLAGS"
690 if test "$build_x11vnc" = "yes"; then
691 if test "x$HAVE_PNGLIB_H" != "xtrue"; then
693 ==========================================================================
694 *** The libpng compression library was not found. ***
695 This may lead to reduced performance, especially over slow links.
696 If libpng is in a non-standard location use --with-png=DIR to
697 indicate the header file is in DIR/include/png.h and the library
698 in DIR/lib/libpng.a. A copy of libpng may be obtained from:
699 http://www.libpng.org/pub/png/libpng.html
700 ==========================================================================
708 [ --without-libz disable support for deflate],,)
710 [ --without-zlib disable support for deflate]
711 [ --with-zlib=DIR use zlib include/library files in DIR],,)
713 if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then
714 if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then
715 saved_CPPFLAGS="$CPPFLAGS"
716 saved_LDFLAGS="$LDFLAGS"
717 CPPFLAGS="$CPPFLAGS -I$with_zlib/include"
718 LDFLAGS="$LDFLAGS -L$with_zlib/lib"
719 if test "x$ld_minus_R" = "xno"; then
721 elif test "x$GCC" = "xyes"; then
722 LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib"
724 LDFLAGS="$LDFLAGS -R$with_zlib/lib"
727 AC_CHECK_HEADER(zlib.h, HAVE_ZLIB_H="true")
728 if test "x$HAVE_ZLIB_H" = "xtrue"; then
729 AC_CHECK_LIB(z, deflate, , HAVE_ZLIB_H="")
731 if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then
732 if test "x$HAVE_ZLIB_H" != "xtrue"; then
733 CPPFLAGS="$saved_CPPFLAGS"
734 LDFLAGS="$saved_LDFLAGS"
737 if test "$build_x11vnc" = "yes"; then
738 if test "x$HAVE_ZLIB_H" != "xtrue"; then
740 ==========================================================================
741 *** The libz compression library was not found. ***
742 This may lead to reduced performance, especially over slow links.
743 If libz is in a non-standard location use --with-zlib=DIR to indicate the
744 header file is in DIR/include/zlib.h and the library in DIR/lib/libz.a.
745 A copy of libz may be obtained from: http://www.gzip.org/zlib/
746 ==========================================================================
754 [ --without-pthread disable support for libpthread],,)
756 if test "x$with_pthread" != "xno"; then
757 AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true")
758 if test ! -z "$HAVE_PTHREAD_H"; then
759 AC_CHECK_LIB(pthread, pthread_mutex_lock)
760 AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
763 AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
765 AC_MSG_CHECKING([for __thread])
766 AC_LINK_IFELSE([AC_LANG_PROGRAM(, [static __thread int p = 0])],
767 [AC_DEFINE(HAVE_TLS, 1,
768 Define to 1 if compiler supports __thread)
769 AC_MSG_RESULT([yes])],
770 [AC_MSG_RESULT([no])])
772 # tightvnc-filetransfer implemented using threads:
773 if test -z "$HAVE_LIBPTHREAD"; then
774 with_tightvnc_filetransfer=""
776 if test "x$with_tightvnc_filetransfer" = "xyes"; then
777 AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
779 AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes")
781 # websockets implemented using base64 from resolve
782 if test "x$HAVE_B64" != "xtrue"; then
785 if test "x$with_websockets" = "xyes"; then
786 LIBS="$LIBS $RESOLV_LIB $SSL_LIBS"
787 AC_DEFINE(WITH_WEBSOCKETS)
789 AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes")
791 AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H")
792 AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H")
793 AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H")
796 SDLCONFIG="sdl-config"
797 AC_ARG_WITH(sdl-config,
798 [[ --with-sdl-config=FILE
799 Use the given path to sdl-config when determining
800 SDL configuration; defaults to "sdl-config"]],
802 if test "$withval" != "yes" -a "$withval" != ""; then
807 if test -z "$with_sdl"; then
808 if $SDLCONFIG --version >/dev/null 2>&1; then
810 SDL_CFLAGS=`$SDLCONFIG --cflags`
811 SDL_LIBS=`$SDLCONFIG --libs`
816 AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes")
821 # Check for GTK+. if present, build the GTK+ vnc viewer example
822 PKG_CHECK_MODULES([GTK], [gtk+-2.0],,:)
823 AM_CONDITIONAL(HAVE_LIBGTK, test ! -z "$GTK_LIBS")
826 MINGW=`echo $host_os | grep mingw32 2>/dev/null`
827 AM_CONDITIONAL(MINGW, test ! -z "$MINGW" )
828 if test ! -z "$MINGW"; then
830 LDFLAGS="$LDFLAGS -no-undefined"
834 # Check for libgcrypt
835 AH_TEMPLATE(WITH_CLIENT_GCRYPT, [Enable support for libgcrypt in libvncclient])
837 [ --without-gcrypt disable support for gcrypt],,)
838 AC_ARG_WITH(client-gcrypt,
839 [ --without-client-gcrypt disable support for gcrypt in libvncclient],,)
841 if test "x$with_gcrypt" != "xno"; then
842 AM_PATH_LIBGCRYPT(1.4.0, , with_client_gcrypt=no)
843 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
844 LIBS="$LIBS $LIBGCRYPT_LIBS"
845 if test "x$with_client_gcrypt" != "xno"; then
846 AC_DEFINE(WITH_CLIENT_GCRYPT)
851 AH_TEMPLATE(HAVE_GNUTLS, [GnuTLS library present])
853 [ --without-gnutls disable support for gnutls]
854 [ --with-gnutls=DIR use gnutls include/library files in DIR],,)
856 if test "x$with_gnutls" != "xno"; then
857 PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.4.0,,:)
858 CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
859 LIBS="$LIBS $GNUTLS_LIBS"
861 AM_CONDITIONAL(HAVE_GNUTLS, test ! -z "$GNUTLS_LIBS")
862 if test ! -z "$GNUTLS_LIBS" ; then
863 AC_DEFINE(HAVE_GNUTLS)
867 # warn if neither GnuTLS nor OpenSSL are available
868 if test -z "$SSL_LIBS" -a -z "$GNUTLS_LIBS"; then
870 ==========================================================================
871 *** No encryption library could be found. ***
872 A libvncserver/libvncclient built this way will not support SSL encryption.
873 To enable SSL install the necessary development packages (perhaps it is named
874 something like libssl-dev or gnutls-dev) and run configure again.
875 ==========================================================================
882 AH_TEMPLATE(IPv6, [Enable IPv6 support])
884 [ --without-ipv6 disable IPv6 support],,)
885 if test "x$with_ipv6" != "xno"; then
886 AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(IPv6,1),
887 AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(IPv6,1), [
888 AC_MSG_CHECKING([for getaddrinfo in -lws2_32])
889 LIBS="$LIBS -lws2_32"
890 AC_TRY_LINK([#include <ws2tcpip.h>], [getaddrinfo(0, 0, 0, 0);], [
900 # Checks for header files.
902 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])
905 if test "$build_x11vnc" = "yes"; then
906 AC_CHECK_HEADERS([pwd.h sys/wait.h utmpx.h termios.h sys/ioctl.h sys/stropts.h])
909 # Checks for typedefs, structures, and compiler characteristics.
917 if test ! -d ./rfb; then
918 echo "creating subdir ./rfb for rfbint.h"
921 AC_CREATE_STDINT_H(rfb/rfbint.h)
922 AC_CACHE_CHECK([for in_addr_t],
924 AC_TRY_COMPILE([#include <sys/types.h>
925 #include <netinet/in.h>],
926 [in_addr_t foo; return 0;],
930 AH_TEMPLATE(NEED_INADDR_T, [Need a typedef for in_addr_t])
931 if test $inaddrt = no ; then
932 AC_DEFINE(NEED_INADDR_T)
934 # Checks for library functions.
940 AC_CHECK_LIB(nsl,gethostbyname)
941 AC_CHECK_LIB(socket,socket)
943 uname_s=`(uname -s) 2>/dev/null`
944 if test "x$uname_s" = "xHP-UX"; then
945 # need -lsec for getspnam()
946 LDFLAGS="$LDFLAGS -lsec"
949 AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr])
951 if test "$build_x11vnc" = "yes"; then
952 AC_CHECK_FUNCS([setsid setpgrp getpwuid getpwnam getspnam getuid geteuid setuid setgid seteuid setegid initgroups waitpid setutxent grantpt shmat])
955 # check, if shmget is in cygipc.a
956 AC_CHECK_LIB(cygipc,shmget)
957 AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true")
959 # Check if /usr/include/linux exists, if so, define LINUX
960 AM_CONDITIONAL(LINUX, test -d /usr/include/linux)
962 # Check for OS X specific header
963 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true")
964 AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true")
966 # Check for Android specific header
967 AC_CHECK_HEADER(android/api-level.h, HAVE_ANDROID="true")
968 AM_CONDITIONAL(ANDROID, test "$HAVE_ANDROID" = "true")
969 if test "$HAVE_ANDROID" = "true"; then
970 AC_DEFINE(HAVE_ANDROID, 1, [Android host system detected])
973 # On Solaris 2.7, write() returns ENOENT when it really means EAGAIN
974 AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it])
975 case `(uname -sr) 2>/dev/null` in
977 AC_DEFINE(ENOENT_WORKAROUND)
981 # Check for rpm SOURCES path
982 printf "checking for rpm sources path... "
983 RPMSOURCEDIR="NOT-FOUND"
984 for directory in packages OpenLinux redhat RedHat rpm RPM "" ; do
985 if test -d /usr/src/${directory}/SOURCES; then
986 RPMSOURCEDIR="/usr/src/${directory}/SOURCES/"
990 AM_CONDITIONAL(HAVE_RPM, test "$RPMSOURCEDIR" != "NOT-FOUND")
991 AM_CONDITIONAL(WITH_X11VNC, test "$build_x11vnc" = "yes")
992 AC_SUBST(RPMSOURCEDIR)
994 AC_CONFIG_FILES([Makefile
997 libvncserver/Makefile
999 examples/android/Makefile
1002 webclients/java-applet/Makefile
1003 webclients/java-applet/ssl/Makefile
1004 libvncclient/Makefile
1005 client_examples/Makefile
1012 if test "$build_x11vnc" = "yes"; then
1014 # NOTE: if you are using the LibVNCServer-X.Y.Z.tar.gz source
1015 # tarball and nevertheless want to run autoconf (i.e. aclocal,
1016 # autoheader, automake, autoconf) AGAIN (perhaps you have a
1017 # special target system, e.g. embedded) then you will need to
1018 # comment out the following 'AC_CONFIG_FILES' line to avoid
1019 # automake error messages like:
1021 # configure.ac:690: required file `x11vnc/Makefile.in' not found
1023 AC_CONFIG_FILES([x11vnc/Makefile x11vnc/misc/Makefile x11vnc/misc/turbovnc/Makefile])
1025 if test ! -z "$with_system_libvncserver" -a "x$with_system_libvncserver" != "xno"; then
1026 # need to move local tarball rfb headers aside:
1027 hdrs="rfb.h rfbclient.h rfbproto.h rfbregion.h rfbint.h"
1028 echo "with-system-libvncserver: moving aside headers $hdrs"
1031 if test -f "rfb/$hdr"; then
1032 echo "with-system-libvncserver: moving rfb/$hdr to rfb/$hdr.ORIG"
1033 mv rfb/$hdr rfb/$hdr.ORIG
1036 echo "with-system-libvncserver: *NOTE* move them back manually to start over."
1040 AC_CONFIG_COMMANDS([chmod-libvncserver-config],[chmod a+x libvncserver-config])
1042 chmod a+x ./libvncserver-config