+ Makefile.am for db drivers: mysql, postgres
authorAlex Kirhenshtein <alk@netxms.org>
Tue, 11 May 2004 22:15:05 +0000 (22:15 +0000)
committerAlex Kirhenshtein <alk@netxms.org>
Tue, 11 May 2004 22:15:05 +0000 (22:15 +0000)
! obsolete mysql_connect replaced with mysql_real_connect

.gitattributes
configure.ac
reconf
sql/Makefile
src/server/Makefile.am
src/server/dbdrv/Makefile.am [copied from src/server/Makefile.am with 95% similarity]
src/server/dbdrv/mysql/Makefile [deleted file]
src/server/dbdrv/mysql/Makefile.am [new file with mode: 0644]
src/server/dbdrv/mysql/mysql.cpp
src/server/dbdrv/pgsql/Makefile.am [new file with mode: 0644]

index 7248f2d..c58751f 100644 (file)
@@ -175,15 +175,17 @@ src/server/core/tools.cpp -text
 src/server/core/users.cpp -text
 src/server/core/watchdog.cpp -text
 src/server/core/winsrv.cpp -text
+src/server/dbdrv/Makefile.am -text
 src/server/dbdrv/mssql/mssql.cpp -text
 src/server/dbdrv/mssql/mssql.dsp -text
 src/server/dbdrv/mssql/mssql.dsw -text
 src/server/dbdrv/mssql/mssqldrv.h -text
-src/server/dbdrv/mysql/Makefile -text
+src/server/dbdrv/mysql/Makefile.am -text
 src/server/dbdrv/mysql/mysql.cpp -text
 src/server/dbdrv/mysql/mysql.dsp -text
 src/server/dbdrv/mysql/mysql.dsw -text
 src/server/dbdrv/mysql/mysqldrv.h -text
+src/server/dbdrv/pgsql/Makefile.am -text
 src/server/dbdrv/pgsql/pgsql.cpp -text
 src/server/dbdrv/pgsql/pgsql.dsp -text
 src/server/dbdrv/pgsql/pgsql.dsw -text
index b5533b7..de9d293 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.2 2004-05-11 14:39:56 alk Exp $
+# $Id: configure.ac,v 1.3 2004-05-11 22:14:55 alk Exp $
 #
 # Process this file with autoconf to produce a configure script.
 #
@@ -37,16 +37,17 @@ AC_ARG_WITH(mysql,
        if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
                LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"   
                LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
-               CFLAGS="$CFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
+               CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
        else
                LD_RUN_PATH="/usr/local/mysql/lib:/usr/local/mysql/lib/mysql:/usr/lib/mysql:/usr/mysql/lib:/usr/mysql/lib/mysql:/usr/local/lib/mysql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
                LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql"
-               CFLAGS="$CFLAGS -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql"
+               CPPFLAGS="$CPPFLAGS -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql"
        fi
        AC_CHECK_LIB(m, floor)
        AC_CHECK_LIB(z, gzclose)
        with_mysql="yes"
        AC_DEFINE(WITH_MYSQL,,[with mysql])
+       DB_DRIVERS="$DB_DRIVERS mysql"
        AC_CHECK_LIB(mysqlclient, mysql_init, ,
                [AC_MSG_ERROR(libmysqlclient is needed for MySQL support)])
        AC_MSG_CHECKING(whether mysql clients can run)
@@ -64,44 +65,44 @@ AC_ARG_WITH(mysql,
        ],[])
        AC_MSG_RESULT(yes)
        AC_CHECK_FUNCS(mysql_real_escape_string)
