blob: 1847bc79afd7014838f92fd99c4f544ff4286d37 [file] [log] [blame]
Adam Tkac8aee1a82009-09-04 12:08:56 +00001dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ([2.57])
3AC_INIT([tigervnc], [0.0.91], [http://www.tigervnc.org])
4AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
5
6AC_CONFIG_SUBDIRS([common/jpeg common/zlib])
7
8AC_CONFIG_HEADERS([config.h])
9
10dnl Checks for programs.
11AC_PROG_CC
12AC_PROG_CXX
13AC_PROG_LIBTOOL
14AC_LANG([C++])
15dnl AM_GNU_GETTEXT([external])
16dnl AM_GNU_GETTEXT_VERSION([0.14.1])
17
18case "`(uname -sr) 2>/dev/null`" in
19"SunOS 5"*)
20 SOLARIS=yes
21 USE_MITSHM=yes
22 USE_SUN_OVL=yes
23 ;;
24"IRIX 6"*)
25 LDFLAGS="-L/usr/lib32 $LDFLAGS"
26 USE_MITSHM=yes
27 USE_READDISPLAY=yes
28 ;;
29"LynxOS 2"*)
30 SJLJ_EXCEPTIONS=yes
31 ;;
32esac
33
34case "$host_os" in
35mingw*)
36 CPPFLAGS="$CPPFLAGS -DWINVER=0x0500 -D_WIN32_IE=0x0500"
37 CXXFLAGS="$CXXFLAGS -mthreads"
38 ;;
39esac
40
41dnl FIXME: Check for MIT-SHM properly, add a corresponding --with option.
42if test "$USE_MITSHM" = yes; then
43 MITSHM_DEFINE="-DHAVE_MITSHM"
44fi
45AC_SUBST(MITSHM_DEFINE)
46
47if test "$GCC" = yes; then
48 CFLAGS="$CFLAGS -Wall"
49 if test "$SOLARIS" = yes; then
50 CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wno-implicit-int"
51 fi
52fi
53if test "$GXX" = yes; then
54 CXXFLAGS="$CXXFLAGS -Wall"
55 if test "$SOLARIS" = yes; then
56 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive"
57 fi
58 if test "$SJLJ_EXCEPTIONS" = yes; then
59 CXXFLAGS="$CXXFLAGS -fsjlj-exceptions"
60 fi
61fi
62
63AC_PATH_XTRA
64
65VNCCONFIG_DIR='vncconfig'
66AC_ARG_ENABLE([vncconfig],
67 AS_HELP_STRING([--enable-vncconfig],
68 [build the vncconfig utility (default yes)]),
69 [if test "$enableval" = no; then VNCCONFIG_DIR=; fi ], [])
70AC_SUBST(VNCCONFIG_DIR)
71
72dnl Check for the XTest X11 extension library.
73AC_CHECK_LIB(Xtst,XTestGrabControl,USE_XTEST=yes,USE_XTEST=,
74 ["$X_LIBS" -lXext -lX11])
75if test "$USE_XTEST" = yes; then
76 XTEST_DEFINE='-DHAVE_XTEST'
77 XTEST_LIB=-lXtst
78else
79 echo Warning: No XTest extension, building x0vncserver view-only
80 XTEST_DEFINE=
81 XTEST_LIB=
82fi
83AC_SUBST(XTEST_DEFINE)
84AC_SUBST(XTEST_LIB)
85
86dnl Support for READDISPLAY (Irix) and SUN_OVL (Solaris) extensions
87dnl FIXME: Implement corresponding --with options.
88if test "$USE_READDISPLAY" = yes; then
89 READDISPLAY_DEFINE='-DHAVE_READDISPLAY'
90elif test "$USE_SUN_OVL" = yes; then
91 READDISPLAY_DEFINE='-DHAVE_SUN_OVL'
92else
93 READDISPLAY_DEFINE=
94fi
95AC_SUBST(READDISPLAY_DEFINE)
96
97dnl Under Lynx/OS 2.3, we have to link with -lbsd to resolve
98dnl gethostbyname, inet_addr, htons etc. Check if it's necessary.
99dnl NOTE: Did not want to use AC_SEARCH_LIBS which would add
100dnl -lbsd to LIBS. We set INET_LIB instead.
101AC_LANG_SAVE
102AC_LANG_C
103AC_CHECK_FUNC(gethostbyname,INET_LIB_REQ=,INET_LIB_REQ=yes)
104if test "$INET_LIB_REQ" = yes; then
105 AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,INET_LIB=)
106fi
107AC_LANG_RESTORE
108AC_SUBST(INET_LIB)
109
110dnl Check for zlib library
111INCLUDED_ZLIB=no
112AC_ARG_WITH([included-zlib],
113 AS_HELP_STRING([--with-included-zlib],
114 [use libz which is distributed with VNC]),
115 [INCLUDED_ZLIB=yes],
116 [AC_SEARCH_LIBS([inflateEnd], [z], [], [INCLUDED_ZLIB=yes])])
117
118AM_CONDITIONAL([INCLUDED_ZLIB], [ test "x$INCLUDED_ZLIB" = xyes ])
119AC_CONFIG_SUBDIRS([zlib])
120
121dnl Check for libjpeg library
122INCLUDED_JPEG=yes
123AC_ARG_WITH([system-jpeg],
124 AS_HELP_STRING([--with-system-jpeg],
125 [use libjpeg which is distributed with the O/S]),
126 [AC_SEARCH_LIBS([jpeg_destroy_compress], [jpeg],
127 [INCLUDED_JPEG=no], [])],
128 [])
129
130AM_CONDITIONAL([INCLUDED_JPEG], [ test "x$INCLUDED_JPEG" = xyes ])
131AC_CONFIG_SUBDIRS([jpeg])
132
133AC_CHECK_FUNCS([vsnprintf snprintf strcasecmp strncasecmp])
134
135# IPv6 related functions
136AC_CHECK_FUNCS([inet_ntop getaddrinfo])
137
138AC_CHECK_TYPES([socklen_t], [], [], [[#include <sys/socket.h>]])
139
140AC_CHECK_HEADERS([sys/select.h])
141
142AC_OUTPUT([
143Makefile
144common/Makefile
145common/os/Makefile
146common/rdr/Makefile
147common/network/Makefile
148common/Xregion/Makefile
149common/rfb/Makefile
150unix/Makefile
151unix/tx/Makefile
152unix/x0vncserver/Makefile
153unix/vncviewer/Makefile
154unix/vncconfig/Makefile
155unix/vncpasswd/Makefile
156])