| 1 |
# -*- Autoconf -*- |
| 2 |
# Process this file with autoconf to produce a configure script. |
| 3 |
|
| 4 |
AC_PREREQ([2.65]) |
| 5 |
AC_INIT([dss], [1.10.0], [http://redmine.digitalstrom.org]) |
| 6 |
AC_CONFIG_AUX_DIR(configure_aux) |
| 7 |
AC_CONFIG_SRCDIR([src/dss.cpp]) |
| 8 |
AC_CONFIG_HEADERS([config.h]) |
| 9 |
AC_CONFIG_MACRO_DIR([m4]) |
| 10 |
AM_INIT_AUTOMAKE([1.10 -Wall]) |
| 11 |
|
| 12 |
if test "x${prefix}" = "xNONE"; then |
| 13 |
prefix="${ac_default_prefix}" |
| 14 |
fi |
| 15 |
|
| 16 |
MT_SET_SEARCHPATH |
| 17 |
|
| 18 |
if test -n "$MT_SEARCHPATH_PKGCONFIG"; then |
| 19 |
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$MT_SEARCHPATH_PKGCONFIG |
| 20 |
fi |
| 21 |
|
| 22 |
if test -n "$MT_SEARCHPATH_PROGS"; then |
| 23 |
export PATH=$PATH:$MT_SEARCHPATH_PROGS |
| 24 |
fi |
| 25 |
|
| 26 |
MT_OPTION([debug], [enable], |
| 27 |
[enable debug flags during compilation], |
| 28 |
[ |
| 29 |
CFLAGS="-g -Wall -O0" |
| 30 |
CXXFLAGS="-g -Wall -O0" |
| 31 |
], |
| 32 |
[]) |
| 33 |
|
| 34 |
MT_OPTION([soap], [disable], |
| 35 |
[build dSS without SOAP support (default: enabled)], |
| 36 |
[],[]) |
| 37 |
|
| 38 |
MT_OPTION([curl], [disable], |
| 39 |
[build dSS without curl support (default: enabled)], |
| 40 |
[],[]) |
| 41 |
|
| 42 |
MT_OPTION([http], [enable], |
| 43 |
[build with HTTP support (default: HTTPS only)], |
| 44 |
[ |
| 45 |
AC_DEFINE([WITH_HTTP], [1], [ build with HTTP support ]) |
| 46 |
],[]) |
| 47 |
|
| 48 |
MT_OPTION([bonjour], [disable], |
| 49 |
[build with bonjour support (default: enabled)], |
| 50 |
[ |
| 51 |
AC_DEFINE([WITH_BONJOUR], [1], [ build with bonjour support ]) |
| 52 |
],[]) |
| 53 |
|
| 54 |
AC_ARG_WITH(dss-data, |
| 55 |
AC_HELP_STRING([--with-dss-data=DIR], [use DIR as dSS data directory]), |
| 56 |
[ |
| 57 |
if test "x$withval" != "x"; then |
| 58 |
AC_DEFINE([WITH_DATADIR], [1], [custom dSS data directory set]) |
| 59 |
AC_DEFINE_UNQUOTED([DSS_DATADIR], ["$withval"], [dSS data directory]) |
| 60 |
fi |
| 61 |
]) |
| 62 |
|
| 63 |
AC_ARG_WITH(dss-config, |
| 64 |
AC_HELP_STRING([--with-dss-config=DIR], [use DIR as dSS config directory]), |
| 65 |
[ |
| 66 |
if test "x$withval" != "x"; then |
| 67 |
AC_DEFINE([WITH_CONFIGDIR], [1], [custom dSS config directory set]) |
| 68 |
AC_DEFINE_UNQUOTED([DSS_CONFIGDIR], ["$withval"], [dSS data directory]) |
| 69 |
fi |
| 70 |
]) |
| 71 |
|
| 72 |
AC_ARG_WITH(dss-webroot, |
| 73 |
AC_HELP_STRING([--with-dss-webroot=DIR], [use DIR as dSS webroot directory]), |
| 74 |
[ |
| 75 |
if test "x$withval" != "x"; then |
| 76 |
AC_DEFINE([WITH_WEBROOTDIR], [1], [custom dSS webroot directory set]) |
| 77 |
AC_DEFINE_UNQUOTED([DSS_WEBROOTDIR], ["$withval"], [dSS webroot directory]) |
| 78 |
fi |
| 79 |
]) |
| 80 |
|
| 81 |
AC_ARG_WITH(dss-js-logs, |
| 82 |
AC_HELP_STRING([--with-dss-js-logs=DIR], [use DIR as dSS JavaScript logging directory]), |
| 83 |
[ |
| 84 |
if test "x$withval" != "x"; then |
| 85 |
AC_DEFINE([WITH_JSLOGDIR], [1], [custom dSS JavaScript logging directory set]) |
| 86 |
AC_DEFINE_UNQUOTED([DSS_JSLOGDIR], ["$withval"], [dSS JS log directory]) |
| 87 |
fi |
| 88 |
]) |
| 89 |
|
| 90 |
AC_ARG_WITH(dss-saved-properties, |
| 91 |
AC_HELP_STRING([--with-dss-saved-properties=DIR], [save dSS add-on script properties in DIR]), |
| 92 |
[ |
| 93 |
if test "x$withval" != "x"; then |
| 94 |
AC_DEFINE([WITH_SAVEDPROPSDIR], [1], [custom dSS savedprops directory set]) |
| 95 |
AC_DEFINE_UNQUOTED([DSS_SAVEDPROPSDIR], ["$withval"], [dSS savedprops directory]) |
| 96 |
fi |
| 97 |
]) |
| 98 |
|
| 99 |
AC_ARG_WITH(js-pkgconfig, |
| 100 |
AC_HELP_STRING([--with-js-pkgconfig=DIR], [search for libjs.pc or mozjs185.c in DIR]), |
| 101 |
[ |
| 102 |
if test "x$withval" != "x"; then |
| 103 |
AC_MSG_NOTICE([Will also search for packages in $withval]) |
| 104 |
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$withval |
| 105 |
fi |
| 106 |
]) |
| 107 |
|
| 108 |
|
| 109 |
SENDMAIL= |
| 110 |
AC_ARG_WITH(sendmail-location, |
| 111 |
AC_HELP_STRING([--with-sendmail-location=SENDMAIL], [hardcode location of sendmail binary, no checks will be performed (useful for cross compiling)]), |
| 112 |
[ |
| 113 |
if test "x$withval" != "x"; then |
| 114 |
AC_MSG_NOTICE([Hardcoding sendmail location to $withval]) |
| 115 |
SENDMAIL="$withval" |
| 116 |
AC_DEFINE([HAVE_SENDMAIL], [1], [sendmail program is available]) |
| 117 |
fi |
| 118 |
]) |
| 119 |
|
| 120 |
DISTR_VERSION_FILE= |
| 121 |
AC_ARG_WITH(distro-version-file, |
| 122 |
AC_HELP_STRING([--with-distro-version-file=FILENAME], [read distro version information from specified file (must be a a text file, first line will be interpreted as a distro version)]), |
| 123 |
[ |
| 124 |
if test "x$withval" != "x"; then |
| 125 |
AC_MSG_NOTICE([Will read distro version information from $withval]) |
| 126 |
DISTRO_VERSION_FILE="$withval" |
| 127 |
AC_DEFINE_UNQUOTED([DISTRO_VERSION_FILE], ["$withval"], [read distro version from here]) |
| 128 |
fi |
| 129 |
]) |
| 130 |
|
| 131 |
# Checks for programs. |
| 132 |
AC_PROG_CXX |
| 133 |
AC_PROG_CC |
| 134 |
AC_PROG_INSTALL |
| 135 |
AC_PROG_MAKE_SET |
| 136 |
AC_PROG_LIBTOOL |
| 137 |
AC_PROG_MKDIR_P |
| 138 |
|
| 139 |
# Checks for libraries. |
| 140 |
ACX_PTHREAD(,AC_MSG_ERROR(POSIX threads missing)) |
| 141 |
AC_SUBST(PTHREAD_CFLAGS) |
| 142 |
AC_SUBST(PTHREAD_LIBS) |
| 143 |
|
| 144 |
AC_LANG_CPLUSPLUS |
| 145 |
|
| 146 |
# Checks for header files. |
| 147 |
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h], [], [AC_MSG_ERROR([required system header not found])]) |
| 148 |
|
| 149 |
# Checks for typedefs, structures, and compiler characteristics. |
| 150 |
AC_HEADER_STDBOOL |
| 151 |
AC_C_INLINE |
| 152 |
AC_TYPE_INT32_T |
| 153 |
AC_TYPE_INT64_T |
| 154 |
AC_TYPE_OFF_T |
| 155 |
AC_TYPE_PID_T |
| 156 |
AC_TYPE_SIZE_T |
| 157 |
AC_TYPE_UINT16_T |
| 158 |
AC_TYPE_UINT32_T |
| 159 |
AC_TYPE_UINT64_T |
| 160 |
AC_TYPE_UINT8_T |
| 161 |
|
| 162 |
# Checks for library functions. |
| 163 |
AC_FUNC_FORK |
| 164 |
AC_FUNC_FSEEKO |
| 165 |
AC_FUNC_MALLOC |
| 166 |
AC_FUNC_MKTIME |
| 167 |
AC_FUNC_REALLOC |
| 168 |
AC_FUNC_STRTOD |
| 169 |
AC_CHECK_FUNCS(dup2 gethostbyname gettimeofday inet_ntoa localtime_r memchr memmove memset select setlocale socket strchr strcspn strdup strerror strrchr strspn strstr strtol strtoul iconv, [], |
| 170 |
[ AC_MSG_ERROR([required function not available]) ]) |
| 171 |
|
| 172 |
# Check for execinfo.h and backtrace |
| 173 |
AC_CHECK_HEADERS(execinfo.h, |
| 174 |
[ |
| 175 |
AC_CHECK_FUNCS(backtrace backtrace_symbols, |
| 176 |
[ |
| 177 |
BACKTRACE_LDFLAGS="-rdynamic" |
| 178 |
AC_SUBST(BACKTRACE_LDFLAGS) |
| 179 |
], |
| 180 |
[]) |
| 181 |
] |
| 182 |
[] |
| 183 |
) |
| 184 |
|
| 185 |
ASSUMED_BOOST_VER=146 |
| 186 |
|
| 187 |
BOOST_REQUIRE([1.46], |
| 188 |
[ |
| 189 |
unset boost_cv_version |
| 190 |
unset boost_cv_inc_path |
| 191 |
BOOST_REQUIRE([1.35], |
| 192 |
[ |
| 193 |
AC_MSG_ERROR([could not find boost on your system]) |
| 194 |
]) |
| 195 |
ASSUMED_BOOST_VER=135 |
| 196 |
]) |
| 197 |
|
| 198 |
if test $ASSUMED_BOOST_VER -eq 135; then |
| 199 |
AC_DEFINE([BOOST_VERSION_135], [1], [boost 1.35 or higher]) |
| 200 |
else |
| 201 |
AC_DEFINE([BOOST_VERSION_146], [1], [boost 1.46 or higher]) |
| 202 |
fi |
| 203 |
|
| 204 |
BOOST_ASIO |
| 205 |
BOOST_BIND |
| 206 |
BOOST_FOREACH |
| 207 |
BOOST_FUNCTION |
| 208 |
BOOST_LAMBDA |
| 209 |
BOOST_SMART_PTR |
| 210 |
BOOST_TUPLE |
| 211 |
|
| 212 |
BOOST_THREADS([mt-]) |
| 213 |
BOOST_FILESYSTEM([mt-]) |
| 214 |
BOOST_SYSTEM([mt-]) |
| 215 |
BOOST_PROGRAM_OPTIONS([mt-]) |
| 216 |
BOOST_TEST([mt-]) |
| 217 |
|
| 218 |
PKG_PROG_PKG_CONFIG |
| 219 |
PKG_CHECK_MODULES([JS], [libjs >= 1.8.5], [], |
| 220 |
[ |
| 221 |
AC_MSG_WARN([$JS_PKG_ERRORS]) |
| 222 |
AC_MSG_NOTICE([could not find libjs, trying to find mozjs185]) |
| 223 |
PKG_CHECK_MODULES([JS], [mozjs185],[], |
| 224 |
[ |
| 225 |
echo |
| 226 |
echo "Could not find SpiderMonkey JavaScript library version 1.8.5!" |
| 227 |
echo "Please install the SpiderMonkey development package for your distribution!" |
| 228 |
echo "It's called js-devel for Fedora or libmozjs185-dev for Ubuntu." |
| 229 |
echo "If no package is available for your distribution you can compile libjs from" |
| 230 |
echo "source. The tarball should be available here:" |
| 231 |
echo |
| 232 |
echo "http://ftp.mozilla.org/pub/mozilla.org/js/" |
| 233 |
echo |
| 234 |
echo "If you installed SpiderMonkey manually in a non standard location you can point" |
| 235 |
echo "configure to the directory that is holding your libjs.pc or mozjs185.pc" |
| 236 |
echo "pkg-config files using the --with-js-pkgconfig=/path/ option or by setting the" |
| 237 |
echo "PKG_CONFIG_PATH environment variable prior to running configure." |
| 238 |
echo |
| 239 |
AC_MSG_ERROR([$JS_PKG_ERRORS]) |
| 240 |
]) |
| 241 |
]) |
| 242 |
|
| 243 |
|
| 244 |
PKG_CHECK_MODULES([ICAL], [libical], [], |
| 245 |
[ |
| 246 |
AC_MSG_ERROR([$ICAL_PKG_ERRORS]) |
| 247 |
]) |
| 248 |
|
| 249 |
CFLAGS_SAVE="$CFLAGS" |
| 250 |
CXXFLAGS_SAVE="$CXXFLAGS" |
| 251 |
CFLAGS="$CFLAGS $ICAL_CFLAGS" |
| 252 |
CXXFLAGS="$CXXFLAGS $ICAL_CFLAGS" |
| 253 |
|
| 254 |
AC_CHECK_HEADERS([libical/ical.h], [], |
| 255 |
[ |
| 256 |
AC_CHECK_HEADERS([ical.h], [], |
| 257 |
[ |
| 258 |
AC_MSG_ERROR([Could not find required ical.h header!]) |
| 259 |
]) |
| 260 |
]) |
| 261 |
|
| 262 |
CFLAGS="$CFLAGS_SAVE" |
| 263 |
CXXFLAGS="$CXXFLAGS_SAVE" |
| 264 |
|
| 265 |
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [], |
| 266 |
[ |
| 267 |
AC_MSG_ERROR([$LIBXML2_PKG_ERRORS]) |
| 268 |
]) |
| 269 |
|
| 270 |
PKG_CHECK_MODULES([OPENSSL], [openssl], [], |
| 271 |
[ |
| 272 |
AC_MSG_ERROR([$OPENSSL_PKG_ERRORS]) |
| 273 |
]) |
| 274 |
|
| 275 |
PKG_CHECK_MODULES([AVAHI], [avahi-client], |
| 276 |
[ |
| 277 |
AC_DEFINE([HAVE_AVAHI], [1], [avahi support available]) |
| 278 |
], |
| 279 |
[ |
| 280 |
AC_MSG_ERROR([$AVAHI_PKG_ERRORS]) |
| 281 |
]) |
| 282 |
|
| 283 |
PKG_CHECK_MODULES([LIBRRD], [librrd], [], |
| 284 |
[ |
| 285 |
AC_MSG_ERROR([$LIBRRD_PKG_ERRORS]) |
| 286 |
]) |
| 287 |
|
| 288 |
MT_CHECK_REQUIRED_PACKAGE([libdsm-api], [digitalSTROM/dsm-api-v2/dsm-api], |
| 289 |
[dsm-api-v2], [DsmApiOpen], [-lds485-client]) |
| 290 |
|
| 291 |
MT_CHECK_REQUIRED_PACKAGE([expat], [expat], [expat], [XML_ParserCreate]) |
| 292 |
|
| 293 |
if test "x$SOAP_OPTION_ENABLED" = "xyes"; then |
| 294 |
PKG_CHECK_MODULES([GSOAP], [gsoapssl++], [], |
| 295 |
[ |
| 296 |
AC_MSG_ERROR([$GSOAP_PKG_ERRORS]) |
| 297 |
]) |
| 298 |
|
| 299 |
AC_PATH_PROG(GSOAP_SOAPCPP2, soapcpp2, no) |
| 300 |
if test "x$GSOAP_SOAPCPP2" = xno; then |
| 301 |
AC_MSG_ERROR([soapcpp2 utility not found]) |
| 302 |
fi |
| 303 |
AC_SUBST(GSOAP_SOAPCPP2) |
| 304 |
|
| 305 |
GSOAP_IMPORT_DIR= |
| 306 |
AC_ARG_WITH(gsoap-import, |
| 307 |
AC_HELP_STRING([--with-gsoap-import=DIR], [search for gSOAP import headers in DIR]), |
| 308 |
[ |
| 309 |
if test "x$withval" != "x"; then |
| 310 |
if (test -d "$withval") && (test -f "$withval/wsa.h") ; then |
| 311 |
GSOAP_IMPORT_DIR="$withval" |
| 312 |
AC_MSG_NOTICE([gSOAP import headers path set to $withval]) |
| 313 |
else |
| 314 |
AC_MSG_ERROR([you specified $withval as gSOAP import header directory, but this path does not exist or does not contain valid headers!]) |
| 315 |
fi |
| 316 |
fi |
| 317 |
]) |
| 318 |
|
| 319 |
AC_MSG_CHECKING([for gSOAP import header directory]) |
| 320 |
if (test -z $GSOAP_IMPORT_DIR); then |
| 321 |
for GSPATH in /usr/share/gsoap/import \ |
| 322 |
/usr/local/share/gsoap/import \ |
| 323 |
/opt/local/share/gsoap/import ; do |
| 324 |
if (test -z $GSOAP_IMPORT_DIR) && (test -s $GSPATH/wsa.h); then |
| 325 |
GSOAP_IMPORT_DIR=$GSPATH |
| 326 |
fi |
| 327 |
done |
| 328 |
fi |
| 329 |
if (test -z $GSOAP_IMPORT_DIR); then |
| 330 |
AC_MSG_ERROR([could not find gSOAP import header directory]) |
| 331 |
fi |
| 332 |
|
| 333 |
AC_MSG_RESULT([$GSOAP_IMPORT_DIR]) |
| 334 |
AC_SUBST(GSOAP_IMPORT_DIR) |
| 335 |
AC_DEFINE([WITH_SOAP], [1], [ build with SOAP support ]) |
| 336 |
fi |
| 337 |
|
| 338 |
AM_CONDITIONAL(BUILD_SOAP, test "x$SOAP_OPTION_ENABLED" = "xyes") |
| 339 |
|
| 340 |
if test "x$CURL_OPTION_ENABLED" = "xyes"; then |
| 341 |
PKG_CHECK_MODULES([CURL], [libcurl], |
| 342 |
[ |
| 343 |
AC_DEFINE([HAVE_CURL], [1], [libcurl support available]) |
| 344 |
WITH_CURL=yes |
| 345 |
], |
| 346 |
[ |
| 347 |
AC_MSG_ERROR([$CURL_PKG_ERRORS]) |
| 348 |
]) |
| 349 |
AC_SUBST(HAVE_CURL) |
| 350 |
fi |
| 351 |
AM_CONDITIONAL(WITH_CURL, test "x$WITH_CURL" = "xyes") |
| 352 |
|
| 353 |
if test "x$SENDMAIL" = "x"; then |
| 354 |
AC_PATH_PROG(SENDMAIL, sendmail, no) |
| 355 |
if test "x$SENDMAIL" = "xno"; then |
| 356 |
SENDMAIL= |
| 357 |
else |
| 358 |
AC_DEFINE([HAVE_SENDMAIL], [1], [sendmail program is available]) |
| 359 |
fi |
| 360 |
fi |
| 361 |
AC_DEFINE_UNQUOTED([SENDMAIL], ["$SENDMAIL"], [location of the sendmail program]) |
| 362 |
|
| 363 |
AC_PATH_PROG(DOXYGEN, doxygen, no) |
| 364 |
if test "x$DOXYGEN" = "xno"; then |
| 365 |
DOXYGEN= |
| 366 |
fi |
| 367 |
|
| 368 |
AC_SUBST(DOXYGEN) |
| 369 |
AM_CONDITIONAL(HAVE_DOXYGEN, test -n "$DOXYGEN") |
| 370 |
|
| 371 |
eval PACKAGE_DATADIR="${datadir}/${PACKAGE}" |
| 372 |
eval PACKAGE_DATADIR="${PACKAGE_DATADIR}" |
| 373 |
AC_DEFINE_UNQUOTED(PACKAGE_DATADIR, "$PACKAGE_DATADIR", [data directory]) |
| 374 |
|
| 375 |
AC_DEFINE_UNQUOTED([DSS_VERSION], ["$VERSION"], [alias for dSS version define that is used in the code]) |
| 376 |
|
| 377 |
AC_DEFINE([HAVE_BUILD_INFO_H], [1], [currently we are always generating the build info header]) |
| 378 |
|
| 379 |
AC_DEFINE([USE_LIBXML], [1], [TODO: check why this is a define, libxml2 seems to be required anyway]) |
| 380 |
|
| 381 |
|
| 382 |
AC_CONFIG_FILES([ |
| 383 |
Makefile |
| 384 |
build/Makefile |
| 385 |
tools/Makefile |
| 386 |
data/Makefile |
| 387 |
]) |
| 388 |
|
| 389 |
AC_OUTPUT |