[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pdns-dev
Subject:    [Pdns-dev] Here is the generic SQLite backend, please test
From:       Michel Stol <michel () powerdns ! com>
Date:       2003-09-21 11:46:58
Message-ID: oprvuloku6jl0271 () localhost
[Download RAW message or body]

Hello,

Attached to this mail you'll find the files necessary to build the brand 
new generic SQLite backend and configure.in. The files should go in the 
modules/gsqlitebackend/ (except configure.in).
You can find the library needed to build this backend on 
http://www.sqlite.org/ (or just apt if you use debian :)).

Documentation has still to be written, but in short:
- Create a database using: sqlite powerdns.sqlite
- Create tables (yes, copy/pasted from the manual ;))

create table domains (
 id INT auto_increment,
 name VARCHAR(255) NOT NULL,
 master VARCHAR(20) DEFAULT NULL,
 last_check INT DEFAULT NULL,
 type VARCHAR(6) NOT NULL,
 notified_serial INT DEFAULT NULL, account         VARCHAR(40) DEFAULT 
NULL,
 primary key (id)
);

CREATE UNIQUE INDEX name_index ON domains(name);

CREATE TABLE records (
  id              INT auto_increment,
  domain_id       INT DEFAULT NULL,
  name            VARCHAR(255) DEFAULT NULL,
  type            VARCHAR(6) DEFAULT NULL,
  content         VARCHAR(255) DEFAULT NULL,
  ttl             INT DEFAULT NULL,
  prio            INT DEFAULT NULL,
  change_date     INT DEFAULT NULL,
  primary key(id)
);

CREATE INDEX rec_name_index ON records(name);
CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);

create table supermasters (
  ip VARCHAR(25) NOT NULL, nameserver VARCHAR(255) NOT NULL, account 
VARCHAR(40) DEFAULT NULL
);

- Fill the database with data; I used zone2sql to create gmysql output and 
then: cat zone2sql.output | sqlite powerdns.sqlite

- Launch, and have fun testing: pdns_server --launch=gsqlite --gsqlite- 
database=<path to your SQLite database>

Can you guys give it a go? I'm particulary interested in benchmarking 
results, and maybe some problems with AXFR (which is currently untested).

Thanks in advance,

- Michel Stol


["OBJECTLIBS." (OBJECTLIBS.)]

-lsqlite
["gsqlitebackend.hh" (gsqlitebackend.hh)]


//
// SQLite backend for PowerDNS
// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
//

#ifndef GSQLITEBACKEND_HH
#define GSQLITEBACKEND_HH

#include <string>
#include "pdns/backends/gsql/gsqlbackend.hh"

//! The gSQLiteBackend retrieves it's data from a SQLite database (http://www.sqlite.org/)
class gSQLiteBackend : public GSQLBackend
{
private:
protected:
public:
  //! Constructs the backend, throws an exception if it failed..
  gSQLiteBackend( const std::string & mode, const std::string & suffix );

};

#endif // GSQLITEBACKEND_HH

["OBJECTFILES." (OBJECTFILES.)]

gsqlitebackend.o ssqlite.o
["gsqlitebackend.cc" (gsqlitebackend.cc)]


//
// SQLite backend for PowerDNS
// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
//

#include "pdns/utility.hh"
#include <map>
#include <sstream>
#include <string>

#include "pdns/dns.hh"
#include "pdns/dnsbackend.hh"
#include "pdns/dnspacket.hh"
#include "pdns/ueberbackend.hh"
#include "pdns/ahuexception.hh"
#include "pdns/logger.hh"
#include "pdns/arguments.hh"
#include "ssqlite.hh"
#include "gsqlitebackend.hh"


// Connects to the database.
gSQLiteBackend::gSQLiteBackend( const std::string & mode, const std::string & suffix \
) : GSQLBackend( mode, suffix ) {
  try 
  {
    setDB( new SSQLite( getArg( "database" )));    
  }  
  catch( SSqlException & e ) 
  {
    L << Logger::Error << mode << " Connection failed: " << e.txtReason() << \
std::endl;  throw AhuException( "Unable to launch " + mode + " connection: " + \
e.txtReason());  }

  L << Logger::Warning << mode << " Connection succesful" << std::endl;
}