-       fi ])
+fi ])
 
 AC_ARG_WITH(pgsql,
 [AS_HELP_STRING(--with-pgsql,enable postgres backend)],
 [ if test "x$withval" != "xno" ; then
-    if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
-      LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"    
-      LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
-      CFLAGS="$CFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
-    else
-      LD_RUN_PATH="/usr/local/pgsql/lib:/usr/local/pgsql/lib/pgsql:/usr/lib/pgsql:/usr/pgsql/lib:/usr/pgsql/lib/pgsql:/usr/local/lib/pgsql:/usr/local/postgresql/lib:/usr/local/postgresql/lib/postgresql:/usr/lib/postgresql:/usr/postgresql/lib:/usr/postgresql/lib/postgresql:/usr/local/lib/postgresql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
-      LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib -L/usr/lib/pgsql -L/usr/pgsql/lib -L/usr/local/lib/pgsql -L/usr/local/pgsql/lib/pgsql -L/usr/pgsql/lib/pgsql -L/usr/local/postgresql/lib -L/usr/lib/postgresql -L/usr/postgresql/lib -L/usr/local/lib/postgresql -L/usr/local/postgresql/lib/postgresql -L/usr/postgresql/lib/postgresql"
-      CFLAGS="$CFLAGS -I/usr/local/pgsql/include -I/usr/include/pgsql -I/usr/pgsql/include -I/usr/local/include/pgsql -I/usr/local/pgsql/include/pgsql -I/usr/pgsql/include/pgsql -I/usr/local/postgresql/include -I/usr/include/postgresql -I/usr/postgresql/include -I/usr/local/include/postgresql -I/usr/local/postgresql/include/postgresql -I/usr/postgresql/include/postgresql"
-    fi
-    AC_CHECK_LIB(m, floor)
-    AC_CHECK_LIB(z, gzclose)
-    with_pgsql="yes"
-    AC_DEFINE(WITH_PGSQL,,[with pgsql])
-    AC_CHECK_LIB(pq, PQconnectdb, ,
-      [AC_MSG_ERROR(libpq is needed for PostgreSQL support)])        
-    AC_MSG_CHECKING(whether postgresql clients can run)
-    AC_RUN_IFELSE([AC_LANG_SOURCE([[
-      #include <stdio.h>
-      #include <libpq-fe.h>
-      int main(void)
-      {
-          PGconn *a = PQconnectdb("");
-          return 0;
-      }
-      ]])],[],[
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
-      
-    ],[])    
-    AC_MSG_RESULT(yes)
-  fi ])
-
+       if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+               LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"    
+               LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
+               CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
+       else
+               LD_RUN_PATH="/usr/local/pgsql/lib:/usr/local/pgsql/lib/pgsql:/usr/lib/pgsql:/usr/pgsql/lib:/usr/pgsql/lib/pgsql:/usr/local/lib/pgsql:/usr/local/postgresql/lib:/usr/local/postgresql/lib/postgresql:/usr/lib/postgresql:/usr/postgresql/lib:/usr/postgresql/lib/postgresql:/usr/local/lib/postgresql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
+               LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib -L/usr/lib/pgsql -L/usr/pgsql/lib -L/usr/local/lib/pgsql -L/usr/local/pgsql/lib/pgsql -L/usr/pgsql/lib/pgsql -L/usr/local/postgresql/lib -L/usr/lib/postgresql -L/usr/postgresql/lib -L/usr/local/lib/postgresql -L/usr/local/postgresql/lib/postgresql -L/usr/postgresql/lib/postgresql"
+               CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include -I/usr/include/pgsql -I/usr/pgsql/include -I/usr/local/include/pgsql -I/usr/local/pgsql/include/pgsql -I/usr/pgsql/include/pgsql -I/usr/local/postgresql/include -I/usr/include/postgresql -I/usr/postgresql/include -I/usr/local/include/postgresql -I/usr/local/postgresql/include/postgresql -I/usr/postgresql/include/postgresql"
+       fi
+       AC_CHECK_LIB(m, floor)
+       AC_CHECK_LIB(z, gzclose)
+       with_pgsql="yes"
+       DB_DRIVERS="$DB_DRIVERS pgsql"
+       AC_DEFINE(WITH_PGSQL,,[with pgsql])
+       AC_CHECK_LIB(pq, PQconnectdb, ,
+               [AC_MSG_ERROR(libpq is needed for PostgreSQL support)])        
+                       AC_MSG_CHECKING(whether postgresql clients can run)
+                       AC_RUN_IFELSE([AC_LANG_SOURCE([[
+                               #include <stdio.h>
+                               #include <libpq-fe.h>
+                               int main(void)
+                               {
+                                       PGconn *a = PQconnectdb("");
+                                       return 0;
+                               }
+                       ]])],[],[
+                       AC_MSG_RESULT(no)
+                       AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
+               ],[])    
+       AC_MSG_RESULT(yes)
+fi ])
 
+AC_SUBST(DB_DRIVERS)
 
 
 # --------------------------------------------------------------------------
@@ -201,22 +202,23 @@ AC_EGREP_CPP(yes,
                yes
        #endif
        ], AC_MSG_RESULT(yes)
-       CFLAGS="$CFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
+       CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
        AC_MSG_RESULT(no))
 if test "x$PTHREAD_LIBS" = xerror; then
        AC_CHECK_LIB(pthread, pthread_attr_init,
-       PTHREAD_LIBS="-lpthread")
+               PTHREAD_LIBS="-lpthread")
 fi
 if test "x$PTHREAD_LIBS" = xerror; then
        AC_CHECK_LIB(pthreads, pthread_attr_init,
-       PTHREAD_LIBS="-lpthreads")
+               PTHREAD_LIBS="-lpthreads")
 fi
 if test "x$PTHREAD_LIBS" = xerror; then
        AC_CHECK_LIB(c_r, pthread_attr_init,
-       PTHREAD_LIBS="-lc_r")
+               PTHREAD_LIBS="-lc_r")
 fi
 if test "x$PTHREAD_LIBS" = xerror; then
