Updated configure.in to include more platform-dependent checks and set
variables affecting x0vncserver. Now x0vncserver seems to work as
reliable as one from outdated "tightvnc-unix" module, and includes all
the same features.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@312 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/configure.in b/configure.in
index e232c18..73e0223 100644
--- a/configure.in
+++ b/configure.in
@@ -23,17 +23,27 @@
 "SunOS 5"*)
   SOLARIS=yes
   USE_MITSHM=yes
+  USE_SUN_OVL=yes
   ;;
 "Linux"*)
   LINUX=yes
   USE_MITSHM=yes
   ;;
+"IRIX 6"*)
+  X_LIBS="-L/usr/lib32"
+  USE_MITSHM=yes
+  USE_READDISPLAY=yes
+  ;;
+"LynxOS 2"*)
+  SJLJ_EXCEPTIONS=yes
+  ;;
 esac
 
+dnl FIXME: Check for MIT-SHM properly, add a corresponding --with option.
 if test "$USE_MITSHM" = yes; then
-  MITSHM_CPPFLAGS="-DMITSHM"
+  MITSHM_DEFINE="-DHAVE_MITSHM"
 fi
-AC_SUBST(MITSHM_CPPFLAGS)
+AC_SUBST(MITSHM_DEFINE)
 
 if test "$GCC" = yes; then
   CFLAGS="$CFLAGS -Wall"
@@ -44,7 +54,10 @@
 if test "$GXX" = yes; then
   CXXFLAGS="$CXXFLAGS -Wall"
   if test "$SOLARIS" = yes; then
-    CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -Wno-implicit-int -fpermissive"
+    CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive"
+  fi
+  if test "$SJLJ_EXCEPTIONS" = yes; then
+    CXXFLAGS="$CXXFLAGS -fsjlj-exceptions"
   fi
 fi
 
@@ -90,9 +103,66 @@
 AC_SUBST(JPEG_INCLUDE)
 AC_SUBST(JPEG_LIB)
 
+AC_ARG_ENABLE(vncconfig,
+[  --enable-vncconfig      build the vncconfig utility (assumed by default),
+                          use --disable-vncconfig to skip building vncconfig])
+if test "$enable_vncconfig" = no; then
+  echo "vncconfig utility will not be built"
+  VNCCONFIG_DIR=
+else
+  VNCCONFIG_DIR='vncconfig_unix'
+fi
+AC_SUBST(VNCCONFIG_DIR)
+
+dnl Check for the XTest X11 extension library.
+AC_CHECK_LIB(Xtst,XTestGrabControl,USE_XTEST=yes,USE_XTEST=,
+["$X_LIBS" -lXext -lX11])
+if test "$USE_XTEST" = yes; then
+  XTEST_DEFINE='-DHAVE_XTEST'
+  XTEST_LIB=-lXtst
+else
+  echo Warning: No XTest extension, building x0vncserver view-only
+  XTEST_DEFINE=
+  XTEST_LIB=
+fi
+AC_SUBST(XTEST_DEFINE)
+AC_SUBST(XTEST_LIB)
+
+dnl Support for READDISPLAY (Irix) and SUN_OVL (Solaris) extensions
+dnl FIXME: Implement corresponding --with options.
+if test "$USE_READDISPLAY" = yes; then
+  READDISPLAY_DEFINE='-DHAVE_READDISPLAY'
+elif test "$USE_SUN_OVL" = yes; then
+  READDISPLAY_DEFINE='-DHAVE_SUN_OVL'
+else
+  READDISPLAY_DEFINE=
+fi
+AC_SUBST(READDISPLAY_DEFINE)
+
 AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=)
 AC_SUBST(VSNPRINTF_DEFINE)
 
+AC_CHECK_FUNC(strcasecmp,STRCASECMP_DEFINE='-DHAVE_STRCASECMP',
+  STRCASECMP_DEFINE=)
+AC_SUBST(STRCASECMP_DEFINE)
+
+AC_CHECK_FUNC(strncasecmp,STRNCASECMP_DEFINE='-DHAVE_STRNCASECMP',
+  STRNCASECMP_DEFINE=)
+AC_SUBST(STRNCASECMP_DEFINE)
+
+dnl Under Lynx/OS 2.3, we have to link with -lbsd to resolve
+dnl gethostbyname, inet_addr, htons etc. Check if it's necessary.
+dnl NOTE: Did not want to use AC_SEARCH_LIBS which would add
+dnl   -lbsd to LIBS. We set INET_LIB instead.
+AC_LANG_SAVE
+AC_LANG_C
+AC_CHECK_FUNC(gethostbyname,INET_LIB_REQ=,INET_LIB_REQ=yes)
+if test "$INET_LIB_REQ" = yes; then
+  AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,INET_LIB=)
+fi
+AC_LANG_RESTORE
+AC_SUBST(INET_LIB)
+
 AC_MSG_CHECKING(for socklen_t)
 AC_TRY_COMPILE(
 [#include <sys/types.h>