home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1995-1996 by Cayenne Software, Inc.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software, Inc.
- #
- #---------------------------------------------------------------------------
- #
- # File : @(#)tdb_config.tcl /main/hindenburg/2
- # Author : edri
- # Original date : 16-01-1995
- # Description : Target DB dependent routines, called from */subcfg.tcl
- #
- #---------------------------------------------------------------------------
- #
-
- require machdep.tcl
-
- #
- # Gen
- #
- proc GEN::copy {} {
- }
-
- proc GEN::config {} {
- }
-
- #
- # Informix
- #
-
- if {[osIdentification] == "WIN"} {
- set INFORMIX::headers "sqlca.h sqlhdr.h sqlproto.h"
- } else {
- set INFORMIX::headers "sqlhdr.h"
- }
-
- proc INFORMIX::copy {} {
- global projcf
- if {$projcf == "0"} {
- # Only do this at project configuration time, else m4create_env fails.
- return
- }
-
- #
- # Copy the sqlhdr.h file from $INFORMIXDIR, so we can configure it for
- # use with a C++ compiler.
- #
-
- if {[osIdentification] == "WIN"} {
- set inf [get env(INFORMIXDIR) [location C: INFORMIX]]
- } else {
- set inf [get env(INFORMIXDIR) [location /usr informix]]
- }
-
- foreach baseName ${INFORMIX::headers} {
- set fullName [path_name concat [location $inf incl esql] $baseName]
-
- #
- # On PC include files are in different directory ...
- #
-
- if {! [file exists $fullName]} {
- set fullName [path_name concat [location $inf incl] $baseName]
- }
-
- set m4sqlpath [location [m4basedir] include]
- set m4hdrpath [path_name concat $m4sqlpath $baseName]
-
- if {! [file isdirectory $m4sqlpath]} {
- mkdir $m4sqlpath
- }
-
- puts "cp $fullName $m4hdrpath"
-
- if {[catch {copy_text_file $fullName $m4hdrpath} msg]} {
- puts stderr ""
- puts stderr "ERROR: Could not copy $fullName, set INFORMIXDIR properly!"
- puts stderr "($msg)"
- puts stderr ""
- return
- }
- }
-
- global freshly_copied
- set freshly_copied 1
- }
-
- proc INFORMIX::config {} {
- global projcf
- if {$projcf == "0"} {
- # Only do this at project configuration time, else m4create_env fails.
- return
- }
-
- global freshly_copied
- if {![info exists freshly_copied] || $freshly_copied != "1"} {
- return
- } else {
- set freshly_copied 0
- }
-
- if {[osIdentification] == "WIN"} {
- return [INFORMIX::winConfig]
- } else {
- return [INFORMIX::unixConfig]
- }
- }
-
- proc INFORMIX::winConfig {} {
- set m4sqlpath [location [m4basedir] include]
-
- set extern_patt {^extern }
- set extern_sub {extern "C" }
- set cfg(extern) [list $extern_patt $extern_sub]
- set sqlret_patt {^SQLRET }
- set sqlret_sub {extern "C" SQLRET }
- set cfg(sqlret) [list $sqlret_patt $sqlret_sub]
- set sqllps_patt {^_LPSQCURSOR }
- set sqllps_sub {extern "C" _LPSQCURSOR }
- set cfg(sqllps) [list $sqllps_patt $sqllps_sub]
-
- foreach baseName ${INFORMIX::headers} {
- config_file include $baseName cfg
- }
- }
-
- proc INFORMIX::unixConfig {} {
- #
- # Fix up the Informix sqlhdr.h from $INFORMIXDIR/incl/esql/sqlhdr.h,
- # because it contains K&R externs which can't be used with a C++
- # compiler.
- #
-
- #
- # Remove K&R C externs
- #
- set pat {^extern.*();$}
- set sub {}
- set extern_cfg(externs) [list $pat $sub]
-
- #
- # Add C++ prototypes
- #
- set pat {^#endif.*_SQLHDR.*$}
- set sub "\n
- #ifdef __cplusplus
- extern \"C\" {
- _SQCURSOR* _iqnprep( ... );
- _SQCURSOR* _iqlocate_cursor( ... );
- }
- #endif
-
- #endif /* _SQLHDR */\n"
- set protos_cfg(protos) [list $pat $sub]
-
- puts ""
- puts "Configuring sqlhdr.h ..."
-
- set m [config_file include sqlhdr.h extern_cfg]
- if {$m == -1} {
- puts " Skipping because sqlhdr.h was not copied correctly!"
- } else {
- puts " Removed $m K&R style externs"
-
- set m [config_file include sqlhdr.h protos_cfg]
- if {$m == 1} {
- puts " Added C++ prototypes"
- puts "Done."
- } elseif {$m == -1} {
- puts " Could not find sqlhdr.h!"
- } else {
- puts " Could not find endline in sqlhdr.h; C++ prototypes not added!"
- puts " (last line of sqlhdr.h should look like '#endif /* _SQLHDR */')"
- }
- }
- }
-
- #
- # Ingres
- #
- proc INGRES::copy {} {
- }
-
- proc INGRES::config {} {
- }
-
- #
- # Oracle
- #
- proc ORACLE::copy {} {
- }
-
- proc ORACLE::config {} {
- }
-
- #
- # Sybase
- #
- proc SYBASE::copy {} {
- }
-
- proc SYBASE::config {} {
- }
-
- #
- # Microsoft SQL server
- #
- proc SQLSERVER::copy {} {
- }
-
- proc SQLSERVER::config {} {
- }
-