-       AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
+       AC_CHECK_FUNC(pthread_attr_init,
+               PTHREAD_LIBS="")
 fi
 if test "x$PTHREAD_LIBS" = xerror; then
        AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
@@ -271,6 +273,9 @@ AC_CONFIG_FILES([
    src/libnetxms/Makefile
    src/server/Makefile
    src/server/core/Makefile
+   src/server/dbdrv/Makefile
+   src/server/dbdrv/mysql/Makefile
+   src/server/dbdrv/pgsql/Makefile
 ])
 
 AC_OUTPUT
diff --git a/reconf b/reconf
index f7c416c..e00777d 100644 (file)
--- a/reconf
+++ b/reconf
@@ -19,4 +19,4 @@ echo "- autoheader." &&
 autoheader-2.59 &&
 echo "- automake." &&
 automake-1.7 -a &&
-exit
+exit $?
index 663df20..c8382b7 100644 (file)
-#
-# Makefile for SQL scripts
-#
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# sql/Makefile.  Generated from Makefile.in by configure.
 
-ROOT_FILE = dbinit.in
-SOURCE = $(ROOT_FILE) schema.in setup.in events.in
-COMMAND = cpp -P -Wundef -I../include -I../src/server/core
-SQUEEZE = perl -e "while (<>) { if (! /^[\s\t\n]*$$/) { print; } }"
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-all: dbinit_mysql.sql dbinit_pgsql.sql dbinit_mssql.sql
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
 
-dbinit_mysql.sql: $(SOURCE)
-       $(COMMAND) -DDB_MYSQL $(ROOT_FILE) | $(SQUEEZE) > $@
 
-dbinit_pgsql.sql: $(SOURCE)
-       $(COMMAND) -DDB_POSTGRESQL $(ROOT_FILE) | $(SQUEEZE) > $@
 
-dbinit_mssql.sql: $(SOURCE)
-       $(COMMAND) -DDB_MSSQL $(ROOT_FILE) | $(SQUEEZE) > $@
+srcdir = .
+top_srcdir = ..
 