//! Constructs a gSQLiteBackend
class gSQLiteFactory : public BackendFactory
{
public:
  //! Constructor.
  gSQLiteFactory( const std::string & mode ) : BackendFactory( mode ), d_mode( mode )
  {
  }
  
  //! Declares all needed arguments.
  void declareArguments( const std::string & suffix = "" )
  {
    declare( suffix, "database", "Filename of the SQLite database", "powerdns.sqlite" \
);  
    declare( suffix, "basic-query", "Basic query","select \
content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");  \
declare( suffix, "id-query", "Basic with ID query","select \
content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and \
domain_id=%d");  declare( suffix, "wildcard-query", "Wildcard query","select \
content,ttl,prio,type,domain_id,name from records where type='%s' and name like \
'%s'");  declare( suffix, "wildcard-id-query", "Wildcard with ID query","select \
content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s' \
and domain_id=%d");

    declare( suffix, "any-query", "Any query","select \
content,ttl,prio,type,domain_id,name from records where name='%s'");  declare( \
suffix, "any-id-query", "Any with ID query","select \
content,ttl,prio,type,domain_id,name from records where name='%s' and domain_id=%d"); \
declare( suffix, "wildcard-any-query", "Wildcard ANY query","select \
content,ttl,prio,type,domain_id,name from records where name like '%s'");  declare( \
suffix, "wildcard-any-id-query", "Wildcard ANY with ID query","select \
content,ttl,prio,type,domain_id,name from records where like '%s' and domain_id=%d");

    declare( suffix, "list-query", "AXFR query", "select \
content,ttl,prio,type,domain_id,name from records where domain_id=%d");  declare( \
suffix, "master-zone-query", "Data", "select master from domains where name='%s' and \
type='SLAVE'");

    declare( suffix, "info-zone-query", "","select \
id,name,master,last_check,notified_serial,type from domains where name='%s'");

    declare( suffix, "info-all-slaves-query", "","select \
id,name,master,last_check,type from domains where type='SLAVE'");  declare( suffix, \
"supermaster-query", "", "select account from supermasters where ip='%s' and \
nameserver='%s'");  declare( suffix, "insert-slave-query", "", "insert into domains \
(type,name,master,account) values('SLAVE','%s','%s','%s')");  declare( suffix, \
"insert-record-query", "", "insert into records \
(content,ttl,prio,type,domain_id,name) values ('%s',%d,%d,'%s',%d,'%s')");  declare( \
suffix, "update-serial-query", "", "update domains set notified_serial=%d where \
id=%d");  declare( suffix, "update-lastcheck-query", "", "update domains set \
last_check=%d where id=%d");  declare( suffix, "info-all-master-query", "", "select \
id,name,master,last_check,notified_serial,type from domains where type='MASTER'");  \
declare( suffix, "delete-zone-query", "", "delete from records where domain_id=%d");  \
}  
  //! Constructs a new gSQLiteBackend object.
  DNSBackend *make( const string & suffix = "" )
  {
    return new gSQLiteBackend( d_mode, suffix );
  }

private:
  const string d_mode;
};


//! Magic class that is activated when the dynamic library is loaded
class gSQLiteLoader
{
public:
  //! This reports us to the main UeberBackend class
  gSQLiteLoader()
  {
    BackendMakers().report( new gSQLiteFactory( "gsqlite" ));
    L<<Logger::Warning << "This is module gsqlite reporting" << std::endl;
  }
};


//! Reports the backendloader to the UeberBackend.
static gSQLiteLoader gsqliteloader;


["ssqlite.cc" (ssqlite.cc)]


//
// SQLite backend for PowerDNS
// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
//

#include <string>
#include "ssqlite.hh"


// Constructor.
SSQLite::SSQLite( const std::string & database )
{
  // Open the database connection.
  m_pDB = sqlite_open( database.c_str(), 0, NULL );
  if ( m_pDB == NULL )
    throw sPerrorException( "Could not connect to the SQLite database" );

  m_pVM = NULL;
}


// Destructor.
SSQLite::~SSQLite( void )
{
  if ( m_pDB )
    sqlite_close( m_pDB );
}


