1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3# 4# Copyright (c) 2009-2017, The Trusted Domain Project. All rights reserved. 5# 6 7# 8# Setup 9# 10AC_PREREQ(2.61) 11 12# 13# Package version 14# 15m4_define([VERSION_RELEASE], 1) 16m4_define([VERSION_MAJOR_REV], 0) 17m4_define([VERSION_MINOR_REV], 0) 18m4_define([VERSION_PATCH], 0) 19 20# 21# Library version 22# - bump "current" and reset "revision" with API changes 23# - bump "revision" with internal source code changes 24# 25m4_define([LIBVERSION_CURRENT], 0) 26m4_define([LIBVERSION_REVISION], 0) 27m4_define([LIBVERSION_AGE], 0) 28 29# 30# Autotools setup 31# 32AC_INIT([OpenARC], 33 [VERSION_RELEASE.VERSION_MAJOR_REV.VERSION_MINOR_REV], 34 [bugs@trusteddomain.org]) 35 36AC_CONFIG_AUX_DIR([build-aux]) 37AM_INIT_AUTOMAKE( 38 1.11.1 39 dnl Automake version before 1.13 (when the serial-tests option was 40 dnl still the default) still defined the badly obsolete macro 41 dnl 'AM_PROG_INSTALL'. 42 m4_ifndef([AM_PROG_INSTALL], [serial-tests]) 43) 44AC_CONFIG_HEADERS([build-config.h]) 45 46AC_CONFIG_MACRO_DIR([m4]) 47 48# 49# Hexadecimal version, for use in generating dkim.h 50# 51HEX_VERSION=$(printf %08x $(( ((VERSION_RELEASE << 8 | VERSION_MAJOR_REV) << 8 | VERSION_MINOR_REV) << 8| VERSION_PATCH ))) 52AC_SUBST([HEX_VERSION]) 53 54# 55# library version, passed to libtool 56# 57LIBOPENARC_VERSION_INFO=$(printf %d:%d:%d LIBVERSION_CURRENT LIBVERSION_REVISION LIBVERSION_AGE) 58AC_SUBST([LIBOPENARC_VERSION_INFO]) 59 60# 61# Checks for programs 62# 63AC_PROG_CC 64AC_PROG_CC_C99 65AM_PROG_CC_C_O 66AC_PROG_LIBTOOL 67 68PKG_PROG_PKG_CONFIG 69 70# 71# Check for how to compile threaded stuff 72# 73AX_PTHREAD 74 75# 76# save outer values 77# 78outer_CFLAGS="$CFLAGS" 79outer_CPPFLAGS="$CPPFLAGS" 80outer_LDFLAGS="$LDFLAGS" 81outer_LIBS="$LIBS" 82 83# 84# Checks for libraries 85# 86saved_LIBS="$LIBS" 87LIBS="" 88AC_SEARCH_LIBS(inet_addr, nsl) 89LIBNSL_LIBS="$LIBS" 90LIBS="$saved_LIBS" 91AC_SUBST([LIBNSL_LIBS]) 92 93saved_LIBS="$LIBS" 94LIBS="" 95AC_SEARCH_LIBS(dlopen, dl) 96LIBDL_LIBS="$LIBS" 97LIBS="$saved_LIBS" 98AC_SUBST([LIBDL_LIBS]) 99 100AC_SEARCH_LIBS(socket, socket) 101AC_SEARCH_LIBS(inet_aton, resolv) 102AC_SEARCH_LIBS(inet_pton, resolv, 103 AC_DEFINE(HAVE_INET_PTON, 1, 104 [Define to 1 if you have the `inet_pton()' function.])) 105AC_SEARCH_LIBS(inet_ntop, resolv nsl, 106 AC_DEFINE(HAVE_INET_NTOP, 1, 107 [Define to 1 if you have the `inet_ntop()' function.])) 108AC_SEARCH_LIBS(getaddrinfo, resolv, 109 AC_DEFINE(HAVE_GETADDRINFO, 1, 110 [Define to 1 if you have the `getaddrinfo()' function.])) 111AC_SEARCH_LIBS(res_ninit, resolv, 112 AC_DEFINE(HAVE_RES_NINIT, 1, 113 [Define to 1 if you have the `res_ninit()' function.])) 114AC_SEARCH_LIBS(res_sertservers, resolv bind, 115 AC_DEFINE(HAVE_RES_SETSERVERS, 1, 116 [Define to 1 if you have the `res_setservers()' function.])) 117AC_SEARCH_LIBS(getopt_long, iberty, 118 AC_DEFINE(HAVE_GETOPT_LONG, 1, 119 [Define to 1 if you have the `getopt_long()' function.])) 120 121AC_HEADER_RESOLV 122 123# 124# Check for types 125# 126 127AC_CHECK_TYPES([useconds_t]) 128 129# 130# See if libopenarc will need -lresolv 131# 132dnscheck=' 133#include "confdefs.h" 134#include <sys/types.h> 135#include <netinet/in.h> 136#include <arpa/nameser.h> 137#include <resolv.h> 138int main() { 139res_mkquery (0, 0, 0, 0, 0, 0, 0, 0, 0); 140dn_expand (0, 0, 0, 0, 0); 141dn_skipname (0, 0); 142dn_comp (0, 0, 0, 0, 0); 143return 0; 144}' 145AC_MSG_CHECKING([whether the resolver works without -lresolv]) 146LIBRESOLV= 147AC_LINK_IFELSE([AC_LANG_SOURCE([ 148$dnscheck 149])] , [ 150 AC_MSG_RESULT(yes) 151] , [ 152 AC_MSG_RESULT(no) 153 AC_MSG_CHECKING([whether the resolver works with -lresolv]) 154 saved_LIBS="$LIBS" 155 LIBS="$outer_LIBS -lresolv" 156 AC_LINK_IFELSE([AC_LANG_SOURCE([ 157$dnscheck 158 ])] , [ 159 AC_MSG_RESULT(yes) 160 LIBRESOLV=-lresolv 161 ] , [ 162 AC_MSG_RESULT(no) 163 AC_MSG_ERROR([need workable resolver library]) 164 ]) 165 LIBS="$saved_LIBS" 166]) 167AC_SUBST([LIBRESOLV]) 168 169# 170# Checks for header files 171# 172AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h iso/limits_iso.h netdb.h netinet/in.h paths.h stdlib.h string.h sys/file.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h stdint.h]) 173 174# 175# Checks for typedefs, structures, and compiler characteristics. 176# 177AC_HEADER_STDBOOL 178AC_TYPE_UID_T 179AC_TYPE_MODE_T 180AC_TYPE_OFF_T 181AC_TYPE_PID_T 182AC_TYPE_SIZE_T 183AC_TYPE_SSIZE_T 184AC_TYPE_UINT16_T 185AC_TYPE_UINT32_T 186AC_TYPE_UINT64_T 187 188# 189# Checks for library functions. 190# 191AC_FUNC_FORK 192AC_FUNC_GETGROUPS 193AC_FUNC_MALLOC 194AC_FUNC_MKTIME 195AC_FUNC_REALLOC 196 197AC_CHECK_FUNCS([dup2 endpwent getcwd gethostname gethostbyname getaddrinfo gethostbyname2 gettimeofday isascii memchr memmove memset regcomp select socket strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol strtoul strtoull realpath strsep]) 198 199bsdstrl_h_found="no" 200strl_found="no" 201libstrl_found="no" 202strl_h_found="no" 203 204AC_CHECK_HEADERS([bsd/string.h], [bsdstrl_h_found="yes"]) 205 206AC_CHECK_FUNCS([strlcat strlcpy], [strl_found="yes"], 207 [ 208 saved_LIBS="$LIBS" 209 LIBS="$outer_LIBS" 210 AC_SEARCH_LIBS([strlcat], 211 [bsd strl], 212 [libstrl_found="yes"], 213 [strl_found="no"]) 214 AC_SEARCH_LIBS([strlcpy], 215 [bsd strl], 216 [libstrl_found="yes"], 217 [strl_found="no"]) 218 STRL_LIBS="$LIBS" 219 LIBS="$saved_LIBS" 220 ]) 221 222if test x"$libstrl_found" = x"yes" 223then 224 LIBS="$LIBS $STRL_LIBS" 225fi 226 227# we need something above to have worked 228if test x"$strl_found" != x"yes" -a x"$libstrl_found" != x"yes" 229then 230 AC_MSG_ERROR(no strlcpy/strlcat found) 231fi 232 233AC_CHECK_HEADERS([strl.h], [strl_h_found="yes"]) 234if test x"$strl_h_found" != x"yes" 235then 236 strldirs="/usr/local/include /usr/include" 237 238 for d in $strldirs 239 do 240 AC_MSG_CHECKING([for strl.h in $d/strl]) 241 if test -f $d/strl/strl.h 242 then 243 unset ac_cv_header_strl_h 244 saved_CPPFLAGS="$CPPFLAGS" 245 CPPFLAGS="$CPPFLAGS -I$d/strl" 246 AC_CHECK_HEADERS([strl.h], [strl_h_found="yes"]) 247 CPPFLAGS="$saved_CPPFLAGS" 248 fi 249 250 if test x"$strl_h_found" = x"yes" 251 then 252 CPPFLAGS="$CPPFLAGS -I$d/strl" 253 break 254 fi 255 done 256fi 257 258# we need to include <strl.h> if an installed strl.h was found and no 259# bsd/string.h was found 260if test x"$strl_h_found" = x"yes" -a x"$bsdstrl_h_found" = x"no" 261then 262 AC_DEFINE([USE_STRL_H], 1, 263 [Define to 1 if you need to include <strl.h> to get the `strlcat()' and `strlcpy()' functions.]) 264fi 265 266if test x"$bsdstrl_h_found" = x"yes" 267then 268 AC_DEFINE([USE_BSD_H], 1, 269 [Define to 1 if you need to include <bsd/string.h> to get the `strlcat()' and `strlcpy()' functions.]) 270fi 271 272# 273# Checks for structure members 274# 275AC_CHECK_MEMBER([struct sockaddr_un.sun_len], 276 AC_DEFINE([HAVE_SUN_LEN], 277 [1], 278 [Define if sockaddr_un has a sun_len member]), 279 [], 280 [[#include <sys/un.h>]]) 281 282AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 283 AC_DEFINE([HAVE_SIN_LEN], 284 [1], 285 [Define if sockaddr_in has a sin_len member]), 286 [], 287 [[#include <netinet/in.h>]]) 288 289AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len], 290 AC_DEFINE([HAVE_SIN6_LEN], 291 [1], 292 [Define if sockaddr_in6 has a sin6_len member]), 293 [], 294 [[#include <netinet/in.h>]]) 295 296# 297# Library feature string and macros 298# 299LIBOPENARC_FEATURE_STRING="libopenarc $PACKAGE_VERSION:" 300 301AC_DEFUN([TR_UP], [m4_translit([AS_TR_SH([$1])], [a-z], [A-Z])]) 302 303AC_DEFUN([FEATURE], 304 [notincluded="(Not enabled for this installation.)" 305 AC_ARG_ENABLE($1, AS_HELP_STRING(--enable-$1, $2), 306 AS_IF([test "x$enable_]$1[" = "xyes"], 307 [ 308 AC_SUBST(TR_UP($1)[_MANNOTICE], "") 309 AC_DEFINE(TR_UP($1), 1, [enable $1 feature]) 310 ], 311 [ 312 AC_SUBST(TR_UP($1)[_MANNOTICE], $notincluded) 313 ]), 314 AC_SUBST(TR_UP($1)[_MANNOTICE], $notincluded)) 315 ]) 316 317AC_DEFUN([LIB_FEATURE], 318 [FEATURE($1, $2) 319 AS_IF([test "x$enable_]$1[" = "xyes"], 320 [ 321 LIBOPENARC_FEATURE_STRING="$LIBOPENARC_FEATURE_STRING $1" 322 ]) 323 ]) 324 325AC_DEFUN([FFR_FEATURE], 326 [experimentalnotincluded="(Experimental feature not enabled for this installation.)" 327 AC_ARG_ENABLE($1, AS_HELP_STRING(--enable-$1, $2), 328 AS_IF([test "x$enable_]$1[" = "xyes"], 329 [ 330 AC_DEFINE([_FFR_]TR_UP($1), 1, 331 [enable $1 feature]) 332 AC_SUBST(TR_UP($1)[_MANNOTICE], 333 "(Note: Feature is experimental.)") 334 ], 335 [ 336 AC_SUBST(TR_UP($1)[_MANNOTICE], 337 $experimentalnotincluded) 338 ]), 339 AC_SUBST(TR_UP($1)[_MANNOTICE], 340 $experimentalnotincluded)) 341 ]) 342 343AC_DEFUN([LIB_FFR_FEATURE], 344 [FFR_FEATURE($1, $2) 345 AS_IF([test "x$enable_]$1[" = "xyes"], 346 [ 347 LIBOPENARC_FEATURE_STRING="$LIBOPENARC_FEATURE_STRING $1" 348 ]) 349 ]) 350 351# 352# openarc 353# 354 355FEATURE([poll], [use poll() instead of select()]) 356 357# sendmail command 358 359AC_PATH_PROG([SENDMAIL_PATH], [sendmail], [/usr/sbin/sendmail], 360 [/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/lib:$PATH]) 361AC_DEFINE_UNQUOTED([SENDMAIL_PATH], "$ac_cv_path_SENDMAIL_PATH", 362 [The path the the sendmail executable for report sending]) 363AC_SUBST([SENDMAIL_PATH]) 364 365# 366# use rpath at load time? 367# 368 369AC_ARG_ENABLE( 370 [rpath], 371 AS_HELP_STRING([--enable-rpath], 372 [include library load paths in binaries]), 373 , 374 enable_rpath="yes") 375AM_CONDITIONAL([RPATH], [test x"$enable_rpath" = x"yes"]) 376if test x"$enable_rpath" != x"yes" 377then 378 AC_MSG_RESULT([Suppressing -rpath use by libtool]) 379 hardcode_libdir_flag_spec=" -D__LIBTOOL_NO_RPATH__ " 380 chmod 0755 libtool 381fi 382 383# 384# test coverage/profiling stuff 385# 386AC_ARG_ENABLE([codecoverage], 387 AS_HELP_STRING([--enable-codecoverage], 388 [include code coverage/profiling code])) 389if test x"$enable_codecoverage" = x"yes" 390then 391 # gcc can do all of them; Solaris cc can only do gprof 392 AC_CHECK_PROG([hasgcc], [gcc], [yes]) 393 AC_CHECK_PROG([hascc], [cc], [yes]) 394 if test x"$hasgcc" != x"yes" -a x"$hascc" = x"yes" 395 then 396 if test x`cc -V 2>&1 | grep -c "Sun C"` = x"1" 397 then 398 hassuncc="yes" 399 fi 400 fi 401 402 # figure out which profiling system to use 403 AC_CHECK_PROG([hasgprof], [gprof], [yes]) 404 AC_ARG_WITH(gprof, 405 AS_HELP_STRING(--with-gprof, profiling with gprof), 406 hasgprof="$withval") 407 if test x"$hasgcc" = x"yes" 408 then 409 AC_CHECK_PROG([hasgcov], [gcov], [yes]) 410 AC_ARG_WITH(gcov, 411 AS_HELP_STRING(--with-gcov, profiling with gcov), 412 hasgcov="$withval") 413 AC_CHECK_PROG([haslcov], [lcov], [yes]) 414 AC_ARG_WITH(lcov, 415 AS_HELP_STRING(--with-lcov, profiling with lcov), 416 haslcov="$withval") 417 fi 418 419 # bail if none 420 if test x"$hasgprof" != x"yes" -a \ 421 x"$hasgcov" != x"yes" -a \ 422 x"$haslcov" != x"yes" 423 then 424 AC_MSG_ERROR([no supported test coverage packages found]) 425 fi 426 427 # see if there's a libgcov (OpenBSD doesn't have one) 428 if test x"$hasgcov" = x"yes" -a x"$haslcov" != x"yes" 429 then 430 saved_LIBS="$LIBS" 431 LIBS="$outer_LIBS" 432 AC_SEARCH_LIBS([__gcov_init], [gcov]) 433 GCOV_LIBS="$LIBS" 434 LIBS="$saved_LIBS" 435 fi 436 437 COV_CFLAGS="" 438 COV_LDFLAGS="" 439 COV_LIBADD="" 440 441 # sun profiling 442 if test x"$hasgprof" = x"yes" -a \ 443 x"$hasgcov" != x"yes" -a \ 444 x"$hassuncc" = x"yes" 445 then 446 COV_CFLAGS="-g -xpg" 447 COV_LDFLAGS="-g -xpg" 448 # non-sun profiling 449 elif test x"$hasgprof" = x"yes" -a \ 450 x"$hasgcov" != x"yes" -a \ 451 x"$hassuncc" != x"yes" 452 then 453 COV_CFLAGS="-g -pg" 454 COV_LDFLAGS="-g -pg" 455 # gcov profiling 456 elif test x"$hasgcov" = x"yes" 457 then 458 COV_CFLAGS="-g -fprofile-arcs -ftest-coverage" 459 COV_LIBADD="$GCOV_LIBS" 460 fi 461 462 AC_SUBST(COV_CFLAGS) 463 AC_SUBST(COV_LDFLAGS) 464 AC_SUBST(COV_LIBADD) 465fi 466 467# see if profiling-enabled binaries generate profile output with the 468# standard name "gmon.out" or "<file>.gmon" 469 470gprof_gmon_out="unknown" 471if test x"$hasgprof" = x"yes" 472then 473 gprofcheck=' 474int main() { 475 long x; 476 477 x = random(); 478}' 479 AC_MSG_CHECKING([names of profiling output files]) 480 481 saved_CFLAGS="$CFLAGS" 482 saved_LDFLAGS="$LDFLAGS" 483 484 CFLAGS="$CFLAGS $COV_CFLAGS" 485 LDFLAGS="$LDFLAGS $COV_LDFLAGS" 486 487 AC_RUN_IFELSE([AC_LANG_SOURCE([$gprofcheck])], 488 [ if test -f "gmon.out" 489 then 490 gprof_gmon_out="yes" 491 rm -f gmon.out 492 AC_MSG_RESULT(gmon.out) 493 else 494 gprof_gmon_out="no" 495 rm -f *.gmon 496 AC_MSG_RESULT([<binary>.gmon]) 497 fi 498 ], 499 [AC_MSG_RESULT(unknown)]) 500 501 CFLAGS="$saved_CFLAGS" 502 LDFLAGS="$saved_LDFLAGS" 503fi 504 505AM_CONDITIONAL(LCOV, test x"$haslcov" = x"yes" -a x"$hasgcov" = x"yes") 506AM_CONDITIONAL(GCOV, test x"$hasgcov" = x"yes") 507AM_CONDITIONAL(GCOV_ONLY, test x"$hasgcov" = x"yes" -a x"$haslcov" != x"yes") 508AM_CONDITIONAL(GPROF, test x"$hasgprof" = x"yes" -a x"$hasgcov" != x"yes") 509AM_CONDITIONAL(GPROF_FILENAMES, test x"$gprof_gmon_out" = x"no") 510 511# 512# openarc 513# 514AC_ARG_ENABLE([filter], 515 AS_HELP_STRING([--disable-filter], 516 [do not compile the openarc filter]), 517 [enable_filter=$enableval], 518 [enable_filter=yes]) 519AM_CONDITIONAL([BUILD_FILTER], [test x"$enable_filter" != x"no"]) 520 521# 522# Conditional stuff 523# 524AC_ARG_ENABLE([allsymbols], 525 AS_HELP_STRING([--enable-allsymbols], 526 [export internal-use symbols for better test coverage])) 527AM_CONDITIONAL(ALL_SYMBOLS, [test x"$enable_allsymbols" = x"yes"]) 528 529# the AM_CONDITIONAL and AC_DEFINE for USE_ARLIB are farther below, 530# after the Darwin checks 531 532AC_ARG_ENABLE([debug], 533 AS_HELP_STRING([--enable-debug], 534 [produce debugging binaries and libraries]), 535 AS_IF([test "x$enable_debug" = x"yes"], 536 [ 537 LIBOPENARC_FEATURE_STRING="$LIBOPENARC_FEATURE_STRING debug" 538 [[CFLAGS=`echo $CFLAGS | sed 's/ -O[1-9s]*//g'`]] 539 ]) 540) 541 542AM_CONDITIONAL([DEBUG], [test x"$enable_debug" = x"yes"]) 543 544# 545# OpenSSL 546# 547 548AC_ARG_WITH([openssl], 549 AS_HELP_STRING([--with-openssl], 550 [location of OpenSSL includes and library]), 551 [sslpath="$withval"], [sslpath="auto"]) 552 553openssl_found="no" 554 555if test \( "$sslpath" = "auto" -o x"$sslpath" = x"yes" \) -a x"$PKG_CONFIG" != x"" 556then 557 PKG_CHECK_MODULES([LIBCRYPTO], [openssl >= 0.9.7], 558 [openssl_found="yes"], 559 [openssl_found="no" 560 AC_MSG_WARN([pkg-config for openssl not found, trying manual search...]) 561 ]) 562elif test "$sslpath" != "auto" -a x"$sslpath" != x"yes" 563then 564 AC_MSG_CHECKING([for OpenSSL includes]) 565 if test -f $sslpath/include/openssl/opensslv.h 566 then 567 LIBCRYPTO_CPPFLAGS="-I$sslpath/include" 568 LIBCRYPTO_CFLAGS="" 569 LIBCRYPTO_LIBDIRS="-L$sslpath/lib" 570 LIBCRYPTO_LIBS="-lssl -lcrypto" 571 openssl_found=yes 572 AC_MSG_RESULT([$sslpath]) 573 else 574 AC_MSG_RESULT([no]) 575 fi 576fi 577 578if test x"$openssl_found" = x"no" 579then 580 AC_MSG_CHECKING([for OpenSSL library and includes]) 581 ssldirs="/usr/local/ssl /usr/local /usr/sfw /opt/local /usr" 582 if test "$sslpath" = "auto" -o "$sslpath" = "yes" 583 then 584 for d in $ssldirs 585 do 586 if test -f $d/include/openssl/opensslv.h 587 then 588 sslpath=$d 589 openssl_found=yes 590 break 591 fi 592 done 593 fi 594 case "$sslpath" in 595 no) 596 AC_MSG_ERROR([OpenSSL is required]) 597 ;; 598 auto) 599 AC_MSG_ERROR([OpenSSL not found]) 600 ;; 601 */*) 602 AC_MSG_RESULT([$sslpath]) 603 ;; 604 *) 605 AC_MSG_ERROR([OpenSSL not found]) 606 ;; 607 esac 608 LIBCRYPTO_CPPFLAGS="-I$sslpath/include" 609 LIBCRYPTO_CFLAGS="" 610 LIBCRYPTO_LIBDIRS="-L$sslpath/lib" 611 LIBCRYPTO_LIBS="-lssl -lcrypto" 612fi 613 614if test x"$openssl_found" = x"yes" 615then 616 saved_CFLAGS="$CFLAGS" 617 saved_CPPFLAGS="$CPPFLAGS" 618 saved_LDFLAGS="$LDFLAGS" 619 saved_LIBS="$LIBS" 620 621 LIBS="$outer_LIBS $LIBCRYPTO_LIBS $saved_LIBS" 622 CPPFLAGS="$LIBCRYPTO_CPPFLAGS $saved_CPPFLAGS" 623 CFLAGS="$LIBCRYPTO_CFLAGS $saved_CFLAGS" 624 LDFLAGS="$outer_LDFLAGS $LIBCRYPTO_LIBDIRS $saved_LDFLAGS" 625 626 AC_CHECK_HEADERS([openssl/bio.h openssl/conf.h openssl/crypto.h openssl/err.h openssl/evp.h openssl/md5.h openssl/opensslv.h openssl/pem.h openssl/rsa.h openssl/sha.h openssl/ssl.h], , 627 AC_MSG_ERROR([required OpenSSL header not found])) 628 629 # -ldl is needed to assist with compilation of static openssl libraries. 630 # It appears to need dl for opening engine plugins. It fails at load 631 # time It also fails to build on FreeBSD if enabled by default. 632 AC_SEARCH_LIBS([ERR_peek_error], [crypto], , 633 AC_MSG_ERROR([libcrypto not found])) 634 635 AC_SEARCH_LIBS([SSL_new], [ssl], , 636 [ 637 if test x"$enable_shared" = x"yes" 638 then 639 AC_MSG_ERROR([Cannot build shared openarc 640 against static openssl libraries. 641 Configure with --disable-shared 642 to get this working or obtain a 643 shared libssl library for 644 openarc to use.]) 645 fi 646 647 # avoid caching issue - last result of SSL_new 648 # shouldn't be cached for this next check 649 unset ac_cv_search_SSL_new 650 LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl" 651 AC_SEARCH_LIBS([SSL_new], [ssl], , 652 AC_MSG_ERROR([libssl not found]), [-ldl]) 653 ] 654 ) 655 656 AC_CHECK_DECL([SHA256_DIGEST_LENGTH], 657 AC_DEFINE([HAVE_SHA256], 1, 658 [Define to 1 if your crypto library has SHA256 support]), 659 AC_MSG_WARN([SHA256 is required for DKIM but is not 660 supported with your version of OpenSSL]), 661 [ 662#include <sys/types.h> 663#include <openssl/sha.h>]) 664 665 CFLAGS="$saved_CFLAGS" 666 CPPFLAGS="$saved_CPPFLAGS" 667 LDFLAGS="$saved_LDFLAGS" 668 LIBS="$saved_LIBS" 669 670fi 671 672AC_SUBST(LIBCRYPTO_CFLAGS) 673AC_SUBST(LIBCRYPTO_CPPFLAGS) 674AC_SUBST(LIBCRYPTO_LIBDIRS) 675AC_SUBST(LIBCRYPTO_LIBS) 676 677# 678# libmilter 679# 680AC_MSG_CHECKING([for milter library and includes]) 681AC_ARG_WITH([milter], 682 AS_HELP_STRING([--with-milter], 683 [location of milter includes and library]), 684 [milterpath="$withval"], [milterpath="auto"]) 685 686if test x"$enable_filter" = x"no" 687then 688 milterpath="no" 689fi 690 691if test "$milterpath" = "auto" -o "$milterpath" = "yes" 692then 693 milterdirs="/usr/local /opt/local /usr" 694 for d in $milterdirs 695 do 696 if test -f $d/include/libmilter/mfapi.h 697 then 698 milterpath=$d 699 break 700 fi 701 done 702fi 703case "$milterpath" in 704 no) 705 if test x"$enable_filter" = x"yes" 706 then 707 AC_MSG_ERROR([milter is required]) 708 fi 709 AC_MSG_RESULT(disabled) 710 ;; 711 auto) 712 AC_MSG_ERROR([milter not found]) 713 ;; 714 */*) 715 if ! test -f $milterpath/include/libmilter/mfapi.h 716 then 717 AC_MSG_ERROR([milter includes not found at $milterpath]) 718 fi 719 AC_MSG_RESULT([$milterpath]) 720 ;; 721 *) 722 AC_MSG_ERROR([milter not found]) 723 ;; 724esac 725 726LIBMILTER_INCDIRS="" 727LIBMILTER_LIBDIRS="" 728LIBMILTER_LIBS="" 729 730if test x"$milterpath" != x"no" 731then 732 LIBMILTER_INCDIRS="-I$milterpath/include" 733 734 saved_CC="$CC" 735 saved_CFLAGS="$CFLAGS" 736 saved_CPPFLAGS="$CPPFLAGS" 737 saved_LDFLAGS="$LDFLAGS" 738 saved_LIBS="$LIBS" 739 740 CC="$PTHREAD_CC" 741 LIBS="$outer_LIBS $PTHREAD_LIBS $saved_LIBS" 742 CPPFLAGS="$LIBMILTER_INCDIRS $saved_CPPFLAGS" 743 CFLAGS="$PTHREAD_CFLAGS $saved_CFLAGS" 744 LDFLAGS="$outer_LDFLAGS $PTHREAD_CFLAGS $saved_LDFLAGS" 745 746 breakloop="no" 747 for d in lib lib64 lib/libmilter 748 do 749 unset ac_cv_search_smfi_register 750 LDFLAGS="$outer_LDFLAGS $PTHREAD_CFLAGS -L$milterpath/$d $saved_LDFLAGS" 751 AC_SEARCH_LIBS([smfi_register], [milter], 752 [ 753 LIBMILTER_LIBDIRS="-L$milterpath/$d" 754 LIBMILTER_LIBS="-lmilter" 755 breakloop="yes" 756 ]) 757 758 AC_CHECK_FUNC([smfi_insheader], 759 AC_DEFINE([HAVE_SMFI_INSHEADER], 1, 760 [Define if libmilter has smfi_insheader()])) 761 762 AC_CHECK_FUNC([smfi_opensocket], 763 AC_DEFINE([HAVE_SMFI_OPENSOCKET], 1, 764 [Define if libmilter has smfi_opensocket()])) 765 766 AC_CHECK_FUNC([smfi_progress], 767 AC_DEFINE([HAVE_SMFI_PROGRESS], 1, 768 [Define if libmilter has smfi_progress()])) 769 770 AC_CHECK_FUNC([smfi_setsymlist], 771 AC_DEFINE([HAVE_SMFI_SETSYMLIST], 1, 772 [Define if libmilter has smfi_setsymlist()])) 773 774 AC_CHECK_FUNC([smfi_version], 775 AC_DEFINE([HAVE_SMFI_VERSION], 1, 776 [Define if libmilter has smfi_version()])) 777 778 if test x"$breakloop" = x"yes" 779 then 780 break 781 fi 782 done 783 if test x"$LIBMILTER_LIBDIRS" = x"" 784 then 785 AC_MSG_ERROR([libmilter not found]) 786 fi 787 788 CC="$saved_CC" 789 CPPFLAGS="$saved_CPPFLAGS" 790 CFLAGS="$saved_CFLAGS" 791 LDFLAGS="$saved_LDFLAGS" 792 LIBS="$saved_LIBS" 793fi 794 795AC_SUBST(LIBMILTER_INCDIRS) 796AC_SUBST(LIBMILTER_LIBDIRS) 797AC_SUBST(LIBMILTER_LIBS) 798 799# 800# header filtering requires libjansson 801# 802 803AC_ARG_WITH([libjansson], 804 AS_HELP_STRING([--with-libjansson], 805 [location of jansson includes and library]), 806 [janssonpath="$withval"], [janssonpath="auto"]) 807 808LIBJANSSON_CPPFLAGS="" 809LIBJANSSON_LDFLAGS="" 810LIBJANSSON_LIBS="" 811 812jansson_found="no" 813if test \( x"$janssonpath" = x"auto" -o x"$janssonpath" = x"yes" \) -a \ 814 x"$PKG_CONFIG" != x"" 815then 816 PKG_CHECK_MODULES([LIBJANSSON], [jansson >= 2.2.1], 817 [ 818 jansson_found="yes" 819 LIBJANSSON_CPPFLAGS="$LIBJANSSON_CFLAGS" 820 LIBJANSSON_LIBS="$LIBJANSSON_LIBS" 821 ], 822 [ 823 jansson_found="no" 824 AC_MSG_WARN([pkg-config for libjansson not found, trying manual 825 search...]) 826 ]) 827fi 828 829if test x"$janssonpath" != x"no" -a x"$jansson_found" = x"no" 830then 831 AC_MSG_CHECKING([for libjansson]) 832 if test x"$janssonpath" != x"auto" -a x"$janssonpath" != x"yes" 833 then 834 if test -f $janssonpath/include/jansson.h 835 then 836 AC_MSG_RESULT($janssonpath) 837 jansson_found="yes" 838 LIBJANSSON_CPPFLAGS="-I$janssonpath/include" 839 LIBJANSSON_LDFLAGS="-L$janssonpath/lib" 840 LIBJANSSON_LIBS="-ljansson" 841 else 842 AC_MSG_ERROR(not found at $janssonpath) 843 fi 844 else 845 janssondirs="/usr /usr/local" 846 for d in $janssondirs 847 do 848 if test -f $d/include/jansson.h 849 then 850 janssonpath=$d 851 AC_MSG_RESULT($d) 852 jansson_found="yes" 853 LIBJANSSON_CPPFLAGS="-I$janssonpath/include" 854 LIBJANSSON_LDFLAGS="-L$janssonpath/lib" 855 LIBJANSSON_LIBS="-ljansson" 856 break 857 fi 858 done 859 fi 860 if test x"$jansson_found" != x"yes" 861 then 862 AC_MSG_RESULT([no]) 863 fi 864fi 865AC_SUBST(LIBJANSSON_CPPFLAGS) 866AC_SUBST(LIBJANSSON_LDFLAGS) 867AC_SUBST(LIBJANSSON_LIBS) 868AM_CONDITIONAL(JANSSON, test x"$LIBJANSSON_LIBS" != x"") 869 870if test x"$jansson_found" == x"yes" 871then 872 AC_DEFINE(USE_JANSSON, 1, [use libjansson to provide header field checks]) 873fi 874 875# This (below) is just for the pkg-config file openarc.pc.in 876LIBOPENARC_LIBS_PKG="$LIBOPENARC_LIBS" 877LIBOPENARC_INC="$LIBCRYPTO_CPPFLAGS $LIBCRYPTO_CFLAGS $LIBTRE_CPPFLAGS" 878 879if test x"$USE_DB_LIBOPENARC_TRUE" = x"" 880then 881 LIBOPENARC_INC="$LIBOPENARC_INC $LIBDB_INCDIRS" 882 LIBOPENARC_LIBS_PKG="$LIBOPENARC_LIBS_PKG $LIBDB_LIBS" 883 LIBOPENARC_LIBS="$LIBOPENARC_LIBS $LIBDB_LIBS" 884fi 885 886AC_SUBST(LIBOPENARC_LIBS) 887AC_SUBST(LIBOPENARC_LIBS_PKG) 888AC_SUBST(LIBOPENARC_INC) 889 890AC_DEFINE_UNQUOTED([LIBOPENARC_FEATURE_STRING], "$LIBOPENARC_FEATURE_STRING", 891 [Feature string for printing]) 892 893# 894# setup for testing 895# 896 897AC_ARG_ENABLE([live-testing], 898 AS_HELP_STRING([--disable-live-testing], 899 [disable tests that require Internet access]), 900 [live_tests="$enable_live_testing"], [live_tests="yes"]) 901AM_CONDITIONAL(LIVE_TESTS, test x"$live_tests" = x"yes") 902 903# 904# specify test socket 905# 906 907AC_ARG_WITH([test-socket], 908 AS_HELP_STRING([--with-test-socket], 909 [specify socket to use for all tests]), 910 [testsocket="$withval"], [testsocket=""]) 911AM_CONDITIONAL(TEST_SOCKET, test x"$testsocket" != x"") 912if test x"$testsocket" != x"" 913then 914 TESTSOCKET=$testsocket 915 AC_SUBST(TESTSOCKET) 916fi 917 918# 919# Platform Specific Configuration 920# 921AC_CANONICAL_HOST 922case "$host" in 923 *-darwin*) 924 CPPFLAGS="$CPPFLAGS -DBIND_8_COMPAT -DDARWIN" 925 if test x"$unboundpath" = x"no" 926 then 927 AC_MSG_ERROR("unbound required on Darwin") 928 fi 929 ;; 930esac 931 932# 933# Determine domainname for sample configs 934# 935AC_ARG_WITH([domain], 936 AS_HELP_STRING([--with-domain], 937 [name of the domain for signing - sets this in sample configuration files]), 938 [ 939 DOMAIN="$withval" 940 ],[ 941 AC_PATH_PROG(domainname, domainname) 942 AS_IF([test x"$domainname" != x""], 943 [DOMAIN=`$domainname`], 944 ) 945 AS_IF([test x"$DOMAIN" = x"" -o x"$DOMAIN" = x"(none)" ], 946 [DOMAIN=example.com] 947 ) 948 ] 949 ) 950 951AC_SUBST([DOMAIN]) 952 953# 954# final command line tweaks 955# 956 957CPPFLAGS="$CPPFLAGS -DCONFIG_BASE=\\\"$sysconfdir\\\"" 958 959test "x$prefix" = xNONE && prefix=$ac_default_prefix 960SYSCONFDIR=`eval echo "$sysconfdir"` 961AC_SUBST([SYSCONFDIR]) 962 963# 964# for contrib/spec/openarc.spec.in 965# 966 967installbin="no" 968specconfig="" 969specrequires="" 970specbuildrequires="" 971 972SPECBINDIR="" 973if test x"$installbin" = x"yes" 974then 975 SPECBINDIR="%{_bindir}/*" 976fi 977 978SPECCONFIGURE="$specconfig" 979 980if test x"$specrequires" = x"" 981then 982 SPECREQUIRES="" 983else 984 SPECREQUIRES="Requires:$specrequires" 985fi 986 987if test x"$specbuildrequires" = x"" 988then 989 SPECBUILDREQUIRES="" 990else 991 SPECBUILDREQUIRES="BuildRequires:$specbuildrequires" 992fi 993 994AC_SUBST(SPECBINDIR) 995AC_SUBST(SPECCONFIGURE) 996AC_SUBST(SPECREQUIRES) 997AC_SUBST(SPECBUILDREQUIRES) 998 999# 1000# Finish up 1001# 1002 1003AC_OUTPUT([ Makefile 1004 docs/Makefile 1005 contrib/Makefile 1006 contrib/docs/Makefile 1007 contrib/init/Makefile 1008 contrib/init/generic/Makefile 1009 contrib/init/redhat/Makefile 1010 contrib/init/redhat/openarc 1011 contrib/init/solaris/Makefile 1012 contrib/spec/Makefile 1013 contrib/spec/openarc.spec 1014 contrib/systemd/Makefile 1015 contrib/systemd/openarc.service 1016 libopenarc/openarc.pc libopenarc/Makefile 1017 libopenarc/docs/Makefile 1018 openarc/Makefile openarc/openarc.8 openarc/openarc.conf.5 1019 openarc/openarc.conf.simple 1020]) 1021 #libopenarc/tests/Makefile 1022 #openarc/tests/Makefile 1023