Constantin Kaplinsky | b30ae7f | 2006-05-25 05:04:46 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | AC_INIT(vncviewer_unix/vncviewer.cxx) |
| 3 | |
| 4 | PACKAGE=tightvnc |
| 5 | VERSION=1.5.0 |
| 6 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") |
| 7 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION") |
| 8 | AC_SUBST(PACKAGE) |
| 9 | AC_SUBST(VERSION) |
| 10 | |
| 11 | dnl dirty hack to prevent use of -g in CFLAGS and CXXFLAGS |
| 12 | ac_cv_prog_cc_g=no |
| 13 | ac_cv_prog_cxx_g=no |
| 14 | |
| 15 | dnl Checks for programs. |
| 16 | AC_PROG_CC |
| 17 | AC_PROG_CXX |
| 18 | AC_PROG_RANLIB |
| 19 | AC_PROG_MAKE_SET |
| 20 | AC_LANG_CPLUSPLUS |
| 21 | |
| 22 | case "`(uname -sr) 2>/dev/null`" in |
| 23 | "SunOS 5"*) |
| 24 | SOLARIS=yes |
| 25 | USE_MITSHM=yes |
| 26 | USE_SUN_OVL=yes |
| 27 | ;; |
| 28 | "Linux"*) |
| 29 | LINUX=yes |
| 30 | USE_MITSHM=yes |
| 31 | ;; |
| 32 | "IRIX 6"*) |
| 33 | X_LIBS="-L/usr/lib32" |
| 34 | USE_MITSHM=yes |
| 35 | USE_READDISPLAY=yes |
| 36 | ;; |
| 37 | "LynxOS 2"*) |
| 38 | SJLJ_EXCEPTIONS=yes |
| 39 | ;; |
| 40 | esac |
| 41 | |
| 42 | dnl FIXME: Check for MIT-SHM properly, add a corresponding --with option. |
| 43 | if test "$USE_MITSHM" = yes; then |
| 44 | MITSHM_DEFINE="-DHAVE_MITSHM" |
| 45 | fi |
| 46 | AC_SUBST(MITSHM_DEFINE) |
| 47 | |
| 48 | if test "$GCC" = yes; then |
| 49 | CFLAGS="$CFLAGS -Wall" |
| 50 | if test "$SOLARIS" = yes; then |
| 51 | CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wno-implicit-int" |
| 52 | fi |
| 53 | fi |
| 54 | if test "$GXX" = yes; then |
| 55 | CXXFLAGS="$CXXFLAGS -Wall" |
| 56 | if test "$SOLARIS" = yes; then |
| 57 | CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive" |
| 58 | fi |
| 59 | if test "$SJLJ_EXCEPTIONS" = yes; then |
| 60 | CXXFLAGS="$CXXFLAGS -fsjlj-exceptions" |
| 61 | fi |
| 62 | fi |
| 63 | |
| 64 | AC_PATH_XTRA |
| 65 | |
| 66 | AC_ARG_WITH(installed-zlib, |
| 67 | [ --with-installed-zlib use the version of zlib which is installed on the |
| 68 | system instead of the one distributed with VNC]) |
| 69 | |
| 70 | if test "$with_installed_zlib" = yes; then |
| 71 | echo "using installed zlib" |
| 72 | ZLIB_LIB=-lz |
| 73 | else |
| 74 | ZLIB_DIR=zlib |
| 75 | ZLIB_INCLUDE='-I$(top_srcdir)/zlib' |
| 76 | ZLIB_LIB='$(top_srcdir)/zlib/libz.a' |
| 77 | echo "configuring zlib..." |
| 78 | (cd zlib; ./configure) |
| 79 | echo "...done configuring zlib" |
| 80 | fi |
| 81 | |
| 82 | AC_SUBST(ZLIB_DIR) |
| 83 | AC_SUBST(ZLIB_INCLUDE) |
| 84 | AC_SUBST(ZLIB_LIB) |
| 85 | |
| 86 | AC_ARG_WITH(installed-jpeg, |
| 87 | [ --with-installed-jpeg use the version of jpeg which is installed on the |
| 88 | system instead of the one distributed with VNC]) |
| 89 | |
| 90 | if test "$with_installed_jpeg" = yes; then |
| 91 | echo "using installed jpeg" |
| 92 | JPEG_LIB=-ljpeg |
| 93 | else |
| 94 | JPEG_DIR=jpeg/build |
| 95 | JPEG_INCLUDE='-I$(top_srcdir)/jpeg' |
| 96 | JPEG_LIB='$(top_srcdir)/jpeg/build/libjpeg.a' |
| 97 | echo "configuring jpeg..." |
| 98 | (mkdir jpeg/build; cd jpeg/build; ../configure) |
| 99 | echo "...done configuring jpeg" |
| 100 | fi |
| 101 | |
| 102 | AC_SUBST(JPEG_DIR) |
| 103 | AC_SUBST(JPEG_INCLUDE) |
| 104 | AC_SUBST(JPEG_LIB) |
| 105 | |
| 106 | AC_ARG_ENABLE(vncconfig, |
| 107 | [ --enable-vncconfig build the vncconfig utility (assumed by default), |
| 108 | use --disable-vncconfig to skip building vncconfig]) |
| 109 | if test "$enable_vncconfig" = no; then |
| 110 | echo "vncconfig utility will not be built" |
| 111 | VNCCONFIG_DIR= |
| 112 | else |
| 113 | VNCCONFIG_DIR='vncconfig_unix' |
| 114 | fi |
| 115 | AC_SUBST(VNCCONFIG_DIR) |
| 116 | |
| 117 | dnl Check for the XTest X11 extension library. |
| 118 | AC_CHECK_LIB(Xtst,XTestGrabControl,USE_XTEST=yes,USE_XTEST=, |
| 119 | ["$X_LIBS" -lXext -lX11]) |
| 120 | if test "$USE_XTEST" = yes; then |
| 121 | XTEST_DEFINE='-DHAVE_XTEST' |
| 122 | XTEST_LIB=-lXtst |
| 123 | else |
| 124 | echo Warning: No XTest extension, building x0vncserver view-only |
| 125 | XTEST_DEFINE= |
| 126 | XTEST_LIB= |
| 127 | fi |
| 128 | AC_SUBST(XTEST_DEFINE) |
| 129 | AC_SUBST(XTEST_LIB) |
| 130 | |
| 131 | dnl Support for READDISPLAY (Irix) and SUN_OVL (Solaris) extensions |
| 132 | dnl FIXME: Implement corresponding --with options. |
| 133 | if test "$USE_READDISPLAY" = yes; then |
| 134 | READDISPLAY_DEFINE='-DHAVE_READDISPLAY' |
| 135 | elif test "$USE_SUN_OVL" = yes; then |
| 136 | READDISPLAY_DEFINE='-DHAVE_SUN_OVL' |
| 137 | else |
| 138 | READDISPLAY_DEFINE= |
| 139 | fi |
| 140 | AC_SUBST(READDISPLAY_DEFINE) |
| 141 | |
| 142 | AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=) |
| 143 | AC_SUBST(VSNPRINTF_DEFINE) |
| 144 | |
| 145 | AC_CHECK_FUNC(strcasecmp,STRCASECMP_DEFINE='-DHAVE_STRCASECMP', |
| 146 | STRCASECMP_DEFINE=) |
| 147 | AC_SUBST(STRCASECMP_DEFINE) |
| 148 | |
| 149 | AC_CHECK_FUNC(strncasecmp,STRNCASECMP_DEFINE='-DHAVE_STRNCASECMP', |
| 150 | STRNCASECMP_DEFINE=) |
| 151 | AC_SUBST(STRNCASECMP_DEFINE) |
| 152 | |
| 153 | dnl Under Lynx/OS 2.3, we have to link with -lbsd to resolve |
| 154 | dnl gethostbyname, inet_addr, htons etc. Check if it's necessary. |
| 155 | dnl NOTE: Did not want to use AC_SEARCH_LIBS which would add |
| 156 | dnl -lbsd to LIBS. We set INET_LIB instead. |
| 157 | AC_LANG_SAVE |
| 158 | AC_LANG_C |
| 159 | AC_CHECK_FUNC(gethostbyname,INET_LIB_REQ=,INET_LIB_REQ=yes) |
| 160 | if test "$INET_LIB_REQ" = yes; then |
| 161 | AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,INET_LIB=) |
| 162 | fi |
| 163 | AC_LANG_RESTORE |
| 164 | AC_SUBST(INET_LIB) |
| 165 | |
| 166 | AC_MSG_CHECKING(for socklen_t) |
| 167 | AC_TRY_COMPILE( |
| 168 | [#include <sys/types.h> |
| 169 | #include <sys/socket.h>], |
| 170 | [socklen_t x; |
| 171 | accept(0, 0, &x);], |
| 172 | AC_MSG_RESULT(yes) |
| 173 | SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=socklen_t', |
| 174 | AC_MSG_RESULT(using int) |
| 175 | SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=int') |
| 176 | AC_SUBST(SOCKLEN_T_DEFINE) |
| 177 | |
| 178 | AM_GNU_GETTEXT |
| 179 | |
| 180 | BOILERPLATE=boilerplate.mk |
| 181 | |
| 182 | if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then |
| 183 | if sh -c "vncmkdepend" >/dev/null 2>&1; then |
| 184 | BOILERPLATE="$BOILERPLATE:depend.mk" |
| 185 | fi |
| 186 | fi |
| 187 | |
| 188 | AC_OUTPUT(Makefile:Makefile.in:$BOILERPLATE intl/Makefile po/Makefile.in \ |
| 189 | rdr/Makefile:rdr/Makefile.in:$BOILERPLATE \ |
| 190 | network/Makefile:network/Makefile.in:$BOILERPLATE \ |
| 191 | Xregion/Makefile:Xregion/Makefile.in:$BOILERPLATE \ |
| 192 | rfb/Makefile:rfb/Makefile.in:$BOILERPLATE \ |
| 193 | tx/Makefile:tx/Makefile.in:$BOILERPLATE \ |
| 194 | x0vncserver/Makefile:x0vncserver/Makefile.in:$BOILERPLATE \ |
| 195 | vncviewer_unix/Makefile:vncviewer_unix/Makefile.in:$BOILERPLATE \ |
| 196 | vncconfig_unix/Makefile:vncconfig_unix/Makefile.in:$BOILERPLATE \ |
| 197 | vncpasswd/Makefile:vncpasswd/Makefile.in:$BOILERPLATE \ |
| 198 | ) |