blob: 7bbce072e90c3fe77039a1620eec9cc963a25c96 [file] [log] [blame]
Constantin Kaplinsky0bb538b2006-05-30 06:05:33 +00001dnl Process this file with autoconf to produce a configure script.
2AC_INIT(rdr/InStream.h)
3
4dnl dirty hack to prevent use of -g in CFLAGS and CXXFLAGS
5ac_cv_prog_cc_g=no
6ac_cv_prog_cxx_g=no
7
8dnl Checks for programs.
9AC_PROG_CC
10AC_PROG_CXX
11AC_PROG_RANLIB
12AC_PROG_MAKE_SET
13AC_LANG_CPLUSPLUS
14
15case "`(uname -sr) 2>/dev/null`" in
16"SunOS 5"*)
17 SOLARIS=yes
18 ;;
19"Linux"*)
20 LINUX=yes
21 ;;
22"IRIX 6"*)
23 X_LIBS="-L/usr/lib32"
24 ;;
25"LynxOS 2"*)
26 SJLJ_EXCEPTIONS=yes
27 ;;
28esac
29
30dnl FIXME: Remove duplication between this script and ../unix/configure.in
31if test "$GCC" = yes; then
32 CFLAGS="$CFLAGS -Wall"
33 if test "$SOLARIS" = yes; then
34 CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wno-implicit-int"
35 fi
36fi
37if test "$GXX" = yes; then
38 CXXFLAGS="$CXXFLAGS -Wall"
39 if test "$SOLARIS" = yes; then
40 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive"
41 fi
42 if test "$SJLJ_EXCEPTIONS" = yes; then
43 CXXFLAGS="$CXXFLAGS -fsjlj-exceptions"
44 fi
45fi
46
47AC_PATH_XTRA
48
49AC_ARG_WITH(installed-zlib,
50[ --with-installed-zlib use the version of zlib which is installed on the
51 system instead of the one distributed with VNC])
52
53if test "$with_installed_zlib" = yes; then
54 echo "using installed zlib"
55 ZLIB_LIB=-lz
56else
57 ZLIB_DIR=zlib
58 ZLIB_INCLUDE='-I$(top_srcdir)/zlib'
59 ZLIB_LIB='$(top_srcdir)/zlib/libz.a'
60 echo "configuring zlib..."
61 (cd zlib; ./configure)
62 echo "...done configuring zlib"
63fi
64
65AC_SUBST(ZLIB_DIR)
66AC_SUBST(ZLIB_INCLUDE)
67AC_SUBST(ZLIB_LIB)
68
69AC_ARG_WITH(installed-jpeg,
70[ --with-installed-jpeg use the version of jpeg which is installed on the
71 system instead of the one distributed with VNC])
72
73if test "$with_installed_jpeg" = yes; then
74 echo "using installed jpeg"
75 JPEG_LIB=-ljpeg
76else
77 JPEG_DIR=jpeg/build
78 JPEG_INCLUDE='-I$(top_srcdir)/jpeg'
79 JPEG_LIB='$(top_srcdir)/jpeg/build/libjpeg.a'
80 echo "configuring jpeg..."
81 (mkdir jpeg/build; cd jpeg/build; ../configure)
82 echo "...done configuring jpeg"
83fi
84
85AC_SUBST(JPEG_DIR)
86AC_SUBST(JPEG_INCLUDE)
87AC_SUBST(JPEG_LIB)
88
89AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=)
90AC_SUBST(VSNPRINTF_DEFINE)
91
92AC_CHECK_FUNC(strcasecmp,STRCASECMP_DEFINE='-DHAVE_STRCASECMP',
93 STRCASECMP_DEFINE=)
94AC_SUBST(STRCASECMP_DEFINE)
95
96AC_CHECK_FUNC(strncasecmp,STRNCASECMP_DEFINE='-DHAVE_STRNCASECMP',
97 STRNCASECMP_DEFINE=)
98AC_SUBST(STRNCASECMP_DEFINE)
99
100dnl Under Lynx/OS 2.3, we have to link with -lbsd to resolve
101dnl gethostbyname, inet_addr, htons etc. Check if it's necessary.
102dnl NOTE: Did not want to use AC_SEARCH_LIBS which would add
103dnl -lbsd to LIBS. We set INET_LIB instead.
104AC_LANG_SAVE
105AC_LANG_C
106AC_CHECK_FUNC(gethostbyname,INET_LIB_REQ=,INET_LIB_REQ=yes)
107if test "$INET_LIB_REQ" = yes; then
108 AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,INET_LIB=)
109fi
110AC_LANG_RESTORE
111AC_SUBST(INET_LIB)
112
113AC_MSG_CHECKING(for socklen_t)
114AC_TRY_COMPILE(
115[#include <sys/types.h>
116 #include <sys/socket.h>],
117[socklen_t x;
118accept(0, 0, &x);],
119AC_MSG_RESULT(yes)
120SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=socklen_t',
121AC_MSG_RESULT(using int)
122SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=int')
123AC_SUBST(SOCKLEN_T_DEFINE)
124
125BOILERPLATE=boilerplate.mk
126
127if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then
128 if sh -c "vncmkdepend" >/dev/null 2>&1; then
129 BOILERPLATE="$BOILERPLATE:depend.mk"
130 fi
131fi
132
133AC_OUTPUT(Makefile:Makefile.in:$BOILERPLATE \
134 rdr/Makefile:rdr/Makefile.in:$BOILERPLATE \
135 network/Makefile:network/Makefile.in:$BOILERPLATE \
136 Xregion/Makefile:Xregion/Makefile.in:$BOILERPLATE \
137 rfb/Makefile:rfb/Makefile.in:$BOILERPLATE \
138)