// Constructs a SSqlException object.
SSqlException SSQLite::sPerrorException( const std::string & reason )
{
  return SSqlException( reason );
}


// Performs a query.
int SSQLite::doQuery( const std::string & query, result_t & result )
{
  result.clear();
  
  doQuery( query );
  
  row_t row;
  while( getRow( row ))
    result.push_back( row );
    
  return result.size();
}


// Performs a query.
int SSQLite::doQuery( const std::string & query )
{
  const char *pOut;

  // Execute the query.
  if ( sqlite_compile( m_pDB, query.c_str(), &pOut, &m_pVM, NULL ) != SQLITE_OK )
    sPerrorException( "Could not create SQLite VM for query" );
    
  return 0;
}


// Returns a row from the result set.
bool SSQLite::getRow( row_t & row )
{
  int  numCols;
  int  rc;
  const char **ppData;
  const char **ppColumnNames;

  do
  {
    rc = sqlite_step( m_pVM, &numCols, &ppData, &ppColumnNames );
    
    if ( rc == SQLITE_BUSY )
    {
      usleep( 250 ); // FIXME: Should this be increased, decreased, or is it Just Right? :)
      continue;
    }   
  } while ( false );
  
  if ( rc == SQLITE_ROW )
  {
    // Another row received, process it.
    for ( int i = 0; i < numCols; i++ )
    {
      if ( ppData[ i ] )
        row.push_back( ppData[ i ] );
      else
        row.push_back( "" ); // NULL value.
    }
    
    return true;
  }
  
  if ( rc == SQLITE_DONE )
  {
    // We're done, clean up.
    sqlite_finalize( m_pVM, NULL );
    m_pVM = NULL;
    
    return false;
  }
  
  // Something went wrong, complain.
  throw sPerrorException( "Error while retrieving SQLite query results" );
  
  // Prevent some compilers from complaining.
  return false;
}


// Escape a SQL query.
std::string SSQLite::escape( const std::string & name)
{
  std::string a;
  
    for( std::string::const_iterator i = name.begin(); i != name.end(); ++i ) 
    {
      if( *i == '\'' || *i == '\\' )
        a += '\\';
        
      a += *i;
    }
    
  return a;
}


["ssqlite.hh" (ssqlite.hh)]


//
// SQLite backend for PowerDNS
// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
//

#ifndef SSQLITE_HH
#define SSQLITE_HH

#include <sqlite.h>
#include "pdns/backends/gsql/ssql.hh"

class SSQLite : public SSql
{
private:
  //! Pointer to the SQLite database instance.
  sqlite *m_pDB;

  //! Pointer to the SQLite virtual machine executing a query.
  sqlite_vm *m_pVM;
  
protected:
public:
  //! Constructor.
  SSQLite( const std::string & database );
  
  //! Destructor.
  ~SSQLite( void );
  
  //! Performs a query.
  int doQuery( const std::string & query, result_t & result );
  
  //! Performs a query.
  int doQuery( const std::string & query );
  
  //! Returns a row from a result set.
  bool getRow( row_t & row );
  
  //! Escapes the SQL query.
  std::string escape( const std::string & query );
  
  //! Used to create an backend specific exception message.
  SSqlException sPerrorException( const std::string & reason );
  
};

#endif // SSQLITE_HH


["Makefile.am" (Makefile.am)]

lib_LTLIBRARIES = libgsqlitebackend.la

EXTRA_DIST=OBJECTFILES OBJECTLIBS

INCLUDES=-I@SQLITE_incdir@

libgsqlitebackend_la_SOURCES=gsqlitebackend.cc gsqlitebackend.hh \
                ssqlite.hh ssqlite.cc


libgsqlitebackend_la_LDFLAGS=-module -lsqlite

["configure.in" (configure.in)]

dnl intro
AC_INIT(pdns/receiver.cc)
AM_INIT_AUTOMAKE(pdns, 2.9.11)
AC_CANONICAL_HOST
AM_CONFIG_HEADER(config.h)
AC_C_BIGENDIAN 
AC_PREREQ(2.52)
CXXFLAGS="$CXXFLAGS -Wall -O2"

