summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-15 16:04:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-15 16:04:22 +0000
commit7730bd035b2f0edc33109316b8d52610894db835 (patch)
tree1ecd17eeb387b41ec8bd49de2f2c445b16987a65 /configure
parenta10024d9e354a2c5567976fd4ee8e5469e939302 (diff)
Added better detection of strlcpy that doesn't involve compiling a test program (faster)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1390 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure28
1 files changed, 15 insertions, 13 deletions
diff --git a/configure b/configure
index f02392c0d..86a909b8e 100755
--- a/configure
+++ b/configure
@@ -76,19 +76,21 @@ if (!$config{MAX_CLIENT}) {
}
# Perform the strlcpy() test..
-open(STRLCPY, ">.test.cpp");
-print STRLCPY "#include <string.h>
-#include <stdio.h>
-int main() { char a[10]; char b[10]; strlcpy(a,b,10); printf(\"%d\\n\",9); }\n";
-close(STRLCPY);
-
-# Build the Binary..
-system("g++ -o .test .test.cpp 2>&1");
-
-# Was the build succesful?
-if (-e ".test") {
- $config{HAS_STRLCPY} = "true";
- system("rm -f .test .test.cpp");
+$config{HAS_STRLCPY} = "false";
+my $fail = 0;
+open(STRLCPY, "</usr/include/string.h") or $fail = 1;
+if (!$fail)
+{
+ while (chomp($line = <STRLCPY>))
+ {
+ # try and find the delcaration of:
+ # size_t strlcpy(...)
+ if (($line =~ /size_t(\0x9|\s)+strlcpy(\0x9|\s)+\(/) || ($line =~ /size_t(\0x9|\s)+strlcpy\(/))
+ {
+ $config{HAS_STRLCPY} = "true";
+ }
+ }
+ close(STRLCPY);
}
################################################################################