summaryrefslogtreecommitdiff
path: root/src/modules/extra/openssl_config.pl
blob: 61d8f29021004bc7abaac6c0d9d0652e7c0475ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

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[0] eq "compile")
{
	$ret = `pkg-config --cflags openssl 2>/dev/null`;
	if ((!defined $ret) || ($ret eq ""))
	{
		$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 2>/dev/null`;
	if ((!defined $ret) || ($ret eq ""))
	{
		$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";