AC_PREFIX_DEFAULT(/usr/local)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL 
AC_LANG_CPLUSPLUS

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)

# Check for libdl

my_save_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB(dl,dlopen)
LIBDL=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBDL)

AC_MSG_CHECKING([for RTLD_NOW]);
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LIBDL"
AC_TRY_LINK(
[#include <dlfcn.h>],
[ (void) dlopen("",RTLD_NOW); ],
has_RTLD_NOW=yes, has_RTLD_NOW=no)
AC_MSG_RESULT([$has_RTLD_NOW])
if test "$has_RTLD_NOW" = "no"
then
	AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
fi
LIBS=$ac_save_LIBS

DYNLINKFLAGS=""
THREADFLAGS=""

case "$host_os" in
solaris2.8 | solaris2.9 ) 
	AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
	AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional \
prototype])  AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
	LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
	CXXFLAGS="-D_REENTRANT $CXXFLAGS"
	;;
solaris2.6 | solaris2.7) 
	AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
	AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional \
prototype])  LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
	CXXFLAGS="-D_REENTRANT $CXXFLAGS"
	;;
linux*)
	AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
	DYNLINKFLAGS="-rdynamic"
	LDFLAGS="$LDFLAGS"
	THREADFLAGS="-pthread"
	CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
	;;
openbsd*)
	AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
	DYNLINKFLAGS="-rdynamic"
	LDFLAGS="-lc_r $LDFLAGS"
	CXXFLAGS="-pthread $CXXFLAGS"
	;;
*)
	AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
	DYNLINKFLAGS="-rdynamic"
	LDFLAGS="-pthread $LDFLAGS"
	CXXFLAGS="-pthread $CXXFLAGS"
	;;
esac

AC_SUBST(THREADFLAGS)

AC_SUBST(DYNLINKFLAGS)

AC_MSG_CHECKING(whether we will be doing verbose logging)
AC_ARG_ENABLE(verbose-logging, 
 [  --enable-verbose-logging	Do verbose logging],enable_verbose_logging=yes \
,enable_verbose_logging=no)

if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose \
logging should be enabled])  fi
AC_MSG_RESULT($enable_verbose_logging)

AC_MSG_CHECKING(whether we should build static binaries)

AC_ARG_ENABLE(static-binaries, 
	[  --enable-static-binaries	Build static binaries],
     [case "${enableval}" in
       yes) static=true ;;
       no)  static=false ;;
       *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
     esac],[debug=false])
AC_MSG_RESULT($static)

AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)

if test x$static = xtrue; 
then 
	LDFLAGS="-all-static $LDFLAGS"
fi



modules="gmysql"
AC_ARG_WITH(modules, [  --with-modules Which userbases to compile with ], 
[
        modules="$withval"  
])

dynmodules="pipe"
AC_ARG_WITH(dynmodules, [  --with-dynmodules Which userbases to build for dynamic \
loading ],  [
        dynmodules="$withval"  
])



AC_SUBST(socketdir)
socketdir="/var/run"
AC_ARG_WITH(socketdir, [  --with-socketdir Where the controlsocket lives ], 
[
        socketdir="$withval"  
])

AC_SUBST(moduledirs)
AC_SUBST(moduleobjects)
AC_SUBST(modulelibs)

AC_MSG_CHECKING(whether we will be building the server)
AC_ARG_ENABLE(pdns-server, 
 [  --enable-pdns_server	If we should build the server],
	enable_pdns_server=$enableval,
	enable_pdns_server=yes)

AC_MSG_RESULT($enable_pdns_server)

if test x"$enable_pdns_server" = "xyes"
then 
	programdescend=pdns
fi

AC_SUBST(programdescend)


AC_MSG_CHECKING(whether we will be building the recursor)
AC_ARG_ENABLE(recursor, 
 [  --enable-recursor	If we should build the server],
	enable_recursor=$enableval,
	enable_recursor=no)

AC_MSG_RESULT($enable_recursor)

AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")

