summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-14 00:39:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-14 00:39:29 +0000
commitf9d43fcd9f82d2316f91548acd99c794f7de4071 (patch)
tree91d4ead2dce731bcdcdd7d6c0817ac31c787d38b
parentfdabab1b825c2625a9165fca7ff8366ad00b127a (diff)
Add eval() and exec() macros, that evaluate perl and execute commands at configure time, rather than delaying them with backticks till compile time. This picks up any errors sooner.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6311 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--make/utilities.pm20
-rw-r--r--src/modules/extra/m_filter_pcre.cpp4
-rw-r--r--src/modules/extra/m_mysql.cpp4
-rw-r--r--src/modules/extra/m_pgsql.cpp4
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp2
-rw-r--r--src/modules/extra/pgsql_config.pl6
6 files changed, 27 insertions, 13 deletions
diff --git a/make/utilities.pm b/make/utilities.pm
index fa7375da5..0109bf929 100644
--- a/make/utilities.pm
+++ b/make/utilities.pm
@@ -1,5 +1,6 @@
package make::utilities;
use Exporter 'import';
+use POSIX;
@EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs translate_functions);
# Parse the output of a *_config program,
@@ -123,6 +124,25 @@ sub pkgconfig_get_lib_dirs($$$)
sub translate_functions($)
{
my ($line) = @_;
+ while ($line =~ /exec\("(.+?)"\)/)
+ {
+ my $replace = `$1`;
+ chomp($replace);
+ $line =~ s/exec\("(.+?)"\)/$replace/;
+ }
+ while ($line =~ /eval\("(.+?)"\)/)
+ {
+ my $tmpfile;
+ do
+ {
+ $tmpfile = tmpnam();
+ } until sysopen(TF, $tmpfile, O_RDWR|O_CREAT|O_EXCL, 0700);
+ print TF $1;
+ close TF;
+ my $replace = `perl $tmpfile`;
+ chomp($replace);
+ $line =~ s/eval\("(.+?)"\)/$replace/;
+ }
while ($line =~ /pkgconflibs\("(.+?)","(.+?)","(.+?)"\)/)
{
my $replace = pkgconfig_get_lib_dirs($1, $2, $3);
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index da0142317..19ff1b48c 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -21,8 +21,8 @@
#include "m_filter.h"
/* $ModDesc: m_filter with regexps */
-/* $CompileFlags: `pcre-config --cflags` */
-/* $LinkerFlags: `pcre-config --libs` rpath("pcre-config --libs") -lpcre */
+/* $CompileFlags: exec("pcre-config --cflags") */
+/* $LinkerFlags: exec("pcre-config --libs") rpath("pcre-config --libs") -lpcre */
/* $ModDep: m_filter.h */
class PCREFilter : public FilterResult
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 7b718b43a..0688b1099 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -24,8 +24,8 @@
/* VERSION 2 API: With nonblocking (threaded) requests */
/* $ModDesc: SQL Service Provider module for all other m_sql* modules */
-/* $CompileFlags: `mysql_config --include` */
-/* $LinkerFlags: `mysql_config --libs_r` rpath("mysql_config --libs_r") */
+/* $CompileFlags: exec("mysql_config --include") */
+/* $LinkerFlags: exec("mysql_config --libs_r") rpath("mysql_config --libs_r") */
/* $ModDep: m_sqlv2.h */
/* THE NONBLOCKING MYSQL API!
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index d702b9c34..8807d82c5 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -28,8 +28,8 @@
#include "m_sqlv2.h"
/* $ModDesc: PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API */
-/* $CompileFlags: -I`pg_config --includedir` `perl extra/pgsql_config.pl` */
-/* $LinkerFlags: -L`pg_config --libdir` -lpq */
+/* $CompileFlags: -Iexec("pg_config --includedir") eval("my $s = `pg_config --version`;$s =~ /^.*?(\d+)\.(\d+)\.(\d+).*?$/;my $v = hex(sprintf("0x%02x%02x%02x", $1, $2, $3));print "-DPGSQL_HAS_ESCAPECONN" if(($v >= 0x080104) or (($v >= 0x07030F) and ($v < 0x080000)));") */
+/* $LinkerFlags: -Lexec("pg_config --libdir") -lpq */
/* $ModDep: m_sqlv2.h */
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index bb76ec978..5720216d2 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -30,7 +30,7 @@
#include "transport.h"
/* $ModDesc: Provides SSL support for clients */
-/* $CompileFlags: `libgnutls-config --cflags` */
+/* $CompileFlags: exec("libgnutls-config --cflags") */
/* $LinkerFlags: rpath("libgnutls-config --libs") */
/* $ModDep: transport.h */
diff --git a/src/modules/extra/pgsql_config.pl b/src/modules/extra/pgsql_config.pl
deleted file mode 100644
index 277a4f71d..000000000
--- a/src/modules/extra/pgsql_config.pl
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/perl
-
-my $s = `pg_config --version`;
-$s =~ /^.*?(\d+)\.(\d+)\.(\d+).*?$/;
-my $v = hex(sprintf("0x%02x%02x%02x", $1, $2, $3));
-print "-DPGSQL_HAS_ESCAPECONN" if(($v >= 0x080104) or (($v >= 0x07030F) and ($v < 0x080000)));