configure: improve checks for funcs not in stdlib
[m6w6/ext-psi] / m4 / posix / ndbm.m4
index 3d60b06dbf58ef837ae53a6318a6047f7873c320..ee7159118d5ffaaad52bd51b0f1433bdf6b01f67 100644 (file)
@@ -1,25 +1,32 @@
 PSI_CHECK_NDBM() {
-       PSI_CONFIG_POSIX(ndbm, ndbm.h)
-       
-       PHP_CHECK_FUNC_LIB(dbm_open, gdbm_compat)
-       
+       PSI_CONFIG_POSIX(ndbm, dnl
+               ndbm.h dnl posix
+               relic.h dnl qdbm
+               gdbm-ndbm.h dnl gdbm
+       )
+
        PSI_STRUCT(datum, [
                void *dptr,
                int dsize]
        )
-       
+
        PSI_OPAQUE_TYPE(DBM)
-       
+
        PSI_CONST(DBM_INSERT, int)
        PSI_CONST(DBM_REPLACE, int)
-       
-       PSI_DECL(void dbm_clearerr, [(DBM *db)])
-       PSI_DECL(void dbm_close, [(DBM *db)])
-       PSI_DECL(int dbm_delete, [(DBM *db, datum key)])
-       PSI_DECL(int dbm_error, [(DBM *db)])
-       PSI_DECL(datum dbm_fetch, [(DBM *db, datum key)])
-       PSI_DECL(datum dbm_firstkey, [(DBM *db)])
-       PSI_DECL(datum dbm_nextkey, [(DBM *db)])
-       PSI_DECL(DBM *dbm_open, [(char *file, int open_flags, mode_t file_mode)])
-       PSI_DECL(int dbm_store, [(DBM *db, datum key, datum content, int store_mode)])
+
+       PSI_DECL(void dbm_clearerr, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(void dbm_close, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(int dbm_delete, [(DBM *db, datum key)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(int dbm_error, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(datum dbm_fetch, [(DBM *db, datum key)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(datum dbm_firstkey, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(datum dbm_nextkey, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(DBM *dbm_open, [(char *file, int open_flags, mode_t file_mode)], [], [-lqdbm -lgdbm_compat])
+       PSI_DECL(int dbm_store, [(DBM *db, datum key, datum content, int store_mode)], [], [-lqdbm -lgdbm_compat])
+
+       # See http://www.gnu.org.ua/software/gdbm/manual/html_section/gdbm_19.html
+       if expr X"$LIBS" : "X.*-lgdbm_compat" >/dev/null; then
+               LIBS="-lgdbm $LIBS"
+       fi
 }
\ No newline at end of file