aboutsummaryrefslogtreecommitdiffstats
path: root/common/configure.ac
blob: 096fe7dfbb62edbdc883532afc7ae402911c4bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([librfb], [1.5.0a1], [http://www.tightvnc.com/bugs.html])

AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_LANG([C++])

case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
  SOLARIS=yes
  ;;
"Linux"*)
  LINUX=yes
  ;;
"IRIX 6"*)
  X_LIBS="-L/usr/lib32"
  ;;
"LynxOS 2"*)
  SJLJ_EXCEPTIONS=yes
  ;;
esac

dnl FIXME: Remove duplication between this script and ../unix/configure.in
if test "$GCC" = yes; then
  CFLAGS="$CFLAGS -Wall"
  if test "$SOLARIS" = yes; then
    CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wno-implicit-int"
  fi
fi
if test "$GXX" = yes; then
  CXXFLAGS="$CXXFLAGS -Wall"
  if test "$SOLARIS" = yes; then
    CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -fpermissive"
  fi
  if test "$SJLJ_EXCEPTIONS" = yes; then
    CXXFLAGS="$CXXFLAGS -fsjlj-exceptions"
  fi
fi

dnl Checks for IRIX-specific Compression Library.
AC_CHECK_LIB(cl, clQuerySchemeFromName,
  [AC_DEFINE(HAVE_CL)
  IRIX_COMPRESS=yes
  LIBS="$LIBS -lcl"])
AM_CONDITIONAL([IRIX_COMPRESS], [ test "x$IRIX_COMPRESS" = xyes ])

dnl Checks for IRIX-specific Digital Media libraries.
AC_CHECK_LIB(dmedia, dmICCreate,
  [AC_DEFINE(HAVE_DMEDIA)
  IRIX_MEDIA=yes
  LIBS="$LIBS -ldmedia"])
AM_CONDITIONAL([IRIX_MEDIA], [ test "x$IRIX_MEDIA" = xyes ])

AC_ARG_WITH([tight-zlib],
	AS_HELP_STRING([--with-tight-zlib],
		       [use libz which is distributed with VNC]),
	[], [with_tight_zlib='no'])

if test "x$with_tight_zlib" = xno; then
	AC_SEARCH_LIBS([inflateEnd], [z],
		[ZLIB_LIB='-lz'],
		[ZLIB_DIR=zlib
		 ZLIB_INCLUDE='-I$(top_srcdir)/zlib'
		 ZLIB_LIB='$(top_srcdir)/zlib/libz.la'])
else
	ZLIB_DIR=zlib
	ZLIB_INCLUDE='-I$(top_srcdir)/zlib'
	ZLIB_LIB='$(top_srcdir)/zlib/libz.la'
fi

AC_SUBST(ZLIB_DIR)
AC_SUBST(ZLIB_INCLUDE)
AC_SUBST(ZLIB_LIB)

AC_CONFIG_SUBDIRS([zlib])

AC_ARG_WITH([tight-jpeg],
	AS_HELP_STRING([--with-tight-jpeg], 
		       [use libjpeg which is distributed with VNC]),
	[], [with_tight_jpeg='no'])

if test "x$with_tight_jpeg" = xno; then
  AC_SEARCH_LIBS([jpeg_destroy_compress], [jpeg],
	[JPEG_LIB='-ljpeg'],
	[JPEG_DIR=jpeg
	 JPEG_INCLUDE='-I$(top_srcdir)/jpeg'
	 JPEG_LIB='$(top_srcdir)/jpeg/libjpeg.la'])
else
	JPEG_DIR=jpeg
	JPEG_INCLUDE='-I$(top_srcdir)/jpeg'
	JPEG_LIB='$(top_srcdir)/jpeg/libjpeg.la'
fi

AC_CONFIG_SUBDIRS([jpeg])

AC_SUBST(JPEG_DIR)
AC_SUBST(JPEG_INCLUDE)
AC_SUBST(JPEG_LIB)

AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=)
AC_SUBST(VSNPRINTF_DEFINE)

AC_CHECK_FUNC(strcasecmp,STRCASECMP_DEFINE='-DHAVE_STRCASECMP',
  STRCASECMP_DEFINE=)
AC_SUBST(STRCASECMP_DEFINE)

AC_CHECK_FUNC(strncasecmp,STRNCASECMP_DEFINE='-DHAVE_STRNCASECMP',
  STRNCASECMP_DEFINE=)
AC_SUBST(STRNCASECMP_DEFINE)

AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE(
[#include <sys/types.h>
 #include <sys/socket.h>],
[socklen_t x;
accept(0, 0, &x);],
AC_MSG_RESULT(yes)
SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=socklen_t',
AC_MSG_RESULT(using int)
SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=int')
AC_SUBST(SOCKLEN_T_DEFINE)

AC_OUTPUT([Makefile
	   rdr/Makefile
	   network/Makefile
	   Xregion/Makefile
	   rfb/Makefile])