summaryrefslogtreecommitdiff
path: root/ext/NDBM_File
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-10-09 20:17:07 +0000
committerSteve Peters <steve@fisharerojo.org>2006-10-09 20:17:07 +0000
commite82f3e3c5fa2a46d2475b54a3790ddd631719562 (patch)
treefe2966dbaf5b3390ca02e9491e091a4655dcc74a /ext/NDBM_File
parent15db3ae289ff45bb22c7aa4fbfecdc85d7503321 (diff)
downloadperl-e82f3e3c5fa2a46d2475b54a3790ddd631719562.tar.gz
Make g++ happy when compiling NDBM_File on a system that
is likely using the GDBM compatibility headers that g++ (and other C++ implementations) cannot handle. p4raw-id: //depot/perl@28976
Diffstat (limited to 'ext/NDBM_File')
-rw-r--r--ext/NDBM_File/Makefile.PL9
-rw-r--r--ext/NDBM_File/NDBM_File.xs14
2 files changed, 23 insertions, 0 deletions
diff --git a/ext/NDBM_File/Makefile.PL b/ext/NDBM_File/Makefile.PL
index 7b586017d7..dc5cc447fb 100644
--- a/ext/NDBM_File/Makefile.PL
+++ b/ext/NDBM_File/Makefile.PL
@@ -1,7 +1,16 @@
+use Config;
use ExtUtils::MakeMaker;
+
+my $define = "";
+
+if($Config{i_gdbm} && $Config{i_gdbm} eq 'define') {
+ $define .= " -DHAS_GDBM";
+}
+
WriteMakefile(
NAME => 'NDBM_File',
LIBS => ["-L/usr/local/lib -lndbm", "-ldbm -lucb"],
+ DEFINE => $define,
MAN3PODS => {}, # Pods will be built by installman.
XSPROTOARG => '-noprototypes', # XXX remove later?
VERSION_FROM => 'NDBM_File.pm',
diff --git a/ext/NDBM_File/NDBM_File.xs b/ext/NDBM_File/NDBM_File.xs
index 5e02af7657..0c726cf397 100644
--- a/ext/NDBM_File/NDBM_File.xs
+++ b/ext/NDBM_File/NDBM_File.xs
@@ -16,6 +16,20 @@ typedef NDBM_File_type * NDBM_File ;
typedef datum datum_key ;
typedef datum datum_value ;
+
+#if defined(_cplusplus) && defined(HAS_GDBM)
+/* gdbm's header file used for compatibility with gdbm */
+/* isn't compatible to C++ syntax, so we need these */
+/* declarations to make everyone happy. */
+EXTERN_C DBM *dbm_open(const char *, int, mode_t);
+EXTERN_C void dbm_close(DBM *);
+EXTERN_C datum dbm_fetch(DBM *, datum);
+EXTERN_C int dbm_store(DBM *, datum, datum, int);
+EXTERN_C int dbm_delete(DBM *, datum);
+EXTERN_C datum dbm_firstkey(DBM *);
+EXTERN_C datum dbm_nextkey(DBM *);
+#endif
+
MODULE = NDBM_File PACKAGE = NDBM_File PREFIX = ndbm_
NDBM_File