diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 195 |
1 files changed, 97 insertions, 98 deletions
diff --git a/configure.in b/configure.in index 383f1788..21a39930 100644 --- a/configure.in +++ b/configure.in | |||
@@ -104,6 +104,8 @@ AC_PATH_PROG(PYTHON,python) | |||
104 | AC_PATH_PROG(SH,sh) | 104 | AC_PATH_PROG(SH,sh) |
105 | AC_PATH_PROG(PERL,perl) | 105 | AC_PATH_PROG(PERL,perl) |
106 | AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config) | 106 | AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config) |
107 | AC_PATH_PROG(HOSTNAME,hostname) | ||
108 | AC_PATH_PROG(BASENAME,basename) | ||
107 | 109 | ||
108 | dnl allow them to override the path of perl | 110 | dnl allow them to override the path of perl |
109 | AC_ARG_WITH(perl, | 111 | AC_ARG_WITH(perl, |
@@ -112,14 +114,28 @@ AC_ARG_WITH(perl, | |||
112 | with_perl=$withval,with_perl=$PERL) | 114 | with_perl=$withval,with_perl=$PERL) |
113 | AC_SUBST(PERL, $with_perl) | 115 | AC_SUBST(PERL, $with_perl) |
114 | 116 | ||
115 | dnl allow for gnutls, if it exists, instead of openssl | 117 | dnl openssl/gnutls |
118 | AC_ARG_WITH(openssl, | ||
119 | AC_HELP_STRING([--with-openssl=DIR], | ||
120 | [sets path to openssl installation]) AC_HELP_STRING([--without-openssl], [disable openssl]),) | ||
121 | |||
116 | AC_ARG_WITH(gnutls, | 122 | AC_ARG_WITH(gnutls, |
117 | ACX_HELP_STRING([--with-gnutls=PATH], | 123 | ACX_HELP_STRING([--with-gnutls=PATH], |
118 | [path to gnutls installation root]), | 124 | [path to gnutls installation root]) AC_HELP_STRING([--without-gnutls], [disable gnutls]),) |
119 | GNUTLS=$withval) | ||
120 | 125 | ||
121 | AC_PATH_PROG(HOSTNAME,hostname) | 126 | dnl you can only have one or the other |
122 | AC_PATH_PROG(BASENAME,basename) | 127 | if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then |
128 | with_gnutls="no" | ||
129 | fi | ||
130 | if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then | ||
131 | with_openssl="no" | ||
132 | fi | ||
133 | |||
134 | dnl list of possible dirs to try to autodetect openssl | ||
135 | dnl if $dir/include exists, we consider it found | ||
136 | dnl the order should allow locally installed versions to override distros' ones | ||
137 | OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \ | ||
138 | /opt /opt/openssl" | ||
123 | 139 | ||
124 | dnl | 140 | dnl |
125 | dnl Check for miscellaneous stuff | 141 | dnl Check for miscellaneous stuff |
@@ -417,114 +433,97 @@ if test "$FOUNDINCLUDE" = "no"; then | |||
417 | fi | 433 | fi |
418 | 434 | ||
419 | 435 | ||
420 | dnl Check for OpenSSL location | 436 | dnl openssl detection/configuration |
421 | AC_PATH_PROG(OPENSSL,openssl) | 437 | if ! test "$with_openssl" = "no"; then |
422 | if test "$OPENSSL" = "/usr/bin/openssl"; then | 438 | dnl Check for OpenSSL location if it wasn't already specified |
423 | OPENSSL=/usr | 439 | if ! test -d "$with_openssl"; then |
424 | elif test "$OPENSSL" = "/usr/sbin/openssl"; then | 440 | for d in $OPENSSL_DIRS; do |
425 | OPENSSL=/usr | 441 | if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then |
426 | elif test "$OPENSSL" = "/opt/bin/openssl"; then | 442 | with_openssl=$d |
427 | OPENSSL=/opt | 443 | fi |
428 | elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then | 444 | done |
429 | OPENSSL=/opt/openssl | 445 | fi |
430 | elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then | ||
431 | OPENSSL=/usr/slocal | ||
432 | elif test "$OPENSSL" = "/usr/local/bin/openssl"; then | ||
433 | OPENSSL=/usr/local | ||
434 | elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then | ||
435 | OPENSSL=/usr/local/ssl | ||
436 | fi | ||
437 | AC_ARG_WITH(openssl, | ||
438 | AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation]) | ||
439 | AC_HELP_STRING([--without-openssl], [disable openssl]), | ||
440 | OPENSSL=$withval) | ||
441 | 446 | ||
442 | _SAVEDCPPFLAGS="$CPPFLAGS" | 447 | _SAVEDCPPFLAGS="$CPPFLAGS" |
443 | _SAVEDLDFLAGS="$LDFLAGS" | 448 | _SAVEDLDFLAGS="$LDFLAGS" |
444 | if test X"$OPENSSL" = "Xno"; then | 449 | dnl Check for OpenSSL header files |
445 | AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins]) | 450 | unset FOUNDINCLUDE |
446 | FOUNDSSL="dontbother" | 451 | CPPFLAGS="$CPPFLAGS -I$OPENSSL/include" |
447 | else | 452 | LDFLAGS="$LDFLAGS -R$OPENSSL/lib" |
448 | dnl Check for OpenSSL header files | 453 | |
449 | unset FOUNDINCLUDE | 454 | dnl check for openssl in $dir/include/openssl |
450 | if test "$OPENSSL" != "/usr"; then | 455 | AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h, |
451 | CPPFLAGS="$CPPFLAGS -I$OPENSSL/include" | 456 | SSLINCLUDE="-I$OPENSSL/include" |
452 | LDFLAGS="$LDFLAGS -R$OPENSSL/lib" | 457 | FOUNDINCLUDE=yes, |
453 | fi | 458 | FOUNDINCLUDE=no) |
454 | AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h, | 459 | dnl else check to see if $dir/include has it |
455 | SSLINCLUDE="-I$OPENSSL/include" | 460 | if test "$FOUNDINCLUDE" = "no"; then |
456 | FOUNDINCLUDE=yes, | 461 | AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h, |
457 | FOUNDINCLUDE=no) | 462 | SSLINCLUDE="-I$OPENSSL/include" |
458 | if test "$FOUNDINCLUDE" = "no"; then | 463 | FOUNDINCLUDE=yes, |
459 | AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h, | 464 | FOUNDINCLUDE=no) |
460 | SSLINCLUDE="-I$OPENSSL/include" | 465 | fi |
461 | FOUNDINCLUDE=yes, | 466 | AC_SUBST(SSLINCLUDE) |
462 | FOUNDINCLUDE=no) | 467 | dnl if we didn't find it, reset CPPFLAGS |
463 | fi | 468 | if test "$FOUNDINCLUDE" = "no"; then |
464 | AC_SUBST(SSLINCLUDE) | 469 | CPPFLAGS="$_SAVEDCPPFLAGS" |
465 | if test "$FOUNDINCLUDE" = "no"; then | 470 | LDFLAGS="$_SAVEDLDFLAGS" |
466 | CPPFLAGS="$_SAVEDCPPFLAGS" | 471 | fi |
467 | fi | ||
468 | 472 | ||
469 | dnl Check for crypto lib | 473 | dnl Check for crypto lib |
470 | _SAVEDLIBS="$LIBS" | 474 | _SAVEDLIBS="$LIBS" |
471 | AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib) | 475 | LIBS="-L${with_openssl}/lib" |
472 | if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then | 476 | AC_CHECK_LIB(crypto,CRYPTO_lock) |
473 | dnl Check for SSL lib | 477 | if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then |
474 | AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto",AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto"),-L$OPENSSL/lib -lcrypto) | 478 | dnl Check for SSL lib |
475 | fi | 479 | AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto) |
476 | LIBS="$_SAVEDLIBS" | 480 | fi |
477 | 481 | LIBS="$_SAVEDLIBS" | |
478 | FOUNDSSL="no" | 482 | |
479 | dnl test headers and libs to decide whether check_http should use SSL | 483 | dnl test headers and libs to decide whether check_http should use SSL |
480 | if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then | 484 | if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then |
481 | if test "$ac_cv_lib_ssl_main" = "yes"; then | 485 | if test "$ac_cv_lib_ssl_main" = "yes"; then |
482 | if test "$FOUNDINCLUDE" = "yes"; then | 486 | if test "$FOUNDINCLUDE" = "yes"; then |
483 | FOUNDSSL="yes" | 487 | FOUNDOPENSSL="yes" |
484 | fi | 488 | fi |
485 | fi | 489 | fi |
486 | fi | 490 | fi |
487 | fi | 491 | fi |
488 | 492 | ||
493 | |||
489 | dnl check for gnutls if openssl isn't found (or is disabled) | 494 | dnl check for gnutls if openssl isn't found (or is disabled) |
490 | FOUNDGNUTLS="no" | 495 | if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then |
491 | if ! test "$FOUNDSSL" = "yes" && ! test "$with_gnutls" = "no"; then | 496 | if test ! "$with_gnutls" = ""; then |
492 | if test "$GNUTLS" = ""; then | 497 | CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include" |
493 | CPPFLAGS="$CPPFLAGS -I$GNUTLS" | 498 | elif test ! "$LIBGNUTLS_CONFIG" = ""; then |
494 | elif ! test "$LIBGNUTLS_CONFIG" = ""; then | ||
495 | CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`" | 499 | CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`" |
496 | fi | 500 | fi |
497 | AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",) | 501 | AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",) |
498 | if test "$FOUNDGNUTLS" = "yes"; then | 502 | if test "$FOUNDGNUTLS" = "yes"; then |
499 | AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl") | 503 | AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl") |
500 | FOUNDSSL="yes" | ||
501 | fi | 504 | fi |
502 | fi | 505 | fi |
503 | dnl end check for gnutls | 506 | dnl end check for gnutls |
504 | 507 | ||
505 | if test "$FOUNDSSL" = "yes"; then | 508 | if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then |
506 | check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp" | 509 | check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp" |
507 | AC_SUBST(check_tcp_ssl) | 510 | AC_SUBST(check_tcp_ssl) |
508 | AC_SUBST(SSLLIBS) | 511 | AC_SUBST(SSLLIBS) |
509 | AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found]) | 512 | AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found]) |
510 | if test "$FOUNDGNUTLS" = "no"; then | 513 | if test "$FOUNDOPENSSL" = "yes"; then |
511 | AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries]) | 514 | AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries]) |
512 | with_openssl="yes" | 515 | with_openssl="yes" |
513 | with_gnutls="no" | 516 | with_gnutls="no" |
514 | else | 517 | else |
515 | AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries]) | 518 | AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries]) |
516 | with_gnutls="yes" | 519 | with_gnutls="yes" |
517 | with_openssl="no" | 520 | with_openssl="no" |
518 | fi | 521 | fi |
519 | else | 522 | else |
520 | if test "$FOUNDSSL" = "no"; then | 523 | dnl else deliberately disabled or no ssl support available |
521 | AC_MSG_WARN([OpenSSL libs could not be found]) | 524 | AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled]) |
522 | dnl else deliberately disabled | 525 | with_openssl="no" |
523 | fi | 526 | with_gnutls="no" |
524 | with_openssl="no" | ||
525 | with_gnutls="no" | ||
526 | CPPFLAGS="$_SAVEDCPPFLAGS" | ||
527 | LDFLAGS="$_SAVEDLDFLAGS" | ||
528 | fi | 527 | fi |
529 | 528 | ||
530 | dnl | 529 | dnl |