diff options
107 files changed, 8209 insertions, 2106 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 61c80f8b878..82fa8244856 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1,3 +1,4 @@ +Administrador@light. Administrator@co3064164-a. Administrator@co3064164-a.rochd1.qld.optushome.com.au Administrator@fred. @@ -49,6 +50,7 @@ monty@tramp.mysql.fi monty@work.mysql.com mwagner@cash.mwagner.org mwagner@evoq.mwagner.org +mwagner@work.mysql.com nick@mysql.com nick@nick.leippe.com paul@central.snake.net diff --git a/Docs/bk.txt b/Docs/bk.txt index 4c83c48aea6..b9274901653 100644 --- a/Docs/bk.txt +++ b/Docs/bk.txt @@ -1,4 +1,5 @@ Mail by sasha, should be rewritten as a HOWTO sometimes +vva added point C) for Windows-project ----------- I have set up a repository with BitKeeper on work. There are still some things @@ -29,6 +30,12 @@ you will need just to set up a slave repository on your machine: Now you have the entire source tree in the current directory. Let's compile it: BUILD/compile-pentium-debug + +C) Windows project. + - Compile Linux-project (see points above) + - run VC++Files/prepare + - make repository accessible for Windows (using samba) + - open VC++Files/mysql.dsw in Microsoft Visual Stidio (5.0 or above) After you edit a file, you need to check it in using bk citool or bk ci filename. Note that ci is different than commit - you ci a file, but you commit diff --git a/Docs/manual.texi b/Docs/manual.texi index d3495892d4d..45807e95371 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -548,8 +548,7 @@ Written in C and C++. Tested with a broad range of different compilers. @item Works on many different platforms. @xref{Which OS}. @item -Uses GNU Automake (1.4), Autoconf (Version 2.52 or newer), and Libtool for -portability. +Uses GNU Automake, Autoconf, and Libtool for portability. @item APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl. @xref{Clients}. @@ -6986,10 +6985,8 @@ The initial download of the source tree may take a while, depending on the speed of your connection; be patient. @item -You will need GNU @code{autoconf 2.52}, @code{automake 1.4}, -@code{libtool}, and @code{m4} to run the next set of commands. - -@code{automake} (1.5) doesn't yet work. +You will need GNU @code{autoconf 2.52}, @code{automake 1.5}, +@code{libtool 1.4}, and @code{m4} to run the next set of commands. @example shell> cd mysql-4.0 @@ -49804,11 +49801,6 @@ By Thomas Thaele @email{tthaele@@papenmeier.de} @itemize @bullet -@item @uref{http://www.mysql.com/Downloads/Contrib/mod_mysql_include_1.0.tar.gz} -Apache module to include HTML from MySQL queries into your pages, -and run update queries. Originally written to implement a simple fast -low-overhead banner-rotation system. By Sasha Pachev. - @item @uref{http://htcheck.sourceforge.net/} htCheck is a URL checker with MySQL backend. Spidered URLs can later be queried using SQL to retrieve @@ -50096,63 +50088,6 @@ Wrapper for mysqldump to backup all databases. By Marc Swanson. Prints the storage usage of a MySQL database. @end itemize -@cindex RPMs, for common tools -@cindex tools, RPMs for -@appendixsec RPMs for Common Tools (Most Are for RedHat 6.1) - -@itemize @bullet -@item @uref{http://www.mysql.com/Downloads/Contrib/perl-Data-ShowTable-3.3-2.i386.rpm} -@item @uref{http://www.mysql.com/Downloads/Contrib/perl-Msql-Mysql-modules-1.2210-2.i386.rpm} -@item @uref{http://www.mysql.com/Downloads/Contrib/php-pg-3.0.13-1.i386.rpm} -@item @uref{http://www.mysql.com/Downloads/Contrib/php-pg-manual-3.0.13-1.i386.rpm} -@item @uref{http://www.mysql.com/Downloads/Contrib/php-pg-mysql-3.0.13-1.i386.rpm} -@item @uref{http://www.mysql.com/Downloads/Contrib/phpMyAdmin-2.0.5-1.noarch.rpm} -@end itemize - -@cindex functions, useful -@appendixsec Useful Functions -@itemize @bullet -@item @uref{http://www.mysql.com/Downloads/Contrib/mysnprintf.c} -sprintf() function for SQL queries that can escape blobs. By Chunhua Liu. -@end itemize - -@appendixsec Windows Programs -@itemize @bullet -@item @uref{http://www.mysql.com/Downloads/Contrib/LaunchMySQL.zip} -The program launches the MySQL server, shuts it down, and -display status information. By Bill Thompson -@end itemize - -@appendixsec Uncategorised - -@itemize @bullet - -@item @uref{http://www.mysql.com/Downloads/Contrib/findres.pl} -Find reserved words in tables. By Nem W Schlecht. - -@item @uref{http://www.mysql.com/Downloads/Contrib/handicap.tar.gz} -Performance handicapping system for yachts. Uses PHP. By -@email{rhill@@stobyn.ml.org}. - -@item @uref{http://www.mysql.com/Downloads/Contrib/hylalog-1.0.tar.gz} -Store @code{hylafax} outgoing faxes in a MySQL database. By Sinisa -Milivojevic, @email{sinisa@@mysql.com}. - -@item @uref{http://www.mysql.com/Downloads/Contrib/mrtg-mysql-1.0.tar.gz} -MySQL status plotting with MRTG, by Luuk de Boer, @email{luuk@@wxs.nl}. - -@item @uref{http://www.mysql.com/Downloads/Contrib/wuftpd-2.4.2.18-mysql_support.2.tar.gz} -Patches to add logging to MySQL for WU-ftpd. By Zeev Suraski, -@email{bourbon@@netvision.net.il}. - -@item @uref{http://www.mysql.com/Downloads/Contrib/wu-ftpd-2.6.0-mysql.4.tar.gz} -Patches to add logging to MySQL for WU-ftpd 2.6.0. By -@email{takeshi@@SoftAgency.co.jp}, based on Zeev Suraski wuftpd patches. - -@item @uref{http://www.mysql.com/Downloads/Contrib/Old-Versions} -Previous versions of things found here that you probably won't be -interested in. -@end itemize @page @@ -50862,6 +50797,20 @@ each individual 4.0.x release. @appendixsubsec Changes in release 4.0.5 @itemize @item +Fixed a bug in multi-table deletes when outer join is used on an empty +table, which get's first to be deleted +@item +Fixed a bug in multi-table updates when a single table is updated +@item +Updated source tree to be built using @code{automake 1.5} and +@code{libtool 1.4}. +@item +Fixed bug that made @code{REPAIR TABLE} and @code{myisamchk} +to corrupt @code{FULLTEXT} indexes. +@item +Fixed bug with caching system database ('mysql'). Now query to system +database is not cached by query cache. +@item Small fix in @code{mysqld_safe} for some shells. @item Give error if a @code{MyISAM} @code{MERGE} table has more than 2 ^ 32 rows and diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index 4d70971a363..d03623cedb9 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -398,7 +398,7 @@ SOURCE=.\mysys_priv.h # End Source File # Begin Source File -SOURCE=..\libmysql\net.c +SOURCE=..\sql\net_serv.cpp # End Source File # Begin Source File diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index a65f607e738..a9dd33217be 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -19,6 +19,8 @@ CFG=INNOBASE - WIN32 RELEASE !MESSAGE !MESSAGE "innobase - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "innobase - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "innobase - Win32 nt" (based on "Win32 (x86) Static Library") +!MESSAGE "innobase - Win32 Max nt" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -74,12 +76,60 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"..\lib_release\innodb.lib" # ADD LIB32 /nologo /out:"..\lib_release\innodb.lib" +!ELSEIF "$(CFG)" == "innobase - Win32 nt" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "innobase___Win32_nt" +# PROP BASE Intermediate_Dir "innobase___Win32_nt" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "innobase___Win32_nt" +# PROP Intermediate_Dir "innobase___Win32_nt" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\lib_release\innodb.lib" +# ADD LIB32 /nologo /out:"..\lib_release\innodb.lib" + +!ELSEIF "$(CFG)" == "innobase - Win32 Max nt" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "innobase___Win32_Max_nt" +# PROP BASE Intermediate_Dir "innobase___Win32_Max_nt" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "innobase___Win32_Max_nt" +# PROP Intermediate_Dir "innobase___Win32_Max_nt" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\lib_release\innodb.lib" +# ADD LIB32 /nologo /out:"..\lib_release\innodb.lib" + !ENDIF # Begin Target # Name "innobase - Win32 Debug" # Name "innobase - Win32 Release" +# Name "innobase - Win32 nt" +# Name "innobase - Win32 Max nt" # Begin Source File SOURCE=.\btr\btr0btr.c diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp index 4dc0f86a6e9..ea5ef096561 100644 --- a/VC++Files/libmysql/libmysql.dsp +++ b/VC++Files/libmysql/libmysql.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "." /I "..\include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "." /I "..\include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -59,7 +59,7 @@ LINK32=link.exe # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Move DLL export lib -PostBuild_Cmds=xcopy release\libmysql.lib ..\lib_release /v +PostBuild_Cmds=xcopy release\libmysql.lib ..\lib_release /y # End Special Build Tool !ELSEIF "$(CFG)" == "libmySQL - Win32 Debug" @@ -76,7 +76,7 @@ PostBuild_Cmds=xcopy release\libmysql.lib ..\lib_release /v # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "." /I "..\include" /I "../zlib" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -92,7 +92,7 @@ LINK32=link.exe # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Move DLL export lib -PostBuild_Cmds=xcopy ..\lib_debug\libmysql.dll C:\winnt\system32\ /v xcopy debug\libmysql.lib ..\lib_debug\ /v +PostBuild_Cmds=xcopy ..\lib_debug\libmysql.dll C:\winnt\system32\ /y xcopy debug\libmysql.lib ..\lib_debug\ /y # End Special Build Tool !ENDIF @@ -375,7 +375,7 @@ SOURCE=..\client\mysys_priv.h # End Source File # Begin Source File -SOURCE=.\net.c +SOURCE=..\sql\net_serv.cpp # End Source File # Begin Source File diff --git a/VC++Files/myisampack/myisampack.dsp b/VC++Files/myisampack/myisampack.dsp index 5ea392e1b41..f576a93faf2 100644 --- a/VC++Files/myisampack/myisampack.dsp +++ b/VC++Files/myisampack/myisampack.dsp @@ -88,7 +88,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\myisampack.c +SOURCE=..\myisam\myisampack.c # End Source File # End Group # Begin Group "Header Files" diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw index a6c3b4e7334..b576730b500 100644 --- a/VC++Files/mysql.dsw +++ b/VC++Files/mysql.dsw @@ -30,6 +30,18 @@ Package=<4> ############################################################################### +Project: "comp_err"=".\comp_err\comp_err.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "dbug"=".\dbug\dbug.dsp" - Package Owner=<4> Package=<5> @@ -186,6 +198,27 @@ Package=<4> ############################################################################### +Project: "my_print_defaults"=".\my_print_defaults\my_print_defaults.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name mysys + End Project Dependency + Begin Project Dependency + Project_Dep_Name strings + End Project Dependency + Begin Project Dependency + Project_Dep_Name dbug + End Project Dependency +}}} + +############################################################################### + Project: "myisam"=".\myisam\myisam.dsp" - Package Owner=<4> Package=<5> @@ -426,14 +459,26 @@ Package=<4> Project_Dep_Name myisammrg End Project Dependency Begin Project Dependency - Project_Dep_Name innobase - End Project Dependency - Begin Project Dependency Project_Dep_Name bdb End Project Dependency Begin Project Dependency Project_Dep_Name vio End Project Dependency + Begin Project Dependency + Project_Dep_Name innobase + End Project Dependency +}}} + +############################################################################### + +Project: "mysqldemb"=".\mysqldemb\mysqldemb.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ }}} ############################################################################### @@ -468,6 +513,51 @@ Package=<4> ############################################################################### +Project: "mysqlserver"=".\mysqlserver\mysqlserver.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name dbug + End Project Dependency + Begin Project Dependency + Project_Dep_Name heap + End Project Dependency + Begin Project Dependency + Project_Dep_Name innobase + End Project Dependency + Begin Project Dependency + Project_Dep_Name merge + End Project Dependency + Begin Project Dependency + Project_Dep_Name myisam + End Project Dependency + Begin Project Dependency + Project_Dep_Name myisammrg + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysqldemb + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysys + End Project Dependency + Begin Project Dependency + Project_Dep_Name regex + End Project Dependency + Begin Project Dependency + Project_Dep_Name strings + End Project Dependency + Begin Project Dependency + Project_Dep_Name zlib + End Project Dependency +}}} + +############################################################################### + Project: "mysqlshow"=".\client\mysqlshow.dsp" - Package Owner=<4> Package=<5> @@ -624,7 +714,7 @@ Package=<4> ############################################################################### -Project: "thr_insert_test"=".\thr_insert_test\thr_insert_test.dsp" - Package Owner=<4> +Project: "test_libmysqld"=".\libmysqld\examples\test_libmysqld.dsp" - Package Owner=<4> Package=<5> {{{ @@ -633,7 +723,19 @@ Package=<5> Package=<4> {{{ Begin Project Dependency - Project_Dep_Name mysqlclient + Project_Dep_Name strings + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysys + End Project Dependency + Begin Project Dependency + Project_Dep_Name libmysqld + End Project Dependency + Begin Project Dependency + Project_Dep_Name vio + End Project Dependency + Begin Project Dependency + Project_Dep_Name zlib End Project Dependency }}} diff --git a/VC++Files/mysqlbinlog/mysqlbinlog.dsp b/VC++Files/mysqlbinlog/mysqlbinlog.dsp index 94723b0a127..5d3ff2bb090 100644 --- a/VC++Files/mysqlbinlog/mysqlbinlog.dsp +++ b/VC++Files/mysqlbinlog/mysqlbinlog.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../sql" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../client" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -67,7 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../client" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -88,7 +88,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\client\mysqlbinlog.cpp +SOURCE=.\mysqlbinlog.cpp # End Source File # End Group # Begin Group "Header Files" diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp index a637c486574..7b844a68511 100644 --- a/VC++Files/mysqldemb/mysqldemb.dsp +++ b/VC++Files/mysqldemb/mysqldemb.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /YX /FD /c # ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
BSC32=bscmake.exe
@@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /YX /FD /GZ /c # ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
BSC32=bscmake.exe
@@ -110,10 +110,6 @@ SOURCE=..\libmysql\get_password.c # End Source File
# Begin Source File
-SOURCE=..\sql\ha_berkeley.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\sql\ha_heap.cpp
# End Source File
# Begin Source File
@@ -190,10 +186,6 @@ SOURCE=..\sql\key.cpp # End Source File
# Begin Source File
-SOURCE=..\libmysqld\lib_load.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\libmysqld\lib_sql.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/mysqlmanager/CHILDFRM.CPP b/VC++Files/mysqlmanager/CHILDFRM.CPP new file mode 100644 index 00000000000..08027e068ac --- /dev/null +++ b/VC++Files/mysqlmanager/CHILDFRM.CPP @@ -0,0 +1,65 @@ +// ChildFrm.cpp : implementation of the CChildFrame class +// + +#include "stdafx.h" +#include "MySqlManager.h" + +#include "ChildFrm.h" + +#ifdef _DEBUG + #define new DEBUG_NEW + #undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame + +IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) + +BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) +//{{AFX_MSG_MAP(CChildFrame) +// NOTE - the ClassWizard will add and remove mapping macros here. +// DO NOT EDIT what you see in these blocks of generated code ! +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame construction/destruction + +CChildFrame::CChildFrame() +{ + // TODO: add member initialization code here + +} + +CChildFrame::~CChildFrame() +{ +} + +BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CMDIChildWnd::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame diagnostics + +#ifdef _DEBUG +void CChildFrame::AssertValid() const +{ + CMDIChildWnd::AssertValid(); +} + +void CChildFrame::Dump(CDumpContext& dc) const +{ + CMDIChildWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame message handlers diff --git a/VC++Files/mysqlmanager/CHILDFRM.H b/VC++Files/mysqlmanager/CHILDFRM.H new file mode 100644 index 00000000000..3075be58a67 --- /dev/null +++ b/VC++Files/mysqlmanager/CHILDFRM.H @@ -0,0 +1,52 @@ +// ChildFrm.h : interface of the CChildFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CHILDFRM_H__826CB2F0_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_CHILDFRM_H__826CB2F0_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CChildFrame : public CMDIChildWnd +{ + DECLARE_DYNCREATE(CChildFrame) +public: + CChildFrame(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CChildFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CChildFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +// Generated message map functions +protected: + //{{AFX_MSG(CChildFrame) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_CHILDFRM_H__826CB2F0_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/MAINFRM.CPP b/VC++Files/mysqlmanager/MAINFRM.CPP new file mode 100644 index 00000000000..499704ed2a0 --- /dev/null +++ b/VC++Files/mysqlmanager/MAINFRM.CPP @@ -0,0 +1,137 @@ +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "MySqlManager.h" +#include "MainFrm.h" + +CMainFrame* CMainFrame::g_pMainFrame = NULL; + +#ifdef _DEBUG + #define new DEBUG_NEW + #undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) +//{{AFX_MSG_MAP(CMainFrame) +// NOTE - the ClassWizard will add and remove mapping macros here. +// DO NOT EDIT what you see in these blocks of generated code ! + ON_WM_CREATE() +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here + +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.Create(this) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + // TODO: Remove this if you don't want tool tips or a resizeable toolbar + m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | + CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CMDIFrameWnd::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CMDIFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CMDIFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + +int CMainFrame::StatusMsg ( LPCSTR fmt, ... ) + +{ + + char buf [2048]; + va_list args; + va_start(args, fmt); + int ret = vsprintf(buf, fmt, args); + + if ( this != NULL ) + { + static char g_StatusMsg_Buffer_TT [ 2048 ]; + memcpy ( g_StatusMsg_Buffer_TT, buf, sizeof(g_StatusMsg_Buffer_TT) ); + m_wndStatusBar.SetPaneText ( 0, buf ); + m_wndStatusBar.UpdateWindow (); + } + + va_end(args); + return ( ret ); + +} + + +BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) +{ + g_pMainFrame = this; + return CMDIFrameWnd::OnCreateClient(lpcs, pContext); +} diff --git a/VC++Files/mysqlmanager/MAINFRM.H b/VC++Files/mysqlmanager/MAINFRM.H new file mode 100644 index 00000000000..06c51965bb1 --- /dev/null +++ b/VC++Files/mysqlmanager/MAINFRM.H @@ -0,0 +1,69 @@ +// MainFrm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__826CB2EE_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_MAINFRM_H__826CB2EE_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CMainFrame : public CMDIFrameWnd +{ + DECLARE_DYNAMIC(CMainFrame) +public: + CMainFrame(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + protected: + virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + int StatusMsg ( LPCSTR fmt, ... ); + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +public: + +static CMainFrame* g_pMainFrame; + +}; + +#define MainFrame ( CMainFrame::g_pMainFrame ? CMainFrame::g_pMainFrame : (CMainFrame*) AfxGetMainWnd() -> GetTopLevelFrame() ) + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__826CB2EE_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/MySqlManager.mak b/VC++Files/mysqlmanager/MySqlManager.mak new file mode 100644 index 00000000000..b372daa52f2 --- /dev/null +++ b/VC++Files/mysqlmanager/MySqlManager.mak @@ -0,0 +1,327 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on MySqlManager.dsp
+!IF "$(CFG)" == ""
+CFG=MySqlManager - Win32 Debug
+!MESSAGE No configuration specified. Defaulting to MySqlManager - Win32 Debug.
+!ENDIF
+
+!IF "$(CFG)" != "MySqlManager - Win32 Release" && "$(CFG)" != "MySqlManager - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "MySqlManager.mak" CFG="MySqlManager - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "MySqlManager - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "MySqlManager - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "MySqlManager - Win32 Release"
+
+OUTDIR=.\release
+INTDIR=.\release
+# Begin Custom Macros
+OutDir=.\release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "..\client_release\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
+
+!ELSE
+
+ALL : "mysqlclient - Win32 Release" "..\client_release\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"mysqlclient - Win32 ReleaseCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\ChildFrm.obj"
+ -@erase "$(INTDIR)\MainFrm.obj"
+ -@erase "$(INTDIR)\MySqlManager.obj"
+ -@erase "$(INTDIR)\MySqlManager.pch"
+ -@erase "$(INTDIR)\MySqlManager.res"
+ -@erase "$(INTDIR)\MySqlManagerDoc.obj"
+ -@erase "$(INTDIR)\MySqlManagerView.obj"
+ -@erase "$(INTDIR)\RegisterServer.obj"
+ -@erase "$(INTDIR)\StdAfx.obj"
+ -@erase "$(INTDIR)\ToolSql.obj"
+ -@erase "$(INTDIR)\ToolSqlQuery.obj"
+ -@erase "$(INTDIR)\ToolSqlResults.obj"
+ -@erase "$(INTDIR)\ToolSqlStatus.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "..\client_release\MySqlManager.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /G6 /MT /W3 /GX /O1 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\MySqlManager.res" /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\MySqlManager.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=/nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\MySqlManager.pdb" /machine:I386 /out:"../client_release/MySqlManager.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\ChildFrm.obj" \
+ "$(INTDIR)\MainFrm.obj" \
+ "$(INTDIR)\MySqlManager.obj" \
+ "$(INTDIR)\MySqlManagerDoc.obj" \
+ "$(INTDIR)\MySqlManagerView.obj" \
+ "$(INTDIR)\RegisterServer.obj" \
+ "$(INTDIR)\StdAfx.obj" \
+ "$(INTDIR)\ToolSql.obj" \
+ "$(INTDIR)\ToolSqlQuery.obj" \
+ "$(INTDIR)\ToolSqlResults.obj" \
+ "$(INTDIR)\ToolSqlStatus.obj" \
+ "$(INTDIR)\MySqlManager.res" \
+ "..\lib_release\mysqlclient.lib"
+
+"..\client_release\MySqlManager.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "MySqlManager - Win32 Debug"
+
+OUTDIR=.\debug
+INTDIR=.\debug
+# Begin Custom Macros
+OutDir=.\debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "..\client_debug\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
+
+!ELSE
+
+ALL : "mysqlclient - Win32 Debug" "..\client_debug\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"mysqlclient - Win32 DebugCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\ChildFrm.obj"
+ -@erase "$(INTDIR)\MainFrm.obj"
+ -@erase "$(INTDIR)\MySqlManager.obj"
+ -@erase "$(INTDIR)\MySqlManager.pch"
+ -@erase "$(INTDIR)\MySqlManager.res"
+ -@erase "$(INTDIR)\MySqlManagerDoc.obj"
+ -@erase "$(INTDIR)\MySqlManagerView.obj"
+ -@erase "$(INTDIR)\RegisterServer.obj"
+ -@erase "$(INTDIR)\StdAfx.obj"
+ -@erase "$(INTDIR)\ToolSql.obj"
+ -@erase "$(INTDIR)\ToolSqlQuery.obj"
+ -@erase "$(INTDIR)\ToolSqlResults.obj"
+ -@erase "$(INTDIR)\ToolSqlStatus.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(INTDIR)\vc60.pdb"
+ -@erase "$(OUTDIR)\MySqlManager.pdb"
+ -@erase "..\client_debug\MySqlManager.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+MTL_PROJ=/nologo /D "_DEBUG" /o "NUL" /win32
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\MySqlManager.res" /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\MySqlManager.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\MySqlManager.pdb" /debug /machine:I386 /out:"../client_debug/MySqlManager.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
+LINK32_OBJS= \
+ "$(INTDIR)\ChildFrm.obj" \
+ "$(INTDIR)\MainFrm.obj" \
+ "$(INTDIR)\MySqlManager.obj" \
+ "$(INTDIR)\MySqlManagerDoc.obj" \
+ "$(INTDIR)\MySqlManagerView.obj" \
+ "$(INTDIR)\RegisterServer.obj" \
+ "$(INTDIR)\StdAfx.obj" \
+ "$(INTDIR)\ToolSql.obj" \
+ "$(INTDIR)\ToolSqlQuery.obj" \
+ "$(INTDIR)\ToolSqlResults.obj" \
+ "$(INTDIR)\ToolSqlStatus.obj" \
+ "$(INTDIR)\MySqlManager.res" \
+ "..\lib_debug\mysqlclient.lib"
+
+"..\client_debug\MySqlManager.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("MySqlManager.dep")
+!INCLUDE "MySqlManager.dep"
+!ELSE
+!MESSAGE Warning: cannot find "MySqlManager.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "MySqlManager - Win32 Release" || "$(CFG)" == "MySqlManager - Win32 Debug"
+SOURCE=.\ChildFrm.cpp
+
+"$(INTDIR)\ChildFrm.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\MainFrm.cpp
+
+"$(INTDIR)\MainFrm.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\MySqlManager.cpp
+
+"$(INTDIR)\MySqlManager.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\MySqlManager.rc
+
+"$(INTDIR)\MySqlManager.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+SOURCE=.\MySqlManagerDoc.cpp
+
+"$(INTDIR)\MySqlManagerDoc.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\MySqlManagerView.cpp
+
+"$(INTDIR)\MySqlManagerView.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\RegisterServer.cpp
+
+"$(INTDIR)\RegisterServer.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\StdAfx.cpp
+
+!IF "$(CFG)" == "MySqlManager - Win32 Release"
+
+CPP_SWITCHES=/nologo /G6 /MT /W3 /GX /O1 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fp"$(INTDIR)\MySqlManager.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+"$(INTDIR)\StdAfx.obj" "$(INTDIR)\MySqlManager.pch" : $(SOURCE) "$(INTDIR)"
+ $(CPP) @<<
+ $(CPP_SWITCHES) $(SOURCE)
+<<
+
+
+!ELSEIF "$(CFG)" == "MySqlManager - Win32 Debug"
+
+CPP_SWITCHES=/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\MySqlManager.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+"$(INTDIR)\StdAfx.obj" "$(INTDIR)\MySqlManager.pch" : $(SOURCE) "$(INTDIR)"
+ $(CPP) @<<
+ $(CPP_SWITCHES) $(SOURCE)
+<<
+
+
+!ENDIF
+
+SOURCE=.\ToolSql.cpp
+
+"$(INTDIR)\ToolSql.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\ToolSqlQuery.cpp
+
+"$(INTDIR)\ToolSqlQuery.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\ToolSqlResults.cpp
+
+"$(INTDIR)\ToolSqlResults.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\ToolSqlStatus.cpp
+
+"$(INTDIR)\ToolSqlStatus.obj" : $(SOURCE) "$(INTDIR)"
+
+
+!IF "$(CFG)" == "MySqlManager - Win32 Release"
+
+"mysqlclient - Win32 Release" :
+ cd "\MYSQL-3.23\client"
+ $(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Release"
+ cd "..\mysqlmanager"
+
+"mysqlclient - Win32 ReleaseCLEAN" :
+ cd "\MYSQL-3.23\client"
+ $(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Release" RECURSE=1 CLEAN
+ cd "..\mysqlmanager"
+
+!ELSEIF "$(CFG)" == "MySqlManager - Win32 Debug"
+
+"mysqlclient - Win32 Debug" :
+ cd "\MYSQL-3.23\client"
+ $(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Debug"
+ cd "..\mysqlmanager"
+
+"mysqlclient - Win32 DebugCLEAN" :
+ cd "\MYSQL-3.23\client"
+ $(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Debug" RECURSE=1 CLEAN
+ cd "..\mysqlmanager"
+
+!ENDIF
+
+
+!ENDIF
+
diff --git a/VC++Files/mysqlmanager/README.TXT b/VC++Files/mysqlmanager/README.TXT new file mode 100644 index 00000000000..cdd54c2cba8 --- /dev/null +++ b/VC++Files/mysqlmanager/README.TXT @@ -0,0 +1,102 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : MySqlManager +======================================================================== + + +AppWizard has created this MySqlManager application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your MySqlManager application. + +MySqlManager.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CMySqlManagerApp application class. + +MySqlManager.cpp + This is the main application source file that contains the application + class CMySqlManagerApp. + +MySqlManager.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Developer Studio. + +res\MySqlManager.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file MySqlManager.rc. + +res\MySqlManager.rc2 + This file contains resources that are not edited by Microsoft + Developer Studio. You should place all resources not + editable by the resource editor in this file. + +MySqlManager.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CMDIFrameWnd and controls all MDI frame features. + +res\Toolbar.bmp + This bitmap file is used to create tiled images for the toolbar. + The initial toolbar and status bar are constructed in the + CMainFrame class. Edit this toolbar bitmap along with the + array in MainFrm.cpp to add more toolbar buttons. + +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one document type and one view: + +MySqlManagerDoc.h, MySqlManagerDoc.cpp - the document + These files contain your CMySqlManagerDoc class. Edit these files to + add your special document data and to implement file saving and loading + (via CMySqlManagerDoc::Serialize). + +MySqlManagerView.h, MySqlManagerView.cpp - the view of the document + These files contain your CMySqlManagerView class. + CMySqlManagerView objects are used to view CMySqlManagerDoc objects. + +res\MySqlManagerDoc.ico + This is an icon file, which is used as the icon for MDI child windows + for the CMySqlManagerDoc class. This icon is included by the main + resource file MySqlManager.rc. + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named MySqlManager.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Developer Studio reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC40XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC40DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/VC++Files/mysqlmanager/RES/BITMAP1.BMP b/VC++Files/mysqlmanager/RES/BITMAP1.BMP Binary files differnew file mode 100644 index 00000000000..3751f1a6923 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/BITMAP1.BMP diff --git a/VC++Files/mysqlmanager/RES/BITMAP3.BMP b/VC++Files/mysqlmanager/RES/BITMAP3.BMP Binary files differnew file mode 100644 index 00000000000..3751f1a6923 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/BITMAP3.BMP diff --git a/VC++Files/mysqlmanager/RES/BMP00001.BMP b/VC++Files/mysqlmanager/RES/BMP00001.BMP Binary files differnew file mode 100644 index 00000000000..e98e93d7850 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/BMP00001.BMP diff --git a/VC++Files/mysqlmanager/RES/BMP00002.BMP b/VC++Files/mysqlmanager/RES/BMP00002.BMP Binary files differnew file mode 100644 index 00000000000..2f2c195a683 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/BMP00002.BMP diff --git a/VC++Files/mysqlmanager/RES/DATABASE.BMP b/VC++Files/mysqlmanager/RES/DATABASE.BMP Binary files differnew file mode 100644 index 00000000000..2fc41313541 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/DATABASE.BMP diff --git a/VC++Files/mysqlmanager/RES/FONTD.BMP b/VC++Files/mysqlmanager/RES/FONTD.BMP Binary files differnew file mode 100644 index 00000000000..c77b4f4fdd0 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/FONTD.BMP diff --git a/VC++Files/mysqlmanager/RES/FONTU.BMP b/VC++Files/mysqlmanager/RES/FONTU.BMP Binary files differnew file mode 100644 index 00000000000..c77b4f4fdd0 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/FONTU.BMP diff --git a/VC++Files/mysqlmanager/RES/QUERY_EX.BMP b/VC++Files/mysqlmanager/RES/QUERY_EX.BMP Binary files differnew file mode 100644 index 00000000000..cc77222decc --- /dev/null +++ b/VC++Files/mysqlmanager/RES/QUERY_EX.BMP diff --git a/VC++Files/mysqlmanager/RES/TOOLBAR.BMP b/VC++Files/mysqlmanager/RES/TOOLBAR.BMP Binary files differnew file mode 100644 index 00000000000..d501723c1ce --- /dev/null +++ b/VC++Files/mysqlmanager/RES/TOOLBAR.BMP diff --git a/VC++Files/mysqlmanager/RES/mysqlmanager.ico b/VC++Files/mysqlmanager/RES/mysqlmanager.ico Binary files differnew file mode 100644 index 00000000000..7eef0bcbe65 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/mysqlmanager.ico diff --git a/VC++Files/mysqlmanager/RES/mysqlmanager.rc2 b/VC++Files/mysqlmanager/RES/mysqlmanager.rc2 new file mode 100644 index 00000000000..67d4f3f4a85 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/mysqlmanager.rc2 @@ -0,0 +1,13 @@ +//
+// MYSQLMANAGER.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/VC++Files/mysqlmanager/RES/mysqlmanagerdoc.ico b/VC++Files/mysqlmanager/RES/mysqlmanagerdoc.ico Binary files differnew file mode 100644 index 00000000000..2a1f1ae6ef1 --- /dev/null +++ b/VC++Files/mysqlmanager/RES/mysqlmanagerdoc.ico diff --git a/VC++Files/mysqlmanager/RESOURCE.H b/VC++Files/mysqlmanager/RESOURCE.H new file mode 100644 index 00000000000..def26ce6808 --- /dev/null +++ b/VC++Files/mysqlmanager/RESOURCE.H @@ -0,0 +1,55 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by MySqlManager.rc +// +#define IDC_START_PB 3 +#define IDC_STOP_PB 4 +#define ID_SERVERS_PB 7 +#define IDD_ABOUTBOX 100 +#define IDM_QUERY_EXEC 101 +#define IDM_QUERY_DATABASES 102 +#define IDM_REFRESH 103 +#define IDD_REGISTER_SERVER 114 +#define IDR_MAINFRAME 128 +#define IDR_MYSQLMTYPE 129 +#define IDD_TOOL_SQL 132 +#define IDB_BITMAP1 133 +#define IDD_TOOL_SQL_QUERY 134 +#define IDD_TOOL_SQL_RESULTS 135 +#define IDD_TOOL_SQL_STATUS 136 +#define IDC_TAB1 1000 +#define IDC_EDIT 1001 +#define IDC_QUERY_PB 1002 +#define IDC_FONT_PB 1003 +#define IDS_QUERY_EXEC 1003 +#define ID_SERVER_CB 1003 +#define ID_USER 1004 +#define IDC_SERVER_CB 1004 +#define IDC_DATABASES_PB 1005 +#define ID_PASSWORD 1005 +#define ID_HOST_CB 1006 +#define IDC_TIMER_SECS 1006 +#define ID_PORT_CB 1007 +#define IDC_CLEAR 1007 +#define ID_GROUPS_PB 1012 +#define ID_REMOVE_PB 1017 +#define ID_DISPLAY_SERVER_STATUS_CK 1057 +#define ID_USE_STANDARD_CK 1058 +#define ID_USE_TRUSTED_CK 1059 +#define IDM_SQL_TOOL_QUERY 32771 +#define IDM_TOOLS_REGISTER_SERVER 32772 +#define IDM_TOOLS_SERVER_PROPERTIES 32773 +#define IDS_QUERY_DATABASES 57346 +#define IDS_REFRESH 57347 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 136 +#define _APS_NEXT_COMMAND_VALUE 32775 +#define _APS_NEXT_CONTROL_VALUE 1008 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif diff --git a/VC++Files/mysqlmanager/STDAFX.CPP b/VC++Files/mysqlmanager/STDAFX.CPP new file mode 100644 index 00000000000..3e0251dff43 --- /dev/null +++ b/VC++Files/mysqlmanager/STDAFX.CPP @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// MySqlManager.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/VC++Files/mysqlmanager/STDAFX.H b/VC++Files/mysqlmanager/STDAFX.H new file mode 100644 index 00000000000..8cd7dfd04f3 --- /dev/null +++ b/VC++Files/mysqlmanager/STDAFX.H @@ -0,0 +1,28 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__826CB2EC_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_STDAFX_H__826CB2EC_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions +#include <afxdisp.h> // MFC OLE automation classes +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include <afxsock.h> +#include "mysql.h" + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__826CB2EC_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/TOOLSQL.CPP b/VC++Files/mysqlmanager/TOOLSQL.CPP new file mode 100644 index 00000000000..1773a3a6dc7 --- /dev/null +++ b/VC++Files/mysqlmanager/TOOLSQL.CPP @@ -0,0 +1,687 @@ +// ToolSql.cpp : implementation file +// + +#include "stdafx.h" +#include "MySqlManager.h" +#include "ToolSql.h" + +#define WINDOW_COORDS 0 +#define CLIENT_COORDS 1 + +#define MY_TIMER_ID 0x1234 + +#ifdef _DEBUG + #define new DEBUG_NEW + #undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// + +CToolSql::CToolSql(CWnd* pParent,CResource* pServer,CResource* pResource) +: CDialog(CToolSql::IDD, pParent) +, m_pQuery(0) +, m_pResults(0) +, m_pStatus(0) +, m_pServer(pServer) +, m_pResource(pResource) +, m_ui_timer(0) +{ + //{{AFX_DATA_INIT(CToolSql) + m_nIntervalTimerSeconds = 10; + m_bClear = FALSE; + //}}AFX_DATA_INIT + memset ( & m_lf, 0,sizeof(m_lf) ); +} + +///////////////////////////////////////////////////////////////////////////// + +CToolSql::~CToolSql() +{ + + if (m_ui_timer) + { + KillTimer(MY_TIMER_ID); + } + + if (m_pdb) + { + mysql_close(m_pdb); + } + if (m_pQuery) + { + m_pQuery->DestroyWindow(); + delete m_pQuery; + } + if (m_pResults) + { + m_pResults->DestroyWindow(); + delete m_pResults; + } + if (m_pStatus) + { + m_pStatus->DestroyWindow(); + delete m_pStatus; + } +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CToolSql) + DDX_Control(pDX, IDC_STOP_PB, m_ctl_Stop); + DDX_Control(pDX, IDC_START_PB, m_ctl_Start); + DDX_Control(pDX, IDC_SERVER_CB, m_ctl_Server); + DDX_Control(pDX, IDC_TAB1, m_tabs); + DDX_Text(pDX, IDC_TIMER_SECS, m_nIntervalTimerSeconds); + DDV_MinMaxInt(pDX, m_nIntervalTimerSeconds, 1, 120); + DDX_Check(pDX, IDC_CLEAR, m_bClear); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CToolSql, CDialog) +//{{AFX_MSG_MAP(CToolSql) + ON_BN_CLICKED(IDC_QUERY_PB, OnQueryPb) + ON_BN_CLICKED(IDC_DATABASES_PB, OnQueryDatabases) + ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1) + ON_BN_CLICKED(IDC_FONT_PB, OnFontPb) + ON_WM_SIZE() + ON_BN_CLICKED(IDC_START_PB, OnStartPb) + ON_BN_CLICKED(IDC_STOP_PB, OnStopPb) + ON_WM_TIMER() + ON_WM_DESTROY() + ON_BN_CLICKED(IDC_CLEAR, OnClear) + ON_COMMAND(IDM_QUERY_EXEC, OnQueryPb) + ON_COMMAND(IDM_QUERY_DATABASES, OnQueryDatabases) + ON_EN_CHANGE(IDC_TIMER_SECS, OnChangeTimerSecs) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// + +BOOL CToolSql::OnInitDialog() +{ + + CDialog::OnInitDialog(); + + m_ctl_Start . EnableWindow(TRUE); + m_ctl_Stop . EnableWindow(FALSE); + + CString strTitle; + + strTitle.Format ("mySql Query to %s on %s",m_pServer->GetDisplayName(),m_pServer->GetHostName()); + + m_ctl_Server.AddString ( m_pServer->GetDisplayName() ); + m_ctl_Server.SetCurSel (0); + + SetWindowText(strTitle); + + CWaitCursor x; + + m_btn_QueryExec.AutoLoad ( IDC_QUERY_PB, this ); + m_btn_QueryDatabases.AutoLoad ( IDC_DATABASES_PB, this ); + m_btn_Font.AutoLoad ( IDC_FONT_PB, this ); + + m_tabs.GetWindowRect ( m_rectTab[WINDOW_COORDS] ); + GetWindowRect ( m_rectDlg[WINDOW_COORDS] ); + + m_tabs.GetClientRect ( m_rectTab[CLIENT_COORDS] ); + GetClientRect ( m_rectDlg[CLIENT_COORDS] ); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + CString strText; + strText.LoadString(IDS_QUERY_EXEC); + if (!strText.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_QUERY_EXEC, strText); + } + strText.LoadString(IDS_QUERY_DATABASES); + if (!strText.IsEmpty()) + { + pSysMenu->AppendMenu(MF_STRING, IDM_QUERY_DATABASES, strText); + } + } + + + m_pdb = new MYSQL; + + CString strQuery ( "Query" ); + CString strResults ( "Results" ); + CString strStatus ( "Status" ); + + TC_ITEM tc1 = { TCIF_TEXT, 0,0, (LPSTR)(LPCTSTR)strQuery, strQuery.GetLength(), 0,0}; + TC_ITEM tc2 = { TCIF_TEXT, 0,0, (LPSTR)(LPCTSTR)strResults, strResults.GetLength(), 0,0}; + TC_ITEM tc3 = { TCIF_TEXT, 0,0, (LPSTR)(LPCTSTR)strStatus, strStatus.GetLength(), 0,0}; + + m_tabs.InsertItem ( 0,&tc1 ); + m_tabs.InsertItem ( 1,&tc2 ); + m_tabs.InsertItem ( 2,&tc3 ); + + m_pQuery = new CToolSqlQuery ( NULL ); + m_pResults = new CToolSqlResults ( NULL ); + m_pStatus = new CToolSqlStatus ( NULL ); + + try + { + +// OpenDatabase(); +// +// m_pSelection->SetDatabase ( & m_db ); +// m_pScript->SetDatabase ( & m_db ); +// m_pLog->SetDatabase ( & m_db ); + + m_pQuery -> Create ( (LPCTSTR)IDD_TOOL_SQL_QUERY, &m_tabs ); + m_pResults -> Create ( (LPCTSTR)IDD_TOOL_SQL_RESULTS, &m_tabs ); + m_pStatus -> Create ( (LPCTSTR)IDD_TOOL_SQL_STATUS, &m_tabs ); + + ActivateTab ( 0 ); + + m_pQuery -> SetWindowPos(NULL,20,24,0,0,SWP_NOZORDER|SWP_NOSIZE); + m_pResults -> SetWindowPos(NULL,20,24,0,0,SWP_NOZORDER|SWP_NOSIZE); + m_pStatus -> SetWindowPos(NULL,20,24,0,0,SWP_NOZORDER|SWP_NOSIZE); + + DoOnSize( SIZE_RESTORED, m_rectDlg[CLIENT_COORDS].Width(), m_rectDlg[CLIENT_COORDS].Height() ); + + } + catch (...) + { + } + + mysql_init(m_pdb); + if (!mysql_real_connect(m_pdb,m_pServer->GetHostName(), m_pServer->GetUserName(),m_pServer->GetPassword(),0,m_pServer->GetPortNumber(), NullS,0)) + { +// my_printf_error(0,"connect to server at '%s' failed; error: '%s'", +// MYF(ME_BELL), pResource->GetHostName(), mysql_error(&mysql)); + CString strText; + strText.Format ( "connect to server at '%s' failed; error: '%s'", m_pServer->GetHostName(), mysql_error(m_pdb)); + AfxMessageBox(strText); + EndDialog(IDCANCEL); + return FALSE; + } + + if ( m_pResource && m_pResource->GetType() == CResource::eDatabase ) + { + CString strDB = m_pResource->GetDisplayName(); + strDB.TrimRight(); + if (mysql_select_db(m_pdb,strDB)) + { + } + } + + return FALSE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::ActivateTab ( int tab ) + +{ + switch (tab) + { + case 0: ; + m_pResults-> ShowWindow(SW_HIDE); + m_pStatus-> ShowWindow(SW_HIDE); + m_pQuery-> ShowWindow(SW_SHOW); + m_pQuery->m_ctl_edit.SetFocus(); + break; + case 1: ; + m_pQuery-> ShowWindow(SW_HIDE); + m_pStatus-> ShowWindow(SW_HIDE); + m_pResults-> ShowWindow(SW_SHOW); + m_pResults->m_ctl_edit.SetFocus(); + break; + case 2: ; + m_pResults-> ShowWindow(SW_HIDE); + m_pQuery-> ShowWindow(SW_HIDE); + m_pStatus-> ShowWindow(SW_SHOW); + m_pStatus->m_ctl_edit.SetFocus(); + break; + default: + break; + } + +} + +///////////////////////////////////////////////////////////////////////////// + +void CalculateFontSize ( CEdit& ed, CSize& sizeRet ) + +{ + + CDC* pdc = ed.GetDC(); + + int nAveWidth , nAveHeight; + int i ; + + CSize size ; + + static BOOL bFirstTime = TRUE; + static char rgchAlphabet [54] ; + + if ( bFirstTime ) + { + bFirstTime = false; + for ( i = 0 ; i <= 25 ; i++) + { + rgchAlphabet[i] = (char)(i+(int)'a') ; + rgchAlphabet[i+26] = (char)(i+(int)'A') ; + } + rgchAlphabet[52] = 0x20; + rgchAlphabet[53] = 0x20; + } + + CFont* pf = ed.GetFont(); + LOGFONT lf; + pf->GetLogFont(&lf); + pdc->SelectObject (pf); + GetTextExtentPoint32 ( pdc->m_hDC, (LPSTR) rgchAlphabet, 54, & size ) ; + + nAveWidth = size.cx / 54 ; + + if ( size.cx % 54 ) + { + nAveWidth++; + } + + nAveHeight = size.cy; //6 * size.cy / 4; + + sizeRet.cx = nAveWidth; + sizeRet.cy = nAveHeight; // tm.tmHeight; + + ed.ReleaseDC(pdc); + +} + +/////////////////////////////////////////////////////////////////////////////// +int ProcessYieldMessage () +{ + + CWinApp* pApp = AfxGetApp(); + + if ( pApp ) + { + MSG msgx; + while (::PeekMessage(&msgx, NULL, NULL, NULL, PM_NOREMOVE)) + try + { + if (!pApp->PumpMessage()) + { +// ExitProcess(1); + } + } + catch (...) + { + } + } + + return 0; + +} + + +///////////////////////////////////////////////////////////////////////////// + +void print_table_data(MYSQL_RES *result,CString& str,CEdit& ed,LOGFONT& lf) +{ + MYSQL_ROW cur; + uint length; + MYSQL_FIELD* field; + bool* num_flag; + my_ulonglong nRows = mysql_num_rows(result); + uint nFields = mysql_num_fields(result); + int* rgi = new int [nFields]; + memset ( rgi, 0, nFields*sizeof(int) ); + num_flag=(bool*) my_alloca(sizeof(bool)*nFields); + + ed.SetLimitText(65535*16); + + CSize sizeFont; + CalculateFontSize ( ed, sizeFont ); + uint index = 0; + rgi[index++]=0; + CString separator(""); + + mysql_field_seek(result,0); + + for (uint off=0; (field = mysql_fetch_field(result)) ; off++) + { + uint length= (uint) strlen(field->name); + length=max(length,field->max_length); + if (length < 4 && !IS_NOT_NULL(field->flags)) + length=4; // Room for "NULL" + field->max_length=length+1; + int n=length+2; + for (uint i=lstrlen(field->name); i-- > 0 ; ) separator+="-"; + if ( index!= nFields ) + { + int o = rgi[index-1]; + rgi[index++]=o+((n+1)*sizeFont.cx)/2; + } + separator+='\t'; + str += field->name; + str += "\t"; + num_flag[off]= IS_NUM(field->type); + } + separator += "\r\n"; + str += "\r\n"; + str += separator; + ed.SetSel(-1,-1); + ed.ReplaceSel(str); + + if ( 1 || nRows > 100 ) + { + while ((cur = mysql_fetch_row(result))) + { + ProcessYieldMessage (); + mysql_field_seek(result,0); + str.Empty(); + ed.SetSel(-1,-1); + for (uint off=0 ; off < mysql_num_fields(result); off++) + { + field = mysql_fetch_field(result); + length=field->max_length; + CString strText; + strText.Format ("%s", cur[off] ? (char*) cur[off] : "NULL"); + str += strText; + str += "\t"; + } + str += "\r\n"; + ed.SetSel(-1,-1); + ed.ReplaceSel(str); + } + } + else + { + while ((cur = mysql_fetch_row(result))) + { + mysql_field_seek(result,0); + for (uint off=0 ; off < mysql_num_fields(result); off++) + { + field = mysql_fetch_field(result); + length=field->max_length; + CString strText; + strText.Format ("%s", cur[off] ? (char*) cur[off] : "NULL"); + str += strText; + str += "\t"; + } + str += "\r\n"; + } + } + my_afree((gptr) num_flag); + str += "\r\n"; + ed.SetTabStops(nFields,rgi); + delete [] rgi; +} + + + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnQueryPb() +{ + + CWaitCursor x; +// mysql_select_db(m_pdb,"mysql"); + + if ( m_pResource && m_pResource->GetType() == CResource::eDatabase ) + { + CString strDB = m_pResource->GetDisplayName(); + strDB.TrimRight(); + if (mysql_select_db(m_pdb,strDB)) + { + } + } + + m_pQuery->UpdateData(); + m_pResults->m_edit.Empty(); + CString str = m_pQuery->m_edit; + if ( mysql_real_query(m_pdb,str,str.GetLength())==0 ) + { + MYSQL_RES *result; + if ((result=mysql_store_result(m_pdb))) + { + my_ulonglong nRows = mysql_num_rows(result); + m_pResults->UpdateData(FALSE); + m_tabs.SetCurSel(1); + ActivateTab ( 1 ); + print_table_data(result,m_pResults->m_edit,m_pResults->m_ctl_edit,m_lf); +// m_pResults->UpdateData(FALSE); + m_pResults->m_ctl_edit.SetSel(-1,-1); + CString strText; + strText.Format ( "\r\n(%d row(s) affected)\r\n", nRows ); + m_pResults->m_ctl_edit.ReplaceSel(strText); + mysql_free_result(result); + } + else + { + m_pResults->m_edit = mysql_error(m_pdb); + m_pResults->UpdateData(FALSE); + } + } + else + { + m_pResults->m_edit = mysql_error(m_pdb); + m_pResults->UpdateData(FALSE); + } + + m_tabs.SetCurSel(1); + ActivateTab ( 1 ); + +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnQueryDatabases() +{ + CWaitCursor x; + MYSQL_RES *result; + m_pResults->m_edit.Empty(); + if ((result=mysql_list_dbs(m_pdb,0))) + { + my_ulonglong nRows = mysql_num_rows(result); + print_table_data(result,m_pResults->m_edit,m_pResults->m_ctl_edit,m_lf); + //m_pResults->UpdateData(FALSE); + mysql_free_result(result); + } + else + { + m_pResults->m_edit = mysql_error(m_pdb); + m_pResults->UpdateData(FALSE); + } + + m_tabs.SetCurSel(1); + ActivateTab ( 1 ); + +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) +{ + ActivateTab ( m_tabs.GetCurSel() ); + *pResult = 0; +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnFontPb() +{ + + CFontDialog FontDlg ( & m_lf ); + + if ( FontDlg.DoModal ( ) == IDOK ) + { + if (m_font.GetSafeHandle()) + m_font.DeleteObject(); + m_lf = *FontDlg.m_cf.lpLogFont; + m_font.CreateFontIndirect(FontDlg.m_cf.lpLogFont); + m_pQuery->SetFont(&m_font); + m_pResults->SetFont(&m_font); + m_pStatus->SetFont(&m_font); + } + +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::DoOnSize(UINT nType, int cx, int cy) +{ + + int nx = cx - ( m_rectDlg[CLIENT_COORDS].Width ( ) - m_rectTab[CLIENT_COORDS].Width ( ) ); + int ny = cy - ( m_rectDlg[CLIENT_COORDS].Height ( ) - m_rectTab[CLIENT_COORDS].Height ( ) ); + + if (IsWindow(m_tabs.GetSafeHwnd())) + { + m_tabs.SetWindowPos ( NULL + , 0 + , 0 + , nx + , ny + , SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW ); + + if (m_pResults&&IsWindow(m_pResults->GetSafeHwnd())) + m_pResults -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE ); + if (m_pQuery&&IsWindow(m_pQuery->GetSafeHwnd())) + m_pQuery -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE ); + if (m_pStatus&&IsWindow(m_pStatus->GetSafeHwnd())) + m_pStatus -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE ); +// switch ( m_tabs.GetCurSel() ) +// { +// case 0: +// { +// if (m_pResults&&IsWindow(m_pResults->GetSafeHwnd())) +// m_pResults -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW ); +// if (m_pQuery&&IsWindow(m_pQuery->GetSafeHwnd())) +// m_pQuery -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW ); +// break; +// } +// case 1: +// { +// if (m_pQuery&&IsWindow(m_pQuery->GetSafeHwnd())) +// m_pQuery -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW ); +// if (m_pResults&&IsWindow(m_pResults->GetSafeHwnd())) +// m_pResults -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW ); +// break; +// } +// } + } + +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnSize(UINT nType, int cx, int cy) +{ + + CDialog::OnSize(nType, cx, cy); + + DoOnSize ( nType, cx, cy ); + +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnOK() +{ + CDialog::OnOK(); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnCancel() +{ + CDialog::OnCancel(); +} + +///////////////////////////////////////////////////////////////////////////// + +BOOL CToolSql::PreTranslateMessage(MSG* pMsg) +{ + return CDialog::PreTranslateMessage(pMsg); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::DoProcessListQuery() +{ + + MYSQL_RES *result; + if (result=mysql_list_processes(m_pdb)) + { + if (m_bClear) + { + m_pStatus->m_edit.Empty(); + m_pStatus->UpdateData(FALSE); + } + print_table_data(result,m_pStatus->m_edit,m_pStatus->m_ctl_edit,m_lf); + mysql_free_result(result); + } + else + { +// my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL),mysql_error(mysql)); + } + +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnStartPb() +{ + UpdateData(); + if (m_ui_timer) return; + if (m_nIntervalTimerSeconds<1) return; + ActivateTab ( 2 ); + m_ui_timer = SetTimer( MY_TIMER_ID, m_nIntervalTimerSeconds*1000, NULL ); + m_ctl_Start . EnableWindow(FALSE); + m_ctl_Stop . EnableWindow(TRUE); + DoProcessListQuery(); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnStopPb() +{ + UpdateData(); + if (m_ui_timer) + { + KillTimer(MY_TIMER_ID); + m_ui_timer = 0; + } + m_ctl_Start . EnableWindow(TRUE); + m_ctl_Stop . EnableWindow(FALSE); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSql::OnTimer(UINT nIDEvent) +{ + DoProcessListQuery(); + CDialog::OnTimer(nIDEvent); +} + +void CToolSql::OnDestroy() +{ + if (m_ui_timer) + { + KillTimer(MY_TIMER_ID); + m_ui_timer = 0; + } + CDialog::OnDestroy(); +} + +void CToolSql::OnClear() +{ + UpdateData(); +} + +void CToolSql::OnChangeTimerSecs() +{ + UpdateData(); +} diff --git a/VC++Files/mysqlmanager/TOOLSQL.H b/VC++Files/mysqlmanager/TOOLSQL.H new file mode 100644 index 00000000000..7d608f46cd2 --- /dev/null +++ b/VC++Files/mysqlmanager/TOOLSQL.H @@ -0,0 +1,102 @@ +#if !defined(AFX_ToolSql_H__826CB2FC_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_ToolSql_H__826CB2FC_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include "ToolSqlQuery.h" +#include "ToolSqlResults.h" +#include "ToolSqlStatus.h" +#include "cresource.h" +#include <my_global.h> +#include "my_sys.h" +#include "mysql.h" + + +///////////////////////////////////////////////////////////////////////////// +// CToolSql dialog + +class CToolSql : public CDialog +{ +// Construction +public: + CToolSql(CWnd* pParent = NULL,CResource* pServer=NULL,CResource* pResource=NULL); + ~CToolSql(); + +// Dialog Data + //{{AFX_DATA(CToolSql) + enum { IDD = IDD_TOOL_SQL }; + CButton m_ctl_Stop; + CButton m_ctl_Start; + CComboBox m_ctl_Server; + CTabCtrl m_tabs; + int m_nIntervalTimerSeconds; + BOOL m_bClear; + //}}AFX_DATA + + CBitmapButton m_btn_QueryExec; + CBitmapButton m_btn_Font; + CBitmapButton m_btn_QueryDatabases; + +#ifdef _WIN64 + __int64 m_ui_timer; +#else + UINT m_ui_timer; +#endif + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CToolSql) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation + + void ActivateTab ( int tab ); + void DoProcessListQuery(); + + CToolSqlQuery* m_pQuery; + CToolSqlResults* m_pResults; + CToolSqlStatus* m_pStatus; + + CResource* m_pServer; + CResource* m_pResource; + MYSQL* m_pdb; + CFont m_font; + LOGFONT m_lf; + CRect m_rectTab[2]; + CRect m_rectDlg[2]; + +protected: + + // Generated message map functions + //{{AFX_MSG(CToolSql) + virtual BOOL OnInitDialog(); + afx_msg void OnQueryPb(); + afx_msg void OnQueryDatabases(); + afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnFontPb(); + afx_msg void OnSize(UINT nType, int cx, int cy); + virtual void OnOK(); + virtual void OnCancel(); + afx_msg void OnStartPb(); + afx_msg void OnStopPb(); + afx_msg void OnTimer(UINT nIDEvent); + afx_msg void OnDestroy(); + afx_msg void OnClear(); + afx_msg void OnChangeTimerSecs(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + void DoOnSize(UINT nType, int cx, int cy) ; + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ToolSql_H__826CB2FC_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/cresource.h b/VC++Files/mysqlmanager/cresource.h new file mode 100644 index 00000000000..37c1839d758 --- /dev/null +++ b/VC++Files/mysqlmanager/cresource.h @@ -0,0 +1,134 @@ +#ifndef _CRESOURCE_H +#define _CRESOURCE_H + +///////////////////////////////////////////////////////////////////////////// + +#define MYSQL_PORT_AS_STRING "3306" /* Can't use # in preprocessor because of bugs in VC++ 5.0 */ + +class CResource +{ +public: + enum eRESOURCETYPE + { + eNone + , eServer + , eDatabase + , eTable + , eField + , eProcesslist + , eProcesslistItem + }; + virtual LPCTSTR GetDisplayName() { return ""; } + virtual LPCTSTR GetHostName() { return LOCAL_HOST; } + virtual LPCTSTR GetUserName() { return "root"; } + virtual LPCTSTR GetPassword() { return ""; } + virtual LPCTSTR GetPortName() { return MYSQL_PORT_AS_STRING; } + virtual int GetPortNumber() { return MYSQL_PORT; } + virtual eRESOURCETYPE GetType() { return eNone; } +}; + +///////////////////////////////////////////////////////////////////////////// + +class CResourceServer : public CResource +{ +public: + CResourceServer(LPCTSTR pszName = "",LPCTSTR pszHost = LOCAL_HOST ,LPCTSTR pszUser = "root", LPCTSTR pszPassword = "", LPCTSTR pszPort = MYSQL_PORT_AS_STRING) + : m_strName(pszName) + , m_strHost(pszHost) + , m_strUser(pszUser) + , m_strPassword(pszPassword) + , m_strPort(pszPort) + { + } + virtual LPCTSTR GetDisplayName() { return m_strName; } + virtual LPCTSTR GetHostName() { return m_strHost; } + virtual LPCTSTR GetUserName() { return m_strUser; } + virtual LPCTSTR GetPassword() { return m_strPassword; } + virtual eRESOURCETYPE GetType() { return eServer; } + virtual LPCTSTR GetPortName() { return m_strPort; } + virtual int GetPortNumber() { return atoi(m_strPort); } + CString m_strName; + CString m_strHost; + CString m_strUser; + CString m_strPassword; + CString m_strPort; + CStringArray m_rgFields; +}; + +///////////////////////////////////////////////////////////////////////////// + +class CResourceDatabase : public CResource +{ +public: + CResourceDatabase(LPCTSTR pszName = "") + : m_strName(pszName) + { + } + virtual LPCTSTR GetDisplayName() { return m_strName; } + virtual eRESOURCETYPE GetType() { return eDatabase; } + CString m_strName; + CStringArray m_rgFields; +}; + +///////////////////////////////////////////////////////////////////////////// + +class CResourceTable : public CResource +{ +public: + CResourceTable(LPCTSTR pszName = "") + : m_strName(pszName) + { + } + virtual LPCTSTR GetDisplayName() { return m_strName; } + virtual eRESOURCETYPE GetType() { return eTable; } + CString m_strName; + CStringArray m_rgFields; +}; + + +///////////////////////////////////////////////////////////////////////////// + +class CResourceField : public CResource +{ +public: + CResourceField(LPCTSTR pszName = "") + : m_strName(pszName) + { + } + virtual LPCTSTR GetDisplayName() { return m_strName; } + virtual eRESOURCETYPE GetType() { return eField; } + CString m_strName; + CStringArray m_rgFields; +}; + + + +///////////////////////////////////////////////////////////////////////////// + +class CResourceProcesslist : public CResource +{ +public: + CResourceProcesslist(LPCTSTR pszName = "Processlist") + : m_strName(pszName) + { + } + virtual LPCTSTR GetDisplayName() { return m_strName; } + virtual eRESOURCETYPE GetType() { return eProcesslist; } + CString m_strName; + CStringArray m_rgFields; +}; + +///////////////////////////////////////////////////////////////////////////// + +class CResourceProcesslistItem : public CResourceProcesslist +{ +public: + CResourceProcesslistItem(LPCTSTR pszName = "ProcesslistItem") + : CResourceProcesslist(pszName) + { + } + virtual eRESOURCETYPE GetType() { return eProcesslistItem; } +}; + + +#endif diff --git a/VC++Files/mysqlmanager/mysqlmanager.cpp b/VC++Files/mysqlmanager/mysqlmanager.cpp new file mode 100644 index 00000000000..09a19181e22 --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanager.cpp @@ -0,0 +1,168 @@ +// MySqlManager.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "MySqlManager.h" + +#include "MainFrm.h" +#include "ChildFrm.h" +#include "MySqlManagerDoc.h" +#include "MySqlManagerView.h" + +#ifdef _DEBUG + #define new DEBUG_NEW + #undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerApp + +BEGIN_MESSAGE_MAP(CMySqlManagerApp, CWinApp) +//{{AFX_MSG_MAP(CMySqlManagerApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) +// NOTE - the ClassWizard will add and remove mapping macros here. +// DO NOT EDIT what you see in these blocks of generated code! +//}}AFX_MSG_MAP +// Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +// Standard print setup command + ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerApp construction + +CMySqlManagerApp::CMySqlManagerApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CMySqlManagerApp object + +CMySqlManagerApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerApp initialization + +BOOL CMySqlManagerApp::InitInstance() +{ + + WSADATA WsaData; + + if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData)) + { + AfxMessageBox("WSAStartup Failed\n"); + return FALSE; + } + + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Change the registry key under which our settings are stored. + // You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CMultiDocTemplate* pDocTemplate; + pDocTemplate = new CMultiDocTemplate( + IDR_MYSQLMTYPE, + RUNTIME_CLASS(CMySqlManagerDoc), + RUNTIME_CLASS(CChildFrame), // custom MDI child frame + RUNTIME_CLASS(CMySqlManagerView)); + AddDocTemplate(pDocTemplate); + + // create main MDI Frame window + CMainFrame* pMainFrame = new CMainFrame; + if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The main window has been initialized, so show and update it. + pMainFrame->ShowWindow(m_nCmdShow); + pMainFrame->UpdateWindow(); + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum {IDD = IDD_ABOUTBOX}; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //{{AFX_MSG(CAboutDlg) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +//{{AFX_MSG_MAP(CAboutDlg) +// No message handlers +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// App command to run the dialog +void CMySqlManagerApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerApp commands diff --git a/VC++Files/mysqlmanager/mysqlmanager.h b/VC++Files/mysqlmanager/mysqlmanager.h new file mode 100644 index 00000000000..accb63a908f --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanager.h @@ -0,0 +1,50 @@ +// MySqlManager.h : main header file for the MYSQLMANAGER application +// + +#if !defined(AFX_MYSQLMANAGER_H__826CB2EA_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_MYSQLMANAGER_H__826CB2EA_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerApp: +// See MySqlManager.cpp for the implementation of this class +// + +class CMySqlManagerApp : public CWinApp +{ +public: + CMySqlManagerApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMySqlManagerApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CMySqlManagerApp) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MYSQLMANAGER_H__826CB2EA_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/mysqlmanager.rc b/VC++Files/mysqlmanager/mysqlmanager.rc new file mode 100644 index 00000000000..1dd9caeb686 --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanager.rc @@ -0,0 +1,572 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\MySqlManager.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#include ""afxprint.rc"" // printing/print preview resources\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\MySqlManager.ico" +IDR_MYSQLMTYPE ICON DISCARDABLE "res\\MySqlManagerDoc.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" +IDB_BITMAP1 BITMAP DISCARDABLE "res\\bitmap3.bmp" +IDB_QUERY_EXECU BITMAP FIXED IMPURE "res\\query_ex.bmp" +IDB_QUERY_EXECD BITMAP FIXED IMPURE "res\\bmp00001.bmp" +IDB_FONTU BITMAP FIXED IMPURE "res\\fontu.bmp" +IDB_FONTD BITMAP FIXED IMPURE "res\\fontd.bmp" +IDB_DATABASESU BITMAP FIXED IMPURE "res\\database.bmp" +IDB_DATABASESD BITMAP FIXED IMPURE "res\\bmp00002.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15 +BEGIN + BUTTON ID_FILE_NEW + BUTTON ID_FILE_OPEN + BUTTON ID_FILE_SAVE + SEPARATOR + BUTTON ID_EDIT_CUT + BUTTON ID_EDIT_COPY + BUTTON ID_EDIT_PASTE + SEPARATOR + BUTTON ID_FILE_PRINT + BUTTON ID_APP_ABOUT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + END + POPUP "&Help" + BEGIN + MENUITEM "&About MySqlManager...", ID_APP_ABOUT + END +END + +IDR_MYSQLMTYPE MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Close", ID_FILE_CLOSE + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT + MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW + MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Tools" + BEGIN + MENUITEM "SQL &Query", IDM_SQL_TOOL_QUERY + MENUITEM "Register Server", IDM_TOOLS_REGISTER_SERVER + MENUITEM "Server Properties", IDM_TOOLS_SERVER_PROPERTIES + END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + END + POPUP "&Window" + BEGIN + MENUITEM "&New Window", ID_WINDOW_NEW + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "&Tile", ID_WINDOW_TILE_HORZ + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE + END + POPUP "&Help" + BEGIN + MENUITEM "&About MySqlManager...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "D", IDM_QUERY_DATABASES, VIRTKEY, ALT, NOINVERT + "E", IDM_QUERY_EXEC, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT + VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "X", IDM_QUERY_EXEC, VIRTKEY, ALT, NOINVERT + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 234, 72 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About MySqlManager" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "MySqlManager Version 1.0.2",IDC_STATIC,37,10,119,8, + SS_NOPREFIX + LTEXT "By James Pereira (jpereira@iafrica.com)",IDC_STATIC,37, + 49,146,9 + DEFPUSHBUTTON "OK",IDOK,195,7,32,14,WS_GROUP + LTEXT "This file is public domain and comes with NO WARRANTY of any kind", + IDC_STATIC,38,25,136,18,SS_SUNKEN +END + +IDD_TOOL_SQL DIALOGEX 0, 0, 452, 246 +STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | + WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_CLIENTEDGE +CAPTION "mySQL Query Tool" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "OK",IDOK,369,10,12,14,NOT WS_VISIBLE + DEFPUSHBUTTON "Close",IDCANCEL,391,10,50,14 + CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,11,26,434,213 + CONTROL "IDB_QUERY_EXEC",IDC_QUERY_PB,"Button",BS_OWNERDRAW | + WS_TABSTOP,106,10,12,14 + CONTROL "IDB_FONT",IDC_FONT_PB,"Button",BS_OWNERDRAW | + WS_TABSTOP,123,10,12,14 + COMBOBOX IDC_SERVER_CB,12,9,85,128,CBS_DROPDOWN | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + CONTROL "IDB_DATABASES",IDC_DATABASES_PB,"Button",BS_OWNERDRAW | + WS_TABSTOP,142,10,12,14 + DEFPUSHBUTTON "&Start",IDC_START_PB,315,10,23,14 + DEFPUSHBUTTON "S&top",IDC_STOP_PB,343,10,23,14 + EDITTEXT IDC_TIMER_SECS,287,10,22,14,ES_AUTOHSCROLL + LTEXT "Interval (s)",IDC_STATIC,249,11,34,8 + CONTROL "Clear",IDC_CLEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 215,11,29,10 +END + +IDD_TOOL_SQL_QUERY DIALOG DISCARDABLE 0, 0, 452, 247 +STYLE WS_CHILD | WS_BORDER +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT,11,11,434,229,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL +END + +IDD_TOOL_SQL_RESULTS DIALOG DISCARDABLE 0, 0, 452, 247 +STYLE WS_CHILD | WS_BORDER +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT,11,11,434,229,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | WS_VSCROLL +END + +IDD_REGISTER_SERVER DIALOG FIXED IMPURE 0, 0, 281, 199 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Register Server" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "",-1,5,0,270,195 + LTEXT "&Server:",-1,12,14,25,8 + COMBOBOX ID_SERVER_CB,46,12,159,60,CBS_DROPDOWN | CBS_AUTOHSCROLL | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "&Host",-1,12,33,25,8 + COMBOBOX ID_HOST_CB,46,31,159,60,CBS_DROPDOWN | CBS_AUTOHSCROLL | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "&Port",-1,12,53,25,8 + COMBOBOX ID_PORT_CB,46,50,159,60,CBS_DROPDOWN | CBS_AUTOHSCROLL | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Login Information",-1,12,82,194,76 + CONTROL "Use S&tandard Security",ID_USE_STANDARD_CK,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,19,107,94,11 + CONTROL "Use Tr&usted Connection",ID_USE_TRUSTED_CK,"Button", + BS_AUTORADIOBUTTON,19,94,99,11 + LTEXT "&Login ID:",1060,37,124,35,8 + EDITTEXT ID_USER,77,122,120,12,ES_AUTOHSCROLL | WS_GROUP + LTEXT "&Password:",1061,37,140,35,8 + EDITTEXT ID_PASSWORD,77,138,120,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "S&erver Group:",-1,12,164,24,25 + CONTROL "&Display Server Status in Server Manager", + ID_DISPLAY_SERVER_STATUS_CK,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,44,168,152,10 + DEFPUSHBUTTON "&Register",IDOK,214,11,53,14 + PUSHBUTTON "Re&move",ID_REMOVE_PB,214,27,53,14 + PUSHBUTTON "&Close",IDCANCEL,214,43,53,14 + PUSHBUTTON "&Help",ID_HELP,214,59,53,14 + PUSHBUTTON "Ser&vers...",ID_SERVERS_PB,214,92,53,14 + PUSHBUTTON "&Groups...",ID_GROUPS_PB,214,108,53,14 +END + +IDD_TOOL_SQL_STATUS DIALOG DISCARDABLE 0, 0, 452, 247 +STYLE WS_CHILD | WS_BORDER +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT,11,11,434,229,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | WS_VSCROLL +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,2 + PRODUCTVERSION 1,0,0,2 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "MySqlManager MFC Application\0" + VALUE "FileVersion", "1, 0, 0, 2\0" + VALUE "InternalName", "MySqlManager\0" + VALUE "LegalCopyright", "Copyright (C) 1998\0" + VALUE "OriginalFilename", "MySqlManager.EXE\0" + VALUE "ProductName", "MySqlManager Application\0" + VALUE "ProductVersion", "1, 0, 0, 2\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 6 + RIGHTMARGIN, 227 + TOPMARGIN, 7 + BOTTOMMARGIN, 65 + END + + IDD_TOOL_SQL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 445 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_TOOL_SQL_QUERY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 445 + TOPMARGIN, 7 + BOTTOMMARGIN, 240 + END + + IDD_TOOL_SQL_RESULTS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 445 + TOPMARGIN, 7 + BOTTOMMARGIN, 240 + END + + IDD_TOOL_SQL_STATUS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 445 + TOPMARGIN, 7 + BOTTOMMARGIN, 240 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "MySqlManager" + IDR_MYSQLMTYPE "\nMySqlM\nMySqlM\n\n\nMySqlManager.Document\nMySqlM Document" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "MySqlManager" + AFX_IDS_IDLEMESSAGE "Ready" + IDS_QUERY_DATABASES "Query Database(s)" + IDS_REFRESH "Refresh" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "CAP" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "SCRL" + ID_INDICATOR_OVR "OVR" + ID_INDICATOR_REC "REC" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "Create a new document\nNew" + ID_FILE_OPEN "Open an existing document\nOpen" + ID_FILE_CLOSE "Close the active document\nClose" + ID_FILE_SAVE "Save the active document\nSave" + ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" + ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup" + ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup" + ID_FILE_PRINT "Print the active document\nPrint" + ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "Display program information, version number and copyright\nAbout" + ID_APP_EXIT "Quit the application; prompts to save documents\nExit" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "Open this document" + ID_FILE_MRU_FILE2 "Open this document" + ID_FILE_MRU_FILE3 "Open this document" + ID_FILE_MRU_FILE4 "Open this document" + ID_FILE_MRU_FILE5 "Open this document" + ID_FILE_MRU_FILE6 "Open this document" + ID_FILE_MRU_FILE7 "Open this document" + ID_FILE_MRU_FILE8 "Open this document" + ID_FILE_MRU_FILE9 "Open this document" + ID_FILE_MRU_FILE10 "Open this document" + ID_FILE_MRU_FILE11 "Open this document" + ID_FILE_MRU_FILE12 "Open this document" + ID_FILE_MRU_FILE13 "Open this document" + ID_FILE_MRU_FILE14 "Open this document" + ID_FILE_MRU_FILE15 "Open this document" + ID_FILE_MRU_FILE16 "Open this document" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "Switch to the next window pane\nNext Pane" + ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_NEW "Open another window for the active document\nNew Window" + ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons" + ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows" + ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows" + ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows" + ID_WINDOW_SPLIT "Split the active window into panes\nSplit" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "Erase the selection\nErase" + ID_EDIT_CLEAR_ALL "Erase everything\nErase All" + ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" + ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" + ID_EDIT_FIND "Find the specified text\nFind" + ID_EDIT_PASTE "Insert Clipboard contents\nPaste" + ID_EDIT_REPEAT "Repeat the last action\nRepeat" + ID_EDIT_REPLACE "Replace specific text with different text\nReplace" + ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" + ID_EDIT_UNDO "Undo the last action\nUndo" + ID_EDIT_REDO "Redo the previously undone action\nRedo" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" + ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "Change the window size" + AFX_IDS_SCMOVE "Change the window position" + AFX_IDS_SCMINIMIZE "Reduce the window to an icon" + AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" + AFX_IDS_SCNEXTWINDOW "Switch to the next document window" + AFX_IDS_SCPREVWINDOW "Switch to the previous document window" + AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "Restore the window to normal size" + AFX_IDS_SCTASKLIST "Activate Task List" + AFX_IDS_MDICHILD "Activate this window" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_QUERY_PB "Execute Query" + IDS_QUERY_EXEC "Execute Query" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\MySqlManager.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#include "afxprint.rc" // printing/print preview resources +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/VC++Files/mysqlmanager/mysqlmanagerdoc.cpp b/VC++Files/mysqlmanager/mysqlmanagerdoc.cpp new file mode 100644 index 00000000000..c89ce693a60 --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanagerdoc.cpp @@ -0,0 +1,84 @@ +// MySqlManagerDoc.cpp : implementation of the CMySqlManagerDoc class +// + +#include "stdafx.h" +#include "MySqlManager.h" + +#include "MySqlManagerDoc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerDoc + +IMPLEMENT_DYNCREATE(CMySqlManagerDoc, CDocument) + +BEGIN_MESSAGE_MAP(CMySqlManagerDoc, CDocument) + //{{AFX_MSG_MAP(CMySqlManagerDoc) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerDoc construction/destruction + +CMySqlManagerDoc::CMySqlManagerDoc() +{ + // TODO: add one-time construction code here + +} + +CMySqlManagerDoc::~CMySqlManagerDoc() +{ +} + +BOOL CMySqlManagerDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerDoc serialization + +void CMySqlManagerDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerDoc diagnostics + +#ifdef _DEBUG +void CMySqlManagerDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CMySqlManagerDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMySqlManagerDoc commands diff --git a/VC++Files/mysqlmanager/mysqlmanagerdoc.h b/VC++Files/mysqlmanager/mysqlmanagerdoc.h new file mode 100644 index 00000000000..f4a4d35cfd5 --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanagerdoc.h @@ -0,0 +1,57 @@ +// MySqlManagerDoc.h : interface of the CMySqlManagerDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MYSQLMANAGERDOC_H__826CB2F2_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_MYSQLMANAGERDOC_H__826CB2F2_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + + +class CMySqlManagerDoc : public CDocument +{ +protected: // create from serialization only + CMySqlManagerDoc(); + DECLARE_DYNCREATE(CMySqlManagerDoc) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMySqlManagerDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMySqlManagerDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CMySqlManagerDoc) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MYSQLMANAGERDOC_H__826CB2F2_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/mysqlmanagerview.cpp b/VC++Files/mysqlmanager/mysqlmanagerview.cpp new file mode 100644 index 00000000000..1d4756e7d7a --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanagerview.cpp @@ -0,0 +1,849 @@ +// MySqlManagerView.cpp : implementation of the CMySqlManagerView class +// + +#include "stdafx.h" +#include "MySqlManager.h" +#include "MySqlManagerDoc.h" +#include "MySqlManagerView.h" +#include "mainfrm.h" +#include "ToolSql.h" +#include "RegisterServer.h" + +class XStatus +{ +public: + XStatus ( LPCSTR fmt, ... ) + { + char buf [2048]; + va_list args; + va_start(args, fmt); + int ret = vsprintf(buf, fmt, args); + MainFrame->StatusMsg ( "%s", buf ); + va_end(args); + } + ~XStatus() + { + MainFrame->StatusMsg ( " "); + } +private: + XStatus(); +}; + +#ifdef _DEBUG + #define new DEBUG_NEW + #undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// + +IMPLEMENT_DYNCREATE(CMySqlManagerView, CTreeView) + +BEGIN_MESSAGE_MAP(CMySqlManagerView, CTreeView) +//{{AFX_MSG_MAP(CMySqlManagerView) +ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk) +ON_COMMAND(IDM_SQL_TOOL_QUERY, OnSqlToolQuery) +ON_COMMAND(IDM_REFRESH, OnRefresh) +ON_COMMAND(IDM_TOOLS_SERVER_PROPERTIES,OnServerProperties) +ON_COMMAND(IDM_TOOLS_REGISTER_SERVER, OnRegisterServer) +ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick) +//}}AFX_MSG_MAP +// Standard printing commands +ON_COMMAND(ID_FILE_PRINT, CTreeView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_DIRECT, CTreeView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_PREVIEW, CTreeView::OnFilePrintPreview) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// + +CMySqlManagerView::CMySqlManagerView() +: m_pTree(0) +, m_pImages(0) +, m_pbmBmp(0) +, m_pTool(0) +{ +} + +///////////////////////////////////////////////////////////////////////////// + +CMySqlManagerView::~CMySqlManagerView() +{ + if ( m_pbmBmp ) delete m_pbmBmp; + if ( m_pImages ) delete m_pImages; + if ( m_pTool ) + { + m_pTool->DestroyWindow(); + delete m_pTool; + } +} + +///////////////////////////////////////////////////////////////////////////// + +BOOL CMySqlManagerView::PreCreateWindow(CREATESTRUCT& cs) +{ + return CTreeView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnDraw(CDC* pDC) +{ + CMySqlManagerDoc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); +} + +///////////////////////////////////////////////////////////////////////////// + +BOOL CMySqlManagerView::OnPreparePrinting(CPrintInfo* pInfo) +{ + return DoPreparePrinting(pInfo); +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ +} + +///////////////////////////////////////////////////////////////////////////// + +#ifdef _DEBUG +void CMySqlManagerView::AssertValid() const +{ + CTreeView::AssertValid(); +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::Dump(CDumpContext& dc) const +{ + CTreeView::Dump(dc); +} + +///////////////////////////////////////////////////////////////////////////// + +CMySqlManagerDoc* CMySqlManagerView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMySqlManagerDoc))); + return (CMySqlManagerDoc*)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnInitialUpdate() +{ + + CTreeView::OnInitialUpdate(); + + m_pTree = & GetTreeCtrl(); + m_pImages = new CImageList; + m_pImages->Create( 16, 16, FALSE, 0, 10 ); + m_pbmBmp = new CBitmap; + m_pbmBmp->LoadBitmap( IDB_BITMAP1 ); + m_pImages->Add( m_pbmBmp, (COLORREF)0 ); + m_pTree->SetImageList( m_pImages, TVSIL_NORMAL ); + + HTREEITEM h = AddResource ( TVI_ROOT, new CResourceServer ( "MySQL", "localhost", "root", "" ) ); +// AddResource ( h, new CResourceProcesslist () ); + h = AddResource ( TVI_ROOT, new CResourceServer ( "Test", "localhost", "test", "" ) ); +// AddResource ( h, new CResourceProcesslist () ); + + m_pTree->ModifyStyle(0, TVS_HASLINES|TVS_HASBUTTONS); + +} + +///////////////////////////////////////////////////////////////////////////// + +HTREEITEM CMySqlManagerView::AddResource ( HTREEITEM hParent, CResource* pRes, HTREEITEM hLastItem ) +{ + + TV_INSERTSTRUCT ItemStruct; + memset( &ItemStruct, 0, sizeof(ItemStruct) ); + ItemStruct.hParent = hParent; + ItemStruct.hInsertAfter = hLastItem; + ItemStruct.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE; + ItemStruct.item.hItem = 0; + ItemStruct.item.state = 0; + ItemStruct.item.stateMask = 0; + ItemStruct.item.pszText = (LPSTR) pRes->GetDisplayName(); + ItemStruct.item.cchTextMax = (int) strlen( ItemStruct.item.pszText ); + ItemStruct.item.iImage = 2; + ItemStruct.item.iSelectedImage = 3; + ItemStruct.item.cChildren = 0; + ItemStruct.item.lParam = (long) pRes; + hLastItem = m_pTree->InsertItem( &ItemStruct ); + return hLastItem; +} + +//int InsertNetResources( LPNETRESOURCE lpNetResource, CTreeCtrl *pTreeCtrl, HTREEITEM hParent, int *pnCount ) +//{ +// +// DWORD Erc; +// NETRESOURCE *pNetRes; +// HANDLE hEnum; +// +// if( !pTreeCtrl ) return -1; +// if( pnCount ) *pnCount = 0; +// Erc = WNetOpenEnum( +// RESOURCE_GLOBALNET,//DWORD dwScope, // scope of enumeration +// RESOURCETYPE_ANY,//DWORD dwType, // resource types to list +// 0,//DWORD dwUsage, // resource usage to list +// lpNetResource,//LPNETRESOURCE lpNetResource, // pointer to resource structure +// &hEnum//LPHANDLE lphEnum // pointer to enumeration handle buffer +// ); +// if( Erc ) +// { +// ShowError( Erc ); +// return Erc; +// } +// +// +// DWORD dwBufferSize = 1024; +// pNetRes = (NETRESOURCE *)malloc( dwBufferSize ); +// +// while( TRUE ) +// { +// DWORD dwCount = 0xFFFFFFFF; +// Erc = WNetEnumResource( +// hEnum,//HANDLE hEnum, // handle to enumeration +// &dwCount,//LPDWORD lpcCount, // pointer to entries to list +// pNetRes,//LPVOID lpBuffer, // pointer to buffer for results +// &dwBufferSize//LPDWORD lpBufferSize // pointer to buffer size variable +// ); +// if( Erc == ERROR_NO_MORE_ITEMS ) return 0; +// if( Erc ) +// { +// free( pNetRes ); +// pNetRes = (NETRESOURCE *)malloc( dwBufferSize ); +// Erc = WNetEnumResource( +// hEnum,//HANDLE hEnum, // handle to enumeration +// &dwCount,//LPDWORD lpcCount, // pointer to entries to list +// pNetRes,//LPVOID lpBuffer, // pointer to buffer for results +// &dwBufferSize//LPDWORD lpBufferSize // pointer to buffer size variable +// ); +// } +// if( Erc ){ ShowError( Erc ); return Erc; } +// +// TV_INSERTSTRUCT ItemStruct; +// HTREEITEM hLastItem = TVI_FIRST; +// DWORD i; +// +// if( pnCount ) *pnCount += dwCount; +// for( i=0; i<dwCount; i++ ) +// { +// memset( &ItemStruct, 0, sizeof(ItemStruct) ); +// ItemStruct.hParent = hParent; +// ItemStruct.hInsertAfter = hLastItem; +// ItemStruct.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE; +// ItemStruct.item.hItem = 0; +// ItemStruct.item.state = 0; +// ItemStruct.item.stateMask = 0; +// ItemStruct.item.pszText = pNetRes[i].lpRemoteName; +// ItemStruct.item.cchTextMax = strlen( ItemStruct.item.pszText ); +// ItemStruct.item.iImage = 2; +// ItemStruct.item.iSelectedImage = 3; +// ItemStruct.item.cChildren = 0; +// ItemStruct.item.lParam = (long) (new CNetResource( &pNetRes[i] )); +// +// hLastItem = pTreeCtrl->InsertItem( &ItemStruct ); +// } +// }//end while() +// +// WNetCloseEnum( hEnum ); +// free( pNetRes ); +// return Erc; +//} + +///////////////////////////////////////////////////////////////////////////// + +static void print_top(MYSQL_RES *result) +{ + uint length; + MYSQL_FIELD *field; + mysql_field_seek(result,0); + while ((field = mysql_fetch_field(result))) + { + if ((length= (uint) strlen(field->name)) > field->max_length) + field->max_length=length; + else + length=field->max_length; + } +} + +///////////////////////////////////////////////////////////////////////////// + +static void print_header(MYSQL_RES *result,CStringArray& rg) +{ + MYSQL_FIELD *field; + print_top(result); + mysql_field_seek(result,0); + while ((field = mysql_fetch_field(result))) + { +// printf(" %-*s|",field->max_length+1,field->name); + rg.Add(field->name); + } + print_top(result); +} + + +///////////////////////////////////////////////////////////////////////////// + +static void print_row(MYSQL_RES *result,MYSQL_ROW row,CStringArray& rg) +{ + uint i,length; + MYSQL_FIELD *field; + mysql_field_seek(result,0); + for (i=0 ; i < mysql_num_fields(result); i++) + { + field = mysql_fetch_field(result); + length=field->max_length; + rg.Add(row[i] ? (char*) row[i] : ""); +// printf(" %-*s|",length+1,row[i] ? (char*) row[i] : ""); + } +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::ProcessResultSet ( HTREEITEM hItem, LPVOID r, CResource* pResource ) +{ + + MYSQL_RES* result = (MYSQL_RES *) r; + MYSQL_ROW row; + + switch (pResource->GetType()) + { + case CResource::eProcesslist: + { + CResourceProcesslist* p = (CResourceProcesslist*) pResource; + CResourceProcesslistItem* pi = new CResourceProcesslistItem (); + CString strText; + print_header(result,p->m_rgFields); + for (int i = 0; i<p->m_rgFields.GetSize(); i++ ) + { + strText += p->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + AddResource ( hItem, pi ); + for (int index=0;(row=mysql_fetch_row(result));index++) + { + pi = new CResourceProcesslistItem (); + print_row(result,row,pi->m_rgFields); + strText.Empty(); + for (int i = 0; i<pi->m_rgFields.GetSize(); i++ ) + { + strText += pi->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + AddResource ( hItem, pi ); + } + print_top(result); + break; + } + case CResource::eServer: + { + CResourceServer* p = (CResourceServer*) pResource; + CResourceDatabase* pi = new CResourceDatabase (); + CString strText; + /* print_header(result,p->m_rgFields); */ + for (int i = 0; i<p->m_rgFields.GetSize(); i++ ) + { + strText += p->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + /* AddResource ( hItem, pi ); */ + for (int index=0;(row=mysql_fetch_row(result));index++) + { + pi = new CResourceDatabase (); + print_row(result,row,pi->m_rgFields); + strText.Empty(); + for (int i = 0; i<pi->m_rgFields.GetSize(); i++ ) + { + strText += pi->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + AddResource ( hItem, pi ); + } + print_top(result); + break; + } + case CResource::eDatabase: + { + CResourceDatabase* p = (CResourceDatabase*) pResource; + CResourceTable* pi = new CResourceTable (); + CString strText; + /* print_header(result,p->m_rgFields); */ + for (int i = 0; i<p->m_rgFields.GetSize(); i++ ) + { + strText += p->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + /* AddResource ( hItem, pi ); */ + for (int index=0;(row=mysql_fetch_row(result));index++) + { + pi = new CResourceTable (); + print_row(result,row,pi->m_rgFields); + strText.Empty(); + for (int i = 0; i<pi->m_rgFields.GetSize(); i++ ) + { + strText += pi->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + AddResource ( hItem, pi ); + } + print_top(result); + break; + } + case CResource::eTable: + { + CResourceTable* p = (CResourceTable*) pResource; + CResourceField* pi = new CResourceField (); + CString strText; + /* print_header(result,p->m_rgFields); */ + for (int i = 0; i<p->m_rgFields.GetSize(); i++ ) + { + strText += p->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + /* AddResource ( hItem, pi ); */ + for (int index=0;(row=mysql_fetch_row(result));index++) + { + pi = new CResourceField (); + print_row(result,row,pi->m_rgFields); + strText.Empty(); + for (int i = 0; i<pi->m_rgFields.GetSize(); i++ ) + { + strText += pi->m_rgFields[i]; + strText += " "; + } + pi->m_strName = strText; + AddResource ( hItem, pi ); + } + print_top(result); + break; + } + } + + +} + +///////////////////////////////////////////////////////////////////////////// + +CResource* CMySqlManagerView::GetSelectedResource(HTREEITEM* phItemRet) +{ + CResource* pResource = NULL; + HTREEITEM hItem = m_pTree->GetSelectedItem(); + if ( hItem ) + { + TV_ITEM item; + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hItem; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + if ( item.lParam ) + { + pResource = (CResource*) item.lParam; + } + } + if (phItemRet) + { + *phItemRet = hItem; + } + return pResource; +} + +///////////////////////////////////////////////////////////////////////////// + +CResourceServer* CMySqlManagerView::GetServerResource(HTREEITEM hItem) +{ + + TV_ITEM item; + + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hItem; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + if ( !item.lParam ) return NULL; + + CResource* pResource = (CResource*) item.lParam; + + switch (pResource->GetType()) + { + case CResource::eServer: + { + return (CResourceServer*) pResource; + } + case CResource::eDatabase: + { + HTREEITEM hParent = m_pTree->GetParentItem(hItem); + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hParent; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + if ( !item.lParam ) return NULL; + return (CResourceServer*) item.lParam; + } + case CResource::eTable: + { + HTREEITEM hParent = m_pTree->GetParentItem(m_pTree->GetParentItem(hItem)); + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hParent; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + if ( !item.lParam ) return NULL; + return (CResourceServer*) item.lParam; + } + } + + return NULL; + +} +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) +{ + HTREEITEM hItem; + hItem = m_pTree->GetSelectedItem(); + *pResult = 0; + if ( !hItem ) return; + + TV_ITEM item; + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hItem; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + + if ( ! item.lParam ) return; + + if ( item.cChildren ) return; //if has got children expand only + + CWaitCursor x; + + CResource* pResource = (CResource*) item.lParam; + + MYSQL mysql; + MYSQL_RES *result; + + switch (pResource->GetType()) + { + case CResource::eProcesslist: + { + XStatus x ( "Connecting to server %s on host %s..." + , (LPCTSTR) pResource->GetDisplayName() + , (LPCTSTR) pResource->GetHostName() + ); + mysql_init(&mysql); + if (!mysql_real_connect(&mysql,pResource->GetHostName(), pResource->GetUserName(),pResource->GetPassword(),0,pResource->GetPortNumber(), NullS,0)) + { + PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES); + return; + } + if (!(result=mysql_list_processes(&mysql))) + { + return; + } + ProcessResultSet ( hItem, result, pResource ); + mysql_free_result(result); + mysql_close(&mysql); + break; + } + case CResource::eServer: + { + MainFrame->StatusMsg ( "Connecting to server %s on host %s..." + , (LPCTSTR) pResource->GetDisplayName() + , (LPCTSTR) pResource->GetHostName() + ); + mysql_init(&mysql); + if (!mysql_real_connect(&mysql,pResource->GetHostName(), pResource->GetUserName(),pResource->GetPassword(),0,pResource->GetPortNumber(), NullS,0)) + { + PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES); + MainFrame->StatusMsg ( "Error: Connecting to server %s... (%s)" + , (LPCTSTR) pResource->GetDisplayName() + , mysql_error(&mysql) + ); + return; + } + if (!(result=mysql_list_dbs(&mysql,0))) + { + } + ProcessResultSet ( hItem, result, pResource ); + mysql_free_result(result); + mysql_close(&mysql); + MainFrame->StatusMsg ( " " ); + break; + } + case CResource::eDatabase: + { + CResourceServer* pServer = GetServerResource(hItem); + if (!pServer) return; + MainFrame->StatusMsg ( "Connecting to server %s on host %s..." + , (LPCTSTR) pServer->GetDisplayName() + , (LPCTSTR) pServer->GetHostName() + ); + mysql_init(&mysql); + if (!mysql_real_connect(&mysql,pServer->GetHostName(), pServer->GetUserName(),pServer->GetPassword(),0,pServer->GetPortNumber(), NullS,0)) + { + PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES); + MainFrame->StatusMsg ( "Error: Connecting to server %s... (%s)" + , (LPCTSTR) pServer->GetDisplayName() + , mysql_error(&mysql) + ); + return; + } + CResourceDatabase* pRes = (CResourceDatabase*) pResource; + CString strDB = pResource->GetDisplayName(); + strDB.TrimRight(); + if (mysql_select_db(&mysql,strDB)) + { + MainFrame->StatusMsg ( "Error: Selecting database %s... (%s)" + , (LPCTSTR) strDB + , mysql_error(&mysql) + ); + return; + } + if (!(result=mysql_list_tables(&mysql,0))) + { + } + ProcessResultSet ( hItem, result, pRes ); + mysql_free_result(result); + mysql_close(&mysql); + MainFrame->StatusMsg ( " " ); + break; + } + case CResource::eTable: + { + CResourceServer* pServer = GetServerResource(hItem); + if (!pServer) return; + MainFrame->StatusMsg ( "Connecting to server %s on host %s..." + , (LPCTSTR) pServer->GetDisplayName() + , (LPCTSTR) pServer->GetHostName() + ); + mysql_init(&mysql); + if (!mysql_real_connect(&mysql,pServer->GetHostName(), pServer->GetUserName(),pServer->GetPassword(),0,pServer->GetPortNumber(), NullS,0)) + { + PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES); + MainFrame->StatusMsg ( "Error: Connecting to server %s... (%s)" + , (LPCTSTR) pServer->GetDisplayName() + , mysql_error(&mysql) + ); + return; + } + HTREEITEM hParent = m_pTree->GetParentItem(hItem); + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hParent; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + if ( item.lParam ) + { + CResourceDatabase* pResDatabase = (CResourceDatabase*) item.lParam; + CResourceTable* pRes = (CResourceTable*) pResource; + CString strDB = pResDatabase->GetDisplayName(); + CString strTable = pResource->GetDisplayName(); + strDB.TrimRight(); + strTable.TrimRight(); + if (mysql_select_db(&mysql,strDB)) + { + return; + } + CString str; str.Format("show fields from %s",(LPCTSTR)strTable); + if ( mysql_query(&mysql,str)==0 ) + { + MYSQL_RES *result; + if ((result=mysql_store_result(&mysql))) + { + ProcessResultSet ( hItem, result, pRes ); + mysql_free_result(result); + } + } + } + mysql_close(&mysql); + break; + } + } + +// InsertNetResources( (LPNETRESOURCE)pTvItem->lParam, +// &m_TreeCtrl, +// hItem, +// &pTvItem->cChildren ); +// pTvItem->mask = TVIF_CHILDREN; +// m_TreeCtrl.SetItem( pTvItem ); + +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnRefresh() +{ + HTREEITEM hItem = NULL; + CResource* pResource = GetSelectedResource(&hItem); + if (pResource&&hItem) + { + switch (pResource->GetType()) + { + case CResource::eTable: + { + + TV_ITEM item; + MYSQL mysql; +// MYSQL_RES *result; + + HTREEITEM hParent = m_pTree->GetParentItem(hItem); + + HTREEITEM hChild = m_pTree->GetChildItem(hItem); + while (hChild) + { + HTREEITEM h = m_pTree->GetNextSiblingItem(hChild); + BOOL b = m_pTree->DeleteItem(hChild); + hChild = h; + } + mysql_init(&mysql); + if (!mysql_real_connect(&mysql,pResource->GetHostName(), pResource->GetUserName(),pResource->GetPassword(),0,pResource->GetPortNumber(), NullS,0)) + { + return; + } + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hParent; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); + if ( item.lParam ) + { + CResourceDatabase* pResDatabase = (CResourceDatabase*) item.lParam; + CResourceTable* pRes = (CResourceTable*) pResource; + CString strDB = pResDatabase->GetDisplayName(); + CString strTable = pResource->GetDisplayName(); + strDB.TrimRight(); + strTable.TrimRight(); + if (mysql_select_db(&mysql,strDB)) + { + return; + } + CString str; str.Format("show fields from %s",(LPCTSTR)strTable); + if ( mysql_query(&mysql,str)==0 ) + { + MYSQL_RES *result; + if ((result=mysql_store_result(&mysql))) + { + ProcessResultSet ( hItem, result, pRes ); + mysql_free_result(result); + } + } + } + mysql_close(&mysql); + break; + } + } + } +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnRegisterServer() +{ + CRegisterServer dlg; + if (dlg.DoModal()!=IDOK) return; + AddResource ( + TVI_ROOT, + new CResourceServer ( dlg.m_strServer, dlg.m_strHost, dlg.m_strUser, dlg.m_strPassword, dlg.m_strPort ) + ); +} + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnServerProperties() +{ + HTREEITEM hItem; + CResource* pRes = GetSelectedResource(&hItem); + if (!pRes) return; + if (pRes->GetType()!=CResource::eServer) return; + CResourceServer* pResource = (CResourceServer*)pRes; + CRegisterServer dlg; + dlg.m_strHost = pResource->GetHostName(); + dlg.m_strUser = pResource->GetUserName(); + dlg.m_strPassword = pResource->GetPassword(); + dlg.m_strPort = pResource->GetPortName(); + if (dlg.DoModal()!=IDOK) return; + pResource->m_strHost = dlg.m_strHost ; + pResource->m_strUser = dlg.m_strUser ; + pResource->m_strPassword = dlg.m_strPassword; + pResource->m_strPort = dlg.m_strPort ; + TV_ITEM item; + memset( &item, 0, sizeof(TV_ITEM) ); + item.hItem = hItem; + item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; + m_pTree->GetItem( &item ); +} + + +///////////////////////////////////////////////////////////////////////////// + +void CMySqlManagerView::OnSqlToolQuery() +{ + + HTREEITEM hItem; + + CResource* pResource = GetSelectedResource(&hItem); + + if (!pResource) return; + + CResourceServer* pServer = GetServerResource(hItem); + if (!pServer) return; /* Avoid bug when selecting field */ + + m_pTool = new CToolSql ( AfxGetMainWnd(), pServer, pResource ); + + if ( ! m_pTool->Create(IDD_TOOL_SQL,this) ) + { + delete m_pTool; + m_pTool = 0; + PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES); + } + else + { + m_pTool->ShowWindow(SW_SHOW); + } + +} + + +///////////////////////////////////////////////////////////////////////////// + +BOOL CMySqlManagerView::PreTranslateMessage(MSG* pMsg) +{ + if (m_pTool && m_pTool->PreTranslateMessage(pMsg)) + return TRUE; + return CTreeView::PreTranslateMessage(pMsg); +} + +void CMySqlManagerView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) +{ + + POINT pt; + + GetCursorPos ( & pt ); + + CMenu menu; + + menu.CreatePopupMenu (); + + menu.AppendMenu ( MF_ENABLED , IDM_SQL_TOOL_QUERY, "SQL Query" ); + menu.AppendMenu ( MF_ENABLED , IDM_REFRESH, "Refresh active item(s)" ); + menu.AppendMenu ( MF_ENABLED , IDM_TOOLS_REGISTER_SERVER, "Register server" ); + menu.AppendMenu ( MF_ENABLED , IDM_TOOLS_SERVER_PROPERTIES, "Properties" ); + + menu.TrackPopupMenu ( TPM_LEFTALIGN | TPM_RIGHTBUTTON , pt.x, pt.y, CWnd::GetParent(), NULL ); + + *pResult = 0; + +} diff --git a/VC++Files/mysqlmanager/mysqlmanagerview.h b/VC++Files/mysqlmanager/mysqlmanagerview.h new file mode 100644 index 00000000000..97f5a2596d1 --- /dev/null +++ b/VC++Files/mysqlmanager/mysqlmanagerview.h @@ -0,0 +1,89 @@ +// MySqlManagerView.h : interface of the CMySqlManagerView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MYSQLMANAGERVIEW_H__826CB2F4_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_MYSQLMANAGERVIEW_H__826CB2F4_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include <afxcview.h> +#include "cresource.h" + +class CToolSql; + +class CMySqlManagerView : public CTreeView +{ +protected: // create from serialization only + CMySqlManagerView(); + DECLARE_DYNCREATE(CMySqlManagerView) + +// Attributes +public: + CMySqlManagerDoc* GetDocument(); + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMySqlManagerView) + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual void OnInitialUpdate(); + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); + virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); + //}}AFX_VIRTUAL + +// Implementation + + CResource* GetSelectedResource(HTREEITEM* phItemRet=NULL); + CResourceServer* GetServerResource(HTREEITEM hItem); + + HTREEITEM AddResource ( HTREEITEM hParent, CResource* pRes, HTREEITEM hLastItem = TVI_FIRST ) ; + void ProcessResultSet ( HTREEITEM hItem, LPVOID result, CResource* pResource ); + +public: + virtual ~CMySqlManagerView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + + CTreeCtrl* m_pTree; + CImageList* m_pImages; + CBitmap* m_pbmBmp; + CToolSql* m_pTool; + +// Generated message map functions +protected: + //{{AFX_MSG(CMySqlManagerView) + afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnSqlToolQuery(); + afx_msg void OnRefresh(); + afx_msg void OnRegisterServer(); + afx_msg void OnServerProperties(); + afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in MySqlManagerView.cpp +inline CMySqlManagerDoc* CMySqlManagerView::GetDocument() + { return (CMySqlManagerDoc*)m_pDocument; } +#endif + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MYSQLMANAGERVIEW_H__826CB2F4_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/registerserver.cpp b/VC++Files/mysqlmanager/registerserver.cpp new file mode 100644 index 00000000000..a0e9dcca3df --- /dev/null +++ b/VC++Files/mysqlmanager/registerserver.cpp @@ -0,0 +1,51 @@ +// RegisterServer.cpp : implementation file +// + +#include "stdafx.h" +#include "mysqlmanager.h" +#include "RegisterServer.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CRegisterServer dialog + + +CRegisterServer::CRegisterServer(CWnd* pParent /*=NULL*/) + : CDialog(CRegisterServer::IDD, pParent) + , m_strServer("servername") + , m_strHost("localhost") + , m_strUser("root") + , m_strPassword("") +{ + //{{AFX_DATA_INIT(CRegisterServer) + m_strPort = _T("3306"); + //}}AFX_DATA_INIT +} + + +void CRegisterServer::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CRegisterServer) + DDX_CBString(pDX, ID_SERVER_CB, m_strServer); + DDX_CBString(pDX, ID_HOST_CB, m_strHost); + DDX_Text(pDX, ID_USER, m_strUser); + DDX_Text(pDX, ID_PASSWORD, m_strPassword); + DDX_CBString(pDX, ID_PORT_CB, m_strPort); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CRegisterServer, CDialog) + //{{AFX_MSG_MAP(CRegisterServer) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CRegisterServer message handlers diff --git a/VC++Files/mysqlmanager/registerserver.h b/VC++Files/mysqlmanager/registerserver.h new file mode 100644 index 00000000000..f4ac2356b2c --- /dev/null +++ b/VC++Files/mysqlmanager/registerserver.h @@ -0,0 +1,50 @@ +#if !defined(AFX_REGISTERSERVER_H__826CB2FF_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_REGISTERSERVER_H__826CB2FF_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// RegisterServer.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CRegisterServer dialog + +class CRegisterServer : public CDialog +{ +// Construction +public: + CRegisterServer(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CRegisterServer) + enum { IDD = IDD_REGISTER_SERVER }; + CString m_strServer; + CString m_strHost; + CString m_strUser; + CString m_strPassword; + CString m_strPort; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CRegisterServer) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CRegisterServer) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_REGISTERSERVER_H__826CB2FF_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/toolsqlquery.cpp b/VC++Files/mysqlmanager/toolsqlquery.cpp new file mode 100644 index 00000000000..1f246f47786 --- /dev/null +++ b/VC++Files/mysqlmanager/toolsqlquery.cpp @@ -0,0 +1,110 @@ +// ToolSqlQuery.cpp : implementation file +// + +#include "stdafx.h" +#include "MySqlManager.h" +#include "ToolSqlQuery.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// + +CToolSqlQuery::CToolSqlQuery(CWnd* pParent /*=NULL*/) + : CDialog(CToolSqlQuery::IDD, pParent) +{ + //{{AFX_DATA_INIT(CToolSqlQuery) + m_edit = _T(""); + //}}AFX_DATA_INIT +} + + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CToolSqlQuery) + DDX_Control(pDX, IDC_EDIT, m_ctl_edit); + DDX_Text(pDX, IDC_EDIT, m_edit); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CToolSqlQuery, CDialog) + //{{AFX_MSG_MAP(CToolSqlQuery) + ON_WM_SIZE() + ON_WM_CLOSE() + ON_COMMAND(IDM_QUERY_EXEC, OnQueryPb) + ON_COMMAND(IDM_QUERY_DATABASES, OnQueryDatabases) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::SetFont(CFont* pFont, BOOL bRedraw) +{ + m_ctl_edit.SetFont(pFont,bRedraw); + m_ctl_edit.Invalidate(); + m_ctl_edit.UpdateWindow(); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::OnSize(UINT nType, int cx, int cy) +{ + CDialog::OnSize(nType, cx, cy); + if (IsWindow(m_ctl_edit.GetSafeHwnd())) + m_ctl_edit.SetWindowPos(NULL,20,24,cx-40,cy-48,SWP_NOZORDER | SWP_NOMOVE); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::OnCancel() +{ +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::OnClose() +{ +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::OnQueryPb() +{ + GetParent()->GetParent()->PostMessage(WM_COMMAND,IDM_QUERY_EXEC); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlQuery::OnQueryDatabases() +{ + GetParent()->GetParent()->PostMessage(WM_COMMAND,IDM_QUERY_DATABASES); +} +///////////////////////////////////////////////////////////////////////////// + +BOOL CToolSqlQuery::PreTranslateMessage(MSG* pMsg) +{ + if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) + { + if (::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) + return TRUE; + } + return CDialog::PreTranslateMessage(pMsg); +} + +///////////////////////////////////////////////////////////////////////////// + +BOOL CToolSqlQuery::OnInitDialog() +{ + + CDialog::OnInitDialog(); + m_hAccel = ::LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE ( IDR_MAINFRAME )); + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/VC++Files/mysqlmanager/toolsqlquery.h b/VC++Files/mysqlmanager/toolsqlquery.h new file mode 100644 index 00000000000..c5d318c161b --- /dev/null +++ b/VC++Files/mysqlmanager/toolsqlquery.h @@ -0,0 +1,60 @@ +#if !defined(AFX_TOOLSQLQUERY_H__826CB2FD_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_TOOLSQLQUERY_H__826CB2FD_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// ToolSqlQuery.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CToolSqlQuery dialog + +class CToolSqlQuery : public CDialog +{ +// Construction +public: + CToolSqlQuery(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CToolSqlQuery) + enum { IDD = IDD_TOOL_SQL_QUERY }; + CEdit m_ctl_edit; + CString m_edit; + //}}AFX_DATA + + HACCEL m_hAccel; + + void SetFont(CFont* pFont, BOOL bRedraw = TRUE); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CToolSqlQuery) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation + +protected: + + // Generated message map functions + //{{AFX_MSG(CToolSqlQuery) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnCancel(); + afx_msg void OnClose(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + afx_msg void OnQueryPb(); + afx_msg void OnQueryDatabases(); + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TOOLSQLQUERY_H__826CB2FD_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/toolsqlresults.cpp b/VC++Files/mysqlmanager/toolsqlresults.cpp new file mode 100644 index 00000000000..b6cfcded18b --- /dev/null +++ b/VC++Files/mysqlmanager/toolsqlresults.cpp @@ -0,0 +1,73 @@ +// ToolSqlResults.cpp : implementation file +// + +#include "stdafx.h" +#include "MySqlManager.h" +#include "ToolSqlResults.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// + +CToolSqlResults::CToolSqlResults(CWnd* pParent /*=NULL*/) + : CDialog(CToolSqlResults::IDD, pParent) +{ + //{{AFX_DATA_INIT(CToolSqlResults) + m_edit = _T(""); + //}}AFX_DATA_INIT +} + + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlResults::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CToolSqlResults) + DDX_Control(pDX, IDC_EDIT, m_ctl_edit); + DDX_Text(pDX, IDC_EDIT, m_edit); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CToolSqlResults, CDialog) + //{{AFX_MSG_MAP(CToolSqlResults) + ON_WM_SIZE() + ON_WM_CLOSE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlResults::SetFont(CFont* pFont, BOOL bRedraw) +{ + m_ctl_edit.SetFont(pFont,bRedraw); + m_ctl_edit.Invalidate(); + m_ctl_edit.UpdateWindow(); +} + + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlResults::OnSize(UINT nType, int cx, int cy) +{ + CDialog::OnSize(nType, cx, cy); + if (IsWindow(m_ctl_edit.GetSafeHwnd())) + m_ctl_edit.SetWindowPos(NULL,20,24,cx-40,cy-48,SWP_NOZORDER | SWP_NOMOVE); +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlResults::OnCancel() +{ +} + +///////////////////////////////////////////////////////////////////////////// + +void CToolSqlResults::OnClose() +{ +} diff --git a/VC++Files/mysqlmanager/toolsqlresults.h b/VC++Files/mysqlmanager/toolsqlresults.h new file mode 100644 index 00000000000..c4de651cb81 --- /dev/null +++ b/VC++Files/mysqlmanager/toolsqlresults.h @@ -0,0 +1,53 @@ +#if !defined(AFX_TOOLSQLRESULTS_H__826CB2FE_8B6D_11D1_AEC1_00600806E071__INCLUDED_) +#define AFX_TOOLSQLRESULTS_H__826CB2FE_8B6D_11D1_AEC1_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// ToolSqlResults.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CToolSqlResults dialog + +class CToolSqlResults : public CDialog +{ +// Construction +public: + CToolSqlResults(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CToolSqlResults) + enum { IDD = IDD_TOOL_SQL_RESULTS }; + CEdit m_ctl_edit; + CString m_edit; + //}}AFX_DATA + + void SetFont(CFont* pFont, BOOL bRedraw = TRUE); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CToolSqlResults) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation + +protected: + + // Generated message map functions + //{{AFX_MSG(CToolSqlResults) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnCancel(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TOOLSQLRESULTS_H__826CB2FE_8B6D_11D1_AEC1_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlmanager/toolsqlstatus.cpp b/VC++Files/mysqlmanager/toolsqlstatus.cpp new file mode 100644 index 00000000000..81605480783 --- /dev/null +++ b/VC++Files/mysqlmanager/toolsqlstatus.cpp @@ -0,0 +1,50 @@ +// ToolSqlStatus.cpp : implementation file +// + +#include "stdafx.h" +#include "mysqlmanager.h" +#include "ToolSqlStatus.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CToolSqlStatus dialog + + +CToolSqlStatus::CToolSqlStatus(CWnd* pParent /*=NULL*/) + : CDialog(CToolSqlStatus::IDD, pParent) +{ + //{{AFX_DATA_INIT(CToolSqlStatus) + m_edit = _T(""); + //}}AFX_DATA_INIT +} + + +void CToolSqlStatus::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CToolSqlStatus) + DDX_Control(pDX, IDC_EDIT, m_ctl_edit); + DDX_Text(pDX, IDC_EDIT, m_edit); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CToolSqlStatus, CDialog) + //{{AFX_MSG_MAP(CToolSqlStatus) + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CToolSqlStatus message handlers + +void CToolSqlStatus::OnDestroy() +{ + CDialog::OnDestroy(); + +} diff --git a/VC++Files/mysqlmanager/toolsqlstatus.h b/VC++Files/mysqlmanager/toolsqlstatus.h new file mode 100644 index 00000000000..5e4883b0b30 --- /dev/null +++ b/VC++Files/mysqlmanager/toolsqlstatus.h @@ -0,0 +1,47 @@ +#if !defined(AFX_TOOLSQLSTATUS_H__40C861B4_9E5A_11D1_AED0_00600806E071__INCLUDED_) +#define AFX_TOOLSQLSTATUS_H__40C861B4_9E5A_11D1_AED0_00600806E071__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// ToolSqlStatus.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CToolSqlStatus dialog + +class CToolSqlStatus : public CDialog +{ +// Construction +public: + CToolSqlStatus(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CToolSqlStatus) + enum { IDD = IDD_TOOL_SQL_STATUS }; + CEdit m_ctl_edit; + CString m_edit; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CToolSqlStatus) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CToolSqlStatus) + afx_msg void OnDestroy(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TOOLSQLSTATUS_H__40C861B4_9E5A_11D1_AED0_00600806E071__INCLUDED_) diff --git a/VC++Files/mysqlserver/mysqlserver.dsp b/VC++Files/mysqlserver/mysqlserver.dsp index dda50cd5538..7991131c3a8 100644 --- a/VC++Files/mysqlserver/mysqlserver.dsp +++ b/VC++Files/mysqlserver/mysqlserver.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "MYSQL_SERVER" /D "__WIN__" /YX /FD /c # ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
BSC32=bscmake.exe
@@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c # ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
BSC32=bscmake.exe
@@ -80,5 +80,13 @@ LIB32=link.exe -lib # Name "mysqlserver - Win32 Release"
# Name "mysqlserver - Win32 Debug"
+# Begin Source File + +SOURCE=..\sql\set_var.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_load.cpp +# End Source File # End Target
# End Project
diff --git a/VC++Files/mysqlshutdown/MYSQL.ICO b/VC++Files/mysqlshutdown/MYSQL.ICO Binary files differnew file mode 100644 index 00000000000..1fe0b7115bb --- /dev/null +++ b/VC++Files/mysqlshutdown/MYSQL.ICO diff --git a/VC++Files/mysqlshutdown/mysqlshutdown.rc b/VC++Files/mysqlshutdown/mysqlshutdown.rc new file mode 100644 index 00000000000..01babed1c98 --- /dev/null +++ b/VC++Files/mysqlshutdown/mysqlshutdown.rc @@ -0,0 +1,2 @@ +MySql ICON DISCARDABLE "MYSQL.ICO"
+
diff --git a/VC++Files/mysys/mysys.dsp b/VC++Files/mysys/mysys.dsp index 42213b16cf5..c4c21d9a6db 100644 --- a/VC++Files/mysys/mysys.dsp +++ b/VC++Files/mysys/mysys.dsp @@ -26,7 +26,7 @@ CFG=mysys - Win32 Debug # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" -CPP=xicl6.exe +CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "mysys - Win32 Release" @@ -42,14 +42,14 @@ RSC=rc.exe # PROP Intermediate_Dir "release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LIB32=xilink6.exe -lib +LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\lib_release\mysys.lib" @@ -66,14 +66,14 @@ LIB32=xilink6.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c # SUBTRACT CPP /Fr # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LIB32=xilink6.exe -lib +LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\lib_debug\mysys.lib" @@ -86,8 +86,8 @@ LIB32=xilink6.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "max" -# PROP Intermediate_Dir "max" +# PROP Output_Dir "mysys___Win32_Max" +# PROP Intermediate_Dir "mysys___Win32_Max" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c # SUBTRACT BASE CPP /YX @@ -98,7 +98,7 @@ LIB32=xilink6.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LIB32=xilink6.exe -lib +LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"..\lib_release\mysys.lib" # ADD LIB32 /nologo /out:"..\lib_release\mysys-max.lib" @@ -283,19 +283,6 @@ SOURCE=.\my_clock.c # Begin Source File SOURCE=.\my_compress.c - -!IF "$(CFG)" == "mysys - Win32 Release" - -# ADD CPP /I "../zlib" - -!ELSEIF "$(CFG)" == "mysys - Win32 Debug" - -# ADD CPP /I "../zlib" - -!ELSEIF "$(CFG)" == "mysys - Win32 Max" - -!ENDIF - # End Source File # Begin Source File diff --git a/VC++Files/pack_isam/pack_isam.dsp b/VC++Files/pack_isam/pack_isam.dsp index 20c832c96d0..1b377c0b68e 100644 --- a/VC++Files/pack_isam/pack_isam.dsp +++ b/VC++Files/pack_isam/pack_isam.dsp @@ -88,7 +88,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\pack_isam.c +SOURCE=..\isam\pack_isam.c # End Source File # End Group # Begin Group "Header Files" diff --git a/VC++Files/prepare b/VC++Files/prepare new file mode 100755 index 00000000000..e0dff9e04c0 --- /dev/null +++ b/VC++Files/prepare @@ -0,0 +1,104 @@ +#!/bin/sh + +if [ -f prepare_done ] +then + exit +fi + +cd .. +SRCDIR=`pwd` + +( +find $SRCDIR -name *.dsw -and -not -path \*SCCS\* -print +find $SRCDIR -name *.dsp -and -not -path \*SCCS\* -print +)|( +while read v +do + sed 's/$'"/`echo -e \\\r`/" $v > $v.tmp + rm $v + mv $v.tmp $v +done +) + +ln -s $SRCDIR/include $SRCDIR/VC++Files/include + +link_dir_files() +{ + for arg do + + cd $SRCDIR/$arg/ + ( + ls -A1|grep \\.[ch]$ + ls -A1|grep \\.ih$ + ls -A1|grep \\.asm$ + )|( + while read v + do + ln -s $SRCDIR/$arg/$v $SRCDIR/VC++Files/$arg/$v + done + ) + + cd $SRCDIR/$arg/ + (ls -A1|grep \\.cc$|sed 's/.cc$//g')|( + while read v + do + ln -s $SRCDIR/$arg/$v.cc $SRCDIR/VC++Files/$arg/$v.cpp + done + ) + + done +} + +link_dir_dirs() +{ + for arg do + + cd $SRCDIR/$arg/ + ( + ls -l |grep "^d"|awk '{print($9)}' - + )|( + while read v + do + ln -s $SRCDIR/$arg/$v $SRCDIR/VC++Files/$arg/ + done + ) + + done +} + +link_dir_files 'heap' +link_dir_files 'isam' +link_dir_files 'merge' +link_dir_files 'mysys' +link_dir_files 'zlib' +link_dir_files 'regex' +link_dir_files 'strings' +link_dir_files 'dbug' +link_dir_files 'vio' +link_dir_files 'client' +link_dir_files 'libmysql' +link_dir_files 'extra' +link_dir_files 'myisam' +link_dir_files 'myisammrg' +link_dir_files 'innobase' +link_dir_files 'bdb' +link_dir_files 'sql' +link_dir_files 'bdb/build_win32' +link_dir_files 'libmysqld' + +link_dir_dirs 'bdb' +link_dir_dirs 'innobase' + +ln -s $SRCDIR/myisam/myisampack.c $SRCDIR/VC++Files/myisampack/ +ln -s $SRCDIR/client/mysqlbinlog.cc $SRCDIR/VC++Files/mysqlbinlog/mysqlbinlog.cpp +ln -s $SRCDIR/isam/pack_isam.c $SRCDIR/VC++Files/pack_isam/pack_isam.c + +echo '/* added for win : */' >> $SRCDIR/config.h +echo '#undef HAVE_SCHED_H' >> $SRCDIR/config.h +echo '#USE_QUERY_CACHE_INTEGRITY_CHECK 1' >> $SRCDIR/config.h + +echo '/* added for win : */' >> $SRCDIR/innobase/ib_config.h +echo '#undef HAVE_SCHED_H' >> $SRCDIR/innobase/ib_config.h + +cd $SRCDIR/VC++Files +echo '1' > prepare_done
\ No newline at end of file diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index 093cfb0d925..ac5550ad2b2 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -28,7 +28,7 @@ CFG=mysqld - Win32 Release # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" -CPP=xicl6.exe +CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "mysqld - Win32 Release" @@ -45,14 +45,14 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x410 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-opt.exe" # SUBTRACT LINK32 /debug @@ -71,14 +71,14 @@ LINK32=xilink6.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /Fr /YX # ADD BASE RSC /l 0x410 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\isam.lib ..\lib_debug\merge.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld.exe" /pdbtype:sept @@ -98,14 +98,14 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /D "DBUG_OFF" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x410 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\dbug.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe" # SUBTRACT LINK32 /pdb:none /debug @@ -126,14 +126,14 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe" # SUBTRACT BASE LINK32 /pdb:none /debug # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-max-nt.exe" @@ -155,14 +155,14 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../client_release/mysqld-opt.exe" # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-max.exe" # SUBTRACT LINK32 /debug @@ -218,6 +218,10 @@ SOURCE=.\derror.cpp # End Source File # Begin Source File +SOURCE=..\client\errmsg.c +# End Source File +# Begin Source File + SOURCE=.\field.cpp !IF "$(CFG)" == "mysqld - Win32 Release" @@ -638,10 +642,6 @@ SOURCE=.\mini_client.cpp # End Source File # Begin Source File -SOURCE=.\mini_client_errors.c -# End Source File -# Begin Source File - SOURCE=.\mysqld.cpp !IF "$(CFG)" == "mysqld - Win32 Release" @@ -1167,6 +1167,10 @@ SOURCE=.\sql_test.cpp # End Source File # Begin Source File +SOURCE=.\sql_udf.cpp +# End Source File +# Begin Source File + SOURCE=.\sql_union.cpp # End Source File # Begin Source File diff --git a/VC++Files/test1/mysql_thr.c b/VC++Files/test1/mysql_thr.c new file mode 100644 index 00000000000..fac5c37a9af --- /dev/null +++ b/VC++Files/test1/mysql_thr.c @@ -0,0 +1,255 @@ +/* Testing of connecting to MySQL from X threads */
+
+#include <windows.h>
+#include <process.h>
+#include <stdio.h>
+#include <mysql.h>
+#include <errno.h>
+
+#define TEST_COUNT 20
+
+/*****************************************************************************
+** The following is to emulate the posix thread interface
+*****************************************************************************/
+
+typedef HANDLE pthread_t;
+typedef struct thread_attr {
+ DWORD dwStackSize ;
+ DWORD dwCreatingFlag ;
+ int priority ;
+} pthread_attr_t ;
+
+typedef struct { int dummy; } pthread_condattr_t;
+typedef unsigned int uint;
+
+typedef struct {
+ uint waiting;
+ HANDLE semaphore;
+} pthread_cond_t;
+
+typedef CRITICAL_SECTION pthread_mutex_t;
+
+#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
+#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
+#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
+#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
+#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
+typedef unsigned (__cdecl *pthread_handler)(void *);
+#define pthread_self() GetCurrentThread()
+
+static unsigned int thread_count;
+static pthread_cond_t COND_thread_count;
+static pthread_mutex_t LOCK_thread_count;
+
+pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
+ THR_LOCK_lock,THR_LOCK_isam;
+
+/*
+** We have tried to use '_beginthreadex' instead of '_beginthread' here
+** but in this case the program leaks about 512 characters for each
+** created thread !
+*/
+
+int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
+ pthread_handler func, void *param)
+{
+ HANDLE hThread;
+
+ hThread=(HANDLE)_beginthread(func,
+ attr->dwStackSize ? attr->dwStackSize :
+ 65535,param);
+ if ((long) hThread == -1L)
+ {
+ return(errno ? errno : -1);
+ }
+ *thread_id=hThread;
+ return(0);
+}
+
+void pthread_exit(unsigned A)
+{
+ _endthread();
+}
+
+/*
+** The following simple implementation of conds works as long as
+** only one thread uses pthread_cond_wait at a time.
+** This is coded very carefully to work with thr_lock.
+*/
+
+/*****************************************************************************
+** The following is a simple implementation of posix conditions
+*****************************************************************************/
+
+int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
+{
+ cond->waiting=0;
+ cond->semaphore=CreateSemaphore(NULL,0,0x7FFFFFFF,(char*) 0);
+ if (!cond->semaphore)
+ return ENOMEM;
+ return 0;
+}
+
+int pthread_cond_destroy(pthread_cond_t *cond)
+{
+ return CloseHandle(cond->semaphore) ? 0 : EINVAL;
+}
+
+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+{
+ InterlockedIncrement(&cond->waiting);
+ LeaveCriticalSection(mutex);
+ WaitForSingleObject(cond->semaphore,INFINITE);
+ InterlockedDecrement(&cond->waiting);
+ EnterCriticalSection(mutex);
+ return 0 ;
+}
+
+int pthread_cond_signal(pthread_cond_t *cond)
+{
+ long prev_count;
+ if (cond->waiting)
+ ReleaseSemaphore(cond->semaphore,1,&prev_count);
+ return 0;
+}
+
+int pthread_attr_init(pthread_attr_t *connect_att)
+{
+ connect_att->dwStackSize = 0;
+ connect_att->dwCreatingFlag = 0;
+ connect_att->priority = 0;
+ return 0;
+}
+
+int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
+{
+ connect_att->dwStackSize=stack;
+ return 0;
+}
+
+int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
+{
+ connect_att->priority=priority;
+ return 0;
+}
+
+int pthread_attr_destroy(pthread_attr_t *connect_att)
+{
+ return 0;
+}
+
+/* from my_pthread.c */
+
+#ifndef REMOVE_BUG
+
+__declspec(thread) int THR_KEY_my_errno;
+
+int _my_errno(void)
+{
+ return THR_KEY_my_errno;
+}
+#endif
+
+
+/*****************************************************************************
+** The test program
+*****************************************************************************/
+
+pthread_handler_decl(test_thread,arg)
+{
+ MYSQL mysql;
+ MYSQL_RES *res;
+
+ mysql_init(&mysql);
+ if (!mysql_real_connect(&mysql,NULL,0,0,NULL,0,NULL,0))
+ {
+ fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql));
+ perror("");
+ goto end;
+ }
+ if (mysql_query(&mysql,"select 1") < 0)
+ {
+ fprintf(stderr,"Query failed (%s)\n",mysql_error(&mysql));
+ goto end;
+ }
+ if (!(res=mysql_store_result(&mysql)))
+ {
+ fprintf(stderr,"Couldn't get result from query failed\n",
+ mysql_error(&mysql));
+ goto end;
+ }
+ mysql_free_result(res);
+
+end:
+
+ Sleep(1000); /* Win32 sleep */
+ mysql_close(&mysql);
+
+ pthread_mutex_lock(&LOCK_thread_count);
+ thread_count--;
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
+ pthread_mutex_unlock(&LOCK_thread_count);
+ pthread_exit(0);
+ return 0;
+}
+
+int main(int argc,char **argv)
+{
+ pthread_t tid;
+ pthread_attr_t thr_attr;
+ int i,error;
+
+ if ((error=pthread_cond_init(&COND_thread_count,NULL)))
+ {
+ fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+ pthread_mutex_init(&LOCK_thread_count,NULL);
+ if ((error=pthread_attr_init(&thr_attr)))
+ {
+ fprintf(stderr,"Got error: %d from pthread_attr_init (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+ if ((error=pthread_attr_setstacksize(&thr_attr,65536L)))
+ {
+ fprintf(stderr,"Got error: %d from pthread_attr_setstacksize (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+
+ printf("Init ok. Creating %d threads\n",TEST_COUNT);
+
+ for (i=1 ; i <= TEST_COUNT ; i++)
+ {
+ int *param= &i;
+ if ((error=pthread_mutex_lock(&LOCK_thread_count)))
+ {
+ fprintf(stderr,"\nGot error: %d from pthread_mutex_lock (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+ if ((error=pthread_create(&tid,&thr_attr,test_thread,(void*) param)))
+ {
+ fprintf(stderr,"\nGot error: %d from pthread_create (errno: %d)\n",
+ error,errno);
+ pthread_mutex_unlock(&LOCK_thread_count);
+ exit(1);
+ }
+ thread_count++;
+ pthread_mutex_unlock(&LOCK_thread_count);
+ }
+
+ if ((error=pthread_mutex_lock(&LOCK_thread_count)))
+ fprintf(stderr,"\nGot error: %d from pthread_mutex_lock\n",error);
+ while (thread_count)
+ {
+ if ((error=pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
+ fprintf(stderr,"\nGot error: %d from pthread_cond_wait\n",error);
+ }
+ pthread_mutex_unlock(&LOCK_thread_count);
+ pthread_attr_destroy(&thr_attr);
+ printf("\nend\n");
+ return 0;
+}
diff --git a/VC++Files/thr_test/thr_test.c b/VC++Files/thr_test/thr_test.c new file mode 100644 index 00000000000..d66b24bc0fc --- /dev/null +++ b/VC++Files/thr_test/thr_test.c @@ -0,0 +1,250 @@ +/* Testing of thread creation to find memory allocation bug
+** This is coded to use as few extern functions as possible!
+**
+** The program must be compiled to be multithreaded !
+**
+** The problem is that when this program is run it will allocate more and more
+** memory, so there is a memory leak in the thread handling. The problem is how
+** to avoid is !
+**
+** It looks like the bug is that the std library doesn't free thread
+** specific variables if one uses a thread variable.
+** If one compiles this program with -DREMOVE_BUG
+** there is no memory leaks anymore!
+**
+** This program is tested with Microsofts VC++ 5.0, but BC5.2 is also
+** reported to have this bug.
+*/
+
+#include <windows.h>
+#include <process.h>
+#include <stdio.h>
+
+#define TEST_COUNT 100000
+
+/*****************************************************************************
+** The following is to emulate the posix thread interface
+*****************************************************************************/
+
+typedef HANDLE pthread_t;
+typedef struct thread_attr {
+ DWORD dwStackSize ;
+ DWORD dwCreatingFlag ;
+ int priority ;
+} pthread_attr_t ;
+typedef struct { int dummy; } pthread_condattr_t;
+typedef struct {
+ unsigned int msg;
+ pthread_t thread;
+ DWORD thread_id;
+} pthread_cond_t;
+typedef CRITICAL_SECTION pthread_mutex_t;
+
+#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
+#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
+#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
+#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
+#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
+typedef unsigned (__cdecl *pthread_handler)(void *);
+#define pthread_self() GetCurrentThread()
+
+static unsigned int thread_count;
+static pthread_cond_t COND_thread_count;
+static pthread_mutex_t LOCK_thread_count;
+
+pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
+ THR_LOCK_lock,THR_LOCK_isam;
+/*
+** We have tried to use '_beginthreadex' instead of '_beginthread' here
+** but in this case the program leaks about 512 characters for each
+** created thread !
+*/
+
+int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
+ pthread_handler func, void *param)
+{
+ HANDLE hThread;
+
+ hThread=(HANDLE)_beginthread(func,
+ attr->dwStackSize ? attr->dwStackSize :
+ 65535,param);
+ if ((long) hThread == -1L)
+ {
+ return(errno ? errno : -1);
+ }
+ *thread_id=hThread;
+ return(0);
+}
+
+void pthread_exit(unsigned A)
+{
+ _endthread();
+}
+
+/*
+** The following simple implementation of conds works as long as
+** only one thread uses pthread_cond_wait at a time.
+** This is coded very carefully to work with thr_lock.
+*/
+
+static unsigned int WIN32_WAIT_SIGNAL= 30000; /* Start message to use */
+
+int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
+{
+ cond->msg=WIN32_WAIT_SIGNAL++;
+ cond->thread=(pthread_t) pthread_self(); /* For global conds */
+//IRENA
+ cond->thread_id=GetCurrentThreadId();
+ return 0;
+}
+
+
+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+{
+ MSG msg ;
+ unsigned int msgCode=cond->msg;
+
+ cond->thread=(pthread_t) pthread_self();
+//IRENA
+//??? cond->thread_id=GetCurrentThreadId();
+ //VOID(ReleaseMutex(*mutex));
+
+ LeaveCriticalSection(mutex);
+ do
+ {
+ WaitMessage() ;
+ if (!PeekMessage(&msg, NULL, 1, 65534,PM_REMOVE))
+ {
+ return errno=GetLastError() ;
+ }
+ } while (msg.message != msgCode) ;
+ EnterCriticalSection(mutex);
+ return 0 ;
+}
+
+
+int pthread_cond_signal(pthread_cond_t *cond)
+{
+
+ if (!PostThreadMessage(cond->thread_id, cond->msg, 0,0))
+ {
+ return errno=GetLastError() ;
+ }
+ return 0 ;
+}
+
+int pthread_attr_init(pthread_attr_t *connect_att)
+{
+ connect_att->dwStackSize = 0;
+ connect_att->dwCreatingFlag = 0;
+ connect_att->priority = 0;
+ return 0;
+}
+
+int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
+{
+ connect_att->dwStackSize=stack;
+ return 0;
+}
+
+int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
+{
+ connect_att->priority=priority;
+ return 0;
+}
+
+int pthread_attr_destroy(pthread_attr_t *connect_att)
+{
+ return 0;
+}
+
+/* from my_pthread.c */
+
+#ifndef REMOVE_BUG
+
+__declspec(thread) int THR_KEY_my_errno;
+
+int _my_errno(void)
+{
+ return THR_KEY_my_errno;
+}
+#endif
+
+/*****************************************************************************
+** The test program
+*****************************************************************************/
+
+pthread_handler_decl(test_thread,arg)
+{
+ pthread_mutex_lock(&LOCK_thread_count);
+ thread_count--;
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
+ pthread_mutex_unlock(&LOCK_thread_count);
+ pthread_exit(0);
+ return 0;
+}
+
+int main(int argc,char **argv)
+{
+ pthread_t tid;
+ pthread_attr_t thr_attr;
+ int i,error;
+
+ if ((error=pthread_cond_init(&COND_thread_count,NULL)))
+ {
+ fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+ pthread_mutex_init(&LOCK_thread_count,NULL);
+ if ((error=pthread_attr_init(&thr_attr)))
+ {
+ fprintf(stderr,"Got error: %d from pthread_attr_init (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+ if ((error=pthread_attr_setstacksize(&thr_attr,65536L)))
+ {
+ fprintf(stderr,"Got error: %d from pthread_attr_setstacksize (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+
+ printf("Init ok. Creating %d threads\n",TEST_COUNT);
+ for (i=1 ; i <= TEST_COUNT ; i++)
+ {
+ int *param= &i;
+ if ((i % 100) == 0)
+ {
+ printf("%8d",i);
+ fflush(stdout);
+ }
+ if ((error=pthread_mutex_lock(&LOCK_thread_count)))
+ {
+ fprintf(stderr,"\nGot error: %d from pthread_mutex_lock (errno: %d)",
+ error,errno);
+ exit(1);
+ }
+ if ((error=pthread_create(&tid,&thr_attr,test_thread,(void*) param)))
+ {
+ fprintf(stderr,"\nGot error: %d from pthread_create (errno: %d)\n",
+ error,errno);
+ pthread_mutex_unlock(&LOCK_thread_count);
+ exit(1);
+ }
+ thread_count++;
+ pthread_mutex_unlock(&LOCK_thread_count);
+
+ if ((error=pthread_mutex_lock(&LOCK_thread_count)))
+ fprintf(stderr,"\nGot error: %d from pthread_mutex_lock\n",error);
+ while (thread_count)
+ {
+ if ((error=pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
+ fprintf(stderr,"\nGot error: %d from pthread_cond_wait\n",error);
+ }
+ pthread_mutex_unlock(&LOCK_thread_count);
+ }
+ pthread_attr_destroy(&thr_attr);
+ printf("\nend\n");
+ return 0;
+}
diff --git a/acinclude.m4 b/acinclude.m4 index 72b50bcc18f..76953e3e4c2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1183,568 +1183,3 @@ dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- -dnl Got this from the GNU tar 1.13.11 distribution -dnl by Paul Eggert <eggert@twinsun.com> -dnl --------------------------------------------------------------------------- - -dnl By default, many hosts won't let programs access large files; -dnl one must use special compiler options to get large-file access to work. -dnl For more details about this brain damage please see: -dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html - -dnl Written by Paul Eggert <eggert@twinsun.com>. - -dnl Internal subroutine of AC_SYS_LARGEFILE. -dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) -AC_DEFUN(AC_SYS_LARGEFILE_FLAGS, - [AC_CACHE_CHECK([for $1 value to request large file support], - ac_cv_sys_largefile_$1, - [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2 - then - ac_cv_sys_largefile_$1=`cat conftest.1` - else - ac_cv_sys_largefile_$1=no - ifelse($1, CFLAGS, - [case "$host_os" in - # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. -changequote(, )dnl - hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) -changequote([, ])dnl - if test "$GCC" = yes; then - if $CC -v 2>&1 | grep 'version 2.95' > /dev/null 2>&1; then - ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ - fi - fi - ;; - # IRIX 6.2 and later require cc -n32. -changequote(, )dnl - irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) -changequote([, ])dnl - if test "$GCC" != yes; then - ac_cv_sys_largefile_CFLAGS=-n32 - fi - esac - if test "$ac_cv_sys_largefile_CFLAGS" != no; then - ac_save_CC="$CC" - CC="$CC $ac_cv_sys_largefile_CFLAGS" - AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) - CC="$ac_save_CC" - fi]) - fi - rm -f conftest*])]) - -dnl Internal subroutine of AC_SYS_LARGEFILE. -dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) -AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND, - [case $2 in - no) ;; - ?*) - case "[$]$1" in - '') $1=$2 ;; - *) $1=[$]$1' '$2 ;; - esac ;; - esac]) - -dnl Internal subroutine of AC_SYS_LARGEFILE. -dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) -AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, - [AC_CACHE_CHECK([for $1], $2, - [$2=no -changequote(, )dnl - $4 - for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do - case "$ac_flag" in - -D$1) - $2=1 ;; - -D$1=*) - $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; - esac - done -changequote([, ])dnl - ]) - if test "[$]$2" != no; then - AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) - fi]) - -AC_DEFUN(MYSQL_SYS_LARGEFILE, - [AC_REQUIRE([AC_CANONICAL_HOST]) - AC_ARG_ENABLE(largefile, - [ --disable-largefile Omit support for large files]) - if test "$enable_largefile" != no; then - AC_CHECK_TOOL(GETCONF, getconf) - AC_SYS_LARGEFILE_FLAGS(CFLAGS) - AC_SYS_LARGEFILE_FLAGS(LDFLAGS) - AC_SYS_LARGEFILE_FLAGS(LIBS) - - for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do - case "$ac_flag" in - no) ;; - -D_FILE_OFFSET_BITS=*) ;; - -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; - -D_LARGE_FILES | -D_LARGE_FILES=*) ;; - -D?* | -I?*) - AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; - *) - AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; - esac - done - AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") - AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") - AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, - ac_cv_sys_file_offset_bits, - [Number of bits in a file offset, on hosts where this is settable.], - [case "$host_os" in - # HP-UX 10.20 and later - hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) - ac_cv_sys_file_offset_bits=64 ;; - esac]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, - ac_cv_sys_largefile_source, - [Define to make fseeko etc. visible, on some hosts.], - [case "$host_os" in - # HP-UX 10.20 and later - hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) - ac_cv_sys_largefile_source=1 ;; - esac]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, - ac_cv_sys_large_files, - [Define for large files, on AIX-style hosts.], - [case "$host_os" in - # AIX 4.2 and later - aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) - ac_cv_sys_large_files=1 ;; - esac]) - fi - ]) - - -## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- -## Copyright (C) 1996-1999 Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -# serial 40 AC_PROG_LIBTOOL -AC_DEFUN(AC_PROG_LIBTOOL, -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ -DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN(AC_LIBTOOL_SETUP, -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -dnl - -case "$target" in -NONE) lt_target="$host" ;; -*) lt_target="$target" ;; -esac - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$lt_target" in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_SHARED, [dnl -define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_STATIC, [dnl -define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl -define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AC_PROG_LD, -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -changequote([,])dnl - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN(AC_PROG_LD_GNU, -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -]) - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AC_PROG_NM, -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(ac_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - ac_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - break - else - ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm -fi]) -NM="$ac_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN(AC_CHECK_LIBM, -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case "$lt_target" in -*-*-beos* | *-*-cygwin*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library, adds --enable-ltdl-convenience to -# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor -# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed -# to be `${top_builddir}/libltdl'. Make sure you start DIR with -# '${top_builddir}/' (note the single quotes!) if your package is not -# flat, and, if you're not using automake, define top_builddir as -# appropriate in the Makefiles. -AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case "$enable_ltdl_convenience" in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la - INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library, and adds --enable-ltdl-install to -# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor -# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed -# to be `${top_builddir}/libltdl'. Make sure you start DIR with -# '${top_builddir}/' (note the single quotes!) if your package is not -# flat, and, if you're not using automake, define top_builddir as -# appropriate in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la - INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -dnl old names -AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl -AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl -AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl -AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl -AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl -AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl -AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl diff --git a/client/mysql.cc b/client/mysql.cc index f7da4a963f9..769a2b94e78 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -557,8 +557,9 @@ static struct my_option my_long_options[] = {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.", (gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.", + (gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, OPT_ARG, 0, 0, + 0, 0, 0, 0}, {"verbose", 'v', "Write more. (-v -v -v gives the table output format)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, diff --git a/config.guess b/config.guess index 7c3ea484210..27ccc69772b 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -# + +timestamp='2001-08-21' + # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -23,51 +25,162 @@ # the same distribution terms that you use for the rest of that program. # Written by Per Bothner <bothner@cygnus.com>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to the Autoconf mailing list <autoconf@gnu.org>. +# Please send patches to <config-patches@gnu.org>. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 fi +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) +# (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -77,41 +190,55 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text .globl main + .align 4 .ent main main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit .end main EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; - 15) + 1-0) UNAME_MACHINE="alphaev5" ;; - 14) + 1-1) UNAME_MACHINE="alphaev56" ;; - 10) + 1-101) UNAME_MACHINE="alphapca56" ;; - 16) + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; esac fi rm -f $dummy.s $dummy @@ -127,11 +254,8 @@ EOF echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -156,13 +280,13 @@ EOF wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) @@ -218,15 +342,15 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor + # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not @@ -250,15 +374,9 @@ EOF *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -271,9 +389,6 @@ EOF powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; @@ -289,6 +404,7 @@ EOF mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -307,12 +423,16 @@ EOF exit (-1); } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 + && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -328,15 +448,18 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} - else + else echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 @@ -357,9 +480,17 @@ EOF ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) + i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c @@ -373,7 +504,8 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then @@ -382,9 +514,9 @@ EOF echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) + *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -392,7 +524,7 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -402,7 +534,7 @@ EOF ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -418,11 +550,31 @@ EOF echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> @@ -453,12 +605,18 @@ EOF exit (0); } EOF - ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + eval $set_cc_for_build + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include <unistd.h> @@ -485,7 +643,8 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; @@ -495,7 +654,7 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; - *9??*:MPE/iX:*:*) + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) @@ -504,7 +663,7 @@ EOF hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; - i?86:OSF1:*:*) + i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else @@ -539,46 +698,39 @@ EOF echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - if test "${UNAME_MACHINE}" = "c86pc"; then - UNAME_MACHINE=pc - fi - echo `uname -p`-${UNAME_MACHINE}-nto-qnx - exit 0;; - *:QNX:*:*) - echo i386-pc-qnx - exit 0;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) @@ -588,17 +740,8 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; @@ -608,6 +751,9 @@ EOF i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -626,151 +772,101 @@ EOF *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - armv*) UNAME_MACHINE=$UNAME_MACHINE ;; - arm* | sa110*) UNAME_MACHINE="arm" ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-${VENDOR}-linux && exit 0 ;; + little) echo mipsel-${VENDOR}-linux && exit 0 ;; esac - + case `sed -n '/^system type/s/^.*: \([^ ]*\).*/\1/p' < /proc/cpuinfo` in + SGI|sgi) echo mips-${VENDOR}-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*|ppc64:Linux:*:*) + echo powerpc-${VENDOR}-linux + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-${VENDOR}-linux + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-${VENDOR}-linux + exit 0 ;; + i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - *ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;; - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf_i?86) echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 ;; - elf32ppc | elf32ppclinux) - # Determine Lib Version - cat >$dummy.c <<EOF -#include <features.h> -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;; + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linuxoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c <<EOF -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF + # Determine whether the default compiler is a.out or elf + cat >$dummy.c <<EOF #include <features.h> #ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -778,25 +874,28 @@ EOF #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); + printf ("%s-${VENDOR}-linux\n", argv[1]); # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-${VENDOR}-linuxlibc1\n", argv[1]); # endif # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-${VENDOR}-linuxlibc1\n", argv[1]); # endif #else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); + printf ("%s-${VENDOR}-linuxaout\n", argv[1]); #endif return 0; } EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) @@ -808,7 +907,7 @@ EOF echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else @@ -816,13 +915,12 @@ EOF fi exit 0 ;; i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then @@ -842,7 +940,11 @@ EOF echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -866,7 +968,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -877,21 +979,24 @@ EOF 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -909,8 +1014,8 @@ EOF echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) @@ -922,10 +1027,14 @@ EOF # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) @@ -959,6 +1068,64 @@ EOF *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1050,11 +1217,24 @@ main () #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -1065,7 +1245,8 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +eval $set_cc_for_build +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -1098,6 +1279,48 @@ then esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub index 5f082e14a35..83f4b0151e0 100755 --- a/config.sub +++ b/config.sub @@ -1,6 +1,10 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-08-13' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to <config-patches@gnu.org>. +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -111,7 +117,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -137,7 +143,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; @@ -148,18 +154,20 @@ case $os in -scout) ;; -wrs) - os=vxworks + os=-vxworks basic_machine=$1 ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; - -unixware7.0.0) - os=-unixware7.0.0 - ;; - -unixware7.0.1) - os=-unixware7.0.1 - ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -205,32 +213,45 @@ case $os in -psos*) os=-psos ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ - | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ - | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | hppa64 \ - | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ - | alphaev6[78] \ - | we32k | ns16k | clipper | i370 | sh | sh[34] \ - | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp10 | pdp11 \ - | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ - | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ - | pj | pjl | h8500 | z8k) + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -253,31 +274,43 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ - | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ - | hppa2.0n-* | hppa64-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ - | alphaev6[78]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ - | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ - | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ - | [cjt]90-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ + | mipsle-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -314,14 +347,14 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) @@ -368,13 +401,16 @@ case $basic_machine in basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -422,6 +458,10 @@ case $basic_machine in basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -521,14 +561,6 @@ case $basic_machine in basic_machine=i386-unknown os=-vsta ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -554,20 +586,22 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; - *mint | *MiNT) + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown - os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown - os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` @@ -575,14 +609,22 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) - basic_machine=i386-unknown + basic_machine=i386-pc os=-msdos ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -592,7 +634,7 @@ case $basic_machine in os=-netbsd ;; netwinder) - basic_machine=armv4l-corel + basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) @@ -636,20 +678,6 @@ case $basic_machine in basic_machine=i960-intel os=-nindy ;; - ntox86) - basic_machine=i386${os:--unknown} - os=-nto-qnx - ;; - nto*le | not*be) - basic_machine=${basic_machine%%be} - basic_machine=${basic_machine%%le} - basic_machine=${basic_machine##nto}${os:--unknown} - os=-nto-qnx - ;; - nto*) - basic_machine=${basic_machine##nto}${os:--unknown} - os=-nto-qnx - ;; mon960) basic_machine=i960-intel os=-mon960 @@ -718,6 +746,8 @@ case $basic_machine in ;; ppc) basic_machine=powerpc-unknown ;; + ppc64) basic_machine=powerpc-unknown + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) @@ -726,6 +756,16 @@ case $basic_machine in ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ps2) basic_machine=i386-ibm ;; @@ -812,6 +852,10 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; symmetry) basic_machine=i386-sequent os=-dynix @@ -820,6 +864,10 @@ case $basic_machine in basic_machine=t3e-cray os=-unicos ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -872,6 +920,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -900,11 +952,14 @@ case $basic_machine in basic_machine=hppa1.1-oki ;; mips) - if [ x$os = x-linux-gnu ]; then + case $os in + linux*) basic_machine=mips-unknown - else + ;; + *) basic_machine=mips-mips - fi + ;; + esac ;; romp) basic_machine=romp-ibm @@ -915,13 +970,20 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; - sparc | sparcv9) + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -981,12 +1043,6 @@ case $os in -svr4*) os=-sysv4 ;; - -unixware7.0.0) - os=-unixware7.0.0 - ;; - -unixware7.0.1) - os=-unixware7.0.1 - ;; -unixware*) os=-sysv4.2uw ;; @@ -1010,10 +1066,11 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1035,15 +1092,18 @@ case $os in -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; -osfrose*) os=-osfrose ;; @@ -1068,6 +1128,9 @@ case $os in -ns2 ) os=-nextstep2 ;; + -nsk*) + os=-nsk + ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` @@ -1102,7 +1165,7 @@ case $os in -xenix) os=-xenix ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) @@ -1130,12 +1193,15 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; - arm*-corel) + arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -1244,7 +1310,7 @@ case $basic_machine in *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) @@ -1304,7 +1370,7 @@ case $basic_machine in -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) @@ -1322,9 +1388,12 @@ case $basic_machine in -mpw* | -macos*) vendor=apple ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; + -vos*) + vendor=stratus + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; diff --git a/configure.in b/configure.in index 51737f969a3..d961e3d5df6 100644 --- a/configure.in +++ b/configure.in @@ -446,6 +446,9 @@ AC_MSG_RESULT("$CHECK_PID") # We need a ANSI C compiler AM_PROG_CC_STDC +# We need an assembler, too +AM_PROG_AS + if test "$am_cv_prog_cc_stdc" = "no" then AC_MSG_ERROR([MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.]) @@ -671,8 +674,7 @@ else AC_MSG_RESULT([no]) fi -# Use Paul Eggerts macros from GNU tar to check for large file support. -MYSQL_SYS_LARGEFILE +AC_SYS_LARGEFILE # Types that must be checked AFTER large file support is checked AC_TYPE_SIZE_T diff --git a/dbug/Makefile.am b/dbug/Makefile.am index c789019cc6b..08f0164c02c 100644 --- a/dbug/Makefile.am +++ b/dbug/Makefile.am @@ -24,15 +24,6 @@ EXTRA_DIST = example1.c example2.c example3.c \ user.r monty.doc readme.prof \ main.c factorial.c dbug_analyze.c -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h - # Must be linked with libs that are not compiled yet extra_progs: factorial dbug_analyze diff --git a/depcomp b/depcomp new file mode 100755 index 00000000000..65899658ee7 --- /dev/null +++ b/depcomp @@ -0,0 +1,411 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 AIX compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + + tmpdepfile1="$object.d" + tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` + if test "$libtool" = yes; then + "$@" -Wc,-MD + else + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + test -z "$dashmflag" && dashmflag=-M + ( IFS=" " + case " $* " in + *" --mode=compile "*) # this is libtool, let us make it quiet + for arg + do # cycle over the arguments + case "$arg" in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + # X makedepend + ( + shift + cleared=no + for arg in "$@"; do + case $cleared in no) + set ""; shift + cleared=yes + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tail +3 "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/extra/Makefile.am b/extra/Makefile.am index 25633a386e2..58776144489 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -20,14 +20,5 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ resolve_stack_dump mysql_install -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/heap/Makefile.am b/heap/Makefile.am index 2e6682e29d0..41d98b79ae9 100644 --- a/heap/Makefile.am +++ b/heap/Makefile.am @@ -29,14 +29,5 @@ libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ hp_rkey.c hp_block.c \ hp_hash.c _check.c _rectest.c hp_static.c -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/include/my_global.h b/include/my_global.h index 8524328a47b..d1b3c516555 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -161,7 +161,7 @@ #endif /* In Linux-ia64 including atomic.h will give us an error */ -#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__ia64__)) || !defined(THREAD) +#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && (defined(__ia64__)||defined(__powerpc64__))) || !defined(THREAD) #undef HAVE_ATOMIC_ADD #undef HAVE_ATOMIC_SUB #endif @@ -228,6 +228,7 @@ #endif #ifdef HAVE_ATOMIC_ADD #define __SMP__ +#define CONFIG_SMP #include <asm/atomic.h> #endif diff --git a/include/my_sys.h b/include/my_sys.h index 6545077df72..f1b4841adb3 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -293,6 +293,14 @@ extern struct my_file_info #endif } my_file_info[MY_NFILE]; +typedef struct st_my_tmpdir +{ + char **list; + uint cur, max; +#ifdef THREAD + pthread_mutex_t mutex; +#endif +} MY_TMPDIR; typedef struct st_dynamic_array { @@ -582,6 +590,10 @@ extern void allow_break(void); #define allow_break() #endif +extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); +extern char *my_tmpdir(MY_TMPDIR *tmpdir); +extern void free_tmpdir(MY_TMPDIR *tmpdir); + extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); extern uint dirname_part(my_string to,const char *name); extern uint dirname_length(const char *name); diff --git a/include/myisam.h b/include/myisam.h index eac517eb28a..acaf8bb7618 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -329,7 +329,8 @@ typedef struct st_mi_check_param uint8 language; my_bool using_global_keycache, opt_lock_memory, opt_follow_links; my_bool retry_repair, force_sort, calc_checksum; - char temp_filename[FN_REFLEN],*isam_file_name,*tmpdir; + char temp_filename[FN_REFLEN],*isam_file_name; + MY_TMPDIR *tmpdir; int tmpfile_createflag; myf myf_rw; IO_CACHE read_cache; @@ -376,7 +377,7 @@ typedef struct st_mi_sort_param byte *rec_buff; void *wordlist, *wordptr; char *record; - char *tmpdir; + MY_TMPDIR *tmpdir; int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); int (*key_read)(struct st_mi_sort_param *,void *); int (*key_write)(struct st_mi_sort_param *, const void *); diff --git a/install-sh b/install-sh index ebc66913e94..e9de23842dc 100755 --- a/install-sh +++ b/install-sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). @@ -118,6 +118,7 @@ if [ x"$dir_arg" != x ]; then if [ -d $dst ]; then instcmd=: + chmodcmd="" else instcmd=mkdir fi diff --git a/isam/Makefile.am b/isam/Makefile.am index c29be94bf6a..8f23138f29f 100644 --- a/isam/Makefile.am +++ b/isam/Makefile.am @@ -36,15 +36,6 @@ libnisam_a_SOURCES = open.c extra.c info.c rkey.c rnext.c \ log.c changed.c static.c isamchk_SOURCES = isamchk.c sort.c CLEANFILES = test?.IS? isam.log -# Omit dependency for ../mit-pthreads/include/ things -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h wait.h # Move to automake rules ? prolint:; plparse -b -u -hF1 "-width(0,0)" "-format=%f:%l:\s%t:%n\s%m" \ diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am index 22d71e00752..e01fc7634a1 100644 --- a/libmysql_r/Makefile.am +++ b/libmysql_r/Makefile.am @@ -27,17 +27,6 @@ INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \ ## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include include $(top_srcdir)/libmysql/Makefile.shared -# Don't depend on files in pthread library -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h lex.h \ - wait.h - libmysql_dir = $(top_srcdir)/libmysql libmysqlclient_r_la_SOURCES = $(target_sources) diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index a8a46e939b0..2cbf960460f 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -63,18 +63,6 @@ EXTRA_DIST = lib_vio.c libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) libmysqld_a_SOURCES= -# Don't depend on things from mit-pthreads - -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h lex.h \ - wait.h - # automake misses these sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy @@ -1997,12 +1997,12 @@ irix5* | irix6*) ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no diff --git a/ltmain.sh b/ltmain.sh index cebed74c167..e82e48a9ca0 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,8 @@ # ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This program is free software; you can redistribute it and/or modify @@ -54,8 +55,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.3.5 -TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" +VERSION=1.4.2 +TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)" default_mode= help="Try \`$progname --help' for more information." @@ -83,11 +84,8 @@ if test "${LANG+set}" = set; then save_LANG="$LANG"; LANG=C; export LANG fi -if test "$LTCONFIG_VERSION" != "$VERSION"; then - echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi +# Make sure IFS has a sensible default +: ${IFS=" "} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 @@ -113,16 +111,16 @@ do arg="$1" shift - case "$arg" in + case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then - case "$prev" in + case $prev in execute_dlfiles) - eval "$prev=\"\$$prev \$arg\"" + execute_dlfiles="$execute_dlfiles $arg" ;; *) eval "$prev=\$arg" @@ -135,7 +133,7 @@ do fi # Have we seen a non-optional argument yet? - case "$arg" in + case $arg in --help) show_help=yes ;; @@ -146,7 +144,7 @@ do ;; --config) - sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; @@ -207,16 +205,21 @@ if test -n "$prevopt"; then exit 1 fi +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then - case "$nonopt" in + case $nonopt in *cc | *++ | gcc* | *-gcc*) mode=link for arg do - case "$arg" in + case $arg in -c) mode=compile break @@ -261,12 +264,13 @@ if test -z "$show_help"; then help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. - case "$mode" in + case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= + prev= lastarg= srcfile="$nonopt" suppress_output= @@ -274,8 +278,34 @@ if test -z "$show_help"; then user_target=no for arg do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + # Accept any command-line options. - case "$arg" in + case $arg in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 @@ -288,9 +318,53 @@ if test -z "$show_help"; then build_old_libs=yes continue ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; esac - case "$user_target" in + case $user_target in next) # The next one is the -o target name user_target=yes @@ -316,10 +390,10 @@ if test -z "$show_help"; then lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly in scan - # sets, so we specify it separately. - case "$lastarg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac @@ -332,7 +406,7 @@ if test -z "$show_help"; then fi done - case "$user_target" in + case $user_target in set) ;; no) @@ -348,7 +422,7 @@ if test -z "$show_help"; then # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' - case "$libobj" in + case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; @@ -363,7 +437,7 @@ if test -z "$show_help"; then libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - case "$libobj" in + case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 @@ -387,10 +461,21 @@ if test -z "$show_help"; then $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 @@ -402,7 +487,7 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until ln "$0" "$lockfile" 2>/dev/null; do + until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done @@ -434,8 +519,13 @@ compiler." # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile - # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $srcfile $pic_flag -DPIC" + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` @@ -506,7 +596,8 @@ compiler." fi # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag" && test "$build_old_libs" = yes; then + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj @@ -532,6 +623,10 @@ compiler." # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi exit 0 else error=$? @@ -546,7 +641,13 @@ compiler." # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then - command="$base_compile $srcfile" + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" @@ -612,17 +713,17 @@ compiler." # Unlock the critical section if it was locked if test "$need_locks" != no; then - $rm "$lockfile" + $run $rm "$lockfile" fi exit 0 ;; # libtool link mode - link) + link | relink) modename="$modename: link" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra @@ -635,181 +736,13 @@ compiler." # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes - - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include <windows.h> -# #undef WIN32_LEAN_AND_MEAN -# #include <stdio.h> -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include <cygwin/cygwin_dll.h> -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# */ -# -# #include <stdio.h> /* for printf() */ -# #include <unistd.h> /* for open(), lseek(), read() */ -# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ -# #include <string.h> /* for strdup() */ -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (!dll) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i<nexp; i++) -# { -# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); -# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); -# } -# -# return 0; -# } -# /* impgen.c ends here */ ;; *) allow_undefined=yes ;; esac + libtool_args="$nonopt" compile_command="$nonopt" - UW7_compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= @@ -819,19 +752,12 @@ compiler." convenience= old_convenience= deplibs= - linkopts= - linkflags= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - lib_search_path= - fi - # now prepend the system-specific ones - eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - avoid_version=no dlfiles= dlprefiles= @@ -841,9 +767,9 @@ compiler." export_symbols_regex= generated= libobjs= - link_against_libtool_libs= ltlibs= module=no + no_install=no objs= prefer_static_libs=no preload=no @@ -860,7 +786,7 @@ compiler." # We need to know -static, to get the right output filenames. for arg do - case "$arg" in + case $arg in -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then @@ -889,17 +815,24 @@ compiler." while test $# -gt 0; do arg="$1" shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then - case "$prev" in + case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac - case "$prev" in + case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. @@ -907,7 +840,7 @@ compiler." finalize_command="$finalize_command @SYMFILE@" preload=yes fi - case "$arg" in + case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then @@ -936,6 +869,7 @@ compiler." dlprefiles="$dlprefiles $arg" fi prev= + continue ;; esac ;; @@ -960,7 +894,7 @@ compiler." ;; rpath | xrpath) # We need an absolute path. - case "$arg" in + case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 @@ -981,17 +915,32 @@ compiler." prev= continue ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi + fi # test -n $prev prevarg="$arg" - case "$arg" in + case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" @@ -1028,7 +977,7 @@ compiler." -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: not more than one -exported-symbols argument allowed" + $echo "$modename: more than one -exported-symbols argument is not allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then @@ -1039,58 +988,76 @@ compiler." continue ;; + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. - case "$dir" in + case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - absdir="$dir" + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 fi dir="$absdir" ;; esac - case " $deplibs " in - *" $arg "*) ;; - *) deplibs="$deplibs $arg";; - esac - case " $lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir";; + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; esac - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - case ":$dllsearchpath:" in - ::) dllsearchpath="$dllsearchdir";; - *":$dllsearchdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac + continue ;; -l*) - if test "$arg" = "-lc"; then - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # These systems don't actually have c library (as such) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) continue ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; esac - elif test "$arg" = "-lm"; then - case "$host" in - *-*-cygwin* | *-*-beos*) - # These systems don't actually have math library (as such) + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" + continue ;; -module) @@ -1098,6 +1065,25 @@ compiler." continue ;; + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + -no-undefined) allow_undefined=no continue @@ -1123,7 +1109,7 @@ compiler." -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. - case "$dir" in + case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 @@ -1138,11 +1124,11 @@ compiler." ;; -static) - # If we have no pic_flag, then this is the same as -all-static. - if test -z "$pic_flag" && test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. continue ;; @@ -1156,29 +1142,71 @@ compiler." continue ;; + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - linkflags="$linkflags $arg" - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; - *.o | *.obj | *.a | *.lib) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A library object. + *.lo | *.$objext) + # A library or standard object. if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" prev= continue else @@ -1191,357 +1219,894 @@ compiler." # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac fi - libobjs="$libobjs $arg" + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue ;; *.la) # A libtool-controlled library. - dlname= - libdir= - library_names= - old_library= + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test $linkmode = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test $pass = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test $pass = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test $pass = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test $pass != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test $found = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else - $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file - # If there is no directory component, then add one. - case "$arg" in - */* | *\\*) . $arg ;; - *) . ./$arg ;; + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; esac + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test $pass = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + elif test $linkmode != prog && test $linkmode != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi - # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - - if test "X$installed" = Xyes; then - dir="$libdir" - else - dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$arg"; then - dir="$objdir" + # This library was specified with -dlopen. + if test $pass = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" else - dir="$dir/$objdir" + newdlfiles="$newdlfiles $lib" fi - fi - - if test -n "$dependency_libs"; then - # Extract -R and -L from dependency_libs - temp_deplibs= - for deplib in $dependency_libs; do - case "$deplib" in - -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - case " $rpath $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - -L*) case "$compile_command $temp_deplibs " in - *" $deplib "*) ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` - case " $lib_search_path " in - *" $temp_dir "*) ;; - *) lib_search_path="$lib_search_path $temp_dir";; - esac - ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - done - dependency_libs="$temp_deplibs" - fi - - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs$dependency_libs" - compile_command="$compile_command $dir/$old_library$dependency_libs" - finalize_command="$finalize_command $dir/$old_library$dependency_libs" continue - fi + fi # $pass = dlopen - # This library was specified with -dlopen. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking statically, - # we need to preload. - prev=dlprefiles - else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - prev= - continue + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" fi - fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - # The library was specified with -dlpreopen. - if test "$prev" = dlprefiles; then + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test $pass = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then - dlprefiles="$dlprefiles $dir/$old_library" + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" else - dlprefiles="$dlprefiles $dir/$linklib" + newdlprefiles="$newdlprefiles $dir/$linklib" fi - prev= + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test $linkmode = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue fi - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - link_against_libtool_libs="$link_against_libtool_libs $arg" - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac + if test $linkmode = prog && test $pass != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes fi - # We need an absolute path. - case "$dir" in - [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - absdir="$dir" + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test $linkalldeplibs = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" fi - ;; - esac - - # This is the magic to use -rpath. - # Skip directories that are in the system default run-time - # search path, unless they have been requested with -R. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac - ;; - esac + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; esac - ;; - esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... - lib_linked=yes - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - deplibs="$deplibs $dir/$linklib" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - if test -n "$dllsearchpath"; then - dllsearchpath="$dllsearchpath:$dllsearchdir" - else - dllsearchpath="$dllsearchdir" - fi - ;; - esac - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) - compile_shlibpath="$compile_shlibpath$dir:" + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" ;; esac - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - case ":$compile_shlibpath:" in - *":$dir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$dir:";; + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n $old_archive_from_expsyms_cmds + + if test $linkmode = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" + fi + if test $linkmode = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" else - lib_linked=no + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi fi - ;; + fi - relink) + if test $linkmode = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then - compile_command="$compile_command $absdir/$linklib" - deplibs="$deplibs $absdir/$linklib" + add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then - case "$compile_command " in - *" -L$absdir "*) ;; - *) compile_command="$compile_command -L$absdir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$absdir -l$name" + add_dir="-L$libdir" + add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then - case ":$compile_shlibpath:" in - *":$absdir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$absdir:";; + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" + add="-l$name" else - lib_linked=no + # We cannot seem to hardcode it, guess we'll fake it. + if test "X$installed" = Xyes; then + add_dir="-L$libdir" + else + add_dir="-L$DESTDIR$libdir" + fi + add="-l$name" fi - ;; - - *) - lib_linked=no - ;; - esac - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$finalize_command " in - *" -L$libdir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:";; - esac - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" + if test $linkmode = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 - exit 1 + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue fi + # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" else - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$dir";; - esac - finalize_command="$finalize_command -l$name" + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** Therefore, libtool will create a static module, that should work " + echo "*** as long as the dlopening application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test $linkmode = lib; then + if test -n "$dependency_libs" && + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - continue - ;; - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - esac + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" + if test $link_all_deplibs != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test $pass = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done fi - done - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - case "$output" in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi - *.a | *.lib) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 - exit 1 + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= fi + done # for pass + if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + case $linkmode in + oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -1569,11 +2134,12 @@ compiler." # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" + objs="$objs$old_deplibs" ;; - *.la) + lib) # Make sure we only generate libraries of the form `libNAME.la'. - case "$outputname" in + case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" @@ -1594,26 +2160,20 @@ compiler." ;; esac - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - if test -n "$objs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 - fi - - # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 - exit 1 + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath @@ -1631,7 +2191,6 @@ compiler." build_libtool_libs=convenience build_old_libs=yes fi - dependency_libs="$deplibs" if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 @@ -1643,7 +2202,7 @@ compiler." else # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" @@ -1658,8 +2217,8 @@ compiler." age="$4" # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -1667,8 +2226,8 @@ compiler." ;; esac - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -1676,8 +2235,8 @@ compiler." ;; esac - case "$age" in - 0 | [1-9] | [1-9][0-9]*) ;; + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -1695,12 +2254,31 @@ compiler." major= versuffix= verstring= - case "$version_type" in + case $version_type in none) ;; + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + irix) major=`expr $current - $age + 1` - versuffix="$major.$revision" verstring="sgi$major.$revision" # Add in all the interfaces that we are compatible with. @@ -1710,6 +2288,10 @@ compiler." loop=`expr $loop - 1` verstring="sgi$major.$iface:$verstring" done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" ;; linux) @@ -1739,21 +2321,11 @@ compiler." versuffix=".$current.$revision" ;; - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - windows) - # Like Linux, but with '-' rather than '.', since we only - # want one extension on Windows 95. + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. major=`expr $current - $age` - versuffix="-$major-$age-$revision" + versuffix="-$major" ;; *) @@ -1767,6 +2339,16 @@ compiler." if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac if test "$need_version" = no; then versuffix= else @@ -1780,7 +2362,7 @@ compiler." versuffix= verstring="" fi - + # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then @@ -1792,37 +2374,12 @@ compiler." # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi - - dependency_libs="$deplibs" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-freebsd*) - #FreeBSD needs to handle -lc and -lc_r itself - ;; - *-*-rhapsody*) - # rhapsody is a little odd... - deplibs="$deplibs -framework System" - ;; - *) - # Add libc to deplibs on all other systems. - deplibs="$deplibs -lc" - ;; - esac fi - # Create the output directory, or remove our outputs if we need to. - if test -d $output_objdir; then + if test "$mode" != relink; then + # Remove our outputs. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* - else - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi fi # Now set the variables for building old libraries. @@ -1833,7 +2390,73 @@ compiler." oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test $build_libtool_need_lc = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname @@ -1848,7 +2471,7 @@ compiler." major="" newdeplibs= droppeddeps=no - case "$deplibs_check_method" in + case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check @@ -1873,7 +2496,7 @@ EOF for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" ; then + if test -n "$name" && test "$name" != "0"; then libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -1898,7 +2521,7 @@ EOF for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" ; then + if test -n "$name" && test "$name" != "0"; then $rm conftest $CC -o conftest conftest.c $i # Did it work? @@ -1934,19 +2557,19 @@ EOF ;; file_magic*) set dummy $deplibs_check_method - file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`" + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" ; then + if test -n "$name" && test "$name" != "0"; then libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path; do + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then - continue + continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. @@ -1956,7 +2579,7 @@ EOF potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` - case "$potliblink" in + case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac @@ -1984,6 +2607,40 @@ EOF fi done # Gone through all deplibs. ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ @@ -2006,6 +2663,13 @@ EOF libname=$libname_save name=$name_save + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + if test "$droppeddeps" = yes; then if test "$module" = yes; then echo @@ -2031,6 +2695,21 @@ EOF echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." + + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi fi fi # Done checking deplibs! @@ -2041,9 +2720,64 @@ EOF library_names= old_library= dlname= - + # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then + if test $hardcode_into_libs = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names @@ -2055,6 +2789,7 @@ EOF else soname="$realname" fi + test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link @@ -2089,7 +2824,7 @@ EOF export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2126,7 +2861,7 @@ EOF for xlib in $convenience; do # Extract the objects. - case "$xlib" in + case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac @@ -2151,7 +2886,12 @@ EOF if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - linkopts="$linkopts $flag" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. @@ -2160,7 +2900,7 @@ EOF else eval cmds=\"$archive_cmds\" fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2168,6 +2908,12 @@ EOF done IFS="$save_ifs" + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then @@ -2184,12 +2930,7 @@ EOF fi ;; - *.lo | *.o | *.obj) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 - exit 1 - fi - + obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi @@ -2214,9 +2955,9 @@ EOF $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi - case "$output" in + case $output in *.lo) - if test -n "$objs"; then + if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi @@ -2240,7 +2981,7 @@ EOF gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec - wl= + wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then @@ -2259,7 +3000,7 @@ EOF for xlib in $convenience; do # Extract the objects. - case "$xlib" in + case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac @@ -2283,11 +3024,11 @@ EOF fi # Create the old-style object. - reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2318,12 +3059,12 @@ EOF exit 0 fi - if test -n "$pic_flag"; then + if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2354,8 +3095,10 @@ EOF exit 0 ;; - # Anything else should be a program. - *) + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi @@ -2365,20 +3108,27 @@ EOF fi if test "$preload" = yes; then - if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi + fi fi - + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. - case "$compile_rpath " in - *" $libdir "*) ;; - *) compile_rpath="$compile_rpath $libdir" ;; - esac case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; @@ -2396,7 +3146,7 @@ EOF hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) @@ -2414,6 +3164,14 @@ EOF *) perm_rpath="$perm_rpath $libdir" ;; esac fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && @@ -2432,7 +3190,7 @@ EOF hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) @@ -2459,23 +3217,6 @@ EOF fi finalize_rpath="$rpath" - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - - # Create the binary in the object directory, then wrap it. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi - fi - if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2492,7 +3233,7 @@ EOF fi if test -n "$dlsyms"; then - case "$dlsyms" in + case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. @@ -2524,7 +3265,7 @@ extern \"C\" { test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" @@ -2534,7 +3275,7 @@ extern \"C\" { $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi - + if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' @@ -2586,27 +3327,25 @@ extern \"C\" { #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * +# define lt_ptr void * #else -# define lt_ptr_t char * +# define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; - lt_ptr_t address; + lt_ptr address; } lt_preloaded_symbols[] = {\ " - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 0} + {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ @@ -2623,7 +3362,7 @@ static const void *lt_preloaded_setup() { fi pic_flag_for_symtable= - case "$host" in + case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use @@ -2668,7 +3407,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -2677,7 +3416,7 @@ static const void *lt_preloaded_setup() { $show "$link_command" $run eval "$link_command" status=$? - + # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" @@ -2691,7 +3430,7 @@ static const void *lt_preloaded_setup() { # We should set the shlibpath_var rpath= for dir in $temp_rpath; do - case "$dir" in + case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" @@ -2733,11 +3472,24 @@ static const void *lt_preloaded_setup() { fi fi + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" - + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else @@ -2757,7 +3509,7 @@ static const void *lt_preloaded_setup() { # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - + # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname @@ -2769,12 +3521,24 @@ static const void *lt_preloaded_setup() { # Quote the relink command for shipping. if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="cd `pwd`; $relink_command" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case "$0" in + case $0 in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac @@ -2790,6 +3554,11 @@ static const void *lt_preloaded_setup() { case $output in *.exe) output=`echo $output|sed 's,.exe$,,'` ;; esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac $rm $output trap "$rm $output; exit 1" 1 2 15 @@ -2819,7 +3588,7 @@ relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: - link_against_libtool_libs='$link_against_libtool_libs' + notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then @@ -2852,7 +3621,7 @@ else # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi @@ -2868,9 +3637,9 @@ else if test "$fast_install" = yes; then echo >> $output "\ - program=lt-'$outputname' + program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" - + if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then @@ -2887,8 +3656,9 @@ else # relink executable if necessary if test -n \"\$relink_command\"; then - if (cd \"\$thisdir\" && eval \$relink_command); then : + if relink_command_output=\`eval \$relink_command 2>&1\`; then : else + $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi @@ -2937,9 +3707,9 @@ else # Run the actual program with our arguments. " case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin*) + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " @@ -2993,7 +3763,7 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi @@ -3009,11 +3779,11 @@ fi\ exit $status fi generated="$generated $gentop" - + # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. - case "$xlib" in + case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac @@ -3059,7 +3829,7 @@ fi\ eval cmds=\"$old_archive_cmds\" fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3074,19 +3844,26 @@ fi\ fi # Now create the libtool archive. - case "$output" in + case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" - if test -n "$xrpath"; then - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - done - dependency_libs="$temp_xrpath $dependency_libs" - fi + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. if test -z "$run"; then @@ -3096,8 +3873,52 @@ fi\ break fi output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" fi $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP @@ -3106,7 +3927,7 @@ fi\ # It is necessary for linking the library. # The name that we can dlopen(3). -dlname='$dlname' +dlname='$tdlname' # Names of this library. library_names='$library_names' @@ -3125,16 +3946,23 @@ revision=$revision # Is this an already installed library? installed=$installed +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + # Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" +libdir='$install_libdir'" + if test "$installed" = no && test $need_relink = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit 0 @@ -3146,10 +3974,12 @@ libdir='$install_libdir'\ # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case "$arg" in + case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; @@ -3165,7 +3995,7 @@ libdir='$install_libdir'\ # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in + case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; @@ -3188,7 +4018,7 @@ libdir='$install_libdir'\ continue fi - case "$arg" in + case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; @@ -3213,7 +4043,7 @@ libdir='$install_libdir'\ # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in + case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; @@ -3264,11 +4094,11 @@ libdir='$install_libdir'\ exit 1 fi fi - case "$destdir" in + case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do - case "$file" in + case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 @@ -3290,8 +4120,8 @@ libdir='$install_libdir'\ for file in $files; do # Do each installation. - case "$file" in - *.a | *.lib) + case $file in + *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; @@ -3307,19 +4137,29 @@ libdir='$install_libdir'\ library_names= old_library= + relink_command= # If there is no directory component, then add one. - case "$file" in + case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. + DESTDIR= if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else + case "$destdir" in + *"$libdir") + DESTDIR=`$echo "$destdir" | sed -e 's!'"$libdir"'$!!'` + if test "X$destdir" != "X$DESTDIR$libdir"; then + DESTDIR= + fi + ;; + esac # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; @@ -3327,10 +4167,22 @@ libdir='$install_libdir'\ esac fi - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + export DESTDIR + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + unset DESTDIR + # See the names of the shared library. set dummy $library_names if test -n "$2"; then @@ -3338,9 +4190,16 @@ libdir='$install_libdir'\ shift shift + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + # Install the shared library and build the symlinks. - $show "$install_prog $dir/$realname $destdir/$realname" - $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi if test $# -gt 0; then # Delete the old symlinks, and create new ones. @@ -3356,7 +4215,7 @@ libdir='$install_libdir'\ # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3387,11 +4246,11 @@ libdir='$install_libdir'\ fi # Deduce the name of the destination old-style object file. - case "$destfile" in + case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; - *.o | *.obj) + *.$objext) staticdest="$destfile" destfile= ;; @@ -3430,39 +4289,46 @@ libdir='$install_libdir'\ # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - link_against_libtool_libs= + notinst_deplibs= relink_command= # If there is no directory component, then add one. - case "$file" in + case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. - if test -z "$link_against_libtool_libs"; then + if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi finalize=yes - for lib in $link_against_libtool_libs; do + for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. - case "$lib" in + case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then @@ -3474,6 +4340,7 @@ libdir='$install_libdir'\ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -3495,6 +4362,23 @@ libdir='$install_libdir'\ fi fi + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" @@ -3511,9 +4395,14 @@ libdir='$install_libdir'\ $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3529,11 +4418,10 @@ libdir='$install_libdir'\ if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 fi - - exit 0 ;; # libtool finish mode @@ -3552,7 +4440,7 @@ libdir='$install_libdir'\ if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3571,7 +4459,7 @@ libdir='$install_libdir'\ fi # Exit here if they wanted silent mode. - test "$show" = : && exit 0 + test "$show" = ":" && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" @@ -3581,7 +4469,7 @@ libdir='$install_libdir'\ echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" @@ -3631,7 +4519,7 @@ libdir='$install_libdir'\ fi dir= - case "$file" in + case $file in *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : @@ -3646,7 +4534,7 @@ libdir='$install_libdir'\ library_names= # If there is no directory component, then add one. - case "$file" in + case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac @@ -3701,13 +4589,13 @@ libdir='$install_libdir'\ args= for file do - case "$file" in + case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. - case "$file" in + case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac @@ -3724,8 +4612,8 @@ libdir='$install_libdir'\ if test -z "$run"; then if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" + # Export the shlibpath_var. + eval "export $shlibpath_var" fi # Restore saved enviroment variables @@ -3736,31 +4624,35 @@ libdir='$install_libdir'\ LANG="$save_LANG"; export LANG fi - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 + # Now prepare to actually exec the command. + exec_cmd='"$cmd"$args' else # Display what would be done. if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; - # libtool uninstall mode - uninstall) - modename="$modename: uninstall" + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" rm="$nonopt" files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" for arg do - case "$arg" in + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac @@ -3772,14 +4664,42 @@ libdir='$install_libdir'\ exit 1 fi + rmdirs= + for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test $mode = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test $mode = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi rmfiles="$file" - case "$name" in + case $name in *.la) # Possibly a libtool archive, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then @@ -3787,38 +4707,43 @@ libdir='$install_libdir'\ # Delete the libtool libraries and symlinks. for n in $library_names; do - rmfiles="$rmfiles $dir/$n" + rmfiles="$rmfiles $objdir/$n" done - test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - - $show "$rm $rmfiles" - $run $rm $rmfiles - - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test $mode = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi + fi - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. fi - - # FIXME: should reinstall the best remaining shared library. fi ;; @@ -3827,17 +4752,35 @@ libdir='$install_libdir'\ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi - $show "$rm $rmfiles" - $run $rm $rmfiles ;; *) - $show "$rm $rmfiles" - $run $rm $rmfiles + # Do a test to see if this is a libtool program. + if test $mode = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi ;; esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 done - exit 0 + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status ;; "") @@ -3847,13 +4790,20 @@ libdir='$install_libdir'\ ;; esac - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi fi # test -z "$show_help" +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + # We need to display help for each of the modes. -case "$mode" in +case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... @@ -3872,6 +4822,7 @@ Provide generalized library-building support services. MODE must be one of the following: + clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries @@ -3884,6 +4835,20 @@ a more detailed description of MODE." exit 0 ;; +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE @@ -3893,6 +4858,8 @@ Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file @@ -3972,6 +4939,8 @@ The following components of LINK-COMMAND are treated specially: -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information diff --git a/merge/Makefile.am b/merge/Makefile.am index 94de6d65391..78441e84fac 100644 --- a/merge/Makefile.am +++ b/merge/Makefile.am @@ -21,14 +21,5 @@ libmerge_a_SOURCES = mrg_open.c mrg_extra.c mrg_info.c mrg_locking.c \ mrg_rrnd.c mrg_update.c mrg_delete.c mrg_rsame.c \ mrg_panic.c mrg_close.c mrg_create.c mrg_static.c -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h - # Don't update the files from bitkeeper %::SCCS/s.% @@ -1,7 +1,7 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. -# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,11 +18,37 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. case "$1" in -h|--h|--he|--hel|--help) @@ -35,6 +61,7 @@ error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' @@ -43,13 +70,15 @@ Supported PROGRAM values: automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing - GNU libit 0.0" + echo "missing 0.3 - GNU automake" ;; -*) @@ -61,7 +90,7 @@ Supported PROGRAM values: aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.in'. You might want + you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 @@ -70,7 +99,7 @@ WARNING: \`$1' is missing on your system. You should only need it if autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.in'. You might want to install the + you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure @@ -79,10 +108,10 @@ WARNING: \`$1' is missing on your system. You should only need it if autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.in'. You might want + you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do @@ -98,7 +127,7 @@ WARNING: \`$1' is missing on your system. You should only need it if automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | @@ -159,7 +188,32 @@ WARNING: \`$1' is missing on your system. You should only need it if fi ;; + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -175,6 +229,45 @@ WARNING: \`$1' is missing on your system. You should only need it if touch $file ;; + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your diff --git a/myisam/Makefile.am b/myisam/Makefile.am index ee13d0b1fad..1dbce5727f0 100644 --- a/myisam/Makefile.am +++ b/myisam/Makefile.am @@ -52,17 +52,6 @@ libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY? DEFS = -DMAP_TO_USE_RAID -# Omit dependency for ../mit-pthreads/include/sys that only exits if -# mit-pthreads are used -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h \ - wait.h # Move to automake rules ? prolint:; plparse -b -u -hF1 "-width(0,0)" "-format=%f:%l:\s%t:%n\s%m" \ diff --git a/myisam/mi_check.c b/myisam/mi_check.c index d4d6c45fbd6..aa1043b2bf8 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -2529,7 +2529,7 @@ static int sort_ft_key_read(MI_SORT_PARAM *sort_param, void *key) if (!sort_param->wordlist) { - do + for (;;) { my_free((char*) wptr, MYF(MY_ALLOW_ZERO_PTR)); if ((error=sort_get_next_record(sort_param))) @@ -2537,9 +2537,10 @@ static int sort_ft_key_read(MI_SORT_PARAM *sort_param, void *key) if (!(wptr=_mi_ft_parserecord(info,sort_param->key, key,sort_param->record))) DBUG_RETURN(1); + if (wptr->pos) + break; error=sort_write_record(sort_param); } - while (!wptr->pos); sort_param->wordptr=sort_param->wordlist=wptr; } else @@ -2560,6 +2561,7 @@ static int sort_ft_key_read(MI_SORT_PARAM *sort_param, void *key) { my_free((char*) sort_param->wordlist, MYF(0)); sort_param->wordlist=0; + error=sort_write_record(sort_param); } else sort_param->wordptr=(void*)wptr; diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 3e8377fc8c0..656d536f159 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -41,9 +41,10 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */ static uint decode_bits; static char **default_argv; static const char *load_default_groups[]= { "myisamchk", 0 }; -static const char *set_charset_name; +static const char *set_charset_name, *opt_tmpdir; static CHARSET_INFO *set_charset; static long opt_myisam_block_size; +static MY_TMPDIR myisamchk_tmpdir; static const char *type_names[]= { "?","char","binary", "short", "long", "float", @@ -257,7 +258,7 @@ static struct my_option my_long_options[] = 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files.", - (gptr*) &check_param.tmpdir, + (gptr*) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"update-state", 'U', "Mark tables as crashed if any errors were found.", @@ -338,7 +339,15 @@ static void usage(void) Change the value of a variable. Please note that\n\ this option is deprecated; you can set variables\n\ directly with '--variable-name=value'.\n\ - -t, --tmpdir=path Path for temporary files\n\ + -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ + specified, separated by " +#if defined( __WIN__) || defined(OS2) + "semicolon (;)" +#else + "colon (:)" +#endif + ", they will be used\n\ + in a round-robin fashion.\n\ -s, --silent Only print errors. One can use two -s to make\n\ myisamchk very silent\n\ -v, --verbose Print more information. This can be used with\n\ @@ -693,6 +702,11 @@ static void get_options(register int *argc,register char ***argv) exit(1); } + if (init_tmpdir(&myisamchk_tmpdir, opt_tmpdir)) + exit(1); + + check_param.tmpdir=&myisamchk_tmpdir; + if (set_charset_name) if (!(set_charset=get_charset_by_name(set_charset_name, MYF(MY_WME)))) exit(1); diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 3fbc371be3f..3eded3b52f2 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -269,7 +269,7 @@ static struct my_option my_long_options[] = static void print_version(void) { - printf("%s Ver 1.21 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); + printf("%s Ver 1.22 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } static void usage(void) @@ -282,7 +282,7 @@ static void usage(void) puts("Pack a MyISAM-table to take much less space."); puts("Keys are not updated, you must run myisamchk -rq on the datafile"); puts("afterwards to update the keys."); - puts("You should give the .MSI file as the filename argument."); + puts("You should give the .MYI file as the filename argument."); printf("\nUsage: %s [OPTIONS] filename...\n", my_progname); my_print_help(my_long_options); diff --git a/myisam/sort.c b/myisam/sort.c index 79d31147bfc..5819fb7b493 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -553,8 +553,8 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && - open_cached_file(tempfile, info->tmpdir, "ST", DISK_BUFFER_SIZE, - info->sort_info->param->myf_rw)) + open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", + DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) DBUG_RETURN(1); /* purecov: inspected */ buffpek->file_pos=my_b_tell(tempfile); @@ -576,8 +576,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, DBUG_ENTER("write_key"); if (!my_b_inited(tempfile) && - open_cached_file(tempfile, info->tmpdir, "ST", DISK_BUFFER_SIZE, - info->sort_info->param->myf_rw)) + open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", + DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) DBUG_RETURN(1); if (my_b_write(tempfile,(byte*)&key_length,sizeof(key_length)) || @@ -619,8 +619,8 @@ static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys, if (*maxbuffer < MERGEBUFF2) DBUG_RETURN(0); /* purecov: inspected */ if (flush_io_cache(t_file) || - open_cached_file(&t_file2,info->tmpdir,"ST",DISK_BUFFER_SIZE, - info->sort_info->param->myf_rw)) + open_cached_file(&t_file2,my_tmpdir(info->tmpdir),"ST", + DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) DBUG_RETURN(1); /* purecov: inspected */ from_file= t_file ; to_file= &t_file2; diff --git a/myisammrg/Makefile.am b/myisammrg/Makefile.am index 5355534eb77..299b1a20d6e 100644 --- a/myisammrg/Makefile.am +++ b/myisammrg/Makefile.am @@ -22,14 +22,6 @@ libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \ myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \ myrg_rprev.c myrg_queue.c myrg_write.c -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 91333dfad9b..57b22f0edbc 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -42,6 +42,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r + $(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r $(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 2b666b11362..ea632732017 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -203,3 +203,12 @@ select 8 from t1; 8 8 drop table t1; +drop table if exists t1; +create table t1 (a text, fulltext key (a)); +insert into t1 values ('aaaa'); +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +select * from t1 where match (a) against ('aaaa'); +a +drop table t1; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 328eb9b394e..9dff4fba825 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -135,3 +135,19 @@ ID ParId tst tst1 2 2 MSSQL Microsoft 3 3 ORACLE ORACLE drop table parent, child; +drop table if exists t1, t2 ; +create table t1 (n numeric(10)); +create table t2 (n numeric(10)); +insert into t2 values (1),(2),(4),(8),(16),(32); +select * from t2 left outer join t1 using (n); +n n +1 NULL +2 NULL +4 NULL +8 NULL +16 NULL +32 NULL +delete t1,t2 from t2 left outer join t1 using (n); +select * from t2 left outer join t1 using (n); +n n +drop table if exists t1,t2 ; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 7c53074b6da..a09f4608142 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -526,3 +526,13 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 drop table t1, t2, t3; +use mysql; +select * from db; +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 +use test; +select * from mysql.db; +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 65d5381d725..6483045f4ed 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -160,3 +160,15 @@ INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),( select 8 from t1; drop table t1; +# +# Check bug reported by Julian Ladisch +# ERROR 1030: Got error 127 from table handler +# + +drop table if exists t1; +create table t1 (a text, fulltext key (a)); +insert into t1 values ('aaaa'); +repair table t1; +select * from t1 where match (a) against ('aaaa'); +drop table t1; + diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 205dbb10ccf..7d855dd54ea 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -139,4 +139,12 @@ WHERE child.ParId = parent.Id; select * from child; -drop table parent, child;
\ No newline at end of file +drop table parent, child; +drop table if exists t1, t2 ; +create table t1 (n numeric(10)); +create table t2 (n numeric(10)); +insert into t2 values (1),(2),(4),(8),(16),(32); +select * from t2 left outer join t1 using (n); +delete t1,t2 from t2 left outer join t1 using (n); +select * from t2 left outer join t1 using (n); +drop table if exists t1,t2 ; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 5dc6d1047f4..a0d2a34ee76 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -367,3 +367,17 @@ show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; drop table t1, t2, t3; + +# +# system databse test +# +use mysql; +disable_result_log; +select * from db; +enable_result_log; +show status like "Qcache_queries_in_cache"; +use test; +disable_result_log; +select * from mysql.db; +enable_result_log; +show status like "Qcache_queries_in_cache"; diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 192b5e7fe37..8690e9527a1 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -31,7 +31,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ my_pread.c my_write.c \ mf_keycache.c \ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ - my_lock.c mf_brkhant.c my_alarm.c \ + mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_realloc.c my_once.c mulalloc.c \ my_alloc.c safemalloc.c my_new.cc \ my_fopen.c my_fstream.c \ @@ -72,15 +72,6 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h - # I hope this always does the right thing. Otherwise this is only test programs FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ @@ -111,7 +102,7 @@ test_io_cache: mf_iocache.c $(LIBRARIES) test_dir: test_dir.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS) -test_charset: test_charset.c $(LIBRARIES) +test_charset$(EXEEXT): test_charset.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS) charset2html: charset2html.c $(LIBRARIES) diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c new file mode 100644 index 00000000000..1ae034af67d --- /dev/null +++ b/mysys/mf_tempdir.c @@ -0,0 +1,83 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include <m_string.h> + +#if defined( __WIN__) || defined(OS2) +#define DELIM ';' +#else +#define DELIM ':' +#endif + +my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) +{ + char *end, *copy; + char buff[FN_REFLEN]; + DYNAMIC_ARRAY t_arr; + pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST); + if (my_init_dynamic_array(&t_arr, sizeof(char*), 1, 5)) + return TRUE; + if (!pathlist || !pathlist[0]) + { + /* Get default temporary directory */ + pathlist=getenv("TMPDIR"); /* Use this if possible */ +#if defined( __WIN__) || defined(OS2) + if (!pathlist) + pathlist=getenv("TEMP"); + if (!pathlist) + pathlist=getenv("TMP"); +#endif + if (!pathlist || !pathlist[0]) + pathlist=(char*) P_tmpdir; + } + do + { + end=strcend(pathlist, DELIM); + convert_dirname(buff, pathlist, end); + if (!(copy=my_strdup(buff, MYF(MY_WME)))) + return TRUE; + if (insert_dynamic(&t_arr, (gptr)©)) + return TRUE; + pathlist=end+1; + } + while (*end); + freeze_size(&t_arr); + tmpdir->list=(char **)t_arr.buffer; + tmpdir->max=t_arr.elements-1; + tmpdir->cur=0; + return FALSE; +} + +char *my_tmpdir(MY_TMPDIR *tmpdir) +{ + char *dir; + pthread_mutex_lock(&tmpdir->mutex); + dir=tmpdir->list[tmpdir->cur]; + tmpdir->cur= (tmpdir->cur == tmpdir->max) ? 0 : tmpdir->cur+1; + pthread_mutex_unlock(&tmpdir->mutex); + return dir; +} + +void free_tmpdir(MY_TMPDIR *tmpdir) +{ + uint i; + for (i=0; i<=tmpdir->max; i++) + my_free(tmpdir->list[i], MYF(0)); + my_free((gptr)tmpdir->list, MYF(0)); + pthread_mutex_destroy(&tmpdir->mutex); +} + diff --git a/regex/Makefile.am b/regex/Makefile.am index 6492ab0370f..ee421b70bcf 100644 --- a/regex/Makefile.am +++ b/regex/Makefile.am @@ -28,15 +28,6 @@ EXTRA_DIST = tests CHANGES COPYRIGHT WHATSNEW regexp.c \ debug.ih engine.ih main.ih regcomp.ih regerror.ih \ regex.3 regex.7 -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h - test: re tests ./re < tests ./re -el < tests diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index e6ecbf6f729..9dea2eb3935 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -307,8 +307,8 @@ do done fi - echo "`date +'%y%m%d %H:%M:%S mysqld restarted'`" | tee -a $err_log + echo "`date +'%y%m%d %H:%M:%S'` mysqld restarted" | tee -a $err_log done -echo "`date +'%y%m%d %H:%M:%S mysqld ended'`" | tee -a $err_log +echo "`date +'%y%m%d %H:%M:%S'` mysqld ended" | tee -a $err_log echo "" | tee -a $err_log diff --git a/sql/Makefile.am b/sql/Makefile.am index 5e023a68de9..606cc3ec7c0 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -98,16 +98,6 @@ BUILT_SOURCES = sql_yacc.cc sql_yacc.h EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) YFLAGS = -d -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h lex.h \ - wait.h - link_sources: rm -f mini_client_errors.c @LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 4aae044148b..e02252e711f 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -559,7 +559,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) param.tmpfile_createflag = O_RDWR | O_TRUNC; param.using_global_keycache = 1; param.thd=thd; - param.tmpdir=mysql_tmpdir; + param.tmpdir=&mysql_tmpdir_list; param.out_flag=0; strmov(fixed_name,file->filename); @@ -718,7 +718,7 @@ bool ha_myisam::activate_all_index(THD *thd) T_CREATE_MISSING_KEYS); param.myf_rw&= ~MY_WAIT_IF_FULL; param.sort_buffer_length= thd->variables.myisam_sort_buff_size; - param.tmpdir=mysql_tmpdir; + param.tmpdir=&mysql_tmpdir_list; error=repair(thd,param,0) != HA_ADMIN_OK; thd->proc_info=save_proc_info; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index b74a2da5f6d..d8281af6bd1 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -640,8 +640,9 @@ bool open_log(MYSQL_LOG *log, const char *hostname, extern time_t start_time; extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH], - mysql_real_data_home[], *charsets_list; -extern my_string mysql_tmpdir; + mysql_real_data_home[], *charsets_list, *opt_mysql_tmpdir; +#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list)) +extern MY_TMPDIR mysql_tmpdir_list; extern const char *command_name[]; extern const char *first_keyword, *localhost, *delayed_user; extern const char **errmesg; /* Error messages */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a3a82d96b2e..8497fe90758 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -395,7 +395,8 @@ const char *myisam_recover_options_str="OFF"; const char *sql_mode_str="OFF"; ulong rpl_recovery_rank=0; -my_string mysql_unix_port=NULL, opt_mysql_tmpdir=NULL, mysql_tmpdir=NULL; +my_string mysql_unix_port=NULL, opt_mysql_tmpdir=NULL; +MY_TMPDIR mysql_tmpdir_list; ulong my_bind_addr; /* the address we bind to */ char *my_bind_addr_str; DATE_FORMAT dayord; @@ -852,7 +853,7 @@ void clean_up(bool print_message) if (defaults_argv) free_defaults(defaults_argv); my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); + free_tmpdir(&mysql_tmpdir_list); my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); x_free(opt_bin_logname); x_free(opt_relay_logname); @@ -1834,17 +1835,6 @@ int main(int argc, char **argv) load_defaults(MYSQL_CONFIG_NAME,load_default_groups,&argc,&argv); defaults_argv=argv; - /* Get default temporary directory */ - opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */ -#if defined( __WIN__) || defined(OS2) - if (!opt_mysql_tmpdir) - opt_mysql_tmpdir=getenv("TEMP"); - if (!opt_mysql_tmpdir) - opt_mysql_tmpdir=getenv("TMP"); -#endif - if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0]) - opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */ - set_options(); get_options(argc,argv); if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) @@ -2941,13 +2931,13 @@ struct my_option my_long_options[] = #endif /* HAVE_BERKELEY_DB */ {"skip-bdb", OPT_BDB_SKIP, "Don't use berkeley db (will save memory)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"big-tables", OPT_BIG_TABLES, + {"big-tables", OPT_BIG_TABLES, "Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"binlog-do-db", OPT_BINLOG_DO_DB, "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB, + {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB, "Tells the master that updates to the given database should not be logged tothe binary log", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to", @@ -3316,16 +3306,23 @@ struct my_option my_long_options[] = #ifdef HAVE_OPENSSL #include "sslopt-longopts.h" #endif - {"temp-pool", OPT_TEMP_POOL, + {"temp-pool", OPT_TEMP_POOL, "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", (gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"tmpdir", 't', "Path for temporary files", (gptr*) &opt_mysql_tmpdir, + {"tmpdir", 't', + "Path for temporary files. Several paths may be specified, separated by a " +#if defined( __WIN__) || defined(OS2) + "semicolon (;)" +#else + "colon (:)" +#endif + ", in this case they are used in a round-robin fashion.", + (gptr*) &opt_mysql_tmpdir, (gptr*) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"transaction-isolation", OPT_TX_ISOLATION, "Default transaction isolation level", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0, - 0, 0, 0, - 0, 0}, + 0, 0, 0, 0, 0}, {"external-locking", OPT_USE_LOCKING, "Use system (external) locking. With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running", (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -4498,9 +4495,7 @@ static void fix_paths(void) charsets_dir=mysql_charsets_dir; } - char *end=convert_dirname(buff, opt_mysql_tmpdir, NullS); - if (!(mysql_tmpdir= my_memdup((byte*) buff,(uint) (end-buff)+1, - MYF(MY_FAE)))) + if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) exit(1); if (!slave_load_tmpdir) { diff --git a/sql/set_var.cc b/sql/set_var.cc index b221a3f98ff..72579664a3e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -541,7 +541,7 @@ struct show_var_st init_vars[]= { {"timezone", time_zone, SHOW_CHAR}, #endif {sys_tmp_table_size.name, (char*) &sys_tmp_table_size, SHOW_SYS}, - {"tmpdir", (char*) &mysql_tmpdir, SHOW_CHAR_PTR}, + {"tmpdir", (char*) &opt_mysql_tmpdir, SHOW_CHAR_PTR}, {"version", server_version, SHOW_CHAR}, {sys_net_wait_timeout.name, (char*) &sys_net_wait_timeout, SHOW_SYS}, {NullS, NullS, SHOW_LONG} diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 78774b376b1..46afddf0967 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2286,30 +2286,32 @@ fill_record(Field **ptr,List<Item> &values) static void mysql_rm_tmp_tables(void) { - uint idx; - char filePath[FN_REFLEN]; + uint i, idx; + char filePath[FN_REFLEN], *tmpdir; MY_DIR *dirp; FILEINFO *file; DBUG_ENTER("mysql_rm_tmp_tables"); + for (i=0; i<=mysql_tmpdir_list.max; i++) + { + tmpdir=mysql_tmpdir_list.list[i]; /* See if the directory exists */ - if (!(dirp = my_dir(mysql_tmpdir,MYF(MY_WME | MY_DONT_SORT)))) - DBUG_VOID_RETURN; /* purecov: inspected */ + if (!(dirp = my_dir(tmpdir,MYF(MY_WME | MY_DONT_SORT)))) + continue; - /* - ** Remove all SQLxxx tables from directory - */ + /* Remove all SQLxxx tables from directory */ for (idx=2 ; idx < (uint) dirp->number_off_files ; idx++) { file=dirp->dir_entry+idx; if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length)) { - sprintf(filePath,"%s%s",mysql_tmpdir,file->name); /* purecov: inspected */ - VOID(my_delete(filePath,MYF(MY_WME))); /* purecov: inspected */ + sprintf(filePath,"%s%s",tmpdir,file->name); + VOID(my_delete(filePath,MYF(MY_WME))); } } my_dirend(dirp); + } DBUG_VOID_RETURN; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 7c51cac0f3a..5bdefbaaa30 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -357,6 +357,12 @@ TODO list: #define DUMP(C) #endif +#ifdef FN_NO_CASE_SENCE +#define DB_NAME_PREPROCESS(C) tolower(C) +#else +#define DB_NAME_PREPROCESS(C) (C) +#endif + const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND",NullS }; TYPELIB query_cache_type_typelib= { @@ -1394,14 +1400,15 @@ ulong Query_cache::init_cache() VOID(hash_init(&queries,system_charset_info,def_query_hash_size, 0, 0, query_cache_query_get_key, 0, 0)); - /* - On windows we have to compare names case insensitive as for the OS - A.frm and a.frm are the same file. - */ +#ifndef FN_NO_CASE_SENCE + VOID(hash_init(&tables,system_charset_info,def_table_hash_size, 0, 0, + query_cache_table_get_key, 0, 0)); +#else + // windows, OS/2 or other case insensitive file names work around VOID(hash_init(&tables,system_charset_info,def_table_hash_size, 0, 0, - query_cache_table_get_key, 0, - IF_WIN((lower_case_table_names ? 0: HASH_CASE_INSENSITIVE), - 0))); + query_cache_table_get_key, 0, + (lower_case_table_names?0:HASH_CASE_INSENSITIVE))); +#endif queries_in_cache = 0; queries_blocks = 0; @@ -2447,7 +2454,7 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, lex->select->options, (int) thd->variables.query_cache_type)); - for (; tables_used; tables_used=tables_used->next) + for (; tables_used; tables_used= tables_used->next) { tables++; DBUG_PRINT("qcache", ("table %s, db %s, type %u", @@ -2457,10 +2464,16 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, tables_used->table->file->has_transactions()); if (tables_used->table->db_type == DB_TYPE_MRG_ISAM || - tables_used->table->tmp_table != NO_TMP_TABLE) + tables_used->table->tmp_table != NO_TMP_TABLE || + (tables_used->db_length == 5 && + DB_NAME_PREPROCESS(tables_used->db[0])=='m' && + DB_NAME_PREPROCESS(tables_used->db[1])=='y' && + DB_NAME_PREPROCESS(tables_used->db[2])=='s' && + DB_NAME_PREPROCESS(tables_used->db[3])=='q' && + DB_NAME_PREPROCESS(tables_used->db[4])=='l')) { DBUG_PRINT("qcache", - ("select not cacheable: used MRG_ISAM or temporary table(s)")); + ("select not cacheable: used MRG_ISAM, temporary or system table(s)")); DBUG_RETURN(0); } if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 0581e0b5a3b..686fee0abe6 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -330,7 +330,7 @@ bool multi_delete::send_data(List<Item> &values) table->status|= STATUS_DELETED; if (!(error=table->file->delete_row(table->record[0]))) deleted++; - else + else if (!table_being_deleted->next) { table->file->print_error(error,MYF(0)); DBUG_RETURN(1); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 5d94b54f347..f530c87dd61 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -776,7 +776,7 @@ bool multi_update::send_eof() thd->proc_info="updating the reference tables"; /* Does updates for the last n - 1 tables, returns 0 if ok */ - int error = do_updates(false); /* do_updates returns 0 if success */ + int error = (num_updated > 1) ? do_updates(false) : 0; /* do_updates returns 0 if success */ /* reset used flags */ #ifndef NOT_USED diff --git a/strings/Makefile.am b/strings/Makefile.am index 58486f6e524..966cab09779 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -54,15 +54,6 @@ EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \ strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \ t_ctype.h -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h - libmystrings_a_LIBADD= conf_to_src_SOURCES = conf_to_src.c conf_to_src_LDADD= diff --git a/tools/Makefile.am b/tools/Makefile.am index e5130865a89..3c786dc9281 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -6,15 +6,5 @@ mysqlmanager_SOURCES= mysqlmanager.c mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) DEF= -DUNDEF_THREADS_HACK -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h lex.h \ - wait.h - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/vio/Makefile.am b/vio/Makefile.am index b512ec33777..b53f3be9f91 100644 --- a/vio/Makefile.am +++ b/vio/Makefile.am @@ -30,17 +30,5 @@ test_sslclient_LDADD = @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a ../my ../strings/libmystrings.a libvio.a $(openssl_libs) libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c -OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ - __math.h time.h __time.h unistd.h __unistd.h types.h \ - xtypes.h ac-types.h posix.h string.h __string.h \ - errno.h socket.h inet.h dirent.h netdb.h \ - cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \ - prio_queue.h pthread_attr.h pthread_once.h queue.h\ - sleep.h specific.h version.h pwd.h timers.h uio.h \ - cdefs.h machdep.h signal.h __signal.h util.h \ - openssl/x509 openssl/ssl.h openssl/err.h \ - openssl/pem.h openssl/asn1.h - - # Don't update the files from bitkeeper %::SCCS/s.% |