From: <kr_...@us...> - 2003-09-06 19:59:10
|
Update of /cvsroot/htoolkit/HSQL In directory sc8-pr-cvs1:/tmp/cvs-serv11008 Modified Files: Makefile configure.ac Log Message: Support for PostgreSQL. The new implementation has better support for Sql<->Haskell data translation Index: Makefile =================================================================== RCS file: /cvsroot/htoolkit/HSQL/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 5 Sep 2003 21:44:09 -0000 1.2 --- Makefile 6 Sep 2003 19:59:06 -0000 1.3 *************** *** 1,64 **** ! include config.mk ! ! ifeq "$(WithODBC)" "YES" ! HS_SRC += ODBC/HSQL.hs ! endif ! ! ifeq "$(WithPostgreSQL)" "YES" ! HS_SRC += PostgreSQL/HSQL.hs ! endif ! ! ifeq "$(WithMySQL)" "YES" ! HS_SRC += MySQL/HSQL.hs ! endif ! ! OBJS = $(patsubst %.hs,%.o, $(HS_SRC)) ! HI_SRC = $(patsubst %.hs,%.hi,$(HS_SRC)) ! ! ifneq "$(HADDOCK)" "" ! HS_PPS = $(addsuffix .raw-hs, $(basename $(HS_SRC))) ! endif ! ! %.o : %.hs ! mkdir -p $(basename $^)_split ! $(GHC) $< -O -c -fglasgow-exts -split-objs $(CPPFLAGS) -package-name hsql ! $(LD) -r -o $@ $(basename $^)_split/*.o ! %.hs : %.hsc ! $(HSC2HS) $< $(CPPFLAGS) ! %.raw-hs : %.hs ! $(GHC) -Iincludes $(CPPFLAGS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@ ! ! all: libHSsql.a ! ! libHSsql.a: $(OBJS) ! rm -f libHSsql.a ! for i in $(patsubst %.o,%_split, $(OBJS)); do \ ! $(AR) -q libHSsql.a $$i/*.o; \ ! done ! ! depend: $(HS_SRC) ! $(GHC) -M $^ ! ! clean: ! rm -f $(OBJS) ! rm -f $(HI_SRC) ! rm -f $(HS_PPS) ! ! doc : $(HS_PPS) ! mkdir -p doc ! $(HADDOCK) -h -o doc $(HS_PPS) ! ! install: libHSsql.a $(HI_SRC) doc ! $(INSTALL) libHSsql.a $(prefix)/libHSsql.a ! $(INSTALL) -d $(prefix)/imports/Database ! for i in $(HI_SRC); do \ ! $(INSTALL) -d $(prefix)/imports/Database/`dirname $$i`; \ ! $(INSTALL) -c $$i $(prefix)/imports/Database/`dirname $$i`; \ ! done ! if test -d doc; then \ ! $(INSTALL) -d $(prefix)/doc/html/hsql; \ ! $(INSTALL) -c doc/* $(prefix)/doc/html/hsql; \ ! fi ! $(GHC_PKG) -u -g -i hsql.pkg ! ! ODBC/HSQL.hs : ODBC/HSQLStructs.h --- 1,66 ---- ! include config.mk ! ! ifeq "$(WithODBC)" "YES" ! HS_SRC += ODBC/HSQL.hs ! endif ! ! ifeq "$(WithPostgreSQL)" "YES" ! HS_SRC += PostgreSQL/HSQL.hs ! endif ! ! ifeq "$(WithMySQL)" "YES" ! HS_SRC += MySQL/HSQL.hs ! endif ! ! OBJS = $(patsubst %.hs,%.o, $(HS_SRC)) ! HI_SRC = $(patsubst %.hs,%.hi,$(HS_SRC)) ! ! ifneq "$(HADDOCK)" "" ! HS_PPS = $(addsuffix .raw-hs, $(basename $(HS_SRC))) ! HADDOCK = echo ! endif ! ! %.o : %.hs ! mkdir -p $(basename $^)_split ! rm -f $(basename $^)_split/* ! $(GHC) $< -O -c -fglasgow-exts -split-objs $(CPPFLAGS) -package-name hsql ! $(LD) -r -o $@ $(basename $^)_split/*.o ! %.hs : %.hsc ! $(HSC2HS) $< $(CPPFLAGS) ! %.raw-hs : %.hs ! $(GHC) -Iincludes $(CPPFLAGS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@ ! ! all: libHSsql.a ! ! libHSsql.a: $(OBJS) ! rm -f libHSsql.a ! for i in $(patsubst %.o,%_split, $(OBJS)); do \ ! $(AR) -q libHSsql.a $$i/*.o; \ ! done ! ! depend: $(HS_SRC) ! $(GHC) -M $^ ! ! clean: ! rm -f $(OBJS) ! rm -f $(HI_SRC) ! rm -f $(HS_PPS) ! ! doc : $(HS_PPS) ! mkdir -p doc ! $(HADDOCK) -h -o doc $(HS_PPS) ! ! install: libHSsql.a $(HI_SRC) doc ! $(INSTALL) libHSsql.a $(prefix)/libHSsql.a ! $(INSTALL) -d $(prefix)/imports/Database ! for i in $(HI_SRC); do \ ! $(INSTALL) -d $(prefix)/imports/Database/`dirname $$i`; \ ! $(INSTALL) -c $$i $(prefix)/imports/Database/`dirname $$i`; \ ! done ! $(GHC_PKG) -u -g -i hsql.pkg ! if test -f doc/index.html; then \ ! $(INSTALL) -d $(prefix)/doc/html/hsql; \ ! $(INSTALL) -c doc/* $(prefix)/doc/html/hsql; \ ! fi ! ! ODBC/HSQL.hs : ODBC/HSQLStructs.h Index: configure.ac =================================================================== RCS file: /cvsroot/htoolkit/HSQL/configure.ac,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configure.ac 5 Sep 2003 21:44:10 -0000 1.2 --- configure.ac 6 Sep 2003 19:59:06 -0000 1.3 *************** *** 1,234 **** ! AC_INIT([HSQL],[1.0],[hto...@li...],[hsql]) ! ! AC_CONFIG_FILES([config.mk:config.mk.in hsql.pkg:hsql.pkg.in]) ! ! AC_CANONICAL_SYSTEM ! ! dnl *********************************************** ! dnl Enable/Disable ODBC binding ! dnl *********************************************** ! AC_ARG_ENABLE(odbc, ! [ --enable-odbc ! Build an ODBC binding for Haskell. ! ], ! [WithODBC=YES], ! [WithODBC=NO] ! ) ! AC_SUBST(WithODBC) ! ! dnl *********************************************** ! dnl Enable/Disable PostgreSQL binding ! dnl *********************************************** ! AC_ARG_ENABLE(postgres, ! [ --enable-postgres ! Build a PostgreSQL binding for Haskell. ! ], ! [WithPostgreSQL=YES], ! [WithPostgreSQL=NO] ! ) ! AC_SUBST(WithPostgreSQL) ! ! dnl *********************************************** ! dnl Enable/Disable MySQL binding ! dnl *********************************************** ! AC_ARG_ENABLE(mysql, ! [ --enable-mysql ! Build a MySQL binding for Haskell. ! ], ! [WithMySQL=YES], ! [WithMySQL=NO] ! ) ! AC_SUBST(WithMySQL) ! ! dnl *********************************************** ! dnl GHC ! dnl *********************************************** ! AC_ARG_WITH(ghc, ! [ --with-ghc=<ghc command> ! Use a different command instead of 'ghc' for the Haskell compiler. ! ], ! [GHC="$withval"], ! [AC_PATH_PROG(GHC,ghc)] ! ) ! ! if test "$GHC" = "" || test ! -f $GHC; then ! AC_MSG_ERROR([GHC is required to build the package]) ! fi ! ! AC_SUBST(GHC) ! ! if test "$prefix" = "NONE"; then ! prefix=`$GHC --print-libdir` ! fi ! ! dnl *********************************************** ! dnl hsc2hs ! dnl *********************************************** ! AC_ARG_WITH(hsc2hs, ! [ --with-hsc2hs=<hsc2hs command> ! Use a different command instead of 'hsc2hs' ! ], ! [HSC2HS="$withval"], ! [AC_PATH_PROG(HSC2HS,hsc2hs)] ! ) ! ! if test "$HSC2HS" = "" || test ! -f $HSC2HS; then ! AC_MSG_ERROR([HSC2HS is required to build the package]) ! fi ! ! AC_SUBST(HSC2HS) ! ! dnl *********************************************** ! dnl ghc-pkg ! dnl *********************************************** ! AC_ARG_WITH(ghc-pkg, ! [ --with-ghc-pkg=<ghc-pkg command> ! Use a different command instead of 'ghc-pkg' ! ], ! [GHC_PKG="$withval"], ! [AC_PATH_PROG(GHC_PKG,ghc-pkg)] ! ) ! ! if test "$GHC_PKG" = "" || test ! -f $GHC_PKG; then ! AC_MSG_ERROR([ghc-pkg is required to build the package]) ! fi ! ! AC_SUBST(GHC_PKG) ! ! dnl *********************************************** ! dnl HADDOCK ! dnl *********************************************** ! AC_ARG_WITH(haddock, ! [ --with-haddock=<haddock command> ! Use a different command instead of 'haddock' for the documentation builder. ! ], ! [HADDOCK="$withval"], ! [AC_PATH_PROG(HADDOCK,haddock)] ! ) ! ! if test "$HADDOCK" = "" || test ! -f $HADDOCK; then ! echo HADDOCK is required to build the documentations ! fi ! ! AC_SUBST(HADDOCK) ! ! dnl *********************************************** ! dnl other progs ! dnl *********************************************** ! AC_PROG_CC ! AC_PROG_CPP ! AC_PROG_INSTALL ! ! AC_PATH_PROG(AR,ar) ! AC_SUBST(AR) ! ! AC_PATH_PROG(LD,ld) ! AC_SUBST(LD) ! ! dnl *********************************************** ! dnl check for headers and libraries for ODBC ! dnl *********************************************** ! ! if test $WithODBC = YES; then ! case $ac_cv_target_alias in ! i[[3456]]86-*-cygwin*|i[[3456]]86-*-mingw32*) ! AC_COMPILE_IFELSE( ! [ ! #include <windows.h> ! #include <sqlext.h> ! ! int main() ! { ! SQLAllocEnv (NULL); ! return 0; ! } ! ], ! [LIBS="${LIBS} -lodbc32"], ! AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ! ;; ! *) AC_CHECK_HEADER(sqlext.h,,AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ! AC_CHECK_LIB(odbc,SQLAllocEnv,,AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ! ;; ! esac ! ! CPPFLAGS="$CPPFLAGS -IODBC" ! fi ! ! dnl *********************************************** ! dnl check for headers and libraries for PostgreSQL ! dnl *********************************************** ! ! if test $WithPostgreSQL = YES; then ! AC_PATH_PROG(PG_CONFIG, pg_config) ! ! if test "$PG_CONFIG" = "" || test ! -f $PG_CONFIG; then ! AC_MSG_ERROR([pg_config is required to build PostgreSQL binding]) ! fi ! ! case $ac_cv_target_alias in ! i[[3456]]86-*-cygwin*|i[[3456]]86-*-mingw32*) ! LDFLAGS="$LDFLAGS -L$(cygpath -m `$PG_CONFIG --libdir`)" ! CPPFLAGS="$CPPFLAGS -I$(cygpath -m /usr/include) -I$(cygpath -m `$PG_CONFIG --includedir`)" ! ;; ! *) LDFLAGS="$LDFLAGS -L`$PG_CONFIG --libdir`" ! CPPFLAGS="$CPPFLAGS -I`$PG_CONFIG --includedir`" ! ;; ! esac ! ! AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([libpq-fe.h header not found])) ! AC_CHECK_LIB(pq,PQsetdbLogin,,AC_MSG_ERROR([libpq.a library not found])) ! fi ! ! dnl *********************************************** ! dnl check for headers and libraries for MySQL ! dnl *********************************************** ! ! if test $WithMySQL = YES; then ! AC_PATH_PROG(MYSQL_CONFIG, mysql_config) ! ! if test "$MYSQL_CONFIG" = "" || test ! -f $MYSQL_CONFIG; then ! AC_MSG_ERROR([mysql_config is required to build PostgreSQL binding]) ! fi ! ! LDFLAGS="$LDFLAGS `$MYSQL_CONFIG --libs`" ! CPPFLAGS="$CPPFLAGS `$MYSQL_CONFIG --cflags`" ! ! AC_CHECK_HEADER(mysql/mysql.h,, AC_MSG_ERROR([mysql.h header not found])) ! ! fi ! ! dnl *********************************************** ! dnl subst ! dnl *********************************************** ! ! LL="$LIBS $LDFLAGS" ! ! if test "x$prefix" != xNONE; then ! LIB_DIRS='"'${prefix}'"' ! else ! LIB_DIRS='"'${ac_default_prefix}'"' ! fi ! ! for lib_opt in ${LL} ! do ! case $lib_opt in ! -l*) ! if test x$DEP_LIBS = x; then ! DEP_LIBS='"'`echo ${lib_opt} | sed s,-l,,`'"' ! else ! DEP_LIBS=$DEP_LIBS,'"'`echo ${lib_opt} | sed s,-l,,`'"' ! fi;; ! -L*) ! LIB_DIRS=$LIB_DIRS,'"'`echo ${lib_opt} | sed s,-L,, | sed s,"'",, | sed s,"'",,`'"' ! esac ! done ! ! AC_SUBST(CPPFLAGS) ! AC_SUBST(DEP_LIBS) ! AC_SUBST(LIB_DIRS) ! AC_SUBST(prefix) ! AC_SUBST(exec_prefix) ! AC_SUBST(libdir) ! ! AC_OUTPUT --- 1,234 ---- ! AC_INIT([HSQL],[1.0],[hto...@li...],[hsql]) ! ! AC_CONFIG_FILES([config.mk:config.mk.in hsql.pkg:hsql.pkg.in]) ! ! AC_CANONICAL_SYSTEM ! ! dnl *********************************************** ! dnl Enable/Disable ODBC binding ! dnl *********************************************** ! AC_ARG_ENABLE(odbc, ! [ --enable-odbc ! Build an ODBC binding for Haskell. ! ], ! [WithODBC=YES], ! [WithODBC=NO] ! ) ! AC_SUBST(WithODBC) ! ! dnl *********************************************** ! dnl Enable/Disable PostgreSQL binding ! dnl *********************************************** ! AC_ARG_ENABLE(postgres, ! [ --enable-postgres ! Build a PostgreSQL binding for Haskell. ! ], ! [WithPostgreSQL=YES], ! [WithPostgreSQL=NO] ! ) ! AC_SUBST(WithPostgreSQL) ! ! dnl *********************************************** ! dnl Enable/Disable MySQL binding ! dnl *********************************************** ! AC_ARG_ENABLE(mysql, ! [ --enable-mysql ! Build a MySQL binding for Haskell. ! ], ! [WithMySQL=YES], ! [WithMySQL=NO] ! ) ! AC_SUBST(WithMySQL) ! ! dnl *********************************************** ! dnl GHC ! dnl *********************************************** ! AC_ARG_WITH(ghc, ! [ --with-ghc=<ghc command> ! Use a different command instead of 'ghc' for the Haskell compiler. ! ], ! [GHC="$withval"], ! [AC_PATH_PROG(GHC,ghc)] ! ) ! ! if test "$GHC" = "" || test ! -f $GHC; then ! AC_MSG_ERROR([GHC is required to build the package]) ! fi ! ! AC_SUBST(GHC) ! ! if test "$prefix" = "NONE"; then ! prefix=`$GHC --print-libdir` ! fi ! ! dnl *********************************************** ! dnl hsc2hs ! dnl *********************************************** ! AC_ARG_WITH(hsc2hs, ! [ --with-hsc2hs=<hsc2hs command> ! Use a different command instead of 'hsc2hs' ! ], ! [HSC2HS="$withval"], ! [AC_PATH_PROG(HSC2HS,hsc2hs)] ! ) ! ! if test "$HSC2HS" = "" || test ! -f $HSC2HS; then ! AC_MSG_ERROR([HSC2HS is required to build the package]) ! fi ! ! AC_SUBST(HSC2HS) ! ! dnl *********************************************** ! dnl ghc-pkg ! dnl *********************************************** ! AC_ARG_WITH(ghc-pkg, ! [ --with-ghc-pkg=<ghc-pkg command> ! Use a different command instead of 'ghc-pkg' ! ], ! [GHC_PKG="$withval"], ! [AC_PATH_PROG(GHC_PKG,ghc-pkg)] ! ) ! ! if test "$GHC_PKG" = "" || test ! -f $GHC_PKG; then ! AC_MSG_ERROR([ghc-pkg is required to build the package]) ! fi ! ! AC_SUBST(GHC_PKG) ! ! dnl *********************************************** ! dnl HADDOCK ! dnl *********************************************** ! AC_ARG_WITH(haddock, ! [ --with-haddock=<haddock command> ! Use a different command instead of 'haddock' for the documentation builder. ! ], ! [HADDOCK="$withval"], ! [AC_PATH_PROG(HADDOCK,haddock)] ! ) ! ! if test "$HADDOCK" = "" || test ! -f $HADDOCK; then ! echo HADDOCK is required to build the documentations ! fi ! ! AC_SUBST(HADDOCK) ! ! dnl *********************************************** ! dnl other progs ! dnl *********************************************** ! AC_PROG_CC ! AC_PROG_CPP ! AC_PROG_INSTALL ! ! AC_PATH_PROG(AR,ar) ! AC_SUBST(AR) ! ! AC_PATH_PROG(LD,ld) ! AC_SUBST(LD) ! ! dnl *********************************************** ! dnl check for headers and libraries for ODBC ! dnl *********************************************** ! ! if test $WithODBC = YES; then ! case $ac_cv_target_alias in ! i[[3456]]86-*-cygwin*|i[[3456]]86-*-mingw32*) ! AC_COMPILE_IFELSE( ! [ ! #include <windows.h> ! #include <sqlext.h> ! ! int main() ! { ! SQLAllocEnv (NULL); ! return 0; ! } ! ], ! [LIBS="${LIBS} -lodbc32"], ! AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ! ;; ! *) AC_CHECK_HEADER(sqlext.h,,AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ! AC_CHECK_LIB(odbc,SQLAllocEnv,,AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ! ;; ! esac ! ! CPPFLAGS="$CPPFLAGS -IODBC" ! fi ! ! dnl *********************************************** ! dnl check for headers and libraries for PostgreSQL ! dnl *********************************************** ! ! if test $WithPostgreSQL = YES; then ! AC_PATH_PROG(PG_CONFIG, pg_config) ! ! if test "$PG_CONFIG" = "" || test ! -f $PG_CONFIG; then ! AC_MSG_ERROR([pg_config is required to build PostgreSQL binding]) ! fi ! ! case $ac_cv_target_alias in ! i[[3456]]86-*-cygwin*|i[[3456]]86-*-mingw32*) ! LDFLAGS="$LDFLAGS -L$(cygpath -m `$PG_CONFIG --libdir`)" ! CPPFLAGS="$CPPFLAGS -I$(cygpath -m /usr/include) -I$(cygpath -m `$PG_CONFIG --includedir`)" ! ;; ! *) LDFLAGS="$LDFLAGS -L`$PG_CONFIG --libdir`" ! CPPFLAGS="$CPPFLAGS -I`$PG_CONFIG --includedir` -I`$PG_CONFIG --includedir`/server" ! ;; ! esac ! ! AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([libpq-fe.h header not found])) ! AC_CHECK_LIB(pq,PQsetdbLogin,,AC_MSG_ERROR([libpq.a library not found])) ! fi ! ! dnl *********************************************** ! dnl check for headers and libraries for MySQL ! dnl *********************************************** ! ! if test $WithMySQL = YES; then ! AC_PATH_PROG(MYSQL_CONFIG, mysql_config) ! ! if test "$MYSQL_CONFIG" = "" || test ! -f $MYSQL_CONFIG; then ! AC_MSG_ERROR([mysql_config is required to build PostgreSQL binding]) ! fi ! ! LDFLAGS="$LDFLAGS `$MYSQL_CONFIG --libs`" ! CPPFLAGS="$CPPFLAGS `$MYSQL_CONFIG --cflags`" ! ! AC_CHECK_HEADER(mysql/mysql.h,, AC_MSG_ERROR([mysql.h header not found])) ! ! fi ! ! dnl *********************************************** ! dnl subst ! dnl *********************************************** ! ! LL="$LIBS $LDFLAGS" ! ! if test "x$prefix" != xNONE; then ! LIB_DIRS='"'${prefix}'"' ! else ! LIB_DIRS='"'${ac_default_prefix}'"' ! fi ! ! for lib_opt in ${LL} ! do ! case $lib_opt in ! -l*) ! if test x$DEP_LIBS = x; then ! DEP_LIBS='"'`echo ${lib_opt} | sed s,-l,,`'"' ! else ! DEP_LIBS=$DEP_LIBS,'"'`echo ${lib_opt} | sed s,-l,,`'"' ! fi;; ! -L*) ! LIB_DIRS=$LIB_DIRS,'"'`echo ${lib_opt} | sed s,-L,, | sed s,"'",, | sed s,"'",,`'"' ! esac ! done ! ! AC_SUBST(CPPFLAGS) ! AC_SUBST(DEP_LIBS) ! AC_SUBST(LIB_DIRS) ! AC_SUBST(prefix) ! AC_SUBST(exec_prefix) ! AC_SUBST(libdir) ! ! AC_OUTPUT |