From caa89fb37c532930805f0b144e3298624ec1adec Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 27 Apr 2008 17:17:59 +0000 Subject: More stuff so that freebsd users can still use the ports version of openssl if they want git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9590 e03df62e-2008-0410-955e-edbf42e46eb7 --- configure | 19 +++++++++++++++++-- make/utilities.pm | 18 ++++++++++++++++++ src/modules/extra/m_ssl_openssl.cpp | 6 +++--- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/configure b/configure index ecc8b1640..f9e85042a 100755 --- a/configure +++ b/configure @@ -102,7 +102,7 @@ our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_n $opt_noepoll, $opt_nokqueue, $opt_disablerpath, $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_ident, $opt_quit, $opt_topic, $opt_maxbuf, $opt_kick, $opt_gecos, $opt_away, $opt_modes, $opt_disable_debug, $opt_maxchans, - $opt_opermaxchans); + $opt_opermaxchans, $opt_freebsd_port); our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir, $opt_library_dir); @@ -142,6 +142,7 @@ GetOptions ( 'with-gecos-length=i' => \$opt_gecos, 'with-away-length=i' => \$opt_away, 'with-max-modes=i' => \$opt_modes, + 'enable-freebsd-ports-openssl' => \$opt_freebsd_port, 'prefix=s' => \$opt_base_dir, 'config-dir=s' => \$opt_config_dir, 'module-dir=s' => \$opt_module_dir, @@ -200,7 +201,8 @@ our $non_interactive = ( (defined $opt_noepoll) || (defined $opt_noports) || (defined $opt_maxbuf) || - (defined $opt_use_gnutls) + (defined $opt_use_gnutls) || + (defined $opt_freebsd_port) ); our $interactive = !$non_interactive; @@ -242,11 +244,14 @@ chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1 if ($^O eq "freebsd") { + # default: use base ssl chomp($config{HAS_OPENSSL} = `openssl version | cut -d ' ' -f 2`); # OpenSSL version, freebsd specific + chomp($config{HAS_OPENSSL_PORT} = `pkg-config --modversion openssl 2>/dev/null`); # Port version, may be different } else { chomp($config{HAS_OPENSSL} = `pkg-config --modversion openssl 2>/dev/null`); # Openssl version, others + $config{HAS_OPENSSL_PORT} = ""; } chomp(our $gnutls_ver = $config{HAS_GNUTLS}); @@ -870,6 +875,16 @@ should NOT be used. You should probably specify a newer compiler.\n\n"; print "\n"; } + $config{USE_FREEBSD_BASE_SSL} = "n"; + if ($config{HAS_OPENSSL_PORT} ne "") + { + print "I have detected the OpenSSL FreeBSD port installed on your system,\n"; + print "version \e[1;32m".$config{HAS_OPENSSL_PORT}."\e[0m. Your base system OpenSSL is version\n"; + print "\e[1;32m".$openssl_ver."\e[0m.\n"; + yesno('USE_FREEBSD_PORTS_SSL', "Do you want to use the FreeBSD base version?"); + $config{USE_FREEBSD_BASE_SSL} = "y" if ($config{USE_FREEBSD_PORTS_SSL} eq "n"); + } + if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) { print "I have detected both \e[1;32mGnuTLS\e[0m and \e[1;32mOpenSSL\e[0m on your system.\n"; print "I will default to GnuTLS. If you wish to use OpenSSL\n"; diff --git a/make/utilities.pm b/make/utilities.pm index 8b74b7e84..812e8a1ae 100644 --- a/make/utilities.pm +++ b/make/utilities.pm @@ -358,6 +358,24 @@ sub translate_functions($$) $line =~ s/if\("(.+?)"\)//; } + if ($line =~ /if\(\!"(\w+)"\)/) + { + if (!defined $main::config{$1}) + { + $line = ""; + return ""; + } + else + { + if (($main::config{$1} =~ /y/i) and ($main::config{$1} eq "1")) + { + $line = ""; + return ""; + } + } + + $line =~ s/if\(\!"(.+?)"\)//; + } while ($line =~ /exec\("(.+?)"\)/) { print "Executing program for module \e[1;32m$module\e[0m ... \e[1;32m$1\e[0m\n"; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index cea32b8fa..4691b874e 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -35,9 +35,9 @@ /* $ModDesc: Provides SSL support for clients */ -/* $LinkerFlags: ifuname("freebsd") -lssl -lcrypto */ -/* $CompileFlags: ifuname(!"freebsd") pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") */ -/* $LinkerFlags: ifuname(!"freebsd") rpath("pkg-config --libs openssl") pkgconflibs("openssl","/libssl.so","-lssl -lcrypto -ldl") */ +/* $LinkerFlags: if("USE_FREEBSD_BASE_SSL") -lssl -lcrypto */ +/* $CompileFlags: if(!"USE_FREEBSD_BASE_SSL") pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") */ +/* $LinkerFlags: if(!"USE_FREEBSD_BASE_SSL") rpath("pkg-config --libs openssl") pkgconflibs("openssl","/libssl.so","-lssl -lcrypto -ldl") */ /* $ModDep: transport.h */ /* $NoPedantic */ -- cgit v1.2.3