blob: 9b58f275ce733d30afd0751887a4e0be30c5444e [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001dnl Process this file with autoconf to produce a configure script.
Constantin Kaplinskyd6ac3722006-04-17 10:06:52 +00002AC_INIT(vncviewer_unix/vncviewer.cxx)
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00003
Peter Åstrand5a15f8c2005-01-23 20:44:20 +00004PACKAGE=tightvnc
5VERSION=1.5.0
6AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
7AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
8AC_SUBST(PACKAGE)
9AC_SUBST(VERSION)
10
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000011dnl dirty hack to prevent use of -g in CFLAGS and CXXFLAGS
12ac_cv_prog_cc_g=no
13ac_cv_prog_cxx_g=no
14
15dnl Checks for programs.
16AC_PROG_CC
17AC_PROG_CXX
18AC_PROG_RANLIB
19AC_PROG_MAKE_SET
20AC_LANG_CPLUSPLUS
21
22case "`(uname -sr) 2>/dev/null`" in
23"SunOS 5"*)
24 SOLARIS=yes
25 USE_MITSHM=yes
Constantin Kaplinskyd397b772005-09-09 12:17:32 +000026 USE_SUN_OVL=yes
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000027 ;;
28"Linux"*)
29 LINUX=yes
30 USE_MITSHM=yes
31 ;;
Constantin Kaplinskyd397b772005-09-09 12:17:32 +000032"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 ;;
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000040esac
41
Constantin Kaplinskyd397b772005-09-09 12:17:32 +000042dnl FIXME: Check for MIT-SHM properly, add a corresponding --with option.
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000043if test "$USE_MITSHM" = yes; then
Constantin Kaplinskyd397b772005-09-09 12:17:32 +000044 MITSHM_DEFINE="-DHAVE_MITSHM"
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000045fi
Constantin Kaplinskyd397b772005-09-09 12:17:32 +000046AC_SUBST(MITSHM_DEFINE)
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000047
48if 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
53fi
54if test "$GXX" = yes; then
55 CXXFLAGS="$CXXFLAGS -Wall"
56 if test "$SOLARIS" = yes; then
Constantin Kaplinskyd397b772005-09-09 12:17:32 +000057 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive"
58 fi
59 if test "$SJLJ_EXCEPTIONS" = yes; then
60 CXXFLAGS="$CXXFLAGS -fsjlj-exceptions"
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000061 fi
62fi
63
64AC_PATH_XTRA
65
66AC_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
70if test "$with_installed_zlib" = yes; then
71 echo "using installed zlib"
72 ZLIB_LIB=-lz
73else
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"
80fi
81
82AC_SUBST(ZLIB_DIR)
83AC_SUBST(ZLIB_INCLUDE)
84AC_SUBST(ZLIB_LIB)
85
Peter Åstrandd29243d2004-11-16 13:36:36 +000086AC_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
90if test "$with_installed_jpeg" = yes; then
91 echo "using installed jpeg"
92 JPEG_LIB=-ljpeg
93else
Peter Åstrand5135eea2005-01-24 13:47:38 +000094 JPEG_DIR=jpeg/build
Peter Åstrandd29243d2004-11-16 13:36:36 +000095 JPEG_INCLUDE='-I$(top_srcdir)/jpeg'
Peter Åstrand1c6ad922005-01-25 08:21:20 +000096 JPEG_LIB='$(top_srcdir)/jpeg/build/libjpeg.a'
Peter Åstrandd29243d2004-11-16 13:36:36 +000097 echo "configuring jpeg..."
Peter Åstrand5135eea2005-01-24 13:47:38 +000098 (mkdir jpeg/build; cd jpeg/build; ../configure)
Peter Åstrandd29243d2004-11-16 13:36:36 +000099 echo "...done configuring jpeg"
100fi
101
102AC_SUBST(JPEG_DIR)
103AC_SUBST(JPEG_INCLUDE)
104AC_SUBST(JPEG_LIB)
105
Constantin Kaplinskyd397b772005-09-09 12:17:32 +0000106AC_ARG_ENABLE(vncconfig,
107[ --enable-vncconfig build the vncconfig utility (assumed by default),
108 use --disable-vncconfig to skip building vncconfig])
109if test "$enable_vncconfig" = no; then
110 echo "vncconfig utility will not be built"
111 VNCCONFIG_DIR=
112else
113 VNCCONFIG_DIR='vncconfig_unix'
114fi
115AC_SUBST(VNCCONFIG_DIR)
116
117dnl Check for the XTest X11 extension library.
118AC_CHECK_LIB(Xtst,XTestGrabControl,USE_XTEST=yes,USE_XTEST=,
119["$X_LIBS" -lXext -lX11])
120if test "$USE_XTEST" = yes; then
121 XTEST_DEFINE='-DHAVE_XTEST'
122 XTEST_LIB=-lXtst
123else
124 echo Warning: No XTest extension, building x0vncserver view-only
125 XTEST_DEFINE=
126 XTEST_LIB=
127fi
128AC_SUBST(XTEST_DEFINE)
129AC_SUBST(XTEST_LIB)
130
131dnl Support for READDISPLAY (Irix) and SUN_OVL (Solaris) extensions
132dnl FIXME: Implement corresponding --with options.
133if test "$USE_READDISPLAY" = yes; then
134 READDISPLAY_DEFINE='-DHAVE_READDISPLAY'
135elif test "$USE_SUN_OVL" = yes; then
136 READDISPLAY_DEFINE='-DHAVE_SUN_OVL'
137else
138 READDISPLAY_DEFINE=
139fi
140AC_SUBST(READDISPLAY_DEFINE)
141
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +0000142AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=)
143AC_SUBST(VSNPRINTF_DEFINE)
144
Constantin Kaplinskyd397b772005-09-09 12:17:32 +0000145AC_CHECK_FUNC(strcasecmp,STRCASECMP_DEFINE='-DHAVE_STRCASECMP',
146 STRCASECMP_DEFINE=)
147AC_SUBST(STRCASECMP_DEFINE)
148
149AC_CHECK_FUNC(strncasecmp,STRNCASECMP_DEFINE='-DHAVE_STRNCASECMP',
150 STRNCASECMP_DEFINE=)
151AC_SUBST(STRNCASECMP_DEFINE)
152
153dnl Under Lynx/OS 2.3, we have to link with -lbsd to resolve
154dnl gethostbyname, inet_addr, htons etc. Check if it's necessary.
155dnl NOTE: Did not want to use AC_SEARCH_LIBS which would add
156dnl -lbsd to LIBS. We set INET_LIB instead.
157AC_LANG_SAVE
158AC_LANG_C
159AC_CHECK_FUNC(gethostbyname,INET_LIB_REQ=,INET_LIB_REQ=yes)
160if test "$INET_LIB_REQ" = yes; then
161 AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,INET_LIB=)
162fi
163AC_LANG_RESTORE
164AC_SUBST(INET_LIB)
165
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +0000166AC_MSG_CHECKING(for socklen_t)
167AC_TRY_COMPILE(
168[#include <sys/types.h>
169 #include <sys/socket.h>],
170[socklen_t x;
171accept(0, 0, &x);],
172AC_MSG_RESULT(yes)
173SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=socklen_t',
174AC_MSG_RESULT(using int)
175SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=int')
176AC_SUBST(SOCKLEN_T_DEFINE)
177
Peter Åstrand5a15f8c2005-01-23 20:44:20 +0000178AM_GNU_GETTEXT
179
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +0000180BOILERPLATE=boilerplate.mk
181
182if (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
186fi
187
Peter Åstrand5a15f8c2005-01-23 20:44:20 +0000188AC_OUTPUT(Makefile:Makefile.in:$BOILERPLATE intl/Makefile po/Makefile.in \
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +0000189 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 \
Peter Åstrandbeb8e202004-11-16 13:27:13 +0000195 vncviewer_unix/Makefile:vncviewer_unix/Makefile.in:$BOILERPLATE \
196 vncconfig_unix/Makefile:vncconfig_unix/Makefile.in:$BOILERPLATE \
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +0000197 vncpasswd/Makefile:vncpasswd/Makefile.in:$BOILERPLATE \
198)