blob: 9b58f275ce733d30afd0751887a4e0be30c5444e [file] [log] [blame]
Constantin Kaplinskyb30ae7f2006-05-25 05:04:46 +00001dnl Process this file with autoconf to produce a configure script.
2AC_INIT(vncviewer_unix/vncviewer.cxx)
3
4PACKAGE=tightvnc
5VERSION=1.5.0
6AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
7AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
8AC_SUBST(PACKAGE)
9AC_SUBST(VERSION)
10
11dnl 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
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 ;;
40esac
41
42dnl FIXME: Check for MIT-SHM properly, add a corresponding --with option.
43if test "$USE_MITSHM" = yes; then
44 MITSHM_DEFINE="-DHAVE_MITSHM"
45fi
46AC_SUBST(MITSHM_DEFINE)
47
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
57 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive"
58 fi
59 if test "$SJLJ_EXCEPTIONS" = yes; then
60 CXXFLAGS="$CXXFLAGS -fsjlj-exceptions"
61 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
86AC_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
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"
100fi
101
102AC_SUBST(JPEG_DIR)
103AC_SUBST(JPEG_INCLUDE)
104AC_SUBST(JPEG_LIB)
105
106AC_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
142AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=)
143AC_SUBST(VSNPRINTF_DEFINE)
144
145AC_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
166AC_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
178AM_GNU_GETTEXT
179
180BOILERPLATE=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
188AC_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)