]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/openssl_config.pl
Change the SQLutils and SQL providers to also use interfaces for proper unload order...
[user/henk/code/inspircd.git] / src / modules / extra / openssl_config.pl
index fb36f2f5e3831e5e6cfed87bb91f2bb88731e320..61d8f29021004bc7abaac6c0d9d0652e7c0475ab 100644 (file)
@@ -1,20 +1,48 @@
 #!/usr/bin/perl
 
-$ENV{PKG_CONFIG_PATH} = "/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/libdata/pkgconfig:/usr/X11R6/libdata/pkgconfig";
+if (!exists $ENV{PKG_CONFIG_PATH})
+{
+       $ENV{PKG_CONFIG_PATH} = "/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/libdata/pkgconfig:/usr/X11R6/libdata/pkgconfig";
+}
+else
+{
+       $ENV{PKG_CONFIG_PATH} .= ":/usr/local/lib/pkgconfig:/usr/local/libdata/pkgconfig:/usr/X11R6/libdata/pkgconfig";
+}
 
-if ($ARGV[1] eq "compile")
+if ($ARGV[0] eq "compile")
 {
-       $ret = `pkg-config --cflags openssl`;
-       if ((undef $ret) || ($ret eq ""))
+       $ret = `pkg-config --cflags openssl 2>/dev/null`;
+       if ((!defined $ret) || ($ret eq ""))
        {
-               $ret = "";
+               $foo = `locate "/openssl/ssl.h" | head -n 1`;
+               $foo =~ /(.+)\/openssl\/ssl\.h/;
+               if (defined $1)
+               {
+                       $foo = "-I$1";
+               }
+               else
+               {
+                       $foo = "";
+               }
+               $ret = "$foo\n";
        }
 }
 else
 {
-       $ret = `pkg-config --libs openssl`;
-       if ((undef $ret) || ($ret eq ""))
+       $ret = `pkg-config --libs openssl 2>/dev/null`;
+       if ((!defined $ret) || ($ret eq ""))
        {
-               $ret = "-lssl -lcrypto -ldl";
+               $foo = `locate "/libssl.so" | head -n 1`;
+               $foo =~ /(.+)\/libssl\.so/;
+               if (defined $1)
+               {
+                       $foo = "-L$1";
+               }
+               else
+               {
+                       $foo = "";
+               }
+               $ret = "$foo -lssl -lcrypto\n";
        }
 }
+print "$ret";