for a in $modules $dynmodules
do
	case "$a" in
		mysql )
			needmysql=yes
		;;
		gmysql )
			needmysql=yes
		;;
		gpgsql )
			needpgsql=yes
		;;
		gsqlite )
			needsqlite=yes
		;;
		pdns )
			needmysql=yes
		;;
	esac
done


if test "$needmysql"
then
	AC_ARG_WITH(mysql,
	    [  --with-mysql=<path>     root directory path of MySQL installation],
	    [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
	MYSQL_inc_check="$withval/include/mysql"],
	    [MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql \
/opt/mysql/lib/mysql /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib \
/opt/mysql/lib /usr/lib"  MYSQL_inc_check="/usr/local/mysql/include/mysql \
/usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include \
/usr/include/mysql"])  AC_ARG_WITH(mysql-lib,
	    [  --with-mysql-lib=<path> directory path of MySQL library installation],
	    [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
		AC_ARG_WITH(mysql-includes,
	    [  --with-mysql-includes=<path>
                         directory path of MySQL header installation],
	    [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
		AC_MSG_CHECKING([for MySQL library directory])
	MYSQL_libdir=
	for m in $MYSQL_lib_check; do
	        if test -d "$m" && \
		   (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
	        then
	                MYSQL_libdir=$m
	                break
	        fi
	done
		if test -z "$MYSQL_libdir"; then
	        AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
	fi
	case "$MYSQL_libdir" in
                 /usr/lib ) MYSQL_lib="" ;;
	  /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
	  * )  AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute \
path.]) ;;  esac
	
	AC_SUBST(MYSQL_lib)
	
	AC_MSG_RESULT([$MYSQL_libdir])
		AC_MSG_CHECKING([for MySQL include directory])
	MYSQL_incdir=
	for m in $MYSQL_inc_check; do
	        if test -d "$m" && test -f "$m/mysql.h"
	        then
	                MYSQL_incdir=$m
	                break
	        fi
	done
		if test -z "$MYSQL_incdir"; then
	        AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
	fi
	
	case "$MYSQL_incdir" in
	  /* ) ;;
	  * )  AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute \
path.]) ;;  esac
	
	AC_SUBST(MYSQL_incdir)
	AC_MSG_RESULT([$MYSQL_incdir])
#	LIBS="$LIBS -lmysqlclient"
fi



if test "$needpgsql" 
then
	AC_ARG_WITH(pgsql,
	    [  --with-pgsql=<path>     root directory path of PgSQL installation],
	    [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
	PGSQL_inc_check="$withval/include/pgsql"],
	    [PGSQL_lib_check="/usr/local/pgsql/lib/pgsql /usr/local/lib/pgsql \
/opt/pgsql/lib/pgsql /usr/lib/pgsql /usr/local/pgsql/lib /usr/local/lib \
/opt/pgsql/lib /usr/lib"  PGSQL_inc_check="/usr/local/pgsql/include/pgsql \
/usr/local/include/postgresql/ /usr/local/include /opt/pgsql/include/pgsql \
/opt/pgsql/include /usr/include/pgsql/ /usr/include/postgresql"])  \
                AC_ARG_WITH(pgsql-lib,
	    [  --with-pgsql-lib=<path> directory path of PgSQL library installation],
	    [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
		AC_ARG_WITH(pgsql-includes,
	    [  --with-pgsql-includes=<path>
                         directory path of PgSQL header installation],
	    [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
		AC_MSG_CHECKING([for PgSQL library directory])
	PGSQL_libdir=
	for m in $PGSQL_lib_check; do
	        if test -d "$m" && \
		   (test -f "$m/libpq++.so" || test -f "$m/libpq++.a")
	        then
	                PGSQL_libdir=$m
	                break
	        fi
	done
		if test -z "$PGSQL_libdir"; then
	        AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
	fi
	case "$PGSQL_libdir" in
           /usr/lib ) PGSQL_lib="" ;;
	  /* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir" 
	       LDFLAGS="$PGSQL_lib $LDFLAGS"
               ;;
	  * )  AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute \
path.]) ;;  esac

	AC_SUBST(PGSQL_lib)
	AC_MSG_RESULT([$PGSQL_libdir])
		AC_MSG_CHECKING([for PgSQL include directory])
	PGSQL_incdir=
	for m in $PGSQL_inc_check; do
	        if test -d "$m" && test -f "$m/libpq++.h"
	        then
	                PGSQL_incdir=$m
	                break
	        fi
	done
		if test -z "$PGSQL_incdir"; then
	        AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
	fi
	case "$PGSQL_incdir" in
	  /* ) ;;
	  * )  AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute \
path.]) ;;  esac
	AC_SUBST(PGSQL_incdir)
	AC_MSG_RESULT([$PGSQL_incdir])

#	LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
fi


if test "$needsqlite"
then
        AC_ARG_WITH(sqlite,
            [  --with-sqlite=<path>     root directory path of SQLite installation],
            [SQLITE_lib_check="$withval/lib/sqlite $with_sqlite/lib"
        SQLITE_inc_check="$withval/include/sqlite"],
            [SQLITE_lib_check="/usr/local/sqlite/lib/sqlite /usr/local/lib/sqlite \
/opt/pgsql/lib/sqlite /usr/lib/sqlite /usr/local/sqlite/lib /usr/local/lib \
/opt/sqlite/lib /usr/lib"  SQLITE_inc_check="/usr/local/sqlite/include/sqlite \
/usr/local/include/sqlite/ /usr/local/include /opt/sqlite/include/sqlite \
/opt/sqlite/include /usr/include/ /usr/include/sqlite"])  AC_ARG_WITH(sqlite-lib,
            [  --with-sqlite-lib=<path> directory path of SQLite library \
                installation],
            [SQLITE_lib_check="$withval/lib/sqlite $withval/sqlite $withval"])
                AC_ARG_WITH(sqlite-includes,
            [  --with-sqlite-includes=<path>
                         directory path of SQLite header installation],
            [SQLITE_inc_check="$withval/include/sqlite $withval/sqlite $withval"])
                AC_MSG_CHECKING([for SQLite library directory])
        SQLITE_libdir=
        for m in $SQLITE_lib_check; do
                if test -d "$m" && \
                   (test -f "$m/libsqlite.so" || test -f "$m/libsqlite.a")
                then
                        SQLITE_libdir=$m
                        break
                fi
        done
                if test -z "$SQLITE_libdir"; then
                AC_MSG_ERROR([Didn't find the sqlite library dir in \
'$SQLITE_lib_check'])  fi
        case "$SQLITE_libdir" in
           /usr/lib ) SQLITE_lib="" ;;
          /* ) SQLITE_lib="-L$SQLITE_libdir -Wl,-rpath,$SQLITE_libdir"
               LDFLAGS="$SQLITE_lib $LDFLAGS"
               ;;
          * )  AC_MSG_ERROR([The SQLite library directory ($SQLITE_libdir) must be an \
absolute path.]) ;;  esac

        AC_SUBST(SQLITE_lib)
        AC_MSG_RESULT([$SQLITE_libdir])
                AC_MSG_CHECKING([for SQLite include directory])
        SQLITE_incdir=
        for m in $SQLITE_inc_check; do
                if test -d "$m" && test -f "$m/sqlite.h"
                then
                        SQLITE_incdir=$m
                        break
                fi
        done
                if test -z "$SQLITE_incdir"; then
                AC_MSG_ERROR([Didn't find the SQLite include dir in \
'$SQLITE_inc_check'])  fi
        case "$SQLITE_incdir" in
          /* ) ;;
          * )  AC_MSG_ERROR([The SQLite include directory ($SQLITE_incdir) must be an \
absolute path.]) ;;  esac
        AC_SUBST(SQLITE_incdir)
        AC_MSG_RESULT([$SQLITE_incdir])

#       LIBS="$LIBS -lsqlite"
fi


for a in $modules
do
        moduledirs="$moduledirs ${a}backend"

	for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
	do
	        moduleobjects="$moduleobjects ../modules/${a}backend/$b"
	done
	modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
done

for a in $dynmodules
do
        moduledirs="$moduledirs ${a}backend"
done

export moduledirs moduleobjects modulelibs

AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
modules/pipebackend/Makefile modules/oraclebackend/Makefile \
modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile \
modules/gsqlitebackend/Makefile )



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic