[2749] | 1 | dnl synergy -- mouse and keyboard sharing utility
|
---|
| 2 | dnl Copyright (C) 2002 Chris Schoeneman
|
---|
| 3 | dnl
|
---|
| 4 | dnl This package is free software; you can redistribute it and/or
|
---|
| 5 | dnl modify it under the terms of the GNU General Public License
|
---|
| 6 | dnl found in the file COPYING that should have accompanied this file.
|
---|
| 7 | dnl
|
---|
| 8 | dnl This package is distributed in the hope that it will be useful,
|
---|
| 9 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 10 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 11 | dnl GNU General Public License for more details.
|
---|
| 12 |
|
---|
| 13 | dnl Process this file with autoconf to produce a configure script.
|
---|
| 14 |
|
---|
| 15 | dnl initialize
|
---|
| 16 | AC_INIT(lib/common/common.h)
|
---|
| 17 | AC_CONFIG_AUX_DIR(config)
|
---|
| 18 |
|
---|
| 19 | dnl current version, extracted from $srcdir/lib/common/Version.h
|
---|
| 20 | MAJOR_VERSION=`grep '#.*define VERSION "' $srcdir/lib/common/Version.h | sed -e 's/.*"\([0-9]*\)\.[0-9]*\.[0-9]*".*/\1/'`
|
---|
| 21 | MINOR_VERSION=`grep '#.*define VERSION "' $srcdir/lib/common/Version.h | sed -e 's/.*"[0-9]*\.\([0-9]*\)\.[0-9]*".*/\1/'`
|
---|
| 22 | RELEASE_VERSION=`grep '#.*define VERSION "' $srcdir/lib/common/Version.h | sed -e 's/.*"[0-9]*\.[0-9]*\.\([0-9]*\)".*/\1/'`
|
---|
| 23 |
|
---|
| 24 | dnl initialize automake
|
---|
| 25 | AM_INIT_AUTOMAKE(synergy, $MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION)
|
---|
| 26 | AM_CONFIG_HEADER(config.h)
|
---|
| 27 |
|
---|
| 28 | dnl information on the package
|
---|
| 29 |
|
---|
| 30 | dnl decide on platform
|
---|
| 31 | ARCH_LIBS=""
|
---|
| 32 | ARCH_CFLAGS=""
|
---|
| 33 | AC_CANONICAL_HOST
|
---|
| 34 | case $host in
|
---|
| 35 | *-*-mingw32* | *-*-windows*)
|
---|
| 36 | acx_host_arch="WIN32"
|
---|
| 37 | acx_host_winapi="MSWINDOWS"
|
---|
| 38 | ;;
|
---|
| 39 | *-*-darwin*)
|
---|
| 40 | acx_host_arch="UNIX"
|
---|
| 41 | acx_host_winapi="CARBON"
|
---|
| 42 | ;;
|
---|
| 43 | *)
|
---|
| 44 | acx_host_arch="UNIX"
|
---|
| 45 | acx_host_winapi="XWINDOWS"
|
---|
| 46 | ;;
|
---|
| 47 | esac
|
---|
| 48 | ARCH_CFLAGS="$ARCH_CFLAGS -DSYSAPI_$acx_host_arch=1 -DWINAPI_$acx_host_winapi=1"
|
---|
| 49 | AM_CONDITIONAL(WIN32, test x$acx_host_arch = xWIN32)
|
---|
| 50 | AM_CONDITIONAL(UNIX, test x$acx_host_arch = xUNIX)
|
---|
| 51 | AM_CONDITIONAL(MSWINDOWS, test x$acx_host_winapi = xMSWINDOWS)
|
---|
| 52 | AM_CONDITIONAL(CARBON, test x$acx_host_winapi = xCARBON)
|
---|
| 53 | AM_CONDITIONAL(XWINDOWS, test x$acx_host_winapi = xXWINDOWS)
|
---|
| 54 |
|
---|
| 55 | dnl checks for programs
|
---|
| 56 | AC_PROG_CC
|
---|
| 57 | AC_PROG_CXX
|
---|
| 58 | AC_PROG_RANLIB
|
---|
| 59 | AC_CHECK_PROG(HAVE_DOT, dot, YES, NO)
|
---|
| 60 |
|
---|
| 61 | dnl AC_PROG_OBJC doesn't exist. Borrow some ideas from KDE.
|
---|
| 62 | dnl AC_MSG_CHECKING(for an Objective-C compiler)
|
---|
| 63 | OBJC="${CC}"
|
---|
| 64 | OBJCFLAGS="${CFLAGS}"
|
---|
| 65 | AC_SUBST(OBJC)
|
---|
| 66 | AC_SUBST(OBJCFLAGS)
|
---|
| 67 | _AM_DEPENDENCIES(OBJC)
|
---|
| 68 |
|
---|
| 69 | dnl do checks using C++
|
---|
| 70 | AC_LANG_CPLUSPLUS
|
---|
| 71 |
|
---|
| 72 | dnl our files end in .cpp not .C so tests should also end in .cpp
|
---|
| 73 | ac_ext=cpp
|
---|
| 74 |
|
---|
| 75 | dnl enable debugging or disable asserts
|
---|
| 76 | AC_ARG_ENABLE([debug], [ --enable-debug enable debugging])
|
---|
| 77 | if test "x$enable_debug" != xno; then
|
---|
| 78 | CXXFLAGS="$CXXFLAGS -g"
|
---|
| 79 | else
|
---|
| 80 | CXXFLAGS="$CXXFLAGS -DNDEBUG"
|
---|
| 81 | fi
|
---|
| 82 |
|
---|
| 83 | dnl check compiler
|
---|
| 84 | ACX_CHECK_CXX
|
---|
| 85 |
|
---|
| 86 | dnl checks for libraries
|
---|
| 87 | if test x"$acx_host_arch" = xUNIX; then
|
---|
| 88 | ACX_PTHREAD(,AC_MSG_ERROR(You must have pthreads to compile synergy))
|
---|
| 89 | ARCH_LIBS="$PTHREAD_LIBS $ARCH_LIBS"
|
---|
| 90 | ARCH_CFLAGS="$ARCH_CFLAGS $PTHREAD_CFLAGS"
|
---|
| 91 | fi
|
---|
| 92 | if test x"$acx_host_winapi" = xCARBON; then
|
---|
| 93 | ARCH_LIBS="-framework Carbon $ARCH_LIBS"
|
---|
| 94 | fi
|
---|
| 95 | ACX_CHECK_NANOSLEEP
|
---|
| 96 | ACX_CHECK_INET_ATON
|
---|
| 97 |
|
---|
| 98 | dnl checks for header files
|
---|
| 99 | AC_HEADER_STDC
|
---|
| 100 | AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h locale.h wchar.h])
|
---|
| 101 | AC_CHECK_HEADERS([sys/socket.h sys/select.h])
|
---|
| 102 | AC_CHECK_HEADERS([sys/utsname.h])
|
---|
| 103 | AC_CHECK_HEADERS([istream ostream sstream])
|
---|
| 104 | AC_HEADER_TIME
|
---|
| 105 | if test x"$acx_host_winapi" = xXWINDOWS; then
|
---|
| 106 | AC_PATH_X
|
---|
| 107 | AC_PATH_XTRA
|
---|
| 108 | save_CPPFLAGS="$CPPFLAGS"
|
---|
| 109 | CPPFLAGS="$X_CFLAGS $CPPFLAGS"
|
---|
| 110 | XEXT_LDADD=
|
---|
| 111 |
|
---|
| 112 | AC_CHECK_LIB(Xtst,
|
---|
| 113 | XTestQueryExtension,
|
---|
| 114 | [XEXT_LDADD="$XEXT_LDADD -lXtst"],
|
---|
| 115 | AC_MSG_ERROR(You must have the XTest library to build synergy),
|
---|
| 116 | [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
|
---|
| 117 | AC_CHECK_HEADERS([X11/extensions/XTest.h],
|
---|
| 118 | ,
|
---|
| 119 | AC_MSG_ERROR(You must have the XTest headers to compile synergy))
|
---|
| 120 |
|
---|
| 121 | acx_have_xkb=no
|
---|
| 122 | AC_CHECK_LIB(X11,
|
---|
| 123 | XkbQueryExtension,
|
---|
| 124 | [acx_have_xkb=yes],
|
---|
| 125 | [acx_have_xkb=no],
|
---|
| 126 | [$X_LIBS $X_EXTRA_LIBS])
|
---|
| 127 | if test x"$acx_have_xkb" = xyes; then
|
---|
| 128 | AC_CHECK_HEADERS([X11/XKBlib.h X11/extensions/XKBstr.h],
|
---|
| 129 | [acx_have_xkb=yes],
|
---|
| 130 | [acx_have_xkb=no],
|
---|
| 131 | [#include <X11/Xlib.h>])
|
---|
| 132 | if test x"$acx_have_xkb" = xyes; then
|
---|
| 133 | AC_TRY_COMPILE([
|
---|
| 134 | #include <X11/Xlib.h>
|
---|
| 135 | #include <X11/XKBlib.h>
|
---|
| 136 | ],[
|
---|
| 137 | XkbQueryExtension(0, 0, 0, 0, 0, 0);
|
---|
| 138 | ],
|
---|
| 139 | [acx_have_xkb=yes],
|
---|
| 140 | [acx_have_xkb=no])
|
---|
| 141 | fi
|
---|
| 142 | fi
|
---|
| 143 | if test x"$acx_have_xkb" = xyes; then
|
---|
| 144 | AC_DEFINE(HAVE_XKB_EXTENSION, 1,
|
---|
| 145 | [Define this if the XKB extension is available.])
|
---|
| 146 | fi
|
---|
| 147 |
|
---|
| 148 | acx_have_xinerama=yes
|
---|
| 149 | AC_CHECK_LIB(Xinerama,
|
---|
| 150 | XineramaQueryExtension,
|
---|
| 151 | [acx_have_xinerama=yes],
|
---|
| 152 | [acx_have_xinerama=no],
|
---|
| 153 | [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
|
---|
| 154 | if test x"$acx_have_xinerama" = xyes; then
|
---|
| 155 | AC_CHECK_HEADERS([X11/extensions/Xinerama.h],
|
---|
| 156 | [acx_have_xinerama=yes],
|
---|
| 157 | [acx_have_xinerama=no],
|
---|
| 158 | [#include <X11/Xlib.h>])
|
---|
| 159 | fi
|
---|
| 160 | if test x"$acx_have_xinerama" = xyes; then
|
---|
| 161 | XEXT_LDADD="$XEXT_LDADD -lXinerama"
|
---|
| 162 | fi
|
---|
| 163 |
|
---|
| 164 | X_DPMS_LDADD=
|
---|
| 165 | acx_have_dpms=no
|
---|
| 166 | AC_CHECK_LIB(Xext,
|
---|
| 167 | DPMSQueryExtension,
|
---|
| 168 | [acx_have_dpms=yes],
|
---|
| 169 | [acx_have_dpms=no],
|
---|
| 170 | [$X_LIBS -lX11 $X_EXTRA_LIBS])
|
---|
| 171 | if test x"$acx_have_dpms" != xyes; then
|
---|
| 172 | AC_CHECK_LIB(Xdpms,
|
---|
| 173 | DPMSQueryExtension,
|
---|
| 174 | [acx_have_dpms=yes; XDPMS_LDADD=-lXdpms],
|
---|
| 175 | [acx_have_dpms=no],
|
---|
| 176 | [$X_LIBS -lX11 $X_EXTRA_LIBS])
|
---|
| 177 | fi
|
---|
| 178 | if test x"$acx_have_dpms" = xyes; then
|
---|
| 179 | AC_CHECK_HEADERS([X11/extensions/dpms.h],
|
---|
| 180 | [acx_have_dpms_h=yes],
|
---|
| 181 | [acx_have_dpms_h=no],
|
---|
| 182 | [#include <X11/Xlib.h>])
|
---|
| 183 | if test x"$acx_have_dpms_h" = xyes; then
|
---|
| 184 | XEXT_LDADD="$XEXT_LDADD $XDPMS_LDADD"
|
---|
| 185 | AC_MSG_CHECKING(for prototypes in X11/extensions/dpms.h)
|
---|
| 186 | acx_have_dpms_protos=no
|
---|
| 187 | AC_TRY_COMPILE([
|
---|
| 188 | #include <X11/Xlib.h>
|
---|
| 189 | extern "C" {
|
---|
| 190 | #include <X11/extensions/dpms.h>
|
---|
| 191 | }
|
---|
| 192 | ],[
|
---|
| 193 | int s = DPMSModeOn;
|
---|
| 194 | DPMSQueryExtension(0, 0, 0);
|
---|
| 195 | ],
|
---|
| 196 | [acx_have_dpms_protos=yes])
|
---|
| 197 | AC_MSG_RESULT($acx_have_dpms_protos)
|
---|
| 198 | if test x"$acx_have_dpms_protos" = xyes; then
|
---|
| 199 | AC_DEFINE(HAVE_DPMS_PROTOTYPES,1,[Define if the <X11/extensions/dpms.h> header file declares function prototypes.])
|
---|
| 200 | fi
|
---|
| 201 | fi
|
---|
| 202 | fi
|
---|
| 203 |
|
---|
| 204 | CPPFLAGS="$save_CPPFLAGS"
|
---|
| 205 | ARCH_LIBS="$X_LIBS $X_PRE_LIBS $XEXT_LDADD -lXext -lX11 $X_EXTRA_LIBS $ARCH_LIBS"
|
---|
| 206 | ARCH_CFLAGS="$ARCH_CFLAGS $X_CFLAGS"
|
---|
| 207 | fi
|
---|
| 208 |
|
---|
| 209 | dnl checks for types
|
---|
| 210 | AC_TYPE_SIZE_T
|
---|
| 211 | ACX_CHECK_SOCKLEN_T
|
---|
| 212 |
|
---|
| 213 | dnl checks for structures
|
---|
| 214 | AC_STRUCT_TM
|
---|
| 215 |
|
---|
| 216 | dnl checks for compiler characteristics
|
---|
| 217 | AC_CHECK_SIZEOF(char, 1)
|
---|
| 218 | AC_CHECK_SIZEOF(short, 2)
|
---|
| 219 | AC_CHECK_SIZEOF(int, 2)
|
---|
| 220 | AC_CHECK_SIZEOF(long, 4)
|
---|
| 221 | ACX_CHECK_CXX_BOOL(,AC_MSG_ERROR(Your compiler must support bool to compile synergy))
|
---|
| 222 | ACX_CHECK_CXX_EXCEPTIONS(,AC_MSG_ERROR(Your compiler must support exceptions to compile synergy))
|
---|
| 223 | ACX_CHECK_CXX_CASTS(,AC_MSG_ERROR(Your compiler must support C++ casts to compile synergy))
|
---|
| 224 | ACX_CHECK_CXX_MUTABLE(,AC_MSG_ERROR(Your compiler must support mutable to compile synergy))
|
---|
| 225 | ACX_CHECK_CXX_STDLIB(,AC_MSG_ERROR(Your compiler must support the C++ standard library to compile synergy))
|
---|
| 226 |
|
---|
| 227 | dnl checks for library functions
|
---|
| 228 | dnl AC_TYPE_SIGNAL
|
---|
| 229 | AC_FUNC_MEMCMP
|
---|
| 230 | AC_FUNC_STRFTIME
|
---|
| 231 | AC_CHECK_FUNCS(gmtime_r)
|
---|
| 232 | ACX_CHECK_GETPWUID_R
|
---|
| 233 | AC_CHECK_FUNCS(vsnprintf)
|
---|
| 234 | AC_FUNC_SELECT_ARGTYPES
|
---|
| 235 | ACX_CHECK_POLL
|
---|
| 236 | dnl use AC_REPLACE_FUNCS() for stuff in string.h
|
---|
| 237 |
|
---|
| 238 | dnl checks for system services
|
---|
| 239 |
|
---|
| 240 | dnl enable maximum compiler warnings and warnings are errors.
|
---|
| 241 | ACX_CXX_WARNINGS
|
---|
| 242 | ACX_CXX_WARNINGS_ARE_ERRORS
|
---|
| 243 |
|
---|
| 244 | dnl adjust compiler and linker variables
|
---|
| 245 | CXXFLAGS="$CXXFLAGS $SYNERGY_CXXFLAGS $ARCH_CFLAGS"
|
---|
| 246 | OBJCXXFLAGS="$OBJCXXFLAGS $CXXFLAGS $ARCH_CFLAGS"
|
---|
| 247 | LIBS="$NANOSLEEP_LIBS $INET_ATON_LIBS $ARCH_LIBS $LIBS"
|
---|
| 248 |
|
---|
| 249 | dnl we need to have an environment variable set when building on OS X.
|
---|
| 250 | dnl i'm not sure of the right way to do that. writing 'export ...' to
|
---|
| 251 | dnl the makefiles isn't portable. here we'll hijack XXXDEPMODE (where
|
---|
| 252 | dnl XXX depends on the language) to insert setting the environment
|
---|
| 253 | dnl variable when running the compiler. we'd like to put that in CC,
|
---|
| 254 | dnl CXX and OBJC but that breaks depcomp. let's hope this works.
|
---|
| 255 | if test x"$acx_host_winapi" = xCARBON; then
|
---|
| 256 | MACOSX_DEPLOYMENT_TARGET="10.2"
|
---|
| 257 | CCDEPMODE="MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $CCDEPMODE"
|
---|
| 258 | CXXDEPMODE="MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $CXXDEPMODE"
|
---|
| 259 | OBJCDEPMODE="MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $OBJCDEPMODE"
|
---|
| 260 | else
|
---|
| 261 | MACOSX_DEPLOYMENT_TARGET="5"
|
---|
| 262 | CXXDEPMODE="FOO=$MACOSX_DEPLOYMENT_TARGET $CXXDEPMODE"
|
---|
| 263 | fi
|
---|
| 264 |
|
---|
| 265 | AC_OUTPUT([
|
---|
| 266 | Makefile
|
---|
| 267 | cmd/Makefile
|
---|
| 268 | cmd/launcher/Makefile
|
---|
| 269 | cmd/synergyc/Makefile
|
---|
| 270 | cmd/synergys/Makefile
|
---|
| 271 | dist/Makefile
|
---|
| 272 | dist/nullsoft/Makefile
|
---|
| 273 | dist/rpm/Makefile
|
---|
| 274 | dist/rpm/synergy.spec
|
---|
| 275 | doc/Makefile
|
---|
| 276 | doc/doxygen.cfg
|
---|
| 277 | lib/Makefile
|
---|
| 278 | lib/arch/Makefile
|
---|
| 279 | lib/base/Makefile
|
---|
| 280 | lib/client/Makefile
|
---|
| 281 | lib/common/Makefile
|
---|
| 282 | lib/io/Makefile
|
---|
| 283 | lib/mt/Makefile
|
---|
| 284 | lib/net/Makefile
|
---|
| 285 | lib/platform/Makefile
|
---|
| 286 | lib/server/Makefile
|
---|
| 287 | lib/synergy/Makefile
|
---|
| 288 | ])
|
---|