-clean:
-       rm -f dbinit_*.sql
+pkgdatadir = $(datadir)/netxms
+pkglibdir = $(libdir)/netxms
+pkgincludedir = $(includedir)/netxms
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /bin/install -c
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = i686-pc-linux-gnu
+ACLOCAL = ${SHELL} /home/alk/work/nms/config/missing --run aclocal-1.7
+AMDEP_FALSE = #
+AMDEP_TRUE = 
+AMTAR = ${SHELL} /home/alk/work/nms/config/missing --run tar
+AR = ar
+AUTOCONF = ${SHELL} /home/alk/work/nms/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/alk/work/nms/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/alk/work/nms/config/missing --run automake-1.7
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS =  -I/usr/local/include
+CPP = gcc -E
+CPPFLAGS =  -I/usr/local/include -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql -I/usr/local/pgsql/include -I/usr/include/pgsql -I/usr/pgsql/include -I/usr/local/include/pgsql -I/usr/local/pgsql/include/pgsql -I/usr/pgsql/include/pgsql -I/usr/local/postgresql/include -I/usr/include/postgresql -I/usr/postgresql/include -I/usr/local/include/postgresql -I/usr/local/postgresql/include/postgresql -I/usr/postgresql/include/postgresql
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+DB_DRIVERS =  mysql pgsql
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO = echo
+ECHO_C = 
+ECHO_N = -n
+ECHO_T = 
+EGREP = grep -E
+EXEEXT = 
+F77 = 
+FFLAGS = 
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+LDFLAGS =  -L/usr/local/lib -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql -L/usr/local/pgsql/lib -L/usr/lib/pgsql -L/usr/pgsql/lib -L/usr/local/lib/pgsql -L/usr/local/pgsql/lib/pgsql -L/usr/pgsql/lib/pgsql -L/usr/local/postgresql/lib -L/usr/lib/postgresql -L/usr/postgresql/lib -L/usr/local/lib/postgresql -L/usr/local/postgresql/lib/postgresql -L/usr/postgresql/lib/postgresql
+LIBNETXMS_LIBRARY_VERSION = 0:1:0
+LIBOBJS = 
+LIBS = -lssl -lcrypto -lpq -lz -lm -lmysqlclient -lz -lm 
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBOBJS = 
+MAKEINFO = ${SHELL} /home/alk/work/nms/config/missing --run makeinfo
+OBJEXT = o
+PACKAGE = netxms
+PACKAGE_BUGREPORT = NetXMS Team <bugs@netxms.org>
+PACKAGE_NAME = NetXMS
+PACKAGE_STRING = NetXMS 0.1.0
+PACKAGE_TARNAME = netxms
+PACKAGE_VERSION = 0.1.0
+PATH_SEPARATOR = :
+PERL = /usr/bin/perl
+POW_LIB = 
+PTHREAD_LIBS = -lpthread
+RANLIB = ranlib
+SET_MAKE = 
+SHELL = /bin/sh
+STRIP = strip
+VERSION = 0.1.0
+ac_ct_AR = ar
+ac_ct_CC = gcc
+ac_ct_CXX = 
+ac_ct_F77 = 
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE = 
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE = 
+am__include = include
+am__leading_dot = .
+am__quote = 
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias = 
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+host = i686-pc-linux-gnu
+host_alias = 
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/alk/work/nms/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+oldincludedir = /usr/include
+prefix = /tmp/nx
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+sysconfdir = ${prefix}/etc
+target_alias = 
+subdir = sql
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  sql/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkinstalldirs) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile
+
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+       distclean distclean-generic distclean-libtool distdir dvi \
+       dvi-am info info-am install install-am install-data \
+       install-data-am install-exec install-exec-am install-info \
+       install-info-am install-man install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
index b4b190a..29891ee 100644 (file)
@@ -9,4 +9,4 @@
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 #SUBDIRS = libnetxms libnxcl server agent console
-SUBDIRS = core
+SUBDIRS = core dbdrv
similarity index 95%
copy from src/server/Makefile.am
copy to src/server/dbdrv/Makefile.am
index b4b190a..c65ff95 100644 (file)
@@ -9,4 +9,4 @@
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 #SUBDIRS = libnetxms libnxcl server agent console
-SUBDIRS = core
+SUBDIRS = @DB_DRIVERS@
diff --git a/src/server/dbdrv/mysql/Makefile b/src/server/dbdrv/mysql/Makefile
deleted file mode 100644 (file)
index a1730f3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-OBJ = mysql.o
-#DST=libnetxms.a
-DST = mysql.ddr
-
-CFLAGS = -I../../include -I../../../../include -I/usr/include/mysql -Wall
-LFLAGS = -shared -L/usr/lib/mysql -lmysqlclient
-
-all: $(DST)
-
-$(DST): $(OBJ)
-       rm -f $(DST)
-#      $(AR) q $(DST) $(OBJ)
-       gcc $(LFLAGS) -o $(DST) $(OBJ)
-
-.SUFFIXES: .cpp .o
-.cpp.o: $(SRC)
-       $(CC) -c -o $@ $(CFLAGS) $<
-
-clean:
-       rm -f $(OBJ) $(DST)
diff --git a/src/server/dbdrv/mysql/Makefile.am b/src/server/dbdrv/mysql/Makefile.am
new file mode 100644 (file)
index 0000000..50f863e
--- /dev/null
@@ -0,0 +1,5 @@
+INCLUDES=-I@top_srcdir@/include -I@top_srcdir@/src/server/include
+
+lib_LTLIBRARIES = libnxddr_mysql.la
+libnxddr_mysql_la_SOURCES = mysql.cpp
+libnxddr_mysql_la_LDFLAGS = -version-info $(LIBNETXMS_LIBRARY_VERSION)
index 5c88c04..8cd1cb7 100644 (file)
@@ -63,14 +63,16 @@ extern "C" DB_HANDLE EXPORT DrvConnect(char *szHost, char *szLogin, char *szPass
    if (pConn == NULL)
       return 0;
 
-   if (!mysql_connect(pConn, szHost, szLogin[0] == 0 ? NULL : szLogin,
-                      (szPassword[0] == 0 || szLogin[0] == 0) ? NULL : szPassword))
-   {
-      mysql_close(pConn);
-      return 0;
-   }
-
-   if (mysql_select_db(pConn, szDatabase) < 0)
+   if (!mysql_real_connect(
+                               pConn, // MYSQL *
+                               szHost, // host
+                               szLogin[0] == 0 ? NULL : szLogin, // user
+                               (szPassword[0] == 0 || szLogin[0] == 0) ? NULL : szPassword, // pass
+                               szDatabase, // DB Name
+                               0, // use default port
+                               NULL, // char * - unix socket
+                               0 // flags
+                       ))
    {
       mysql_close(pConn);
       return 0;
diff --git a/src/server/dbdrv/pgsql/Makefile.am b/src/server/dbdrv/pgsql/Makefile.am
new file mode 100644 (file)
index 0000000..6335845
--- /dev/null
@@ -0,0 +1,5 @@
+INCLUDES=-I@top_srcdir@/include -I@top_srcdir@/src/server/include
+
+lib_LTLIBRARIES = libnxddr_pgsql.la
+libnxddr_pgsql_la_SOURCES = pgsql.cpp
+libnxddr_pgsql_la_LDFLAGS = -version-info $(LIBNETXMS_LIBRARY_VERSION)