commit 26d433260dac2e340961be1163b116a3dded867a Author: Bart Hakvoort Date: Sun Sep 19 20:24:53 2004 +0000 Initial revision diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..6f8d92eb --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Bart +email: gparted@users.sourceforge.net +IRC : irc.gnome.org #gparted diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..dfcb0886 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,71 @@ + +**changes** +- replaced some 'dunglish' terms with more decent english. (Thanks to Tino Meinen) +- cleaned up autoconf stuff a bit +- gparted now gets installed in the sbin/ instead of bin/ (1023181) +- maximum amount of primary partition isn't static anymore, it gets asked from the partition table. +- lots of internal code cleanups. this improved performance and stability. +- doubleclick now invokes infodialog + +**fixes** +- sometimes creating new fat filesystems in very small spaces resulted in errors. fixed. +- use copies from buildfiles instead of symlinks to them. (Thanks to Kristof Vansant) +- when performing operations on just copied partitions, there was a chance the operation would be executed on another partition. fixed. +- fixed a rare bug that caused incorrect partitiontable display after an operation went wrong. +- some errormessages were not entirely threadsafe, fixed (hopefully :P ) + +-------------------------------------------------------------------------- + +GParted-0.0.4 04 Sep 2004 : + +- fixed another bug with hotpluggable stuff (usbdevices etc...) +- fixed "random" chrasher while performing actions on a device with a mounted partition. +- better alignment of information in deviceinfo and partitioninfo. (there were some problems with certain fonts) +- changed checking for filesystemlimits in new partition dialog a bit. +- fixed small bug in new partition dialog which made it possible to add fat16 partition > 1023MB +- time left in progressbar shows now minutes and seconds +- implemented copy'n paste functionality +- fixed small bug with resizer +- internal code cleanups, gained some performance +- made the operationtitles a bit more informative +- fixed bug with converting non-existent (new) partitions +- implemented new operationslist +- lots of small stuff + +------------------------------------------------------- + +GParted-0.0.3 26 Aug 2004 : + +- and as always, lots of small fixed/changes.. +- fixed bug with resizing extended partition +- fixed bug which occasionally occurred when deleting filesystems with errors on them +- fixed small bug with deleting new logical partitions while a partition with a higher number is mounted +- added read-only support for partition flags (e.g. lba, boot, etc...) +- implemented conversion between filesystems. (no big deal, all data is destroyed in the process) +- compiling/running tested on 64bits arch, went perfectly :) +- fixed another small bug with re-reading devices (optionmenu wasn't updated) +- Early check for errors on filesystem. Disable appropiate actions and explain in Info +- When a device can't be read it isn't listed anymore. + +------------------------------------------------------ + +GParted-0.0.2 18 Aug 2004 : + +- new create dialog +- far more compliant with HIG +- unallocated space now visible in treeview +- fixed bug with re-reading devices (segfault) +- fixed bug with new extended (segfault) +- a couple of other small things, fixes and improvements + +--------------------------------------------- + +GParted-0.0.1 12 Aug 2004 : + +***FIRST RELEASE! +- Create (ext2, linux-swap, fat16, fat32) +- resize (ext2, ext3, linux-swap, fat16, fat32 ) +- move (linux-swap, fat16, fat32) +- Full operationslist with undo +- much more little stuff +- basicly working, but not tested very well diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..b42a17ac --- /dev/null +++ b/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..c74acb44 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = include src diff --git a/README b/README new file mode 100644 index 00000000..df35dfcf --- /dev/null +++ b/README @@ -0,0 +1,9 @@ +GParted stands for Gnome Partition Editor and is a graphical frontend to libparted. Among other features it supports creating, resizing, moving and copying of partitions. + +The first goal of GParted is to provide all libparted's features as outlined at http://www.gnu.org/software/parted/#features. +When this is done and GParted is stable enough for normal use, i will look into support for other filesystems such as ntfs . + +GParted is written in C++ and uses gtkmm as Graphical Toolkit. The general approach is to keep the GUI as simple as possible. That's why i try to conform to the GNOME Human Interface Guidelines . + + +Visit http://gparted.sourceforge.net/ for more information diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 00000000..787dcad9 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,14 @@ +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DOC_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_PIXMAPS_DIR +#undef PACKAGE_HELP_DIR +#undef PACKAGE_MENU_DIR +#undef PACKAGE_SOURCE_DIR +#undef GETTEXT_PACKAGE diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..7e553f36 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1 @@ +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..a6fd2d9c --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,6324 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p6 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# Copyright 2002 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 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.4-p6])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN([AM_PROG_CC_STDC], +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)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_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +_LT_AC_SHARED_EXT +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + $archive_expsym_cmds="$archive_cmds" + fi + else + ld_shlibs=no + fi + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + + # Find out which ABI we are using (multilib Linux x86_64 hack). + libsuff= + case "$host_cpu" in + x86_64*) + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + ;; + esac + fi + rm -rf conftest* + ;; + *) + ;; + esac + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + +# _LT_AC_SHARED_EXT +# ---------------- +AC_DEFUN([_LT_AC_SHARED_EXT],[ + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + if test -z "`grep -e 'shared_ext.*shrext' $ofile`"; then + # Make sure $shared_ext gets set to $shrext + if sed -e 's/shared_ext/shrext/g' "$ofile" > "${ofile}T"; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update shared_ext.]) + fi + fi +])# _LT_AC_SHARED_EXT + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_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 + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately 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='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately 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, lt_dlinit, + [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='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 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. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDRT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #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 +# 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 */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED +]) +AC_MSG_RESULT([$SED]) +]) + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..08b7b9ef --- /dev/null +++ b/autogen.sh @@ -0,0 +1,127 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +PKG_NAME="the package." + +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed." + echo "Get ftp://ftp.gnu.org/pub/gnu/" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed." + echo "Get ftp://ftp.gnu.org/pub/gnu/" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -name configure.in -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo processing $dr + macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` + ( cd $dr + aclocalinclude="$ACLOCAL_FLAGS" + for k in $macrodirs; do + if test -d $k; then + aclocalinclude="$aclocalinclude -I $k" + ##else + ## echo "**Warning**: No such directory \`$k'. Ignored." + fi + done + if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then + if grep "sed.*POTFILES" configure.in >/dev/null; then + : do nothing -- we still have an old unmodified configure.in + else + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + ./setup-gettext + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + fi + if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + ./setup-gettext + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + test -d m4 && aclocalinclude="$aclocalinclude -I m4" + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude + if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then + echo "Running autoheader..." + autoheader + fi + echo "Running automake --gnu $am_opt ..." + automake --add-missing --copy --gnu $am_opt + echo "Running autoconf ..." + autoconf + ) + fi +done + +#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME +else + echo Skipping configure process. +fi diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..2f47a1e0 --- /dev/null +++ b/configure.in @@ -0,0 +1,92 @@ +dnl Process this file with autoconf to produce a configure script. +dnl Created by Anjuta - will be overwritten +dnl If you don't want it to overwrite it, +dnl Please disable it in the Anjuta project configuration + +AC_INIT(configure.in) +AM_INIT_AUTOMAKE(GParted, 0.1) +AM_CONFIG_HEADER(config.h) + +AC_ISC_POSIX +CFLAGS="" +AC_SUBST(CFLAGS) +CXXFLAGS="" +AC_SUBST(CXXFLAGS) +AC_PROG_CC +AC_PROG_CXX +AM_PROG_CC_STDC +AC_HEADER_STDC +AM_PROG_LIBTOOL +PKG_CHECK_MODULES(GTKMM, gtkmm-2.4,,exit) +AC_CHECK_LIB(parted, ped_device_probe_all, [], AC_MSG_ERROR([*** libparted >= 1.6.13 not installed - please install first ***]), -luuid -ldl) +AC_SUBST(GTKMM_LIBS) +AC_SUBST(GTKMM_CFLAGS) +dnl Checks for programs. +dnl Checks for libraries. +dnl Checks for header files. +dnl Checks for typedefs, structures, and compiler characteristics. +dnl Checks for library functions. +dnl Checks for Additional stuffs. + +dnl Set PACKAGE SOURCE DIR in config.h. +packagesrcdir=`cd $srcdir && pwd` + +dnl Set PACKAGE PREFIX +if test "x${prefix}" = "xNONE"; then + packageprefix=${ac_default_prefix} +else + packageprefix=${prefix} +fi + +dnl Set PACKAGE DATA & DOC DIR +packagedatadir=share +packagedocdir=doc/${PACKAGE} + +dnl Set PACKAGE DIRS in config.h. +packagepixmapsdir=${packagedatadir}/pixmaps +packagehelpdir=${packagedatadir}/help +packagemenudir=${packagedatadir} + +dnl Subst PACKAGE_DATA_DIR. +NO_PREFIX_PACKAGE_DATA_DIR="${packagedatadir}" +AC_SUBST(NO_PREFIX_PACKAGE_DATA_DIR) +PACKAGE_DATA_DIR="${packageprefix}/${packagedatadir}" +AC_SUBST(PACKAGE_DATA_DIR) + +dnl Subst PACKAGE_DOC_DIR. +NO_PREFIX_PACKAGE_DOC_DIR="${packagedocdir}" +AC_SUBST(NO_PREFIX_PACKAGE_DOC_DIR) +PACKAGE_DOC_DIR="${packageprefix}/${packagedocdir}" +AC_SUBST(PACKAGE_DOC_DIR) + +dnl Subst PACKAGE_PIXMAPS_DIR. +NO_PREFIX_PACKAGE_PIXMAPS_DIR="${packagepixmapsdir}" +AC_SUBST(NO_PREFIX_PACKAGE_PIXMAPS_DIR) +PACKAGE_PIXMAPS_DIR="${packageprefix}/${packagepixmapsdir}" +AC_SUBST(PACKAGE_PIXMAPS_DIR) + +dnl Subst PACKAGE_HELP_DIR. +NO_PREFIX_PACKAGE_HELP_DIR="${packagehelpdir}" +AC_SUBST(NO_PREFIX_PACKAGE_HELP_DIR) +PACKAGE_HELP_DIR="${packageprefix}/${packagehelpdir}" +AC_SUBST(PACKAGE_HELP_DIR) + +dnl Subst PACKAGE_MENU_DIR. +NO_PREFIX_PACKAGE_MENU_DIR="${packagemenudir}" +AC_SUBST(NO_PREFIX_PACKAGE_MENU_DIR) +PACKAGE_MENU_DIR="${packageprefix}/${packagemenudir}" +AC_SUBST(PACKAGE_MENU_DIR) + +AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${packageprefix}/${packagedatadir}") +AC_DEFINE_UNQUOTED(PACKAGE_DOC_DIR, "${packageprefix}/${packagedocdir}") +AC_DEFINE_UNQUOTED(PACKAGE_PIXMAPS_DIR, "${packageprefix}/${packagepixmapsdir}") +AC_DEFINE_UNQUOTED(PACKAGE_HELP_DIR, "${packageprefix}/${packagehelpdir}") +AC_DEFINE_UNQUOTED(PACKAGE_MENU_DIR, "${packageprefix}/${packagemenudir}") +AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}") + +AC_OUTPUT([ +Makefile +include/Makefile +src/Makefile +]) + diff --git a/include/.cvsignore b/include/.cvsignore new file mode 100644 index 00000000..282522db --- /dev/null +++ b/include/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/include/Device.h b/include/Device.h new file mode 100644 index 00000000..91d57e69 --- /dev/null +++ b/include/Device.h @@ -0,0 +1,110 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + + /****************************************************** + This class.... is a mess ;-) + It's does some kind of wrapping around libparted, but it's not very clear and it looks like shit. + The one thing i have to say in favor of it is: IT JUST WORKS :) + + When i've time i will look into it and try to sort things out a bit. + Maybe building a small decent wrapper or so... + ********************************************************/ + +#ifndef DEVICE +#define DEVICE + +#include + +#include "../include/Partition.h" + +#include +#include +#include +#include +#include + +#include +#include + +namespace GParted +{ + +class Device +{ + +public: + Device() ; + Device( const Glib::ustring & device_path); + ~Device() ; + //this function creates a fresh list with al the partitions and free spaces + void Read_Disk_Layout() ; + bool Delete_Partition( const Partition & partition ) ; + bool Create_Partition_With_Filesystem( Partition & new_part, PedTimer *timer) ; + bool Move_Resize_Partition( const Partition & partition_original, const Partition & partition_new , PedTimer *timer) ; + bool Set_Partition_Filesystem( const Partition & new_partition, PedTimer * timer); + bool Copy_Partition( Device *source_device, const Partition & source_partition, PedTimer * timer ) ; + int Create_Empty_Partition( const Partition & new_partition, PedConstraint * constraint = NULL ) ; + bool Commit() ; + + PedPartition * Get_c_partition( int part_num ); + + std::vector Get_Partitions() ; + Sector Get_Length() ; + long Get_Heads() ; + long Get_Sectors() ; + long Get_Cylinders() ; + Glib::ustring Get_Model() ; + Glib::ustring Get_Path() ; + Glib::ustring Get_RealPath() ; + Glib::ustring Get_DiskType() ; + bool Get_any_busy() ; + int Get_Max_Amount_Of_Primary_Partitions() ; + +private: + //make a try to get the amount of used sectors on a filesystem ( see comments in implementation ) + Sector Get_Used_Sectors( PedPartition *c_partition, const Glib::ustring & sym_path ); + + Glib::ustring Get_Flags( PedPartition *c_partition ) ; + + bool open_device_and_disk() ; + void close_device_and_disk() ; + bool Resize_Extended( const Partition & partition, PedTimer *timer) ; + + std::vector device_partitions; + Sector length; + long heads ; + long sectors ; + long cylinders ; + Glib::ustring model; + Glib::ustring path; + Glib::ustring realpath; + Glib::ustring disktype; + + //private variables + PedDevice *device ; + PedDisk *disk ; + PedPartition *c_partition ; + + std::vector flags; + Glib::ustring temp, error ; //error may contain an errormessage for an specific partition ( see Get_Used_Sectors() ) + std::ostringstream os; + Partition partition_temp ; + }; + + } //GParted + +#endif //DEVICE diff --git a/include/Dialog_About.h b/include/Dialog_About.h new file mode 100644 index 00000000..31b6854c --- /dev/null +++ b/include/Dialog_About.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + + /* + of course i could've used Gnome::UI::About but that would add another dependacy to GParted + Besides, i always wanted to build my own creditsdialog :-P + */ + +#ifndef DIALOG_ABOUT +#define DIALOG_ABOUT + +#include +#include +#include +#include +#include + +//i18n stuff .... +#include +#define _(String) gettext(String) + +class Dialog_About : public Gtk::Dialog +{ +public: + Dialog_About() ; + + +private: + void Show_Credits() ; + + Gtk::Label *label_temp ; + Gtk::Button button_credits; +}; + + +#endif diff --git a/include/Dialog_Base_Partition.h b/include/Dialog_Base_Partition.h new file mode 100644 index 00000000..0228899d --- /dev/null +++ b/include/Dialog_Base_Partition.h @@ -0,0 +1,100 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef DIALOG_BASE_PARTITION +#define DIALOG_BASE_PARTITION + +#include "../include/Frame_Resizer_Extended.h" +#include "../include/Partition.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace GParted +{ + +class Dialog_Base_Partition : public Gtk::Dialog +{ +public: + + Dialog_Base_Partition( ) ; + ~Dialog_Base_Partition() ; + + void Set_Resizer( bool extended ) ; + Partition Get_New_Partition() ; + +protected: + enum SPINBUTTON { + BEFORE = 0, + SIZE = 1, + AFTER = 2 + }; + + enum CONFIRMBUTTON { + RESIZE_MOVE = 0, + NEW = 1, + PASTE = 2 + }; + + void Set_Confirm_Button( CONFIRMBUTTON button_type ) ; + + double MB_PER_PIXEL ; + long TOTAL_MB ; + Frame_Resizer_Base *frame_resizer_base; + Partition selected_partition ; + + Sector START; //the first sector of the first relevant partition ( this is either current or current -1 ) needed in Get_Resized_Partition() + Sector total_length ; //total amount of sectors ( this can be up to 3 partitions... + + Gtk::HBox hbox_main; + Gtk::Label label_minmax ; + Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after; + + //used to enable/disable OKbutton... + int ORIG_BEFORE,ORIG_SIZE, ORIG_AFTER ; + + //signal handlers + void on_signal_move( int, int ); + void on_signal_resize( int, int, Frame_Resizer_Base::ArrowType ); + void on_spinbutton_value_changed( SPINBUTTON ) ; + + bool fixed_start, GRIP; + std::ostringstream os; + double before_value ; + int x_start, x_end ; + +private: + void Check_Change() ; + + Gtk::VBox vbox_resize_move; + Gtk::Label *label_temp; + Gtk::Table table_resize; + Gtk::HBox hbox_table, hbox_resizer, hbox_resize_move; + Gtk::Tooltips tooltips; + Gtk::Button button_resize_move ; + Gtk::Image *image_temp ; + +}; + +} //GParted + +#endif //DIALOG_BASE_PARTITION diff --git a/include/Dialog_Partition_Copy.h b/include/Dialog_Partition_Copy.h new file mode 100644 index 00000000..b4551a43 --- /dev/null +++ b/include/Dialog_Partition_Copy.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef DIALOG_PARTITION_COPY +#define DIALOG_PARTITION_COPY + +#include "../include/Dialog_Base_Partition.h" + +namespace GParted +{ + +class Dialog_Partition_Copy : public Dialog_Base_Partition +{ +public: + Dialog_Partition_Copy() ; + void Set_Data( Partition & selected_partition, Partition & copied_partition ); + + +private: + + +}; + +}//GParted + +#endif //DIALOG_PARTITION_COPY diff --git a/include/Dialog_Partition_Info.h b/include/Dialog_Partition_Info.h new file mode 100644 index 00000000..a01fd325 --- /dev/null +++ b/include/Dialog_Partition_Info.h @@ -0,0 +1,77 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef DIALOG_PARTITION_INFO +#define DIALOG_PARTITION_INFO + +//what kind of info would one prefer to see here? +//my guess is, it's best to keep the amount of info minimal and wait for users requests + +#include "../include/Partition.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define BORDER 8 + +namespace GParted +{ + +class Dialog_Partition_Info : public Gtk::Dialog +{ +public: + Dialog_Partition_Info( const Partition & ); + ~Dialog_Partition_Info(); + +private: + void init_drawingarea() ; + void Display_Info(); + void Find_Status() ; + + //signalhandlers + void drawingarea_on_realize( ); + bool drawingarea_on_expose( GdkEventExpose * ); + + Partition partition ; + + Gtk::HBox *hbox ; + Gtk::DrawingArea drawingarea ; + Gtk::Frame *frame ; + Gtk::Label *label ; + Gtk::Image *image; + Gtk::Table *table; + + Glib::RefPtr gc; + Glib::RefPtr pango_layout; + + Gdk::Color color_partition, color_used, color_unused, color_text ; + + int used,unused ; + std::ostringstream os, os_percent; + +}; + +} //GParted + +#endif //DIALOG_PARTITION_INFO diff --git a/include/Dialog_Partition_New.h b/include/Dialog_Partition_New.h new file mode 100644 index 00000000..3d9d9e6c --- /dev/null +++ b/include/Dialog_Partition_New.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef DIALOG_PARTITION_NEW +#define DIALOG_PARTITION_NEW + +#include "../include/Dialog_Base_Partition.h" + +#include +#include + +namespace GParted +{ + +class Dialog_Partition_New : public Dialog_Base_Partition +{ +public: + Dialog_Partition_New() ; + void Set_Data( const Partition & partition, bool any_extended, unsigned short new_count ); + Partition Get_New_Partition() ;//overridden function + +private: + void Build_Filesystems_Menu() ; + //bool Check_Restrictions() ; + + Gtk::Table table_create; + Gtk::OptionMenu optionmenu_type, optionmenu_filesystem; + Gtk::Label label_type,label_filesystem,label_start,label_size; + Gtk::Menu menu_type, menu_filesystem; + + std::vector filesystems ; + + //signal handlers + void optionmenu_changed( bool ); + + Gdk::Color color_temp; + unsigned short new_count ; +}; + +} //GParted + +#endif //DIALOG_PARTITION_NEW diff --git a/include/Dialog_Partition_Resize_Move.h b/include/Dialog_Partition_Resize_Move.h new file mode 100644 index 00000000..2920fa21 --- /dev/null +++ b/include/Dialog_Partition_Resize_Move.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef DIALOG_PARTITION_RESIZE_MOVE +#define DIALOG_PARTITION_RESIZE_MOVE + +#include "../include/Dialog_Base_Partition.h" + +namespace GParted +{ + +class Dialog_Partition_Resize_Move : public Dialog_Base_Partition +{ +public: + Dialog_Partition_Resize_Move( ) ; + void Set_Data( const Partition & selected_partition, const std::vector & partitions ) ; + +private: + void Resize_Move_Normal( const std::vector & partitions ) ; + void Resize_Move_Extended( const std::vector & partitions ) ; + +}; + +} //GParted + +#endif //DIALOG_PARTITION_RESIZE_MOVE diff --git a/include/Dialog_Progress.h b/include/Dialog_Progress.h new file mode 100644 index 00000000..641011e0 --- /dev/null +++ b/include/Dialog_Progress.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef DIALOG_PARTITION_PROGRESS +#define DIALOG_PARTITION_PROGRESS + +#include +#include +#include +#include + +#include + +//i18n stuff .... +#include +#define _(String) gettext(String) + +class Dialog_Progress : public Gtk::Dialog +{ +public: + Dialog_Progress( int, const Glib::ustring & ); + ~Dialog_Progress(); + + void Set_Next_Operation( ); + void Set_Progress_Current_Operation(); + + Glib::ustring current_operation; + float fraction_current; + int time_left ; + +private: + Gtk::Label label_all_operations, label_current, *label_temp; + Gtk::ProgressBar progressbar_all, progressbar_current ; + + double fraction; + std::ostringstream os; + int count_operations, current_operation_number; + char c_buf[ 1024 ] ; //used by sprintf, which is needed for i18n +}; + +#endif //DIALOG_PARTITION_PROGRESS diff --git a/include/Frame_Resizer_Base.h b/include/Frame_Resizer_Base.h new file mode 100644 index 00000000..b6636508 --- /dev/null +++ b/include/Frame_Resizer_Base.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + + +#ifndef FRAME_RESIZER_BASE +#define FRAME_RESIZER_BASE + +#include +#include +#include + +#define BORDER 8 + +class Frame_Resizer_Base : public Gtk::Frame, virtual public sigc::trackable +{ +public: + + enum ArrowType { + ARROW_LEFT = 0, + ARROW_RIGHT = 1 + }; + + Frame_Resizer_Base( ) ; + ~Frame_Resizer_Base() ; + + void set_rgb_partition_color( const Gdk::Color & ) ; + void override_default_rgb_unused_color( const Gdk::Color & ) ; + + void set_x_start( int ) ; + void set_x_end( int ) ; + void set_used( int ); + void set_fixed_start( bool ) ; + void set_used_start( int used_start ) ; + + + + int get_used(); + int get_x_start() ; + int get_x_end() ; + + virtual void Draw_Partition() ; + + + //public signal (emitted upon resize/move) + sigc::signal signal_resize; + sigc::signal signal_move; + +protected: + int X_START, USED, UNUSED, X_END, X_START_MOVE, USED_START; + bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ; + + //signal handlers + void drawingarea_on_realize( ); + bool drawingarea_on_expose( GdkEventExpose * ); + virtual bool drawingarea_on_mouse_motion( GdkEventMotion* ) ; + bool drawingarea_on_button_press_event( GdkEventButton* ) ; + bool drawingarea_on_button_release_event( GdkEventButton* ) ; + bool drawingarea_on_leave_notify( GdkEventCrossing* ) ; + + void Draw_Resize_Grip( ArrowType ) ; + + Gtk::DrawingArea drawingarea; + Glib::RefPtr gc; + + Gdk::Color color_used, color_unused, color_arrow, color_background,color_partition,color_arrow_rectangle; + + std::vector arrow_points; + + Gdk::Cursor *cursor_resize, *cursor_normal, *cursor_move; + + int temp_x, temp_y ; + bool fixed_start; //a fixed start disables moving the start and thereby the whole move functionality.. + +private: + void init() ; + +}; + +#endif // FRAME_RESIZER_BASE diff --git a/include/Frame_Resizer_Extended.h b/include/Frame_Resizer_Extended.h new file mode 100644 index 00000000..a575ef0c --- /dev/null +++ b/include/Frame_Resizer_Extended.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + + +#ifndef FRAME_RESIZER_EXTENDED +#define FRAME_RESIZER_EXTENDED + +#include "../include/Frame_Resizer_Base.h" + + class Frame_Resizer_Extended : public Frame_Resizer_Base +{ +public: + Frame_Resizer_Extended( ) ; + + + + + + +private: + int UNUSED_BEFORE ; + //overridden signal handler + virtual bool drawingarea_on_mouse_motion( GdkEventMotion* ) ; + + virtual void Draw_Partition() ; + + + + + + + +}; + +#endif // FRAME_RESIZER_EXTENDED diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 00000000..ff4609a0 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1 @@ +gparted_includedir = $(pkgincludedir) diff --git a/include/Operation.h b/include/Operation.h new file mode 100644 index 00000000..a84f531f --- /dev/null +++ b/include/Operation.h @@ -0,0 +1,76 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef OPERATION +#define OPERATION + +#include "../include/Partition.h" +#include "../include/Device.h" + +#include +#include + +//i18n stuff .... +#include +#define _(String) gettext(String) + +namespace GParted +{ + +enum OperationType { + DELETE = 0, + CREATE = 1, + RESIZE_MOVE = 2, + CONVERT = 3, + COPY = 4 +}; + +class Operation +{ + +public: + Operation( Device *device, Device *source_device, const Partition &, const Partition &,OperationType ); + Glib::ustring Get_String(); + + //this one can be a little confusing, it *DOES NOT* change any visual representation. It only applies the operation to the list with partitions. + //this new list can be used to change the visual representation. For real writing to disk, see Apply_To_Disk() + std::vector Apply_Operation_To_Visual( std::vector & partitions ); + + void Apply_To_Disk( PedTimer * ); + + //public variables + Device *device, *source_device; //source_device is only used in copy operations + Glib::ustring device_path, source_device_path ; + OperationType operationtype; + Partition partition_new; //the new situation ( can be an whole new partition or simply the old one with a new size or.... ) + +private: + std::vector Apply_Delete_To_Visual( std::vector & partitions ); + std::vector Apply_Create_To_Visual( std::vector & partitions ); + std::vector Apply_Resize_Move_To_Visual( std::vector & partitions ); + std::vector Apply_Resize_Move_Extended_To_Visual( std::vector & partitions ); + std::vector Apply_Convert_To_Visual( std::vector & partitions ); + + void Show_Error( const Glib::ustring & message ) ; + + Partition partition_original; //the original situation + char c_buf[ 1024 ] ; //used by sprintf, which is needed for i18n +}; + +} //GParted + +#endif //OPERATION diff --git a/include/Partition.h b/include/Partition.h new file mode 100644 index 00000000..ce55a0f6 --- /dev/null +++ b/include/Partition.h @@ -0,0 +1,133 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + + /* READ THIS!! + * Partition isn't really a partition. It's more like a geometry, a continuous part of the disk. I use ut to represent partitions as well as unallocated spaces + */ + +#ifndef PARTITION +#define PARTITION + +#include +#include + +#include +#include + +//i18n stuff .... +#include +#define _(String) gettext(String) + +#define MEGABYTE 2048 //try it: 2048 * 512 / 1024 /1024 == 1 :P + +namespace GParted +{ + +typedef long long Sector;//one day this won't be sufficient, oh how i dream of that day... :-P + +inline long Sector_To_MB( Sector sectors ) +{ + return (long) ( (double) sectors * 512/1024/1024 +0.5) ; +} + +inline long Round( double double_value ) +{ + return (long) ( double_value + 0.5) ; +} + +inline Sector Abs( Sector sectors ) +{ + return sectors < 0 ? sectors - 2*sectors : sectors ; +} + + +enum PartitionType { + PRIMARY = 0, + LOGICAL = 1, + EXTENDED = 2, + UNALLOCATED = 3 +}; + +/* +enum FileSystem { + ext2 = 0, + ext3 = 1, + linux_swap = 2, + reiserfs = 3, + hfs = 4, + jfs = 5, + hp_ufs = 6, + sun_ufs = 7, + xfs = 8, + fat16 = 9, + fat32 = 10, + ntfs = 11 +}; +*/ +class Partition +{ +public: + Partition(); + ~Partition() ; + + //simple Set-functions. only for convenience, since most members are public + void Set( const Glib::ustring & partition, + const int partition_number, + const PartitionType type, + const Glib::ustring & filesystem, + const Sector & sector_start, + const Sector & sector_end, + const Sector & sectors_used, + const bool inside_extended, + const bool busy ) ; + + + void Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended ); + + //get color associated with filesystem + Glib::ustring Get_Color( const Glib::ustring & filesystem ); + + //update partition number (used when a logical partition is deleted) + void Update_Number( int new_number ); + + long Get_Length_MB( ); + long Get_Used_MB( ); + long Get_Unused_MB( ); + + //some public members + Glib::ustring partition;//the symbolic path (e.g. /dev/hda1 ) + int partition_number; + PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc... + Glib::ustring filesystem;// ext2, ext3, ntfs, etc.... + Sector sector_start; + Sector sector_end; + Sector sectors_used; + Sector sectors_unused; + Gdk::Color color; + Glib::ustring color_string; + bool inside_extended;//this one is stupid ;-) i use it to check wether unallocated space resides inside extended partition or not. + bool busy; + Glib::ustring error; + Glib::ustring flags; + +private: + + +}; + +}//GParted +#endif //PARTITION diff --git a/include/TreeView_Detail.h b/include/TreeView_Detail.h new file mode 100644 index 00000000..cd43369a --- /dev/null +++ b/include/TreeView_Detail.h @@ -0,0 +1,88 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef TREEVIEW_DETAIL +#define TREEVIEW_DETAIL + +#include "../include/Partition.h" + +#include +#include +#include + +#include +#include + +#include +#include + +namespace GParted +{ + +class TreeView_Detail : public Gtk::TreeView +{ +public: + TreeView_Detail( ); + void Load_Partitions( std::vector & partitions ) ; + void Set_Selected( const Partition & partition ); + + //signals for interclass communication + sigc::signal signal_mouse_click; + + +private: + void Create_Row( const Gtk::TreeRow &, Partition &); + + //overridden signal + virtual bool on_button_press_event(GdkEventButton *); + + + Gtk::TreeRow row,childrow; + Gtk::TreeIter iter,iter_child; + + Glib::RefPtr treestore_detail; + Glib::RefPtr treeselection; + + //columns for this treeview + struct treeview_detail_Columns : public Gtk::TreeModelColumnRecord + { + Gtk::TreeModelColumn partition; + Gtk::TreeModelColumn type; + Gtk::TreeModelColumn size; + Gtk::TreeModelColumn used; + Gtk::TreeModelColumn unused; + Gtk::TreeModelColumn color; + Gtk::TreeModelColumn text_color; + Gtk::TreeModelColumn< Glib::RefPtr > status_icon; + Gtk::TreeModelColumn flags; + Gtk::TreeModelColumn< Partition > partition_struct; //hidden column ( see also on_button_press_event ) + + treeview_detail_Columns() { + add( partition ); add( type ); add( size ); add( used ); add( unused ); add( color ); add( text_color ); add( status_icon ); add( flags ); add(partition_struct); + } + }; + + treeview_detail_Columns treeview_detail_columns; + + Partition partition_temp ; //used in Set_Selected to make the check a bit more readable + std::ostringstream os;//for int to string conversions + +}; + +} //GParted + +#endif //TREEVIEW_DETAIL diff --git a/include/VBox_VisualDisk.h b/include/VBox_VisualDisk.h new file mode 100644 index 00000000..083eec47 --- /dev/null +++ b/include/VBox_VisualDisk.h @@ -0,0 +1,101 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef VBOX_VISUALDISK +#define VBOX_VISUALDISK + +#include "../include/Partition.h" +#include "../include/Device.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define BORDER 8 + +namespace GParted +{ + +class VBox_VisualDisk : public Gtk::VBox +{ + //struct which contains visual information about the partitions. This prevents recalculation of everything after an expose en therefore saves performance.. + struct Visual_Partition + { + //2 attributes used for selection ( see Set_Selected() an drawingarea_on_expose() for more info ) + Sector sector_start; + int index; + + int length; //pixels + int used; //pixels + int height; //pixels + int text_y; //pixels + Gdk::Color color_fs; + Gtk::DrawingArea *drawingarea; + Glib::RefPtr gc; + Glib::RefPtr pango_layout; + }; + +public: + VBox_VisualDisk( const std::vector & partitions, const Sector device_length ); + ~VBox_VisualDisk(); + void Set_Selected( const Partition & ); + + + //public signal for interclass communication + sigc::signal signal_mouse_click; + + +private: + void Build_Visual_Disk( int ) ; //i still dream of some fully resizeable visualdisk.... + void Build_Legend( ) ; + void Add_Legend_Item( const Glib::ustring & filesystem, const Gdk::Color & color ); + + //signal handlers + void drawingarea_on_realize( Visual_Partition * ); + bool drawingarea_on_expose( GdkEventExpose *, Visual_Partition* ); + bool on_drawingarea_button_press( GdkEventButton *, const Partition & ); + + std::vector partitions; + Sector device_length; + + Gtk::Frame *frame_disk_legend ; + Gtk::HBox hbox_disk_main, *hbox_disk, *hbox_extended, hbox_legend_main, *hbox_legend; + Gtk::CheckButton checkbutton_filesystem; + Gtk::Tooltips tooltips; + + Visual_Partition *visual_partition; + std::vector visual_partitions; + Gtk::EventBox * eventbox_extended; + Gdk::Color color_used, color_unused, color_text; + + + std::ostringstream os;//for int to string conversions + int temp,selected_partition; + Gtk::Entry *entry_temp; + Gtk::Label *label_temp; + +}; + +} //GParted +#endif //VBOX_VISUALDISK diff --git a/include/Win_GParted.h b/include/Win_GParted.h new file mode 100644 index 00000000..63ee37f0 --- /dev/null +++ b/include/Win_GParted.h @@ -0,0 +1,183 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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. + */ + +#ifndef WIN_GPARTED +#define WIN_GPARTED + +#include "../include/Device.h" +#include "../include/VBox_VisualDisk.h" +#include "../include/Partition.h" +#include "../include/TreeView_Detail.h" +#include "../include/Dialog_Partition_Info.h" +#include "../include/Dialog_Partition_New.h" +#include "../include/Operation.h" +#include "../include/Dialog_Progress.h" +#include "../include/Dialog_Partition_Resize_Move.h" +#include "../include/Dialog_About.h" +#include "../include/Dialog_Partition_Copy.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace GParted +{ + +class Win_GParted : public Gtk::Window +{ +public: + Win_GParted( ); + +private: + void init_menubar() ; + void init_toolbar() ; + void init_popupmenu() ; + void init_convert_menu() ; + void init_device_info() ; + void init_operationslist() ; + void init_hpaned_main() ; + + void Find_Devices() ; + + //Fill txtview_device_info_buffer with some information about the selected device + void Fill_Label_Device_Info( ); + + //overridden signalhandler + virtual bool on_delete_event(GdkEventAny* ) ; + + void Add_Operation( OperationType, const Partition & ); + void Refresh_Visual( ); + bool Quit_Check_Operations(); + void Set_Valid_Operations() ; //determines which operations are allowed on selected_partition + void Set_Valid_Convert_Filesystems() ; //determines to which filesystems a partition can be converted + + + //convenience functions + void allow_new( bool b ) { menu_popup.items()[0].set_sensitive( b ); toolbar_main.get_nth_item(0) ->set_sensitive( b ); } + void allow_delete( bool b ) { menu_popup.items()[1].set_sensitive( b ); toolbar_main.get_nth_item(1) ->set_sensitive( b ); } + void allow_resize( bool b ) { menu_popup.items()[3].set_sensitive( b ); toolbar_main.get_nth_item(3) ->set_sensitive( b ); } + void allow_copy( bool b ) { menu_popup.items()[5].set_sensitive( b ); toolbar_main.get_nth_item(5) ->set_sensitive( b ); } + void allow_paste( bool b ) { menu_popup.items()[6].set_sensitive( b ); toolbar_main.get_nth_item(6) ->set_sensitive( b ); } + void allow_convert( bool b ) { menu_popup.items()[8].set_sensitive( b ); } + void allow_undo( bool b ) { toolbar_main.get_nth_item(8) ->set_sensitive( b ); } + void allow_apply( bool b ) { toolbar_main.get_nth_item(9) ->set_sensitive( b ); } + + //signal handlers + void close_operationslist() ; + void clear_operationslist() ; + void optionmenu_devices_changed( ); + + void menu_gparted_refresh_devices(); + void menu_gparted_quit(); + void menu_help_contents(); + void menu_help_about(); + + void mouse_click( GdkEventButton*, const Partition & ); + + void activate_resize(); + void activate_copy(); + void activate_paste(); + void activate_new(); + void activate_delete(); + void activate_info(); + void activate_convert( const Glib::ustring & new_fs ); + + void activate_undo(); + void activate_apply(); + void apply_operations_thread(); + +//private variables + unsigned int current_device, source_device; //source_device is used to store the device the copied_partition is from.... + Partition selected_partition, copied_partition; + std::vector devices; + std::vector operations; + +//gui stuff + Gtk::HPaned hpaned_main; + Gtk::VPaned vpaned_main; + Gtk::VBox vbox_main,vbox_info, *vbox; + Gtk::HBox hbox_toolbar,hbox_visual, hbox_operations, *hbox; + Gtk::Toolbar toolbar_main; + Gtk::MenuBar menubar_main; + Gtk::OptionMenu optionmenu_devices; + Gtk::Menu menu_devices,menu_popup, menu_convert, *menu ; + Gtk::ToolButton *toolbutton; + Gtk::Statusbar statusbar; + Gtk::Expander expander_device_info ; + Gtk::Image *image ; + Gtk::ScrolledWindow *scrollwindow; + Gtk::Label label_device_info1, label_device_info2, *label; + Gtk::Tooltips tooltips ; + Gtk::Button *button; + Gtk::Table *table ; + Gtk::MenuItem *menu_item; + Gtk::Entry *entry; + + Gdk::Color color ; + + VBox_VisualDisk *vbox_visual_disk; + TreeView_Detail treeview_detail; + + //operations list + Gtk::TreeView treeview_operations; + Gtk::TreeRow treerow; + Glib::RefPtr liststore_operations; + + struct treeview_operations_Columns : public Gtk::TreeModelColumnRecord + { + Gtk::TreeModelColumn operation_number; + Gtk::TreeModelColumn operation_description; + Gtk::TreeModelColumn< Glib::RefPtr > operation_icon; + + treeview_operations_Columns() { add( operation_number ); add( operation_description );add(operation_icon);} + }; + treeview_operations_Columns treeview_operations_columns; + + + //usefull variables which are used by many different functions... + sigc::connection s2,s3;//usefull for disconnecting and destroying a connection ( see optionmenu_devices_changed() and activate_apply() ) + std::ostringstream os;//for int to string conversions + bool any_logic,any_extended;//used in some checks (e.g. see optionmenu_devices_changed() + unsigned short highest_logic_busy,primary_count, new_count;//primary_count checks for max. of 4 pimary partitions, + //new_count keeps track of the new created partitions, + //highest_logic_busy contains the number of the highest logical which is busy ( 0 if none is busy) + + GParted::Device *temp_device; + std::vector str_devices, filesystems; + char c_buf[ 1024 ] ; //used by sprintf, which is needed for i18n + + //stuff for progress overview + Dialog_Progress *dialog_progress; + Glib::Thread *thread_operations; + Glib::Dispatcher dispatcher_next_operation; + bool apply; + +}; + +} //GParted + +#endif //WIN_GPARTED diff --git a/src/.cvsignore b/src/.cvsignore new file mode 100644 index 00000000..84e36b8c --- /dev/null +++ b/src/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.deps +.libs +gparted +*.o diff --git a/src/Device.cc b/src/Device.cc new file mode 100644 index 00000000..96a97f0f --- /dev/null +++ b/src/Device.cc @@ -0,0 +1,604 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Device.h" + +/* + * This is ridiculous!, if i use this one as a member function realpath starts complaining and won't compile :-S + */ +Glib::ustring get_sym_path( const Glib::ustring & real_path ) +{ + int major,minor,size; + char temp[4096], device_name[4096],short_path[4096] ; + + FILE* proc_part_file = fopen ("/proc/partitions", "r"); + if (!proc_part_file) + return real_path; + + //skip first 2 useless rules of /proc/partitions + fgets (temp, 256, proc_part_file);fgets (temp, 256, proc_part_file); + + while (fgets (temp, 4096, proc_part_file) && sscanf (temp, "%d %d %d %255s", &major, &minor, &size, device_name) == 4) + { + strcpy(short_path, "/dev/"); strcat( short_path, device_name ); + realpath( short_path, device_name ); + + if ( real_path == device_name ) { + fclose (proc_part_file); + return (Glib::ustring(short_path)); + } + + } + + //it's very unlikely, if not impossible, the program will ever reach this, but just in case.... ;-) + fclose (proc_part_file); + return real_path; +} + +//AFAIK it's not possible to use a C++ memberfunction as a callback for a C libary function (if you know otherwise, PLEASE contact me +Glib::ustring error_message; +bool show_libparted_message = true ; +PedExceptionOption PedException_Handler (PedException* ex) +{ + error_message = ex -> message ; + + if ( show_libparted_message ) + { + Gtk::Label *label_temp; + Gtk::HBox *hbox_filler; + + Glib::ustring message = "" + (Glib::ustring) _( "Libparted message" ) + "\n\n" ; + message += (Glib::ustring) _( "This message directly comes from libparted and has little to do with GParted. However, the message might contain useful information, so you might decide to read it.") + "\n"; + message += _( "If you don't want to see these messages any longer, it's safe to disable them.") ; + + Gtk::MessageDialog dialog( message,true,Gtk::MESSAGE_WARNING , Gtk::BUTTONS_OK, true); + Gtk::Frame frame_libparted_message ; + frame_libparted_message .set_size_request( 400, -1 ); + label_temp = manage( new Gtk::Label("" + (Glib::ustring) _( "Libparted message") + ": " ) ) ; + label_temp ->set_use_markup( true ) ; + frame_libparted_message .set_label_widget( *label_temp ) ; + + frame_libparted_message .set_border_width( 5 ) ; + label_temp = manage( new Gtk::Label( ) ) ; + label_temp ->set_size_request( 55, -1 ) ; //used like a simple filler ( remember this html cursus :-P ) + hbox_filler = manage( new Gtk::HBox() ) ; + hbox_filler ->pack_start ( *label_temp, Gtk::PACK_SHRINK ) ; + hbox_filler ->pack_start ( frame_libparted_message, Gtk::PACK_SHRINK ) ; + + dialog .get_vbox() ->pack_start( *hbox_filler, Gtk::PACK_SHRINK ) ; + + Gtk::Label label_libparted_message( "" + error_message + "" ) ; + label_libparted_message .set_selectable( true ) ; + label_libparted_message .set_use_markup( true ) ; + label_libparted_message .set_line_wrap( true ) ; + frame_libparted_message.add ( label_libparted_message ) ; + + Gtk::CheckButton checkbutton_message( _( "Hide libparted messages for this session" ) ) ; + checkbutton_message .set_border_width( 5 ) ; + label_temp = manage( new Gtk::Label( ) ) ; + label_temp ->set_size_request( 55, -1 ) ; + hbox_filler = manage( new Gtk::HBox() ) ; + hbox_filler ->pack_start ( *label_temp, Gtk::PACK_SHRINK ) ; + hbox_filler ->pack_start ( checkbutton_message, Gtk::PACK_SHRINK ) ; + + dialog .get_vbox() ->pack_start( *hbox_filler, Gtk::PACK_SHRINK ) ; + + dialog .show_all_children() ; + dialog .run(); + + show_libparted_message = ! checkbutton_message .get_active() ; + } + + return PED_EXCEPTION_UNHANDLED ; +} + + +namespace GParted +{ + +Device::Device() +{ +} + +Device::Device( const Glib::ustring & device_path ) +{ + ped_exception_set_handler( PedException_Handler ) ; + + this ->realpath = device_path ; //this one is used by open_device_and_disk + + this ->length = 0;//lazy check.. if something goes wrong while reading the device, length will stay zero and i will know it ( see Win_GParted::Find_Devices ) + + if ( ! open_device_and_disk() ) + return ; + + this ->model = device ->model ; + this ->path = get_sym_path( device ->path ) ; + this ->disktype = disk ->type ->name ; + this ->heads = device ->bios_geom.heads ; + this ->sectors = device ->bios_geom.sectors ; + this ->cylinders = device ->bios_geom.cylinders ; + this ->length = heads * sectors * cylinders ; + + //get valid flags for this device + for ( PedPartitionFlag flag = ped_partition_flag_next ( (PedPartitionFlag) 0 ) ; flag ; flag = ped_partition_flag_next ( flag ) ) + flags .push_back( flag ) ; + + Read_Disk_Layout() ; + +} + +void Device::Read_Disk_Layout() +{ + //clear partitions + this ->device_partitions .clear () ; + + c_partition = ped_disk_next_partition ( disk, NULL) ; + while ( c_partition ) + { + os << this ->path << c_partition ->num ; + + switch( c_partition ->type ) + { + //NORMAL (PRIMARY) + case 0 : if ( c_partition ->fs_type ) + temp = c_partition ->fs_type ->name ; + else + {temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; } + + partition_temp.Set( os.str(),c_partition ->num , GParted::PRIMARY, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , false, ped_partition_is_busy( c_partition ) ); + + partition_temp .flags = Get_Flags( c_partition ) ; + partition_temp .error = this ->error ; + device_partitions.push_back( partition_temp ); + + break; + //LOGICAL + case 1: if ( c_partition ->fs_type ) + temp = c_partition ->fs_type ->name ; + else + {temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; } + + partition_temp.Set( os.str(), c_partition ->num, GParted::LOGICAL, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , true, ped_partition_is_busy( c_partition ) ); + + partition_temp .flags = Get_Flags( c_partition ) ; + partition_temp .error = this ->error ; + device_partitions.push_back( partition_temp ); + + break; + //EXTENDED + case 2: partition_temp.Set( os.str(), c_partition ->num, GParted::EXTENDED, "extended", c_partition ->geom .start, c_partition ->geom .end , -1, false, ped_partition_is_busy( c_partition ) ); + + partition_temp .flags = Get_Flags( c_partition ) ; + partition_temp .error = this ->error ; + device_partitions.push_back( partition_temp ); + + break; + //FREESPACE OUTSIDE EXTENDED + case 4: if ( (c_partition ->geom .end - c_partition ->geom .start) > MEGABYTE ) + { + partition_temp.Set_Unallocated( c_partition ->geom .start , c_partition ->geom .end, false ); + device_partitions.push_back( partition_temp ); + } + + break ; + //FREESPACE INSIDE EXTENDED + case 5: if ( (c_partition ->geom .end - c_partition ->geom .start) > MEGABYTE ) + { + partition_temp.Set_Unallocated( c_partition ->geom .start , c_partition ->geom .end, true ); + device_partitions.push_back( partition_temp ); + } + + break ; + //METADATA (do nothing) + default: break; + } + + //reset stuff.. + this ->error = ""; error_message = ""; os.str(""); + + //next partition (if any) + c_partition = ped_disk_next_partition ( disk, c_partition ) ; + } + +} + +bool Device::Delete_Partition( const Partition & partition ) +{ + if ( partition .type == GParted::EXTENDED ) + c_partition = ped_disk_extended_partition( disk ) ; + else + c_partition = ped_disk_get_partition_by_sector( disk, (partition .sector_end + partition .sector_start) / 2 ) ; + + if ( ! ped_disk_delete_partition( disk, c_partition ) ) + return false; + + return Commit() ; +} + +int Device::Create_Empty_Partition( const Partition & new_partition, PedConstraint * constraint ) +{ + PedPartitionType type; + PedPartition *c_part = NULL ; + + //create new partition + switch ( new_partition .type ) + { + case 0 : type = PED_PARTITION_NORMAL; break; + case 1 : type = PED_PARTITION_LOGICAL; break; + case 2 : type = PED_PARTITION_EXTENDED; break; + default : break; + } + c_part = ped_partition_new ( disk, type, NULL, new_partition .sector_start, new_partition .sector_end ) ; + + //create constraint + if ( ! constraint ) + constraint = ped_constraint_any ( device); + + //and add the whole thingy to disk.. + if ( ! constraint || ! ped_disk_add_partition (disk, c_part, constraint) || ! Commit() ) + return 0 ; + + ped_constraint_destroy (constraint); + return c_part ->num; +} + +bool Device::Create_Partition_With_Filesystem( Partition & new_part, PedTimer * timer) +{ + //no need to create a filesystem on an extended partition + if ( new_part .type == GParted::EXTENDED ) + return Create_Empty_Partition( new_part ) ; + else + { + new_part .partition_number = Create_Empty_Partition( new_part ) ; + return Set_Partition_Filesystem( new_part, timer ) ; + } + +} + +bool Device::Move_Resize_Partition( const Partition & partition_original, const Partition & partition_new , PedTimer *timer ) +{ + PedPartition *c_part = NULL ; + PedFileSystem *fs = NULL ; + PedConstraint *constraint = NULL ; + + //since resizing extended is a bit different i handle it elsewhere.. + if ( partition_new.type == GParted::EXTENDED ) + return Resize_Extended( partition_new, timer ) ; + + //normal partitions.... + c_part = ped_disk_get_partition_by_sector( disk, (partition_original .sector_end + partition_original .sector_start) / 2 ) ; + if ( ! c_part ) + return false; + + fs = ped_file_system_open (& c_part->geom ); + if ( ! fs ) + return false ; + + constraint = ped_file_system_get_resize_constraint (fs); + if ( ! constraint ) + { + ped_file_system_close (fs); + return false; + } + + if ( ! ped_disk_set_partition_geom (disk, c_part, constraint, partition_new .sector_start, partition_new .sector_end ) ) + { + ped_constraint_destroy (constraint); + ped_file_system_close (fs); + return false ; + } + + if ( ! ped_file_system_resize (fs, & c_part->geom, timer) ) + { + ped_constraint_destroy (constraint); + ped_file_system_close (fs); + return false ; + } + + ped_constraint_destroy (constraint); + ped_file_system_close (fs); + + return Commit() ; +} + +bool Device::Set_Partition_Filesystem( const Partition & new_partition, PedTimer * timer) +{ + if ( new_partition .partition_number <= 0 ) + return false ; + + PedPartition *c_part = NULL ; + PedFileSystemType *fs_type = NULL ; + PedFileSystem *fs = NULL ; + + c_part = ped_disk_get_partition_by_sector( disk, (new_partition .sector_end + new_partition .sector_start) / 2 ) ; + if ( ! c_part ) + return false; + + fs_type = ped_file_system_type_get ( new_partition .filesystem .c_str() ) ; + if ( ! fs_type ) + return false; + + fs = ped_file_system_create ( & c_part ->geom, fs_type, timer); + if ( ! fs ) + return false; + + ped_file_system_close (fs); + + if ( ! ped_partition_set_system (c_part, fs_type ) ) + return false; + + return Commit() ; +} + +bool Device::Copy_Partition( Device *source_device, const Partition & source_partition, PedTimer * timer) +{ + PedPartition *c_part_src = NULL; + PedFileSystem *src_fs = NULL; + PedPartition *c_part = NULL; + PedFileSystem *dst_fs = NULL; + PedFileSystemType* dst_fs_type = NULL; + + //prepare source for reading + if ( source_device ->Get_Path() == this ->path ) + c_part_src = ped_disk_get_partition( disk, source_partition .partition_number ) ; + else + c_part_src = source_device ->Get_c_partition( source_partition .partition_number ) ; + + if ( ! c_part_src ) + return false; + + src_fs = ped_file_system_open ( &c_part_src ->geom ); + if ( ! src_fs ) + return false ; + + //create new empty partition + c_part = ped_disk_get_partition( disk,Create_Empty_Partition( source_partition, ped_file_system_get_copy_constraint ( src_fs, device ) ) ) ; + if ( ! c_part ) + return false ; + + //and do the copy + dst_fs = ped_file_system_copy (src_fs, &c_part ->geom, timer); + if ( ! dst_fs ) + { + ped_file_system_close (src_fs); + return false ; + } + + dst_fs_type = dst_fs ->type; // may be different to src_fs->type + + ped_file_system_close (src_fs); + ped_file_system_close (dst_fs); + + if ( !ped_partition_set_system (c_part, dst_fs_type) ) + return false ; + + return Commit() ; +} + +bool Device::Resize_Extended( const Partition & partition , PedTimer *timer) +{ + PedPartition *c_part = NULL ; + PedConstraint *constraint = NULL ; + + c_part = ped_disk_extended_partition( disk ) ; + if ( ! c_part ) + return false; + + constraint = ped_constraint_any ( device ); + if ( ! constraint ) + return false; + + if ( ! ped_disk_set_partition_geom (disk, c_part, constraint, partition.sector_start, partition.sector_end ) ) + { + ped_constraint_destroy (constraint); + return false ; + } + + ped_partition_set_system ( c_part, NULL); + + ped_constraint_destroy (constraint); + + return Commit() ; +} + +bool Device::Commit() +{ + bool return_value = ped_disk_commit_to_dev( disk ) ; + + //i don't want this annoying "warning couldn't reread blabla" message all the time. I throw one myself if necessary ) + ped_exception_fetch_all() ; + ped_disk_commit_to_os( disk ) ; + ped_exception_leave_all() ; + + return return_value ; +} + +PedPartition * Device::Get_c_partition( int part_num ) +{ + return ped_disk_get_partition( disk, part_num ) ; +} + +std::vector Device::Get_Partitions() +{ + return device_partitions; +} + +Sector Device::Get_Length() +{ + return length ; +} + +long Device::Get_Heads() +{ + return heads ; +} + +long Device::Get_Sectors() +{ + return sectors ; +} + +long Device:: Get_Cylinders() +{ + return cylinders ; +} + +Glib::ustring Device::Get_Model() +{ + return model ; +} + +Glib::ustring Device::Get_Path() +{ + return path ; +} + +Glib::ustring Device::Get_RealPath() +{ + return realpath ; +} + +Glib::ustring Device::Get_DiskType() +{ + return disktype ; +} + +bool Device::Get_any_busy() +{ + for ( unsigned int t=0;t ) + * - if this fails the filesystem on the partition is ( more or less ) unknown to the operating system and therefore the unused sectors cannot be calcualted + * - as soon as i have my internetconnection back i should ask people with more experience on this stuff for advice ! + */ + + //check if there is a (known) filesystem + if ( ! c_partition ->fs_type ) + return -1; + + //used sectors are not relevant for swapspace + if ( (Glib::ustring) c_partition ->fs_type ->name == "linux-swap" ) + return -1; + + //METHOD #1 + //the getused method doesn't work on mounted partitions and for some filesystems ( i *guess* this is called check by andrew ) + if ( ! ped_partition_is_busy( c_partition ) && (Glib::ustring) c_partition ->fs_type ->name != "ntfs" ) + { + PedFileSystem *fs = NULL; + PedConstraint *constraint = NULL; + + fs = ped_file_system_open( & c_partition ->geom ); //opening a filesystem is *SLOOOWW* :-( + + if ( fs ) + { + constraint = ped_file_system_get_resize_constraint (fs); + ped_file_system_close (fs); + if ( constraint && constraint->min_size != -1 ) //apperantly the compiler evaluates constraint != NULL before the min_size check. Very nice! :D + return constraint->min_size ; + } + else + this ->error = error_message ; + + } + + //METHOD #2 + //this ony works for mounted ( and therefore known to the OS ) filesystems. My method is quite crude, keep in mind it's only temporarely ;-) + Glib::ustring buf; + system( ("df -k --sync " + sym_path + " | grep " + sym_path + " > /tmp/.tmp_gparted").c_str() ); + std::ifstream file_input( "/tmp/.tmp_gparted" ); + + file_input >> buf; //skip first value + file_input >> buf; + if ( buf != "0" && ! buf.empty() ) + { + file_input >> buf; + file_input.close(); system( "rm -f /tmp/.tmp_gparted" ); + return atoi( buf.c_str() ) * 1024/512 ; + } + file_input.close(); system( "rm -f /tmp/.tmp_gparted" ); + + + return -1 ; //all methods were unsuccesfull + +} + +Glib::ustring Device::Get_Flags( PedPartition *c_partition ) +{ + temp = ""; + + for ( unsigned short t = 0; t < flags.size() ; t++ ) + if ( ped_partition_get_flag ( c_partition, flags[ t ] ) ) + temp += (Glib::ustring) ped_partition_flag_get_name ( flags[ t ] ) + " "; + + return temp ; +} + +bool Device::open_device_and_disk() +{ + device = ped_device_get( this->realpath .c_str() ); + if ( device ) + disk = ped_disk_new( device ); + + if ( ! device || ! disk ) + { + if ( device ) + { ped_device_destroy( device ) ; device = NULL ; } + + return false; + } + + return true ; +} + +void Device::close_device_and_disk() +{ + if ( device ) + { + ped_device_destroy( device ) ; + device = NULL ; + } + + if ( disk ) + { + ped_disk_destroy( disk ) ; + disk = NULL ; + } +} + +Device::~Device() +{ + close_device_and_disk() ; +} + + +} //GParted diff --git a/src/Dialog_About.cc b/src/Dialog_About.cc new file mode 100644 index 00000000..2203df94 --- /dev/null +++ b/src/Dialog_About.cc @@ -0,0 +1,87 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_About.h" + +Dialog_About::Dialog_About() +{ + /*TO TRANSLATORS: this is the dialog title */ + this ->set_title( _( "About GParted" ) ); + this ->set_size_request( -1, 220 ) ; + this ->set_resizable( false ); + this ->set_has_separator( false ) ; + + label_temp = manage( new Gtk::Label() ) ; + label_temp -> set_markup( "\nlogo here ;)\n" ) ; + this ->get_vbox()->pack_start( *label_temp ,Gtk::PACK_SHRINK ); + + label_temp = manage( new Gtk::Label() ) ; + label_temp -> set_markup( "" + (Glib::ustring) _( "GParted" ) + " 0.0.4" ) ; + this ->get_vbox()->pack_start( *label_temp ,Gtk::PACK_SHRINK ); + + label_temp = manage( new Gtk::Label() ) ; + label_temp -> set_text( "\n" + (Glib::ustring) _( "Gnome Partition Editor based on libparted" ) + "\n" ) ; + this ->get_vbox()->pack_start( *label_temp ,Gtk::PACK_SHRINK ); + + label_temp = manage( new Gtk::Label() ) ; + label_temp -> set_markup( "" + (Glib::ustring) _( "Copyright (c)" ) + " 2004 Bart Hakvoort" ) ; + this ->get_vbox()->pack_start( *label_temp ,Gtk::PACK_SHRINK ); + + label_temp = manage( new Gtk::Label() ) ; + label_temp -> set_markup( "http://gparted.sourceforge.net" ) ; + label_temp -> set_selectable( true ) ; + this ->get_vbox()->pack_start( *label_temp ,Gtk::PACK_SHRINK ); + + label_temp = manage( new Gtk::Label() ) ; + label_temp -> set_text( "\t\t" ) ; + + button_credits.add_pixlabel( "/usr/share/icons/hicolor/16x16/stock/generic/stock_about.png", "Credits", 0, 0.5 ) ; + button_credits.signal_clicked() .connect( sigc::mem_fun( this, &Dialog_About::Show_Credits ) ) ; + + this ->get_action_area() ->pack_start( button_credits ) ; + this ->get_action_area() ->pack_start( *label_temp ) ; + this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ); + + this ->show_all_children() ; + +} + +void Dialog_About::Show_Credits() +{ + Gtk::Dialog dialog( _("Credits"), *this ) ; + Gtk::Notebook notebook_credits; + Gtk::VBox vbox_written, vbox_documented, vbox_translators ; + Gtk::Label label_writers( "Bart Hakvoort (gparted@users.sourceforge.net)"); + + vbox_written .set_border_width( 5 ) ; + vbox_written .pack_start( label_writers, Gtk::PACK_SHRINK ) ; + + notebook_credits .set_size_request( -1, 200 ) ; + /*TO TRANSLATORS: tablabel in aboutdialog */ + notebook_credits .append_page( vbox_written, _("Written by") ) ; + /*TO TRANSLATORS: tablabel in aboutdialog */ + notebook_credits .append_page( vbox_documented, _("Documented by") ) ; + /*TO TRANSLATORS: tablabel in aboutdialog */ + notebook_credits .append_page( vbox_translators, _("Translated by") ) ; + + dialog .get_vbox()->pack_start( notebook_credits, Gtk::PACK_SHRINK ); + dialog .add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ); + + dialog .set_resizable( false ); + dialog .show_all_children() ; + dialog .run() ; +} diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc new file mode 100644 index 00000000..19fe04e0 --- /dev/null +++ b/src/Dialog_Base_Partition.cc @@ -0,0 +1,325 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_Base_Partition.h" + +namespace GParted +{ + +Dialog_Base_Partition::Dialog_Base_Partition( ) +{ + this ->set_has_separator( false ) ; + + frame_resizer_base = NULL; + GRIP = false ; + this -> fixed_start = false ; + this -> set_resizable( false ); + + //pack resizer hbox + this ->get_vbox() ->pack_start( hbox_resizer, Gtk::PACK_SHRINK ); + + //add label_minmax + this ->get_vbox() ->pack_start( label_minmax, Gtk::PACK_SHRINK ); + + //pack hbox_main + this ->get_vbox() ->pack_start( hbox_main, Gtk::PACK_SHRINK ); + + //put the vbox with resizer stuff (cool widget and spinbuttons) in the hbox_main + hbox_main .pack_start( vbox_resize_move, Gtk::PACK_EXPAND_PADDING); + + + //fill table + table_resize .set_border_width( 5 ) ; + table_resize .set_row_spacings( 5 ) ; + hbox_table.pack_start( table_resize, Gtk::PACK_EXPAND_PADDING ) ; + + hbox_table .set_border_width( 5 ) ; + vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK ); + + //add spinbutton_before + label_temp = manage( new Gtk::Label( (Glib::ustring) _( "Free Space Preceding") + " (MB) :\t" ) ) ; + table_resize.attach( *label_temp, 0,1,0,1,Gtk::SHRINK); + + spinbutton_before .set_numeric( true ); + spinbutton_before .set_increments( 1, 100 ); + table_resize.attach( spinbutton_before, 1,2,0,1,Gtk::FILL); + + //add spinbutton_size + label_temp = manage( new Gtk::Label( (Glib::ustring) _( "New Size") + " (MB) :" ) ) ; + label_temp ->set_alignment( Gtk::ALIGN_LEFT ); + table_resize.attach( *label_temp, 0,1,1,2 ); + + spinbutton_size .set_numeric( true ); + spinbutton_size .set_increments( 1, 100 ); + table_resize.attach( spinbutton_size, 1,2,1,2,Gtk::FILL); + + //add spinbutton_after + label_temp = manage( new Gtk::Label( (Glib::ustring) _( "Free Space Following") + " (MB) :" ) ) ; + label_temp ->set_alignment( Gtk::ALIGN_LEFT ); + table_resize.attach( *label_temp, 0,1,2,3 ) ; + + spinbutton_after .set_numeric( true ); + spinbutton_after .set_increments( 1, 100 ); + table_resize.attach( spinbutton_after, 1,2,2,3,Gtk::FILL); + + + if ( ! fixed_start ) + before_value = spinbutton_before .get_value() ; + + //connect signalhandlers of the spinbuttons + if ( ! fixed_start ) + spinbutton_before .signal_value_changed().connect( sigc::bind( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE) ) ; + + spinbutton_size .signal_value_changed().connect( sigc::bind( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE) ) ; + spinbutton_after .signal_value_changed().connect( sigc::bind( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER) ) ; + + //pack label which warns about small differences in values.. + label_temp = manage( new Gtk::Label( ) ); + label_temp ->set_markup( "\n " + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "" ); + label_temp ->set_alignment( Gtk::ALIGN_LEFT ) ; + this ->get_vbox() ->pack_start( *label_temp, Gtk::PACK_SHRINK ); + + this ->get_vbox() ->pack_start( *( manage( new Gtk::Label( "") ) ), Gtk::PACK_SHRINK ); //filler :-P + + this->add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); + this ->show_all_children() ; +} + +void Dialog_Base_Partition::Set_Resizer( bool extended ) +{ + if ( extended ) + { + frame_resizer_base = new Frame_Resizer_Extended( ) ; + } + else + { + frame_resizer_base = new Frame_Resizer_Base( ) ; + frame_resizer_base ->signal_move .connect ( sigc::mem_fun( this, &Dialog_Base_Partition::on_signal_move) ); + } + + frame_resizer_base ->set_border_width( 5 ) ; + frame_resizer_base ->set_shadow_type(Gtk::SHADOW_ETCHED_OUT); + + //connect signals + frame_resizer_base ->signal_resize .connect ( sigc::mem_fun( this, &Dialog_Base_Partition::on_signal_resize) ); + + hbox_resizer .pack_start( *frame_resizer_base, Gtk::PACK_SHRINK ); + + this ->show_all_children() ; +} + +Partition Dialog_Base_Partition::Get_New_Partition() +{ + //no need to set the start of a fixed_start one ;-) + if ( ! fixed_start ) + selected_partition.sector_start = START + (Sector) spinbutton_before .get_value() * MEGABYTE ; + + selected_partition.sector_end = selected_partition.sector_start + (Sector) spinbutton_size.get_value() * MEGABYTE ; + + //due to loss of precision during calcs from Sector -> MB and back, it is possible the new partition thinks it's bigger then it can be. Here we solve this. + if ( selected_partition.sector_start < START ) + selected_partition.sector_start = START ; + if ( selected_partition.sector_end > (START + total_length) ) + selected_partition.sector_end = START + total_length ; + + //grow a bit into small freespace ( < 1MB ) + if ( (selected_partition.sector_start - START) < MEGABYTE ) + selected_partition.sector_start = START ; + if ( ( START + total_length - selected_partition.sector_end ) < MEGABYTE ) + selected_partition.sector_end = START + total_length ; + + //set new value of unused.. + if ( selected_partition .sectors_used != -1 ) + selected_partition .sectors_unused = ( selected_partition .sector_end - selected_partition .sector_start) - selected_partition .sectors_used ; + + return selected_partition ; +} + +void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type ) +{ + switch( button_type ) + { + case NEW : this->add_button( Gtk::Stock::ADD,Gtk::RESPONSE_OK ); + break ; + case RESIZE_MOVE : if ( selected_partition.filesystem == "ext2" || selected_partition.filesystem == "ext3" ) + label_temp = manage( new Gtk::Label( _("Resize") ) ) ; + else + label_temp = manage( new Gtk::Label( _("Resize/Move") ) ) ; + + image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) ); + hbox_resize_move .pack_start( *image_temp, Gtk::PACK_EXPAND_PADDING ) ; + hbox_resize_move .pack_start( *label_temp, Gtk::PACK_EXPAND_PADDING ) ; + button_resize_move .add( hbox_resize_move ) ; + + this ->add_action_widget ( button_resize_move,Gtk::RESPONSE_OK ) ; + button_resize_move .set_sensitive( false ) ; + break ; + + case PASTE : this->add_button( Gtk::Stock::PASTE,Gtk::RESPONSE_OK ); + break ; + + } + +} + +void Dialog_Base_Partition::on_signal_move( int x_start, int x_end ) +{ + GRIP = true ; + + if ( x_start == 0 ) + spinbutton_before .set_value( 0 ) ; + else + spinbutton_before .set_value( x_start * MB_PER_PIXEL ) ; + + if ( x_end == 500 ) + { + spinbutton_after .set_value(0 ) ; + spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() ) ; + } + else + spinbutton_after .set_value( TOTAL_MB - spinbutton_before .get_value() - spinbutton_size .get_value() ) ; + + this ->x_start = x_start ; + this ->x_end = x_end ; + + Check_Change() ; + + GRIP = false ; +} + +void Dialog_Base_Partition::on_signal_resize( int x_start, int x_end, Frame_Resizer_Base::ArrowType arrow) +{ + GRIP = true ; + + //check for upper/lower limit fat16 + if ( selected_partition.filesystem == "fat16" && ( ( x_end - x_start ) * MB_PER_PIXEL > 1023 || ( x_end - x_start ) * MB_PER_PIXEL < 32 ) ) + { + frame_resizer_base ->set_x_start( this ->x_start ); + frame_resizer_base ->set_x_end( this ->x_end ); + + frame_resizer_base ->Draw_Partition() ; + GRIP = false ; + return ; + } + + //check for lower limit fat32 + if ( selected_partition.filesystem == "fat32" && ( x_end - x_start ) * MB_PER_PIXEL < 256 ) + { + frame_resizer_base ->set_x_start( this ->x_start ); + frame_resizer_base ->set_x_end( this ->x_end ); + + frame_resizer_base ->Draw_Partition() ; + GRIP = false ; + return ; + } + + + + spinbutton_size .set_value( ( x_end - x_start ) * MB_PER_PIXEL ) ; + + fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value() ; + + if ( arrow == Frame_Resizer_Base::ARROW_RIGHT ) //don't touch freespace before, leave it as it is + { + if ( x_end == 500 ) + { + spinbutton_after .set_value(0 ) ; + spinbutton_size .set_value( TOTAL_MB - before_value ) ; + } + else + spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value() ) ; + } + else if ( arrow == Frame_Resizer_Base::ARROW_LEFT ) //don't touch freespace after, leave it as it is + { + if ( x_start == 0 ) + { + spinbutton_before .set_value( 0 ); + spinbutton_size .set_value( TOTAL_MB - spinbutton_after.get_value() ) ; + } + else + spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() ) ; + } + + this ->x_start = x_start ; + this ->x_end = x_end ; + + Check_Change() ; + + GRIP = false ; +} + +void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton ) +{ + if ( ! GRIP ) + { + //i expect libparted soon to be able to move startpoint of ext2/3 as well, so everything is ready for it. Till then this rudimentary check + fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value() ; + + //Balance the spinbuttons + switch ( spinbutton ) + { + case BEFORE : spinbutton_after.set_value( TOTAL_MB - spinbutton_size.get_value() - before_value) ; + spinbutton_size.set_value( TOTAL_MB - before_value - spinbutton_after.get_value( ) ) ; + + break; + case SIZE : spinbutton_after.set_value( TOTAL_MB - before_value - spinbutton_size.get_value() ); + if ( ! fixed_start ) + spinbutton_before .set_value( TOTAL_MB - spinbutton_size.get_value() - spinbutton_after.get_value() ); + + break; + case AFTER : if ( ! fixed_start ) + spinbutton_before .set_value( TOTAL_MB - spinbutton_size.get_value() - spinbutton_after.get_value() ); + + spinbutton_size.set_value( TOTAL_MB - before_value - spinbutton_after.get_value( ) ) ; + + break; + } + + + //And apply the changes to the visual view... + if ( ! fixed_start ) + frame_resizer_base ->set_x_start( (int) (spinbutton_before .get_value() / MB_PER_PIXEL + 0.5) ) ; + + frame_resizer_base ->set_x_end( (int) ( 500 - ( (double) spinbutton_after .get_value() / MB_PER_PIXEL ) + 0.5 ) ) ; + + this ->x_start = frame_resizer_base ->get_x_start() ; + this ->x_end = frame_resizer_base ->get_x_end() ; + + frame_resizer_base ->Draw_Partition() ; + + Check_Change() ; + } +} + +void Dialog_Base_Partition::Check_Change() +{ + if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() && + ORIG_SIZE == spinbutton_size .get_value_as_int() && + ORIG_AFTER == spinbutton_after .get_value_as_int() + ) + button_resize_move .set_sensitive( false ) ; + else + button_resize_move .set_sensitive( true ) ; +} + +Dialog_Base_Partition::~Dialog_Base_Partition() +{ + if ( frame_resizer_base ) + delete frame_resizer_base ; +} + +} //GParted diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc new file mode 100644 index 00000000..29dfea8e --- /dev/null +++ b/src/Dialog_Partition_Copy.cc @@ -0,0 +1,84 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_Partition_Copy.h" + +namespace GParted +{ + +Dialog_Partition_Copy::Dialog_Partition_Copy() +{ + Set_Resizer( false ) ; + Set_Confirm_Button( PASTE ) ; +} + +void Dialog_Partition_Copy::Set_Data( Partition & selected_partition, Partition & copied_partition ) +{ + GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely + + /*TO TRANSLATORS: dialogtitle, looks like Paste /dev/hda3 */ + this ->set_title( (Glib::ustring) _( "Paste" ) + " " + copied_partition .partition ) ; + + //set partition color + frame_resizer_base ->set_rgb_partition_color( copied_partition .color ) ; + + //set some widely used values... + START = selected_partition.sector_start ; + total_length = selected_partition.sector_end - selected_partition.sector_start ; + TOTAL_MB = selected_partition .Get_Length_MB() ; + MB_PER_PIXEL = (double) TOTAL_MB / 500 ; + + //now calculate proportional length of partition + frame_resizer_base ->set_x_start( 0 ) ; + frame_resizer_base ->set_x_end( ( Round( (double) (copied_partition.sector_end - copied_partition.sector_start) / ( (double)total_length/500) )) ) ; + frame_resizer_base ->set_used( frame_resizer_base ->get_x_end() ) ; + + //set values of spinbutton_before + spinbutton_before .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB() -1 ) ;//mind the -1 !! + spinbutton_before .set_value( 0 ) ; + + //set values of spinbutton_size (check for fat16 maxsize of 1023 MB) + double UPPER; + if ( copied_partition.filesystem == "fat16" && Sector_To_MB( total_length ) > 1023 ) + UPPER = 1023 ; + else + UPPER = TOTAL_MB; + + spinbutton_size .set_range( copied_partition .Get_Length_MB() +1, UPPER ) ; + spinbutton_size .set_value( copied_partition .Get_Length_MB() ) ; + + //set values of spinbutton_after + spinbutton_after .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB() -1 ) ; + spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB() ) ; + + //set contents of label_minmax + os << _("Minimum Size") << ": " << copied_partition .Get_Length_MB() +1 ; + os << " MB\t\t" << _( "Maximum Size" ) << ": " << Sector_To_MB( total_length ) << " MB" ; + label_minmax.set_text( os.str() ) ; os.str("") ; + + //set global selected_partition (see Dialog_Base_Partition::Get_New_Partition ) + this ->selected_partition = copied_partition ; + this ->selected_partition .inside_extended = selected_partition .inside_extended ; + selected_partition .inside_extended ? this ->selected_partition .type = GParted::LOGICAL : this ->selected_partition .type = GParted::PRIMARY ; + + + GRIP = false ; +} + + + +} //GParted diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc new file mode 100644 index 00000000..1011fb33 --- /dev/null +++ b/src/Dialog_Partition_Info.cc @@ -0,0 +1,264 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_Partition_Info.h" + +namespace GParted +{ + +Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) +{ + this -> partition = partition ; + + this->set_resizable( false ); + + /*TO TRANSLATORS: dialogtitle, looks like Information about /dev/hda3 */ + this->set_title( (Glib::ustring) _( "Information about") + " " + partition.partition ); + + init_drawingarea() ; + + //add label for detail and fill with relevant info + Display_Info() ; + + //display error (if any) + if ( partition .error != "" ) + { + frame = manage( new Gtk::Frame() ); + frame ->set_border_width( 10 ); + + image = manage( new Gtk::Image( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON ) ); + label = manage( new Gtk::Label( ) ) ; + label ->set_markup( " " + (Glib::ustring) _( "Libparted message" ) + ": " ) ; + + hbox = manage( new Gtk::HBox() ); + hbox ->pack_start( *image, Gtk::PACK_SHRINK ) ; + hbox ->pack_start( *label, Gtk::PACK_SHRINK ) ; + + frame ->set_label_widget( *hbox ) ; + + label = manage( new Gtk::Label( ) ) ; + label ->set_markup( "" + partition.error + "") ; + label ->set_selectable( true ) ; + label ->set_line_wrap( true ) ; + frame ->add( *label ); + + this ->get_vbox() ->pack_start( *frame, Gtk::PACK_SHRINK ) ; + } + + + this->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ); + this->show_all_children(); +} + +void Dialog_Partition_Info::drawingarea_on_realize( ) +{ + gc = Gdk::GC::create( drawingarea .get_window() ); + + drawingarea .get_window() ->set_background( color_partition ); + +} + +bool Dialog_Partition_Info::drawingarea_on_expose( GdkEventExpose *ev ) +{ + if ( partition.type != GParted::UNALLOCATED ) + { + //used + gc ->set_foreground( color_used ); + drawingarea .get_window() ->draw_rectangle( gc, true, BORDER, BORDER, used ,34 ); + + //unused + gc ->set_foreground( color_unused ); + drawingarea .get_window() ->draw_rectangle( gc, true, BORDER + used, BORDER, unused,34 ); + } + + //text + gc ->set_foreground( color_text ); + drawingarea .get_window() ->draw_layout( gc, BORDER +5, BORDER +1 , pango_layout ) ; + + return true; +} + +void Dialog_Partition_Info::init_drawingarea() +{ + drawingarea .set_size_request( 375, 50 ) ; + drawingarea.signal_realize().connect( sigc::mem_fun(*this, &Dialog_Partition_Info::drawingarea_on_realize) ) ; + drawingarea.signal_expose_event().connect( sigc::mem_fun(*this, &Dialog_Partition_Info::drawingarea_on_expose) ) ; + + frame = manage( new Gtk::Frame() ); + frame ->add ( drawingarea ) ; + + frame ->set_shadow_type(Gtk::SHADOW_ETCHED_OUT); + frame ->set_border_width( 10 ); + hbox = manage( new Gtk::HBox() ) ; + hbox ->pack_start( *frame, Gtk::PACK_EXPAND_PADDING ) ; + + this ->get_vbox() ->pack_start( *hbox, Gtk::PACK_SHRINK ) ; + + //calculate proportional width of used and unused + used = unused = 0 ; + used = (int ) ( ( (375 - BORDER *2) / ( (double) (partition.sector_end - partition.sector_start) / partition.sectors_used ) )+0.5 ) ; + unused = 375 - used - (BORDER *2) ; + + //allocate some colors + color_used.set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ; + + partition .type == GParted::EXTENDED ? color_unused.set( "darkgrey" ) : color_unused.set( "white" ) ; + this ->get_colormap() ->alloc_color( color_unused ) ; + + color_text.set( "black" ); this ->get_colormap() ->alloc_color( color_text ) ; + color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ; + + //set text of pangolayout + os << partition .partition << "\n" << this -> partition .Get_Length_MB() << " MB"; + pango_layout = drawingarea .create_pango_layout ( os.str() ) ;os.str(""); + +} + +void Dialog_Partition_Info::Display_Info() +{ + table = manage( new Gtk::Table() ) ; + table ->set_border_width( 5 ) ; + table ->set_col_spacings(10 ) ; + this ->get_vbox() ->pack_start( *table , Gtk::PACK_SHRINK ) ; + + label = manage( new Gtk::Label( "" ) ) ; + + label ->set_text( label ->get_text() + (Glib::ustring) _( "Filesystem" ) + ":\n" ) ; os << partition.filesystem << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Size" ) + ":\n" ) ; os << this -> partition .Get_Length_MB() << " MB\n"; + + + if ( partition.sectors_used != -1 ) + { + label ->set_text( label ->get_text() + (Glib::ustring) _( "Used" ) + ":\n" ) ; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Unused" ) + ":\n" ) ; + + os << this ->partition .Get_Used_MB() << " MB\n"; + os << this ->partition .Get_Unused_MB() << " MB\n" ; + + int percent_used =(int) ( (double) partition.Get_Used_MB() / partition .Get_Length_MB() *100 +0.5 ) ; + os_percent << "\n\n( " << percent_used << "% )\n( " << 100 - percent_used << "% )\n\n\n"; + } + + label ->set_text( label ->get_text() + (Glib::ustring) _( "Flags" ) + ":\n\n" ) ; os << partition .flags << "\n\n"; + + if ( partition.type != GParted::UNALLOCATED && partition .partition.substr( 0, 3 ) != "New" ) + { + label ->set_text( label ->get_text() + (Glib::ustring) _("Path" ) + ":\n" ) ; os << partition.partition << "\n"; + + //get realpath + char real_path[4096] ; + realpath( partition.partition.c_str() , real_path ); + + //only show realpath if it's diffent from the short path... + if ( partition.partition != real_path ) + { + label ->set_text( label ->get_text() + (Glib::ustring) _("Real Path" ) + ":\n" ) ; + os << (Glib::ustring) real_path << "\n"; + os_percent << "\n" ; + } + + label ->set_text( label ->get_text() + (Glib::ustring) _("Status" ) + ":\n" ) ; + if ( partition.busy ) + Find_Status() ; + else if ( partition.type == GParted::EXTENDED ) + os << (Glib::ustring) _("Not busy (There are no mounted logical partitions)" ) + "\n"; + else if ( partition.filesystem == "linux-swap" ) + os << (Glib::ustring) _("Not active" ) + "\n"; + else + os << (Glib::ustring) _("Not mounted" ) + "\n"; + + os_percent << "\n\n" ; + + } + + label ->set_text( label ->get_text() + "\n" ) ; os << "\n"; //splitter :P + + label ->set_text( label ->get_text() + (Glib::ustring) _("First Sector" ) + ":\n" ) ; os << partition.sector_start << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _("Last Sector" ) + ":\n" ) ; os << partition.sector_end << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _("Total Sectors" ) + ":\n" ) ; os << partition.sector_end - partition.sector_start << "\n"; + + label ->set_text( label ->get_text() + "" ) ; + label ->set_use_markup( true ) ; + table ->attach( *label, 0,1,0,1,Gtk::SHRINK); + + label = manage( new Gtk::Label( ) ) ; + label ->set_markup( os.str() ) ; os.str("") ; + table ->attach( *label, 1,2,0,1,Gtk::SHRINK); + + label = manage( new Gtk::Label( ) ) ; + label ->set_markup( os_percent.str() + "\n\n\n\n" ) ; os_percent.str("") ; + table ->attach( *label, 1,2,0,1,Gtk::SHRINK); +} + +void Dialog_Partition_Info::Find_Status() +{ + if ( partition.type == GParted::EXTENDED ) + { + os << _("Busy (At least one logical partition is mounted)" ) << "\n"; + return ; + } + + + if ( partition.filesystem == "linux-swap" ) + { + os << _("Active") << "\n"; + return ; + } + + //try to find the mountpoint in /proc/mounts + //get realpath + char real_path[4096] ; + realpath( partition.partition.c_str() , real_path ); + Glib::ustring mountpoint, partition_real_path = real_path ; //because root partition is listed as /dev/root we need te compare against te real path.. + + + std::ifstream file_mounts( "/proc/mounts" ) ; + std::string line ; + + while ( getline( file_mounts, line ) ) + { + realpath( line.substr( 0, line.find( ' ' ) ) .c_str() , real_path ); + + if ( partition_real_path == real_path ) + { + mountpoint = line.substr( line.find( ' ' ) +1, line .length() ) ; + /*TO TRANSLATORS: used as: mounted on */ + os << _("Mounted on") << " " << mountpoint .substr( 0, mountpoint .find( ' ' ) ) << "\n"; + break ; + } + + + } + + file_mounts .close() ; + + //sometimes rootdevices are not listed as paths. I'll take a guess and just enter / here...( we'll look into this when complaints start coming in :P ) + if ( mountpoint.empty() ) + os << _("Mounted on") << " /\n"; + +} + +Dialog_Partition_Info::~Dialog_Partition_Info() +{ + this ->get_colormap() ->free_colors( color_used, 1 ) ; + this ->get_colormap() ->free_colors( color_unused, 1 ) ; + this ->get_colormap() ->free_colors( color_text, 1 ) ; + this ->get_colormap() ->free_colors( color_partition, 1 ) ; +} + + +} //GParted diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc new file mode 100644 index 00000000..803b5f44 --- /dev/null +++ b/src/Dialog_Partition_New.cc @@ -0,0 +1,243 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_Partition_New.h" + +namespace GParted +{ + +Dialog_Partition_New::Dialog_Partition_New( ) +{ + /*TO TRANSLATORS: dialogtitle */ + this ->set_title( _("Create new Partition") ) ; + Set_Resizer( false ) ; + Set_Confirm_Button( NEW ) ; + + //set partition color + color_temp .set( selected_partition .Get_Color( "ext2" ) ) ; + frame_resizer_base ->set_rgb_partition_color( color_temp ) ; + + //set the resizer.. + frame_resizer_base ->set_x_start( 0 ) ; + frame_resizer_base ->set_x_end( 500 ) ; + frame_resizer_base ->set_used( 0 ) ; + +} + +void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_extended, unsigned short new_count ) +{ + this->new_count = new_count; + this->selected_partition = partition; + + //add table with selection menu;s... + table_create .set_border_width( 10 ) ; + table_create.set_row_spacings( 5 ) ; + hbox_main .pack_start( table_create, Gtk::PACK_SHRINK ); + + /*TO TRANSLATORS: used as label for a list of choices. Create as: */ + label_type.set_text( (Glib::ustring) _("Create as") + ":\t" ); + table_create.attach( label_type, 0,1,0,1,Gtk::SHRINK); + + //fill partitiontype menu + menu_type.items().push_back(Gtk::Menu_Helpers::MenuElem( "Primary") ) ; + menu_type.items().push_back(Gtk::Menu_Helpers::MenuElem( "Logical") ) ; + menu_type.items().push_back(Gtk::Menu_Helpers::MenuElem( "Extended") ) ; + + //determine which PartitionType is allowed + if ( partition.inside_extended ) + { + menu_type.items()[0] . set_sensitive( false ); + menu_type.items()[2] . set_sensitive( false ); + menu_type.set_active( 1 ); + } + else + { + menu_type.items()[1] . set_sensitive( false ); + if ( any_extended ) menu_type.items()[2] . set_sensitive( false ); + } + + optionmenu_type.set_menu( menu_type ); + optionmenu_type.set_size_request( 150, -1 ); //150 is the ideal width for this table column, (when one widget is set, the rest wil take this width as well) + optionmenu_type.signal_changed().connect( sigc::bind(sigc::mem_fun(*this, &Dialog_Partition_New::optionmenu_changed), true) ); + table_create.attach( optionmenu_type, 1,2,0,1,Gtk::FILL); + + //filesystems to choose from + label_filesystem.set_text( (Glib::ustring) _("Filesystem") + ":\t" ); + table_create.attach( label_filesystem, 0,1,1,2,Gtk::SHRINK); + + Build_Filesystems_Menu() ; + + optionmenu_filesystem.set_menu( menu_filesystem ); + optionmenu_filesystem.signal_changed().connect( sigc::bind(sigc::mem_fun(*this, &Dialog_Partition_New::optionmenu_changed), false) ); + table_create.attach( optionmenu_filesystem, 1,2,1,2,Gtk::FILL); + + //set some widely used values... + START = partition.sector_start ; + total_length = partition.sector_end - partition.sector_start ; + TOTAL_MB = this ->selected_partition .Get_Length_MB() ; + MB_PER_PIXEL = (double) TOTAL_MB / 500 ; + + //set spinbuttons + GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely + + spinbutton_before .set_range( 0, TOTAL_MB -1 ) ;//mind the -1 !! + spinbutton_before .set_value( 0 ) ; + + spinbutton_size .set_range( 1, TOTAL_MB ) ; + spinbutton_size .set_value( TOTAL_MB ) ; + + spinbutton_after .set_range( 0, TOTAL_MB -1 ) ;//mind the -1 !! + spinbutton_after .set_value( 0 ) ; + + GRIP = false ; + + //set contents of label_minmax + os << _("Minimum Size") << ": " << 1 << " MB\t\t"; + os << _("Maximum Size") << ": " << TOTAL_MB << " MB" ; + label_minmax.set_text( os.str() ) ; os.str("") ; + + this ->show_all_children() ; +} + +Partition Dialog_Partition_New::Get_New_Partition() +{ + Partition part_temp ; + PartitionType part_type; + Sector new_start, new_end; + + switch ( optionmenu_type.get_history() ) + { + case 0 : part_type = GParted::PRIMARY; break; + case 1 : part_type = GParted::LOGICAL; break; + case 2 : part_type = GParted::EXTENDED; break; + } + + new_start = START + (Sector) (spinbutton_before .get_value() * MEGABYTE) ; + new_end = new_start + (Sector) (spinbutton_size .get_value() * MEGABYTE) ; + + //due to loss of precision during calcs from Sector -> MB and back, it is possible the new partition thinks it's bigger then it can be. Here we try to solve this. + if ( new_start < selected_partition.sector_start ) + new_start = selected_partition.sector_start ; + if ( new_end > selected_partition.sector_end ) + new_end = selected_partition.sector_end ; + + os << "New Partition #" << new_count; + part_temp.Set( os.str(), new_count, part_type , filesystems[ optionmenu_filesystem.get_history() ], new_start, new_end, -1, selected_partition.inside_extended, false) ; os.str("") ; + + //THIS SHOULD PROBABLY BE A SETTING IN USERSPACE! ( grow new partition a bit if freespaces are < 1 MB ) + if ( (part_temp.sector_start - selected_partition.sector_start) < MEGABYTE ) + part_temp.sector_start = selected_partition.sector_start ; + if ( (selected_partition.sector_end - part_temp.sector_end) < MEGABYTE ) + part_temp.sector_end = selected_partition.sector_end ; + + return part_temp; +} + + + +void Dialog_Partition_New::optionmenu_changed( bool type ) +{ + //optionmenu_type + if ( type ) + { + if (optionmenu_type.get_history() == GParted::EXTENDED ) + { + menu_filesystem.items().push_back(Gtk::Menu_Helpers::MenuElem( "extended") ) ; + optionmenu_filesystem.set_history( 5 ) ; + optionmenu_filesystem.set_sensitive( false ); + } + else if ( menu_filesystem.items() .size() > 5 ) + { + menu_filesystem.items() .remove( menu_filesystem.items() .back() ); + optionmenu_filesystem.set_sensitive( true ); + optionmenu_filesystem.set_history( 0 ) ; + } + + } + + //optionmenu_filesystem + if ( ! type ) + { + selected_partition .filesystem = filesystems[ optionmenu_filesystem .get_history() ] ; //needed vor upper limit check (see also Dialog_Base_Partition::on_signal_resize ) + + //set new spinbutton ranges + long MIN, MAX; + switch ( optionmenu_filesystem .get_history() ) + { + case 1 : MIN = 32 ; + TOTAL_MB > 1023 ? MAX = 1023 : MAX = TOTAL_MB ; + break; + case 2 : MIN = 256 ; + MAX = TOTAL_MB ; + break; + default : MIN = 1 ; + MAX = TOTAL_MB ; + } + + spinbutton_before .set_range( 0, TOTAL_MB - MIN ) ; + spinbutton_size .set_range( MIN, MAX ) ; + spinbutton_after .set_range( 0, TOTAL_MB - MIN ) ; + + //set contents of label_minmax + os << _("Minimum Size") << ": " << MIN << " MB\t\t"; + os << _("Maximum Size") << ": " << MAX << " MB" ; + label_minmax.set_text( os.str() ) ; os.str("") ; + + } + + + //set fitting resizer colors + //backgroundcolor.. + optionmenu_type.get_history() == 2 ? color_temp .set( "darkgrey" ) : color_temp .set( "white" ) ; + frame_resizer_base ->override_default_rgb_unused_color( color_temp ); + + //partitioncolor.. + color_temp .set( selected_partition .Get_Color( filesystems[ optionmenu_filesystem.get_history() ] ) ) ; + frame_resizer_base ->set_rgb_partition_color( color_temp ) ; + + frame_resizer_base ->Draw_Partition() ; +} + +void Dialog_Partition_New::Build_Filesystems_Menu() +{ + //those filesystems can be created by libparted (NOTE: to create reiserfs you need libreiserfs, i'll look into that later ) + filesystems.push_back( "ext2" ); + filesystems.push_back( "fat16" ); + filesystems.push_back( "fat32" ); + filesystems.push_back( "linux-swap" ); + filesystems.push_back( "ReiserFS" ); //libreiserfs needed + filesystems.push_back( "extended" ); //convenient ;) + + //fill the filesystem menu with those filesystems (except for extended) + for ( unsigned int t=0; t< filesystems.size() -1 ; t++ ) + menu_filesystem.items().push_back(Gtk::Menu_Helpers::MenuElem( filesystems[t] ) ) ; + + //check if selected unallocated is big enough for fat fs'es + if ( this ->selected_partition .Get_Length_MB() < 32 ) + menu_filesystem.items()[ 1 ] .set_sensitive( false ) ; + if ( this ->selected_partition .Get_Length_MB() < 256 ) + menu_filesystem.items()[ 2 ] .set_sensitive( false ) ; + + + //disable reiserfs for the time being... + menu_filesystem.items()[ 4 ] .set_sensitive( false ) ; + +} + + + +} //GParted diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc new file mode 100644 index 00000000..bf67e071 --- /dev/null +++ b/src/Dialog_Partition_Resize_Move.cc @@ -0,0 +1,237 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_Partition_Resize_Move.h" + +namespace GParted +{ + +Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( ) +{ +} + +void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partition, const std::vector & partitions ) +{ + GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely + + this ->selected_partition = selected_partition ; + + if ( selected_partition .type == GParted::EXTENDED ) + { + Set_Resizer( true ) ; + Resize_Move_Extended( partitions ) ; + } + else + { + Set_Resizer( false ) ; + Resize_Move_Normal( partitions ) ; + } + + //set partition color + frame_resizer_base ->set_rgb_partition_color( selected_partition .color ) ; + + //set some initial values... ( i believe i only use these for fat16 checks.. *sigh* ) + this ->x_start = frame_resizer_base ->get_x_start() ; + this ->x_end = frame_resizer_base ->get_x_end() ; + + //store the original values + ORIG_BEFORE = spinbutton_before .get_value_as_int() ; + ORIG_SIZE = spinbutton_size .get_value_as_int() ; + ORIG_AFTER = spinbutton_after .get_value_as_int() ; + + GRIP = false ; + + Set_Confirm_Button( RESIZE_MOVE ) ; + this ->show_all_children() ; +} + +void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector & partitions ) +{ + + //see if we need a fixed_start + if ( selected_partition.filesystem == "ext2" || selected_partition.filesystem == "ext3" ) + { + /*TO TRANSLATORS: dialogtitle. used as Resize /dev/hda1 */ + this ->set_title( (Glib::ustring) _("Resize") + " " + selected_partition .partition ) ; + this ->fixed_start = true; + frame_resizer_base ->set_fixed_start( true ) ; + spinbutton_before .set_sensitive( false ) ; + } + else + { + /*TO TRANSLATORS: dialogtitle. used as Resize/Move /dev/hda1 */ + this ->set_title( (Glib::ustring) _("Resize/Move") + " " + selected_partition .partition ) ; + frame_resizer_base ->set_fixed_start( false ) ; + } + + //calculate total size in MB's of previous, current and next partition + //first find index of partition + unsigned int t; + for ( t=0;t< partitions.size(); t++ ) + if ( partitions[t].sector_start == selected_partition.sector_start && partitions[t].type != GParted::EXTENDED ) + break; + + Sector previous, next ; + previous = next = 0 ; + //also check the partitions filesystem ( if this is ext2/3 then previous should be 0 ) + if ( t >= 1 && partitions[t -1].type == GParted::UNALLOCATED && selected_partition.filesystem != "ext2" && selected_partition.filesystem != "ext3" && partitions[t -1] .inside_extended == selected_partition.inside_extended ) + { + previous = partitions[t -1].sector_end - partitions[t -1].sector_start ; + START = partitions[t -1].sector_start ; + } + else + START = selected_partition.sector_start ; + + if ( t +1 < partitions.size() && partitions[t +1].type == GParted::UNALLOCATED && partitions[t +1] .inside_extended == selected_partition.inside_extended ) + next = partitions[t +1].sector_end - partitions[t +1].sector_start ; + + total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next; + TOTAL_MB = Sector_To_MB( total_length ) ; + + MB_PER_PIXEL = (double) TOTAL_MB / 500 ; + + //now calculate proportional length of partition + frame_resizer_base ->set_x_start( Round( (double) previous / ( (double)total_length/500) ) ) ; + frame_resizer_base ->set_x_end( ( Round( (double) (selected_partition.sector_end - selected_partition.sector_start) / ( (double)total_length/500) )) + frame_resizer_base ->get_x_start() ) ; + frame_resizer_base ->set_used( Round( (double) selected_partition.sectors_used / ( (double)total_length/500) ) ) ; + + //set values of spinbutton_before + if ( ! fixed_start ) + { + spinbutton_before .set_range( 0, Sector_To_MB(total_length - selected_partition.sectors_used) -1 ) ;//mind the -1 !! + spinbutton_before .set_value( Sector_To_MB( previous ) ) ; + } + + //set values of spinbutton_size + //since some filesystems have upper and lower limits we need to check for this + double LOWER, UPPER; + if ( selected_partition.filesystem == "fat16" && selected_partition .Get_Used_MB() < 32 ) + LOWER = 32 +1 ; + else if ( selected_partition.filesystem == "fat32" && selected_partition .Get_Used_MB() < 256 ) + LOWER = 256 +1; //when shrinking to 256 the filesystem converts to fat16, thats why i added the 1 + else + LOWER = selected_partition .Get_Used_MB() +1; + + if ( selected_partition.filesystem == "fat16" && Sector_To_MB( total_length ) > 1023 ) + UPPER = 1023 ; + else + UPPER = Sector_To_MB( total_length ) ; + + spinbutton_size .set_range( LOWER , UPPER ) ; + spinbutton_size .set_value( selected_partition .Get_Length_MB() ) ; + + //set values of spinbutton_after + spinbutton_after .set_range( 0, Sector_To_MB( total_length ) - LOWER ) ; + spinbutton_after .set_value( Sector_To_MB( next ) ) ; + + //set contents of label_minmax + os << _("Minimum Size") << ": " << LOWER << " MB\t\t"; + os << _("Maximum Size") << ": " << Sector_To_MB( total_length ) << " MB" ; + label_minmax.set_text( os.str() ) ; os.str("") ; +} + + +void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector & partitions ) +{ + //calculate total size in MB's of previous, current and next partition + //first find index of partition + unsigned int t; + for ( t=0;t< partitions.size(); t++ ) + if ( partitions[t].type == GParted::EXTENDED ) + break; + + Sector previous, next ; + previous = next = 0 ; + //calculate length and start of previous + if ( t > 0 && partitions[t -1].type == GParted::UNALLOCATED ) + { + previous = partitions[t -1].sector_end - partitions[t -1].sector_start ; + START = partitions[t -1].sector_start ; + } + else + START = selected_partition.sector_start ; + + //calculate length of next (in this case next should be the first partition OUTSIDE the extended .. ) + for ( t+=1;tset_x_start( Round( (double) previous / ( (double)total_length/500) ) ) ; + frame_resizer_base ->set_x_end( ( Round( (double) (selected_partition.sector_end - selected_partition.sector_start) / ( (double)total_length/500) )) + frame_resizer_base ->get_x_start() ) ; + + //used is a bit different here... we consider start of first logical to end last logical as used space + Sector first =0, used =0 ; + for ( t=0;t< partitions.size(); t++ ) + { + if ( partitions[t].type == GParted::LOGICAL ) + { + if ( first == 0 ) + first = partitions[t] .sector_start ; + + used = partitions[t] .sector_end - first; + } + } + + frame_resizer_base ->set_used_start( Round( (double) (first - START) / ( (double)total_length/500) ) ) ; + frame_resizer_base ->set_used( Round( (double) used / ( (double)total_length/500) ) ) ; + + //set values of spinbutton_before (we assume there is no fixed start.) + if ( first == 0 ) //no logicals + spinbutton_before .set_range( 0, TOTAL_MB - 1) ; + else + spinbutton_before .set_range( 0, Sector_To_MB (first - START) ) ; + + spinbutton_before .set_value( Sector_To_MB ( previous ) ) ; + + //set values of spinbutton_size + if ( first == 0 ) //no logicals + spinbutton_size .set_range( 1 , TOTAL_MB ) ; + else + spinbutton_size .set_range( Sector_To_MB( used ) , TOTAL_MB ) ; + + spinbutton_size .set_value( selected_partition .Get_Length_MB() ) ; + + //set values of spinbutton_after + if ( first == 0 ) //no logicals + spinbutton_after .set_range( 0, TOTAL_MB -1 ) ; + else + spinbutton_after .set_range( 0, Sector_To_MB( total_length + START - first - used) ) ; + + spinbutton_after .set_value( Sector_To_MB( next ) ) ; + + //set contents of label_minmax + os << _("Minimum Size") << ": " << Sector_To_MB( used ) +1 << " MB\t\t"; + os << _("Maximum Size") << ": " << TOTAL_MB << " MB" ; + label_minmax.set_text( os.str() ) ; os.str("") ; + +} + + +} //GParted diff --git a/src/Dialog_Progress.cc b/src/Dialog_Progress.cc new file mode 100644 index 00000000..57508d19 --- /dev/null +++ b/src/Dialog_Progress.cc @@ -0,0 +1,92 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Dialog_Progress.h" + +Dialog_Progress::Dialog_Progress( int count_operations, const Glib::ustring & first_operation ) +{ + this ->set_size_request( 500, 275 ) ; + this ->set_resizable( false ) ; + this ->set_has_separator( false ) ; + this ->set_title( _("Applying pending operations") ) ; + + this ->count_operations = count_operations ; + current_operation_number = 0; + + fraction =(double) 1 / count_operations ; + fraction -= 1E-8 ; //minus 1E-8 is to prevent fraction from ever reaching >=1, it needs to be 0.0 < fraction < 1.0 + + label_temp = manage( new Gtk::Label() ) ; + label_temp ->set_alignment( Gtk::ALIGN_LEFT ); + os << "" << _( "Applying pending operations" ) << "\n\n" ; + os << _("All listed operations are applied to disk.") ; + os << "\n"; + os << _("Clicking Cancel will prevent the next operations from being applied.") ; + os << "\n"; + label_temp ->set_markup( os.str() ) ; os.str("") ; + this->get_vbox() ->pack_start( *label_temp, Gtk::PACK_SHRINK ); + + progressbar_current.set_text( _("initializing...") ); + this->get_vbox() ->pack_start( progressbar_current , Gtk::PACK_SHRINK); + + label_current.set_alignment( Gtk::ALIGN_LEFT ); + label_current.set_markup( "" + first_operation + "" ) ; + this->get_vbox() ->pack_start( label_current, Gtk::PACK_SHRINK ); + + label_all_operations.set_alignment( Gtk::ALIGN_LEFT ); + label_all_operations.set_markup( "\n" + (Glib::ustring) _( "Completed Operations" ) + ":"); + this->get_vbox() ->pack_start( label_all_operations, Gtk::PACK_SHRINK ); + + sprintf( c_buf, _("%d of %d operations complete"), 0, count_operations ) ; + progressbar_all.set_text( c_buf ) ; + + this->get_vbox() ->pack_start( progressbar_all, Gtk::PACK_SHRINK ); + + this->get_vbox() ->set_spacing( 5 ) ; + this->get_vbox() ->set_border_width( 15 ) ; + + this->add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );//doesn't work for current operation + this->show_all_children() ; +} + +Dialog_Progress::~Dialog_Progress() +{ +} + +void Dialog_Progress::Set_Next_Operation( ) +{ + progressbar_all.set_fraction( progressbar_all.get_fraction() + fraction ); + + sprintf( c_buf, _("%d of %d operations complete"), ++current_operation_number, count_operations ) ; + progressbar_all.set_text( c_buf ) ; + + label_current.set_markup( "" + current_operation + "" ) ; + progressbar_current.set_fraction( 0 ); + progressbar_current.set_text( "initializing..." ); +} + +void Dialog_Progress::Set_Progress_Current_Operation( ) +{ + progressbar_current.set_fraction( fraction_current ); + + if ( time_left > 59 && time_left < 120 ) + sprintf( c_buf, _("about %d minute and %d seconds left"), time_left/60, time_left % 60 ) ; + else + sprintf( c_buf, _("about %d minutes and %d seconds left"), time_left/60, time_left % 60 ) ; + + progressbar_current.set_text( c_buf ) ; +} diff --git a/src/Frame_Resizer_Base.cc b/src/Frame_Resizer_Base.cc new file mode 100644 index 00000000..6a73dbf9 --- /dev/null +++ b/src/Frame_Resizer_Base.cc @@ -0,0 +1,296 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Frame_Resizer_Base.h" + +Frame_Resizer_Base::Frame_Resizer_Base() +{ + this ->fixed_start = false ; + init() ; +} + +void Frame_Resizer_Base::init() +{ + drawingarea.set_size_request( 536, 50 ); + + drawingarea.signal_realize().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_realize) ) ; + drawingarea.signal_expose_event().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_expose) ) ; + drawingarea.signal_motion_notify_event().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_mouse_motion) ) ; + drawingarea.signal_button_press_event().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_button_press_event) ) ; + drawingarea.signal_button_release_event().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_button_release_event) ) ; + drawingarea.signal_leave_notify_event().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_leave_notify) ) ; + + this ->add( drawingarea ) ; + + color_used.set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ; + color_unused.set( "white" ); this ->get_colormap() ->alloc_color( color_unused ) ; + color_arrow.set( "black" ); this ->get_colormap() ->alloc_color( color_arrow ) ; + color_background.set( "darkgrey" ); this ->get_colormap() ->alloc_color( color_background ) ; + color_arrow_rectangle.set( "lightgrey" ); this ->get_colormap() ->alloc_color( color_arrow_rectangle ) ; + + cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ; + cursor_normal = new Gdk::Cursor( Gdk::LEFT_PTR ) ; + cursor_move = new Gdk::Cursor( Gdk::FLEUR ) ; + + GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false; + X_END = 0; + + Gdk::Point p; + p.set_y( 15); arrow_points.push_back( p ) ; + p.set_y( 25); arrow_points.push_back( p ) ; + p.set_y( 35); arrow_points.push_back( p ) ; + + this ->show_all_children(); +} + + +void Frame_Resizer_Base::set_rgb_partition_color( const Gdk::Color & color ) +{ + this ->get_colormap() ->free_colors( color_partition, 1 ) ; + this->color_partition = color ; + this ->get_colormap() ->alloc_color( color_partition ) ; +} + +void Frame_Resizer_Base::override_default_rgb_unused_color( const Gdk::Color & color ) +{ + this ->get_colormap() ->free_colors( color_unused, 1 ) ; + this->color_unused = color ; + this ->get_colormap() ->alloc_color( color_unused ) ; +} + +void Frame_Resizer_Base::set_x_start( int x_start) +{ + this ->X_START = x_start +10;//space for leftgripper +} + +void Frame_Resizer_Base::set_x_end( int x_end ) +{ + this ->X_END = x_end +26 ; //space for leftgripper + 2 * BORDER +} + +void Frame_Resizer_Base::set_used( int used) +{ + this ->USED = used ; +} + +void Frame_Resizer_Base::set_fixed_start( bool fixed_start ) +{ + this ->fixed_start = fixed_start ; +} + +void Frame_Resizer_Base::set_used_start( int used_start ) +{ + if ( used_start <= 0 ) + this ->USED_START = 10 ; + else + this ->USED_START = used_start +10; +} + +int Frame_Resizer_Base::get_used() +{ + return USED ; +} + +int Frame_Resizer_Base::get_x_start() +{ + return X_START -10 ; +} + +int Frame_Resizer_Base::get_x_end() +{ + return X_END -26 ; +} + +void Frame_Resizer_Base::drawingarea_on_realize( ) +{ + gc = Gdk::GC::create( drawingarea .get_window() ); + + drawingarea .get_window() ->set_background(color_background); + + drawingarea.add_events(Gdk::POINTER_MOTION_MASK ); + drawingarea.add_events(Gdk::BUTTON_PRESS_MASK ); + drawingarea.add_events(Gdk::BUTTON_RELEASE_MASK ); + drawingarea.add_events(Gdk::LEAVE_NOTIFY_MASK ); +} + +bool Frame_Resizer_Base::drawingarea_on_expose( GdkEventExpose * ev ) +{ + Draw_Partition() ; + return true; +} + +bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev ) +{ + if ( ! GRIP_LEFT && ! GRIP_RIGHT && ! GRIP_MOVE ) //no need to check this while resizing or moving + { + //check if pointer is over a gripper + if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip + drawingarea .get_parent_window() ->set_cursor( *cursor_move ) ; + else //normal pointer + drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ; + } + + + //here's where the real work is done ;-) + if ( GRIP_LEFT || GRIP_RIGHT || GRIP_MOVE) + { + if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= X_END - USED - BORDER * 2 ) + { + X_START =(int) ev -> x ; + signal_resize.emit( X_START -10, X_END -26, ARROW_LEFT) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + } + + else if ( GRIP_RIGHT && ev ->x >= X_START + USED + BORDER *2 && ev ->x <= 526 ) + { + X_END = (int) ev ->x ; + signal_resize.emit( X_START -10, X_END -26, ARROW_RIGHT) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + } + + else if ( GRIP_MOVE ) + { + temp_x = X_START + ((int) ev ->x - X_START_MOVE); + temp_y = X_END + ( (int) ev ->x - X_START_MOVE); + + if ( temp_x >= 10 && temp_y <= 526 ) + { + X_START = temp_x ; + X_END = temp_y ; + } + + X_START_MOVE = (int) ev ->x ; + + signal_move.emit( X_START -10, X_END -26) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + } + + Draw_Partition() ; + } + + return true; + +} + +bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev ) +{ + GRIP_MOVE = false; GRIP_RIGHT = false; GRIP_LEFT = false ; + + if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip + GRIP_LEFT = true ; + else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip + GRIP_RIGHT = true ; + else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip + { GRIP_MOVE = true ; X_START_MOVE = (int)ev ->x; } + + return true; +} + +bool Frame_Resizer_Base::drawingarea_on_button_release_event( GdkEventButton *ev ) +{ + GRIP_LEFT = false ; GRIP_RIGHT = false ; GRIP_MOVE = false; + + return true; +} + +bool Frame_Resizer_Base::drawingarea_on_leave_notify( GdkEventCrossing *ev ) +{ + if ( ! GRIP_LEFT && ! GRIP_RIGHT && ! GRIP_MOVE && (ev ->y > 50 - BORDER || ev ->y < BORDER) ) + drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ; + + return true; +} + +void Frame_Resizer_Base::Draw_Partition( ) +{ + UNUSED = X_END - X_START - BORDER * 2 - USED ; + if ( UNUSED < 0 ) + UNUSED = 0 ; + + drawingarea .get_window() ->clear () ; + + //the two rectangles on each side of the partition + gc ->set_foreground( color_arrow_rectangle ); + drawingarea .get_window() ->draw_rectangle( gc, true, 0,0,10,50 ); + drawingarea .get_window() ->draw_rectangle( gc, true, 526,0,10,50 ); + + //partition + gc ->set_foreground( color_partition ); + drawingarea .get_window() ->draw_rectangle( gc, true, X_START,0,X_END - X_START,50 ); + + //used + gc ->set_foreground( color_used ); + drawingarea .get_window() ->draw_rectangle( gc, true, X_START + BORDER, BORDER, USED ,34 ); + + //unused + gc ->set_foreground( color_unused ); + drawingarea .get_window() ->draw_rectangle( gc, true, X_START + BORDER +USED, BORDER, UNUSED,34 ); + + //resize grips + if ( ! fixed_start ) + Draw_Resize_Grip( ARROW_LEFT ) ; + + Draw_Resize_Grip( ARROW_RIGHT ) ; + +} + +void Frame_Resizer_Base::Draw_Resize_Grip( ArrowType arrow_type ) +{ + if ( arrow_type == ARROW_LEFT ) + { + arrow_points[0] .set_x( X_START) ; + arrow_points[1] .set_x( X_START -10) ; + arrow_points[2] .set_x( X_START) ; + } + else + { + arrow_points[0] .set_x( X_END) ; + arrow_points[1] .set_x( X_END +10) ; + arrow_points[2] .set_x( X_END) ; + } + + //attach resize arrows to the partition + gc ->set_foreground( color_arrow_rectangle ); + + if ( arrow_type == ARROW_LEFT ) + drawingarea .get_window() ->draw_rectangle( gc, false, X_START -10 , 5, 9 , 40 ); + else + drawingarea .get_window() ->draw_rectangle( gc, false, X_END +1, 5, 9 , 40 ); + + gc ->set_foreground( color_arrow ); + drawingarea .get_window() ->draw_polygon( gc , true, arrow_points ); + +} + + +Frame_Resizer_Base::~Frame_Resizer_Base() +{ + this ->get_colormap() ->free_colors( color_used, 1 ) ; + this ->get_colormap() ->free_colors( color_unused, 1 ) ; + this ->get_colormap() ->free_colors( color_arrow, 1 ) ; + this ->get_colormap() ->free_colors( color_background, 1 ) ; + this ->get_colormap() ->free_colors( color_partition, 1 ) ; + this ->get_colormap() ->free_colors( color_arrow_rectangle, 1 ) ; + + if ( cursor_resize ) + delete cursor_resize ; + if ( cursor_normal ) + delete cursor_normal ; + if ( cursor_move ) + delete cursor_move ; +} diff --git a/src/Frame_Resizer_Extended.cc b/src/Frame_Resizer_Extended.cc new file mode 100644 index 00000000..90e24c4b --- /dev/null +++ b/src/Frame_Resizer_Extended.cc @@ -0,0 +1,79 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Frame_Resizer_Extended.h" + +Frame_Resizer_Extended::Frame_Resizer_Extended( ) +{ + +} + +bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev ) +{ + if ( ! GRIP_LEFT && ! GRIP_RIGHT ) //no need to check this while resizing + { + //check if pointer is over a gripper + if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + else //normal pointer + drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ; + } + + if ( GRIP_LEFT || GRIP_RIGHT ) + { + if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= 510 && ev->x <= X_END - BORDER *2 && ( ev ->x <= USED_START || USED == 0 ) ) + { + X_START =(int) ev -> x ; + signal_resize.emit( X_START -10, X_END -26, ARROW_LEFT) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + } + + else if ( GRIP_RIGHT && ev ->x <= 526 && ev->x >= X_START + BORDER *2 && ev ->x >= USED_START + USED + BORDER *2 ) + { + X_END = (int) ev ->x ; + signal_resize.emit( X_START -10, X_END -26, ARROW_RIGHT) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + } + + Draw_Partition() ; + } + return true ; +} + +void Frame_Resizer_Extended::Draw_Partition() +{ + drawingarea .get_window() ->clear () ; + + //the two rectangles on each side of the partition + gc ->set_foreground( color_arrow_rectangle ); + drawingarea .get_window() ->draw_rectangle( gc, true, 0,0,10,50 ); + drawingarea .get_window() ->draw_rectangle( gc, true, 526,0,10,50 ); + + //used + gc ->set_foreground( color_used ); + drawingarea .get_window() ->draw_rectangle( gc, true, USED_START + BORDER, BORDER, USED ,34 ); + + //partition + gc ->set_foreground( color_partition ); + for( short t=0; t<9 ;t++ ) + drawingarea .get_window() ->draw_rectangle( gc, false, X_START +t,t,X_END - X_START -t*2,50 - t*2 ); + + //resize grips + Draw_Resize_Grip( ARROW_LEFT ) ; + Draw_Resize_Grip( ARROW_RIGHT ) ; + +} diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 00000000..432c73cb --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,36 @@ +INCLUDES =\ + $(GTKMM_CFLAGS) + +AM_CFLAGS =\ + -Wall\ + -g + +AM_CXXFLAGS =\ + -Wall\ + -g + +sbin_PROGRAMS = gparted + +gparted_SOURCES = \ + main.cc\ + Win_GParted.cc\ + TreeView_Detail.cc\ + Dialog_Partition_Copy.cc\ + Dialog_Partition_Info.cc\ + Dialog_Partition_New.cc\ + Operation.cc\ + Partition.cc\ + Dialog_Progress.cc\ + Device.cc\ + VBox_VisualDisk.cc\ + Dialog_Partition_Resize_Move.cc\ + Dialog_About.cc\ + Frame_Resizer_Base.cc\ + Frame_Resizer_Extended.cc\ + Dialog_Base_Partition.cc + +gparted_LDFLAGS = -lparted -lgthread-2.0 + +gparted_LDADD = \ + $(GTKMM_LIBS) + diff --git a/src/Operation.cc b/src/Operation.cc new file mode 100644 index 00000000..c5d35839 --- /dev/null +++ b/src/Operation.cc @@ -0,0 +1,441 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Operation.h" + +namespace GParted +{ + +Operation::Operation( Device *device, Device *source_device, const Partition & partition_original , const Partition & partition_new , OperationType operationtype) +{ + this->device = device; + this->device_path = device ->Get_Path() ; + + //this is only used when operationtype == COPY + this->source_device = source_device; + this->source_device_path = source_device ->Get_Path() ; + + this->partition_original = partition_original; + this->partition_new = partition_new; + this->operationtype = operationtype; +} + + +Glib::ustring Operation::Get_String() +{ + std::ostringstream os; + Glib::ustring temp ; + Sector diff ; + + switch ( operationtype ) + { + case DELETE : + if (partition_original.type == GParted::LOGICAL) + /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */ + sprintf( c_buf, _("Delete %s (%s, %ld MB) from %s"), "Logical Partition", partition_original.filesystem.c_str(), partition_original .Get_Length_MB(), device ->Get_Path().c_str() ) ; + else + sprintf( c_buf, _("Delete %s (%s, %ld MB) from %s"), partition_original.partition .c_str(), partition_original.filesystem.c_str(), partition_original .Get_Length_MB(), device ->Get_Path().c_str() ) ; + os << c_buf ; + break; + case CREATE : switch( partition_new.type ) + { + case GParted::PRIMARY : temp = "Primary"; break; + case GParted::LOGICAL : temp = "Logical"; break; + case GParted::EXTENDED : temp = "Extended"; break; + default : break; + } + /*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */ + sprintf( c_buf, _("Create %s Partition #%d (%s, %ld MB) on %s"), temp .c_str(), partition_new.partition_number, partition_new.filesystem .c_str() , partition_new .Get_Length_MB(), device ->Get_Path() .c_str() ) ; + os << c_buf ; + break; + case RESIZE_MOVE : //if startsector has changed >= 1 MB we consider it a move + diff = Abs( partition_new .sector_start - partition_original .sector_start ) ; + + if ( diff >= MEGABYTE ) + { + if ( partition_new .sector_start > partition_original .sector_start ) + sprintf( c_buf, _("Move %s up by %ld MB "), partition_new.partition .c_str(), Sector_To_MB( diff ) ) ; + else + sprintf( c_buf, _("Move %s down by %ld MB "), partition_new.partition .c_str(), Sector_To_MB( diff ) ) ; + + os << c_buf ; + } + + //check if size has changed ( we only consider changes >= 1 MB ) + diff = Abs( (partition_original .sector_end - partition_original .sector_start) - (partition_new .sector_end - partition_new .sector_start) ) ; + + if ( diff >= MEGABYTE ) + { + if ( os.str() == "" ) + sprintf( c_buf, _("Resize %s from %ld MB to %ld MB"), partition_new.partition .c_str(), partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ; + else + sprintf( c_buf, _("and Resize from %ld MB to %ld MB"), partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ; + + os << c_buf ; + } + if ( os.str() == "" ) + os << _("Sorry, changes are too small to make sense"); + break; + case CONVERT : /*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */ + sprintf( c_buf, _("Convert %s from %s to %s"), partition_original .partition .c_str(), partition_original .filesystem .c_str() , partition_new .filesystem .c_str() ) ; + os << c_buf ; + break; + case COPY : /*TO TRANSLATORS: looks like Copy /dev/hda4 from /dev/hda to /dev/hdd (start at 2500 MB) */ + sprintf( c_buf, _("Copy %s to %s (start at %ld MB)"), partition_new .partition .c_str(), device ->Get_Path() .c_str(), Sector_To_MB( partition_new .sector_start ) ) ; + os << c_buf ; + break ; + } + + return os.str(); +} + + +std::vector Operation::Apply_Operation_To_Visual( std::vector & partitions ) +{ + switch ( operationtype ) + { + case DELETE : return Apply_Delete_To_Visual( partitions ); + case CREATE : return Apply_Create_To_Visual( partitions ); + case RESIZE_MOVE : return Apply_Resize_Move_To_Visual( partitions ); + case CONVERT : return Apply_Convert_To_Visual( partitions ) ; + case COPY : return Apply_Create_To_Visual( partitions ); + } + + return partitions; +} + +void Operation::Apply_To_Disk( PedTimer * timer ) +{ + Glib::ustring buf; + bool result; //for some weird reason it won't work otherwise .. ( this one really beats me :-S ) + + switch ( operationtype ) + { + case DELETE : result = device ->Delete_Partition( partition_original ) ; + if ( ! result ) + Show_Error( (Glib::ustring) _("Error while deleting") + " " + partition_original.partition ) ; + + break; + case CREATE : result = device ->Create_Partition_With_Filesystem( partition_new, timer ) ; + if ( ! result ) + Show_Error( (Glib::ustring) _("Error while creating") + " " + partition_new.partition ) ; + + break; + case RESIZE_MOVE : result = device ->Move_Resize_Partition( partition_original, partition_new, timer ) ; + if ( ! result ) + Show_Error( (Glib::ustring) _("Error while resizing/moving") + " " + partition_new.partition ) ; + + break; + case CONVERT : result = device ->Set_Partition_Filesystem( partition_new, timer ) ; + if ( ! result ) + Show_Error( (Glib::ustring) _("Error while converting filesystem of") + " " + partition_new.partition ) ; + + break; + case COPY : result = device ->Copy_Partition( source_device, partition_new, timer ) ; + if ( ! result ) + Show_Error( (Glib::ustring) _("Error while copying") + " " + partition_new .partition ) ; + + break; + } + +} + +std::vector Operation::Apply_Delete_To_Visual( std::vector & partitions ) +{ + unsigned int t ; + + for ( t=0;tpartition_original.type == GParted::EXTENDED && partitions[t].type == GParted::EXTENDED ) + { + partitions[t+1].inside_extended = false; + partitions.erase( partitions.begin() + t ); + break;//we're done here ;-) + } + + else if ( partitions[t].sector_start == this-> partition_original.sector_start ) + { + partitions[t].Set_Unallocated( partition_original.sector_start , partition_original.sector_end, partition_original.inside_extended ); + break;//we're done here ;-) + } + } + + + //if deleted partition was logical we have to decrease the partitionnumbers of the logicals with higher numbers by one (only if its a real partition) + if ( partition_original.type == GParted::LOGICAL && partition_original.partition.substr( 0, 3 ) != "New" ) + for ( t=0;t partition_original.partition_number ) + partitions[t].Update_Number( partitions[t].partition_number -1 ); + + + //now we merge separate unallocated spaces next to each other together FIXME: more performance if we only check t -1 and t +1 + for ( t=0;t Operation::Apply_Create_To_Visual( std::vector & partitions ) +{ + Partition partition_temp; + + //find the original partition and replace it with the new one (original "partition" is unallocated space of course) + unsigned int t; + for ( t=0;t= partitions[t].sector_start && partition_new.sector_start <= partitions[t].sector_end && partitions[t].type != GParted::EXTENDED ) + { + partition_original = partitions[t] ; + partitions.erase( partitions.begin() + t ); + partitions.insert( partitions.begin() + t, partition_new ); + break; + } + + } + + + //check borders and create new elements if necessary + //BEFORE new partition + if ( (partition_new.sector_start - partition_original.sector_start) >= MEGABYTE ) //at least 1 MB between begin new partition and begin original one + { + partition_temp.Set_Unallocated( partition_original.sector_start, partition_new.sector_start -1 , partition_new.inside_extended ); + partitions.insert( partitions.begin() + t, partition_temp ); + t++; + } + + //AFTER new partition + if ( ( partition_original.sector_end - partition_new.sector_end) >= MEGABYTE ) //at least 1 MB between end new partition and end original one + { + partition_temp.Set_Unallocated( partition_new.sector_end +1, partition_original.sector_end ,partition_new.inside_extended ); + partitions.insert( partitions.begin() + t +1, partition_temp ); + } + + //if new created partition is an extended partition, we need to add unallocated space of the same size to the list + if ( partition_new.type == GParted::EXTENDED ) + { + partition_temp.Set_Unallocated( partition_new.sector_start, partition_new.sector_end , true ); + partitions.insert( partitions.begin() + t +1, partition_temp ); + } + + //set proper name for partition if COPY + if ( operationtype == GParted::COPY ) + partitions[ t ] .partition = "copy from " + partitions[ t ] .partition ; + + return partitions; +} + +std::vector Operation::Apply_Resize_Move_To_Visual( std::vector & partitions) +{ + //extended handling is so different i decided to take it apart from normal handling + if ( partition_original.type == GParted::EXTENDED ) + return Apply_Resize_Move_Extended_To_Visual( partitions ) ; + + //normal partitions ( Primary and Logical ) + Partition partition_temp; + + unsigned int t; + for ( t=0;t= partitions[t].sector_start && partition_original.sector_start <= partitions[t].sector_end && partitions[t].type != GParted::EXTENDED ) + { + partition_original = partitions[t] ; + partitions[t].sector_start = partition_new.sector_start ; + partitions[t].sector_end = partition_new.sector_end ; + partitions[t].sectors_unused = partition_new.sectors_unused ; + break; + } + } + + //determine correct perimeters of moving/resizing space + Sector START = partition_original.sector_start ; + Sector END = partition_original.sector_end ; + + + //now we have the index of the original partition we can remove the surrounding partitions ( if UNALLOCATED and inside_extended is the same ) + if ( t > 0 && partitions[t -1].type == GParted::UNALLOCATED && partitions[t -1].inside_extended == partition_new.inside_extended ) + { + START = partitions[t -1] .sector_start ; + partitions.erase( partitions.begin() + t -1 ); + t-- ; + } + + if ( t +1 < partitions.size() && partitions[t +1].type == GParted::UNALLOCATED && partitions[t +1].inside_extended == partition_new.inside_extended) + { + END = partitions[t +1] .sector_end ; + partitions.erase( partitions.begin() + t +1 ); + } + + //now look for unallocated space > 1 MB and add to the list + if ( (partition_new.sector_start - START) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( START, partition_new.sector_start -1 , partition_new.inside_extended ); + partitions.insert( partitions.begin() + t , partition_temp ); + t++; + } + + if ( (END - partition_new.sector_end) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( partition_new.sector_end +1, END , partition_new.inside_extended ); + partitions.insert( partitions.begin() + t +1, partition_temp ); + } + + + return partitions; +} + +std::vector Operation::Apply_Resize_Move_Extended_To_Visual( std::vector & partitions ) +{//WOW! look at this crap! there has to be an easier way to accomplish the same. When it's a bit cooler ( its over 30 C here ) i'll look into it :^) + unsigned int t; + Partition partition_temp; + + //look for index of partition + for ( t=0;t 0 && partitions[ t -1 ].type == GParted::UNALLOCATED ) + { + partitions.erase( partitions.begin() + t -1 ); + t-- ; + } + + //make spaces >= 1 MB unallocated + if ( t > 0 && ( partitions[ t ] .sector_start - partitions[ t -1 ] .sector_end ) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( partitions[ t -1 ] .sector_end +1, partitions[ t ] .sector_start -1 ,false ); + partitions.insert( partitions.begin() + t , partition_temp ); + t++ ; + } + else if ( t == 0 && partitions[ t ] .sector_start >= MEGABYTE ) + { + partition_temp.Set_Unallocated( 0, partitions[ t ] .sector_start -1 ,false ); + partitions.insert( partitions.begin() + t , partition_temp ); + t++ ; + } + + + //now check t +1 + if ( t +1 < partitions.size() && partitions[ t +1 ].type == GParted::UNALLOCATED ) + partitions.erase( partitions.begin() + t +1 ); + + //make spaces >= 1 MB unallocated + if ( t+1 < partitions.size() && partitions[ t +1 ].inside_extended && (partitions[ t +1 ] .sector_start - partitions[ t ] .sector_start) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( partitions[ t ] .sector_start, partitions[ t +1 ] .sector_start -1 , true ); + partitions.insert( partitions.begin() + t +1 , partition_temp ); + } + + //nothing inside extended, so we can add an unallocated with the size of extended( which is always >= 1 MB ) + else if ( t +1 >= partitions.size() || ! partitions[ t +1 ].inside_extended ) + { + partition_temp.Set_Unallocated( partitions[ t ] .sector_start, partitions[ t ] .sector_end , true ); + partitions.insert( partitions.begin() + t +1 , partition_temp ); + } + + // now we look to the other side of the extended partition.. + + //find index of last partition that is still inside extended + t++ ; //set index to first logical + while ( t +1 < partitions.size() && partitions[ t +1 ].inside_extended ) + t++ ; + + //if this is unallocated space we remove it + if ( partitions[ t ].type == GParted::UNALLOCATED && partitions[ t -1 ].type != GParted::EXTENDED ) //in case there is only unallocated inside extended + { + partitions.erase( partitions.begin() + t ); + t-- ; + } + + //decide if we have to insert new unallocated space + if ( (partition_new .sector_end - partitions[ t ] .sector_end) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( partitions[ t ] .sector_end +1, partition_new .sector_end , true ); + partitions.insert( partitions.begin() + t +1 , partition_temp ); + t++ ; + } + + //and the last step ( pfieuw ;) ) checks on first partition outside extended + if ( t +1 < partitions.size() && partitions[ t +1 ].type == GParted::UNALLOCATED ) + partitions.erase( partitions.begin() + t +1 ); + + + if ( t +1 < partitions.size() && (partitions[ t +1 ] .sector_start - partition_new.sector_end) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( partition_new .sector_end +1, partitions[ t +1 ] .sector_start -1 , false ); + partitions.insert( partitions.begin() + t +1 , partition_temp ); + } + + //nothing after extended + else if ( t +1 >= partitions.size() && ( device ->Get_Length() - partition_new .sector_end) >= MEGABYTE ) + { + partition_temp.Set_Unallocated( partition_new .sector_end +1, device ->Get_Length() -1 , false ); + partitions.insert( partitions.begin() + t +1 , partition_temp ); + } + + return partitions ; +} + +std::vector Operation::Apply_Convert_To_Visual( std::vector & partitions ) +{ + for ( unsigned int t=0;t= partitions[t].sector_start && partition_original.sector_start <= partitions[t].sector_end && partitions[t].type != GParted::EXTENDED ) + { + partitions[ t ] = partition_new ; + break; + } + } + + return partitions; + +} + +void Operation::Show_Error( const Glib::ustring & message ) +{ + Gtk::MessageDialog dialog( "" + message + "\n\n" + _( "Be aware that the failure to apply this operation could affect other operations on the list." ) ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); + + gdk_threads_enter(); + dialog .run(); + gdk_threads_leave(); +} + + +} //GParted diff --git a/src/Partition.cc b/src/Partition.cc new file mode 100644 index 00000000..4856434c --- /dev/null +++ b/src/Partition.cc @@ -0,0 +1,118 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Partition.h" + +namespace GParted +{ + +Partition::Partition( ) +{ + this ->error = ""; //just to be sure... +} + +void Partition::Set( const Glib::ustring & partition, + const int partition_number, + const PartitionType type, + const Glib::ustring & filesystem, + const Sector & sector_start, + const Sector & sector_end, + const Sector & sectors_used, + const bool inside_extended, + const bool busy ) +{ + this->partition = partition; + this->partition_number = partition_number; + this->type = type; + this->filesystem = filesystem; + this->sector_start = sector_start; + this->sector_end = sector_end; + this->sectors_used = sectors_used; + sectors_used != -1 ? this->sectors_unused = ( sector_end - sector_start) - sectors_used : this->sectors_unused = -1 ; + this->color.set( Get_Color( filesystem ) ); + this->color_string = Get_Color( filesystem ); + this->inside_extended = inside_extended; + this->busy = busy; +} + +void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended ) +{ + this ->Set( "Unallocated", -1, GParted::UNALLOCATED, "unallocated", sector_start, sector_end , -1, inside_extended, false); + this ->error = "" ;this ->flags = "" ; +} + +Glib::ustring Partition::Get_Color( const Glib::ustring & filesystem ) +{ // very ugly, but somehow i can't figure out a more efficient way. must be lack of sleep or so... :-) + //purple teints + if ( filesystem == "ext2" ) return "purple" ; + else if ( filesystem == "ext3" ) return "#C994EB"; + + //brown + else if ( filesystem == "linux-swap" ) return "brown" ; + + //greenisch stuff.. + else if ( filesystem == "fat16" ) return "green" ; + else if ( filesystem == "fat32" ) return "#18D918"; + else if ( filesystem == "ntfs" ) return "#42E5AC"; + + //blue + else if ( filesystem == "reiserfs" ) return "blue" ; + + //libparted can only detect these, i decided to "yellow them" :^) + else if ( filesystem == "HFS" ) return "yellow" ; + else if ( filesystem == "JFS" ) return "yellow" ; + else if ( filesystem == "UFS" ) return "yellow" ; + else if ( filesystem == "XFS" ) return "yellow" ; + + //darkgrey and ligthblue + else if ( filesystem == "unallocated" ) return "darkgrey" ; + else if ( filesystem == "extended" ) return "#7DFCFE" ; + + //unknown filesystem ( damaged, or simply unknown ) + else return "black"; +} + +void Partition::Update_Number( int new_number ) +{ //of course this fails when we have devicenames with numbers over 99 + partition_number >= 10 ? partition = partition.substr( 0, partition.length() - 2 ) : partition = partition.substr( 0, partition.length() - 1 ) ; + + partition_number = new_number; + std::ostringstream os; + os << new_number; + partition += os.str(); +} + +long Partition::Get_Length_MB( ) +{ + return Sector_To_MB( this ->sector_end - this ->sector_start) ; +} + +long Partition::Get_Used_MB( ) +{ + return Sector_To_MB( this ->sectors_used) ; +} + +long Partition::Get_Unused_MB( ) +{ + return Get_Length_MB( ) - Get_Used_MB( ) ; +} + +Partition::~Partition( ) +{ +} + +} //GParted diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc new file mode 100644 index 00000000..f04b3b48 --- /dev/null +++ b/src/TreeView_Detail.cc @@ -0,0 +1,162 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/TreeView_Detail.h" + +namespace GParted +{ + +TreeView_Detail::TreeView_Detail( ) +{ + //set locale for this stream to standard. this prevent weird locals from f*ucking up my conversions :^) + os.imbue(std::locale("")); + + treestore_detail = Gtk::TreeStore::create( treeview_detail_columns ); + this->set_model( treestore_detail ); + this->set_rules_hint(true); + this->treeselection = this->get_selection(); + + //append columns + this->append_column( _("Partition"), treeview_detail_columns.partition ); + this->append_column( _("Type"), treeview_detail_columns.type ); + this->append_column( (Glib::ustring) _("Size") + "(MB)", treeview_detail_columns.size ); + this->append_column( (Glib::ustring) _("Used") + "(MB)", treeview_detail_columns.used ); + this->append_column( (Glib::ustring) _("Unused") + "(MB)", treeview_detail_columns.unused ); + this->append_column( _("Flags"), treeview_detail_columns.flags ); + + //status_icon + this->get_column( 0 ) ->pack_start( treeview_detail_columns.status_icon,false ); + + //colored text in Partition column (used for darkgrey unallocated) + Gtk::CellRendererText *cell_renderer_text = dynamic_cast( this->get_column( 0 ) ->get_first_cell_renderer() ); + this->get_column( 0 ) ->add_attribute(cell_renderer_text->property_foreground(), treeview_detail_columns.text_color); + + //colored text in Type column + cell_renderer_text = dynamic_cast( this->get_column( 1 ) ->get_first_cell_renderer() ); + this->get_column( 1 ) ->add_attribute(cell_renderer_text->property_foreground(), treeview_detail_columns.color); + + //set alignment of numeric columns to right + for( short t=2;t<5;t++) + { + cell_renderer_text = dynamic_cast( this->get_column( t ) ->get_first_cell_renderer() ); + cell_renderer_text->property_xalign () = 1; + } + +} + +void TreeView_Detail::Load_Partitions( std::vector & partitions ) +{ + treestore_detail ->clear() ; + + for ( unsigned int i=0;iappend()); + Create_Row( row, partitions[i] ); + } + else if ( partitions[ i ] .inside_extended ) + { + childrow = *(treestore_detail->append( row.children() )); + Create_Row( childrow, partitions[i] ); + } + } + + //show logical partitions ( if any ) + this->expand_all(); + +} + +void TreeView_Detail::Set_Selected( const Partition & partition ) +{ + //look for appropiate row + for(iter = treestore_detail->children().begin();iter!=treestore_detail->children().end();iter++ ) + { + row = *iter; + partition_temp = row[treeview_detail_columns.partition_struct] ; + //primary's + if ( partition .sector_start >= partition_temp .sector_start && partition .sector_end <=partition_temp .sector_end && partition.inside_extended == partition_temp.inside_extended ) + { this->set_cursor( (Gtk::TreePath) row); return; } + + //logicals + if ( row.children().size() > 0 ) //this is the row with the extended partition, search it's childrows... + { + for(iter_child = row.children().begin();iter_child != row.children().end();iter_child++ ) + { + childrow = *iter_child; + partition_temp = childrow[treeview_detail_columns.partition_struct] ; + + if ( partition .sector_start >= partition_temp .sector_start && partition .sector_end <= partition_temp.sector_end ) + { + this->expand_all(); + this->set_cursor( (Gtk::TreePath) childrow); + return; + } + } + } + + } + + +} + +void TreeView_Detail::Create_Row( const Gtk::TreeRow & treerow, Partition & partition ) +{ + //hereby i assume these 2 are mutual exclusive. is this wise?? Time (and bugreports) will tell :) + if ( partition.busy ) + treerow[treeview_detail_columns.status_icon] = render_icon(Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON); + else if ( partition.filesystem == "unknown" || partition .error != "" ) + treerow[treeview_detail_columns.status_icon] = render_icon(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON); + + treerow[treeview_detail_columns.partition] = partition.partition; + treerow[treeview_detail_columns.color] = partition.color_string; + + partition .type == GParted::UNALLOCATED ? treerow[treeview_detail_columns.text_color] = "darkgrey" : treerow[treeview_detail_columns.text_color] = "black" ; + treerow[treeview_detail_columns.type] = partition.filesystem; + + os << partition .Get_Length_MB() ; + treerow[treeview_detail_columns.size] = os.str() ; os.str(""); + + partition.sectors_used != -1 ? os << partition .Get_Used_MB() : os << "---" ; + treerow[treeview_detail_columns.used] = os.str() ; os.str("") ; + + partition.sectors_unused != -1 ? os << partition .Get_Unused_MB() : os << "---" ; + treerow[treeview_detail_columns.unused] = os.str() ; os.str("") ; + + treerow[treeview_detail_columns.flags] = " " + partition .flags ; + + treerow[treeview_detail_columns.partition_struct] = partition; +} + +bool TreeView_Detail::on_button_press_event(GdkEventButton* event) +{ + //Call base class, to allow normal handling, + //such as allowing the row to be selected by the right-click: + bool return_value = TreeView::on_button_press_event(event); + + iter = treeselection->get_selected(); + + if ( *iter != 0 ) + { + row = *iter; + signal_mouse_click.emit( event, row[treeview_detail_columns.partition_struct] ); + } + + return return_value; +} + +} //GParted diff --git a/src/VBox_VisualDisk.cc b/src/VBox_VisualDisk.cc new file mode 100644 index 00000000..56a7a60e --- /dev/null +++ b/src/VBox_VisualDisk.cc @@ -0,0 +1,318 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/VBox_VisualDisk.h" + +namespace GParted +{ + +VBox_VisualDisk::VBox_VisualDisk( const std::vector & partitions, const Sector device_length) +{ + this ->partitions = partitions ; + this ->device_length = device_length ; + + selected_partition = -1; + //set locale for this stream to standard. this prevent weird locals from f*cking up my conversions :^) + os.imbue(std::locale("")); + + //create frame which contains the visual disk + frame_disk_legend = manage( new Gtk::Frame() ) ; + frame_disk_legend ->set_shadow_type(Gtk::SHADOW_ETCHED_OUT); + frame_disk_legend ->set_border_width( 5 ); + hbox_disk_main.pack_start( *frame_disk_legend, Gtk::PACK_EXPAND_PADDING ); + + hbox_disk = NULL ; + hbox_extended = NULL ; + + this->set_border_width( 10 ); + this->set_spacing( 8 ); + this->pack_start( hbox_disk_main, Gtk::PACK_SHRINK ); + + //set and allocated some standard colors + color_used.set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ;//bleach yellow ;) + color_unused.set( "white" ); this ->get_colormap() ->alloc_color( color_unused ) ; + color_text.set( "black" ); this ->get_colormap() ->alloc_color( color_text ) ; + + + //since disksegments have minimal sizes ( unallocated 15 and partitions 20 pixels ) i do some checking to prevent the visual disk from growing to much + Sector sectors_per_pixel = Round( (double) device_length / 750 ) ; + + double width, extra_pixels = 0 ; + + for ( unsigned int t=0; tset_spacing( 5 ); + frame_disk_legend ->add ( *hbox_disk ); + + + //walk through all partitions.... + int x,y;//for pango_layout check + for ( unsigned int i=0;iindex = i ; + visual_partitions.back() ->sector_start = partitions[i].sector_start ; + + if ( partitions[i].type == GParted::EXTENDED ) + { + visual_partitions.back() ->drawingarea = NULL ;//it's just a dummy ;-) ( see Set_Selected() ) + visual_partitions.back() ->length = 0 ; //keeps total_length clean + + eventbox_extended = manage( new Gtk::EventBox() ) ; + eventbox_extended ->set_size_request( -1 , 60 ); + eventbox_extended ->modify_bg( eventbox_extended ->get_state(), partitions[i].color ); + hbox_disk ->pack_start( *eventbox_extended, Gtk::PACK_SHRINK ) ; + + hbox_extended = manage( new Gtk::HBox() ) ; + hbox_extended ->set_border_width( 5 ); + hbox_extended ->set_spacing( 5 ); + eventbox_extended ->add( *hbox_extended ) ; + continue; + } + + visual_partitions.back() ->length = (int) (SCREEN_WIDTH / (double) ( device_length / (double) ( partitions[i].sector_end - partitions[i].sector_start) ) ); + if ( visual_partitions.back() ->length < 20 )//we need a min. size. Otherwise some small partitions wouldn't be visible + partitions[i].type == GParted::UNALLOCATED ? visual_partitions.back() ->length = 15 : visual_partitions.back() ->length = 20 ; + + if ( partitions[i].inside_extended ) + { visual_partitions.back() ->height = 34 ; visual_partitions.back() ->text_y = 10 ; } + else + { visual_partitions.back() ->height = 44 ;visual_partitions.back() ->text_y = 15 ; } + + if ( partitions[i].type == GParted::UNALLOCATED ) + visual_partitions.back() ->used = -1; + else + visual_partitions.back() ->used = (int) ( (visual_partitions.back() ->length - (BORDER *2)) / (double) ( ( partitions[i].sector_end - partitions[i].sector_start) / (double)partitions[i].sectors_used ) ) ; + + + visual_partitions.back() ->color_fs = partitions[i].color; + this ->get_colormap() ->alloc_color(visual_partitions.back() ->color_fs); + + visual_partitions.back() ->drawingarea = manage( new Gtk::DrawingArea() ) ; + visual_partitions.back() ->drawingarea ->set_size_request( visual_partitions.back() ->length+1 ,60 ); + visual_partitions.back() ->drawingarea ->set_events(Gdk::BUTTON_PRESS_MASK); + + //connect signal handlers + visual_partitions.back() ->drawingarea ->signal_button_press_event().connect( sigc::bind(sigc::mem_fun(*this, &VBox_VisualDisk::on_drawingarea_button_press), partitions[i] ) ); + visual_partitions.back() ->drawingarea->signal_realize().connect( sigc::bind(sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_realize), visual_partitions.back() ) ); + visual_partitions.back() ->drawingarea ->signal_expose_event().connect( sigc::bind(sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose), visual_partitions.back() )); + + //create pangolayout and see if it fits in the visual partition + os << partitions[i].partition << "\n" << partitions[ i ] .Get_Length_MB() << " MB"; + visual_partitions.back() ->pango_layout = visual_partitions.back() ->drawingarea ->create_pango_layout ( os.str() ) ;os.str(""); + + visual_partitions.back() ->pango_layout ->get_pixel_size( x, y ) ; + if ( visual_partitions.back() ->length - BORDER * 2 -2 < x ) + visual_partitions.back() ->pango_layout ->set_text( "" ) ; + + //tooltip + if ( partitions[i].type != GParted::UNALLOCATED ) + os << partitions[i].filesystem << "\n" ; + + os << partitions[ i ] .Get_Length_MB() ; + tooltips.set_tip( *(visual_partitions.back() ->drawingarea) ,partitions[i].partition + "\n" + os.str() + " MB" );os.str(""); + + partitions[i].inside_extended ? hbox_extended ->pack_start( *(visual_partitions.back() ->drawingarea) , Gtk::PACK_SHRINK ) : hbox_disk ->pack_start( *(visual_partitions.back() ->drawingarea) , Gtk::PACK_SHRINK ) ; + + } + this ->show_all_children() ; +} + + +void VBox_VisualDisk::Build_Legend( ) +{ + //add the hboxes and frame_legenda + frame_disk_legend = manage( new Gtk::Frame() ) ; + hbox_legend_main.pack_start( *frame_disk_legend, Gtk::PACK_EXPAND_PADDING ); + + hbox_legend = manage( new Gtk::HBox() ); + frame_disk_legend ->add( *hbox_legend ) ; + this->pack_start( hbox_legend_main ); + + std::vector legende; + bool legende_allow = true, only_unallocated = true; + + for ( unsigned int i=0;iset_text( label_temp ->get_text() .substr( 0, label_temp ->get_text() .length() -3) ) ; + + + //if there are any partitions add used/unused + if ( ! only_unallocated ) + { + frame_disk_legend = manage( new Gtk::Frame() ) ; + hbox_legend_main.pack_start( *frame_disk_legend, Gtk::PACK_EXPAND_PADDING ); + + hbox_legend = manage( new Gtk::HBox() ); + frame_disk_legend ->add( *hbox_legend ); + + Add_Legend_Item( " " + (Glib::ustring) _( "used" ) + "\t", color_used ) ; + Add_Legend_Item( " " + (Glib::ustring) _( "unused") + " ", color_unused ) ; + } + +} + +void VBox_VisualDisk::Add_Legend_Item( const Glib::ustring & filesystem, const Gdk::Color & color ) +{ + //the colored square + entry_temp = manage ( new Gtk::Entry() ); + entry_temp->set_sensitive( false ); + entry_temp->set_size_request( 15,15); + entry_temp->modify_base( entry_temp->get_state(), color ); + hbox_legend ->pack_start( *entry_temp, Gtk::PACK_SHRINK ); + + //and the label + label_temp = manage( new Gtk::Label( " " + filesystem ) ); + hbox_legend ->pack_start( *label_temp, Gtk::PACK_SHRINK ); +} + +void VBox_VisualDisk::Set_Selected( const Partition & partition ) +{ + //clean previously selected one + temp = selected_partition ; + selected_partition = -1; + if ( temp >= 0 ) //prevent segfault at firsttime selection + drawingarea_on_expose( NULL, visual_partitions[ temp ] ) ; + + + if ( partition.type == GParted::EXTENDED ) + return; //extended can not be selected in visualdisk (yet ) + + //now set new selected one + for ( unsigned int t=0;t< visual_partitions.size() ; t++ ) + { + if ( visual_partitions[t] ->sector_start == partition.sector_start && visual_partitions[t] ->drawingarea != NULL ) + { + selected_partition = t; + drawingarea_on_expose( NULL, visual_partitions[ t ] ) ; + return; + } + } + + +} + + +void VBox_VisualDisk::drawingarea_on_realize( Visual_Partition* vp ) +{ + vp ->gc = Gdk::GC::create( vp ->drawingarea ->get_window() ); + + vp ->drawingarea ->get_window() ->set_background( vp ->color_fs ); + //eventmasks necessary for tooltips + vp ->drawingarea ->add_events(Gdk::ENTER_NOTIFY_MASK ); + vp ->drawingarea ->add_events(Gdk::LEAVE_NOTIFY_MASK ); + +} + +bool VBox_VisualDisk::drawingarea_on_expose( GdkEventExpose * ev, Visual_Partition* vp ) +{ + vp ->drawingarea ->get_window() ->clear() ; + + if ( vp ->used != -1 ) //if not unknown or unallocated + { + vp ->gc ->set_foreground( color_used ); + vp ->drawingarea ->get_window() ->draw_rectangle( vp ->gc, true, BORDER,BORDER,vp ->used , vp ->height ); + + vp ->gc ->set_foreground( color_unused ); + vp ->drawingarea ->get_window() ->draw_rectangle( vp ->gc, true, BORDER + vp ->used, BORDER, vp ->length - vp ->used - BORDER *2 , vp ->height ); + } + + vp ->gc ->set_foreground( color_text ); + vp ->drawingarea ->get_window() ->draw_layout( vp ->gc, BORDER +2, vp ->text_y, vp ->pango_layout ) ; + + //if partition is selected one.. + if ( vp ->index == selected_partition ) + { + vp ->gc ->set_foreground( color_used ); + vp ->drawingarea ->get_window() ->draw_rectangle( vp ->gc, false, 4,4,vp ->length-8, vp ->height +8 ); + } + + return true; +} + +bool VBox_VisualDisk::on_drawingarea_button_press( GdkEventButton *event, const Partition & partition ) +{ + signal_mouse_click.emit( event, partition ); + return true; +} + +VBox_VisualDisk::~VBox_VisualDisk() +{ + for ( unsigned int t=0;t< visual_partitions.size() ; t++ ) + { + this ->get_colormap() ->free_colors( visual_partitions[t] ->color_fs , 1 ) ; + delete visual_partitions[t] ; + } + + visual_partitions.clear() ; + + //free the allocated colors + this ->get_colormap() ->free_colors( color_used, 1 ) ; + this ->get_colormap() ->free_colors( color_unused, 1 ) ; + this ->get_colormap() ->free_colors( color_text, 1 ) ; + +} + + + + +} //GParted diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc new file mode 100644 index 00000000..6d214ebb --- /dev/null +++ b/src/Win_GParted.cc @@ -0,0 +1,1064 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Win_GParted.h" + +namespace GParted +{ + +Win_GParted::Win_GParted( ) +{ + copied_partition .partition = "NONE" ; + new_count = 1; + current_device = source_device = 0 ; + vbox_visual_disk = NULL; + os.imbue(std::locale(""));//set locale for this stream to standard + + //locate all available devices and store them in devices vector + Find_Devices() ; + + //==== GUI ========================= + this->set_title( _("GParted") ); + this->set_default_size( -1,500 ); + + //Pack the main box + this->add( vbox_main ); + + //menubar.... + init_menubar() ; + vbox_main .pack_start( menubar_main, Gtk::PACK_SHRINK ); + + //toolbar.... + init_toolbar() ; + vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK ); + + //hbox_visual... ( contains the visual represenation of the disks ) + vbox_main.pack_start( hbox_visual, Gtk::PACK_SHRINK ); + + //hpaned_main (NOTE: added to vpaned_main) + init_hpaned_main() ; + vpaned_main .pack1( hpaned_main, true, true ) ; + + //vpaned_main.... + vpaned_main.set_position( 1000 ); //let's make sure the operationslist is closed at startup + vbox_main.pack_start( vpaned_main ); + + //device info... + init_device_info() ; + + //operationslist... + init_operationslist() ; + vpaned_main .pack2( hbox_operations, true, true ) ; + + //statusbar... + vbox_main.pack_start( statusbar, Gtk::PACK_SHRINK ); + + //popupmenu... + init_popupmenu() ; + + //initizialize for the first time... + optionmenu_devices_changed(); + + this ->show_all_children(); +} + +void Win_GParted::init_menubar() +{ + //fill menubar_main and connect callbacks + //gparted + menu = manage( new Gtk::Menu() ) ; + image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) ); + menu ->items().push_back(Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("r"), *image , sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) ); + menu ->items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); + menu ->items().push_back(Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::QUIT , sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit) ) ); + menubar_main.items().push_back( Gtk::Menu_Helpers::MenuElem( _("_GParted"), *menu ) ); + + //help + menu = manage( new Gtk::Menu() ) ; + menu ->items().push_back(Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::HELP, sigc::mem_fun(*this, &Win_GParted::menu_help_contents) ) ); + image = manage( new Gtk::Image( "/usr/share/icons/hicolor/16x16/stock/generic/stock_about.png" ) ); + menu ->items().push_back(Gtk::Menu_Helpers::ImageMenuElem( _("About"), *image, sigc::mem_fun(*this, &Win_GParted::menu_help_about) ) ); + menubar_main.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Help"), *menu ) ); +} + +void Win_GParted::init_toolbar() +{ + //initialize and pack toolbar_main + hbox_toolbar.pack_start( toolbar_main ); + + //NEW and DELETE + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::NEW)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_new) ); toolbar_main.append(*toolbutton); + toolbutton ->set_tooltip(tooltips, _("Create a new partition in the selected unallocated space") ); + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::DELETE)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_delete) ); toolbar_main.append(*toolbutton); + toolbutton ->set_tooltip(tooltips, _("Delete the selected partition") ); + toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) ); + + //RESIZE/MOVE + image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) ); + toolbutton = Gtk::manage(new Gtk::ToolButton( *image, _("Resize/Move") )); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_resize) ); toolbar_main.append(*toolbutton); + toolbutton ->set_tooltip(tooltips, _("Resize/Move the selected partition") ); + toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) ); + + //COPY and PASTE + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::COPY)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_copy) ); toolbar_main.append(*toolbutton); + toolbutton ->set_tooltip(tooltips, _("Copy the selected partition to the clipboard") ); + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PASTE)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_paste) ); toolbar_main.append(*toolbutton); + toolbutton ->set_tooltip(tooltips, _("Paste the partition from the clipboard") ); + toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) ); + + //UNDO and APPLY + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false ); + toolbutton ->set_tooltip(tooltips, _("Undo last operation") ); + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::APPLY)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false ); + toolbutton ->set_tooltip(tooltips, _("Apply all operations") ); + + //initizialize and pack optionmenu_devices + optionmenu_devices.set_menu( menu_devices ); + optionmenu_devices.signal_changed().connect( sigc::mem_fun(*this, &Win_GParted::optionmenu_devices_changed) ); + hbox_toolbar.pack_start( optionmenu_devices , Gtk::PACK_SHRINK ); +} + +void Win_GParted::init_popupmenu() +{ + //fill menu_popup + menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::NEW, sigc::mem_fun(*this, &Win_GParted::activate_new) ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::DELETE, Gtk::AccelKey( 0xFFFF, Gdk::BUTTON1_MASK ), sigc::mem_fun(*this, &Win_GParted::activate_delete) ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); + image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::ImageMenuElem( _("Resize/Move"), *image, sigc::mem_fun(*this, &Win_GParted::activate_resize) ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); + menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::COPY, sigc::mem_fun(*this, &Win_GParted::activate_copy) ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::PASTE, sigc::mem_fun(*this, &Win_GParted::activate_paste) ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); + image = manage( new Gtk::Image( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ) ); + menu_popup.items().push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Convert to"), *image, menu_convert ) ) ; + menu_popup.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); + menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::DIALOG_INFO, sigc::mem_fun(*this, &Win_GParted::activate_info) ) ); + init_convert_menu() ; + + menu_popup .accelerate( *this ) ; +} + +void Win_GParted::init_convert_menu() +{ + filesystems.push_back( "ext2" ); + filesystems.push_back( "fat16" ); + filesystems.push_back( "fat32" ); + filesystems.push_back( "linux-swap" ); + filesystems.push_back( "reiserfs" ); + + for ( unsigned int t=0;t < filesystems.size() ;t++ ) + { + if ( filesystems[ t ] != selected_partition .filesystem ) + { + color .set( selected_partition .Get_Color( filesystems[ t ] ) ); + hbox = manage( new Gtk::HBox() ); + + //the colored square + entry = manage ( new Gtk::Entry() ); + entry->set_sensitive( false ); + entry->set_size_request( 12,12); + entry->modify_base( entry->get_state(), color ); + hbox ->pack_start( *entry, Gtk::PACK_SHRINK ); + + //the label... + label = manage( new Gtk::Label( " " + filesystems[ t ] ) ); + label ->set_alignment( Gtk::ALIGN_LEFT ); + + hbox ->pack_start( *label, Gtk::PACK_SHRINK ); + + menu_item = manage( new Gtk::MenuItem( *hbox ) ) ; + menu_convert.items().push_back( *menu_item); + menu_convert.items() .back() .signal_activate() .connect( sigc::bind(sigc::mem_fun(*this, &Win_GParted::activate_convert), filesystems[ t ] ) ) ; + + } + } + + menu_convert.show_all_children() ; +} + +void Win_GParted::init_device_info() +{ + vbox = manage( new Gtk::VBox() ) ; + + //global device info + table = manage( new Gtk::Table() ) ; + table ->set_col_spacings(10 ) ; + label = manage( new Gtk::Label() ) ; + os << " " << _("Model") << ":\n " << _("Size") << ":\n " << _("Path") << ":\n " ; + + //only show realpath if it's different from the short path...(hereby i assume if one device has a realpath, they all have. i guess this makes sense) + if ( devices[ current_device ] ->Get_Path() != devices[ current_device ] ->Get_RealPath() ) + os << _("Real Path") << ":\n " ; + + os << "" ; + label ->set_markup( os.str() ) ; os.str("") ; + table ->attach( *label, 0,1,0,1,Gtk::SHRINK); + + label_device_info1 .set_selectable( true ) ; + table ->attach( label_device_info1, 1,2,0,1,Gtk::SHRINK); + vbox ->pack_start( *table, Gtk::PACK_SHRINK ) ; + + //detailed device info + table = manage( new Gtk::Table() ) ; + table ->set_col_spacings(10 ) ; + label = manage( new Gtk::Label() ) ; + os << " " << _("DiskType") << ":\n " << _("Heads") << ":\n " << _("Sectors/Track") << ":\n " << _("Cylinders") << ":\n "<< _("Total Sectors") << ":\n "; + os << "" ; + label ->set_markup( os.str() ) ; os.str("") ; + table ->attach( *label, 0,1,0,1,Gtk::SHRINK); + + label_device_info2 .set_selectable( true ) ; + table ->attach( label_device_info2, 1,2,0,1,Gtk::SHRINK); + vbox ->pack_start( *table, Gtk::PACK_SHRINK ) ; + + //add the vbox to the expander + expander_device_info.add( *vbox ); + expander_device_info.set_use_markup( true ); + expander_device_info.set_label( "" + (Glib::ustring) _( "Harddisk Information" ) + ":" ); + + //and add the expander to vbox_info + vbox_info.set_spacing( 5 ); + vbox_info.pack_start( expander_device_info, Gtk::PACK_SHRINK ); +} + +void Win_GParted::init_operationslist() +{ + //create listview for pending operations + liststore_operations = Gtk::ListStore::create( treeview_operations_columns ); + treeview_operations.set_model( liststore_operations ); + treeview_operations.set_headers_visible( false ); + treeview_operations.append_column( "", treeview_operations_columns.operation_number ); + treeview_operations.append_column( "", treeview_operations_columns.operation_description ); + treeview_operations.get_column( 0 ) ->pack_start( treeview_operations_columns.operation_icon,false ); + treeview_operations.get_selection() -> set_mode( Gtk::SELECTION_NONE ); + + //init scrollwindow_operations + scrollwindow = manage( new Gtk::ScrolledWindow() ) ; + scrollwindow ->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrollwindow ->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scrollwindow ->add ( treeview_operations ) ; + + //set up the close and clear buttons and pack them in a vbox + vbox = manage( new Gtk::VBox() ) ; + //CLOSE + button = manage( new Gtk::Button() ); + image = manage( new Gtk::Image( Gtk::Stock::CLOSE, Gtk::ICON_SIZE_MENU ) ); + button ->add( *image ) ; + button ->set_relief( Gtk::RELIEF_NONE ); + tooltips .set_tip( *button, _("Hide operationslist") ); + button ->signal_clicked().connect( sigc::mem_fun( *this, &Win_GParted::close_operationslist ) ); + vbox ->pack_start( *button, Gtk::PACK_SHRINK ); + + //CLEAR + button = manage( new Gtk::Button() ); + image = manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ); + button ->add( *image ) ; + button ->set_relief( Gtk::RELIEF_NONE ); + tooltips .set_tip( *button, _("Clear operationslist") ); + button ->signal_clicked().connect( sigc::mem_fun( *this, &Win_GParted::clear_operationslist ) ); + vbox ->pack_start( *button, Gtk::PACK_SHRINK ); + + //add vbox and scrollwindow_operations to hbox_operations + hbox_operations .pack_start( *vbox, Gtk::PACK_SHRINK ); + hbox_operations .pack_start( *scrollwindow, Gtk::PACK_EXPAND_WIDGET ); +} + +void Win_GParted::init_hpaned_main() +{ + //left scrollwindow (holds device info) + scrollwindow = manage( new Gtk::ScrolledWindow() ) ; + scrollwindow ->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrollwindow ->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + hpaned_main.pack1( *scrollwindow, true,true ); + scrollwindow ->add( vbox_info ); + + //right scrollwindow (holds treeview with partitions) + scrollwindow = manage( new Gtk::ScrolledWindow() ) ; + scrollwindow ->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrollwindow ->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + //connect signal and add treeview_detail + treeview_detail .signal_mouse_click.connect( sigc::mem_fun( this, &Win_GParted::mouse_click) ); + scrollwindow ->add ( treeview_detail ); + hpaned_main.pack2( *scrollwindow, true,true ); + + hpaned_main.set_position( 260 ); +} + +void Win_GParted::Find_Devices() +{ + for ( unsigned int t=0;tpath ) ; + device = ped_device_get_next (device) ; + } + + for ( unsigned int t=0;tGet_Length() > 0 ? devices.push_back( temp_device ) : delete temp_device ; + } + + str_devices.clear() ; + + //fill optionmenu_devices + menu_devices.items() .clear() ; + for ( unsigned int i=0;ipack_start( *image, Gtk::PACK_SHRINK ); + + //the label... + os << Sector_To_MB( devices[i] ->Get_Length() ) ; + label = manage( new Gtk::Label( " " + devices[i] ->Get_Path() + "\t (" + os.str() + " MB)" ) ); os.str("") ; + label ->set_alignment( Gtk::ALIGN_LEFT ); + hbox ->pack_start( *label, Gtk::PACK_SHRINK ); + + menu_item = manage( new Gtk::MenuItem( *hbox ) ) ; + menu_devices .items().push_back( *menu_item ); + } + +} + +void Win_GParted::Fill_Label_Device_Info( ) +{ + //global info... + os << devices[ current_device ] ->Get_Model() << "\n" ; + os << Sector_To_MB( devices[ current_device ] ->Get_Length() ) << " MB\n" ; + os << devices[ current_device ] ->Get_Path() << "\n" ; + + //only show realpath if it's diffent from the short path... + if ( devices[ current_device ] ->Get_Path() != devices[ current_device ] ->Get_RealPath() ) + os << devices[ current_device ] ->Get_RealPath() << "\n" ; + + label_device_info1.set_text( os.str() ) ; os.str("") ; + + //detailed info + os << devices[ current_device ] ->Get_DiskType() << "\n" ; + os << devices[ current_device ] ->Get_Heads() << "\n" ; + os << devices[ current_device ] ->Get_Sectors() << "\n" ; + os << devices[ current_device ] ->Get_Cylinders() << "\n" ; + os << devices[ current_device ] ->Get_Length() << "\n" ; + + label_device_info2.set_text( os.str() ) ; os.str("") ; +} + +bool Win_GParted::on_delete_event(GdkEventAny *event) +{ + return ! Quit_Check_Operations(); +} + +void Win_GParted::Add_Operation( OperationType operationtype, const Partition & new_partition) +{ + Operation operation( devices[ current_device ] , devices[ source_device ] , selected_partition, new_partition, operationtype ); + + operations.push_back( operation ); + + allow_undo( true ); + allow_apply( true ); + + Refresh_Visual( ); + + if ( operations.size() == 1 ) //first operation, open operationslist + { + int x,y; this ->get_size( x, y ); + y -= 300; + + for ( int t=vpaned_main.get_position() ; t > y ; t-=3 ) + { + vpaned_main.set_position( t ); + while (Gtk::Main::events_pending()) Gtk::Main::iteration(); + } + } + + //make scrollwindow focus on the last operation in the list + Gtk::TreeIter iter = liststore_operations->children().end() ; + iter-- ; + treeview_operations .set_cursor( (Gtk::TreePath) (Gtk::TreeRow) *iter); + +} + +void Win_GParted::Refresh_Visual( ) +{ + std::vector partitions = devices[current_device] ->Get_Partitions() ; + liststore_operations ->clear(); + + //make all operations visible + for (unsigned int t=0;tGet_Path() == devices[ current_device ] ->Get_Path() ) + partitions = operations[t].Apply_Operation_To_Visual( partitions ) ; + + treerow = *(liststore_operations->append()); + treerow[ treeview_operations_columns.operation_number ] = t +1; + treerow[ treeview_operations_columns.operation_description ] = operations[t].Get_String() ; + switch ( operations[t].operationtype ) + { + case GParted::DELETE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU); + break; + case GParted::CREATE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU); + break; + case GParted::RESIZE_MOVE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU); + break; + case GParted::CONVERT : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU); + break; + case GParted::COPY : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU); + break; + } + + } + + //set new statusbartext + statusbar .pop() ; + os << operations.size() << " " ; + operations.size() != 1 ? os << _( "operations pending" ) : os << _( "operation pending" ) ; + statusbar .push( os.str() );os.str(""); + + if ( ! operations.size() ) + { + allow_undo( false ); + allow_apply( false ); + } + + //count primary's, check for extended and logic and see if any logical is busy + any_logic = any_extended = false; + primary_count = highest_logic_busy = 0; + for (unsigned int t=0;t highest_logic_busy ) + highest_logic_busy = partitions[t].partition_number ; + break; + default : break; + } + } + + //vbox visual + if ( vbox_visual_disk != NULL ) + { + hbox_visual.remove( *vbox_visual_disk ); + s2.disconnect(); + delete ( vbox_visual_disk ); + } + + vbox_visual_disk = new VBox_VisualDisk ( partitions, devices[ current_device ] ->Get_Length() ); + s2 = vbox_visual_disk->signal_mouse_click.connect( sigc::mem_fun( this, &Win_GParted::mouse_click) ); + hbox_visual.pack_start( *vbox_visual_disk, Gtk::PACK_EXPAND_PADDING ); + + //treeview details + treeview_detail .Load_Partitions( partitions ) ; + + allow_new( false ); allow_delete( false );allow_resize( false );allow_copy( false );allow_paste( false ); + + this->show_all_children(); + +} + +bool Win_GParted::Quit_Check_Operations() +{ + if ( operations.size() ) + { + os << "" + (Glib::ustring) _( "Quit GParted?" ) + "\n\n" ; + os << operations.size() << " "; + operations.size() == 1 ? os << "operation is currently pending..." : os << "operations are currently pending..." ; + + Gtk::MessageDialog dialog( *this, os.str() , true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);os.str(""); + dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE ); + dialog .add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); + + if ( dialog.run() == Gtk::RESPONSE_CANCEL ) return false;//don't close GParted + } + + return true; //close GParted +} + +void Win_GParted::Set_Valid_Operations() +{ + allow_new( false ); allow_delete( false ); allow_resize( false );allow_copy( false ); allow_paste( false ); allow_convert( false ); + + //we can't perform any operation on a busy (mounted) filesystem + if ( selected_partition.busy ) + return; + + //UNALLOCATED + if ( selected_partition.type == GParted::UNALLOCATED ) + { + allow_new( true ); + + //find out if there is a copied partition and if it fits inside this unallocated space + if ( copied_partition .partition != "NONE" && copied_partition .Get_Length_MB() < selected_partition .Get_Length_MB() ) + allow_paste( true ) ; + + return ; + } + + //if there was an error reading the filesystem we allow delete and convert ( see also Device::Get_Used_Sectors() ) + if ( selected_partition .error != "" ) + { + allow_delete( true ) ; + allow_convert( true ) ; + return; + } + + //PRIMARY and LOGICAL + if ( selected_partition.type != GParted::EXTENDED ) + { + allow_delete( true ) ; + allow_convert( true ) ; + + //find out if resizing/moving and copying is possible + if ( selected_partition.filesystem == "ext2" || + selected_partition.filesystem == "ext3" || + selected_partition.filesystem == "fat16" || + selected_partition.filesystem == "fat32" || + selected_partition.filesystem == "linux-swap" + ) + { + allow_resize( true ) ; + + //only allow copying of real partitions + if ( selected_partition .partition.substr( 0, 3 ) != "New" && selected_partition .partition.substr( 0, 4 ) != "copy" ) + allow_copy( true ) ; + } + + return ; + } + + + //EXTENDED + else if ( selected_partition.type == GParted::EXTENDED ) + { + if ( ! any_logic ) //deletion is only allowed when there are nog logical partitions inside. + allow_delete( true ) ; + + allow_resize( true ); + } + +} + +void Win_GParted::Set_Valid_Convert_Filesystems() +{ + //disable conversion to the same filesystem + for ( unsigned int t=0;tget_size( x, y ); + y -= 210 ; //height of whole app - menubar - visualdisk - statusbar .... + for ( int t=vpaned_main.get_position() ; t < y ; t+=3 ) + { + vpaned_main.set_position( t ); + while (Gtk::Main::events_pending()) Gtk::Main::iteration(); + } + +} + +void Win_GParted::clear_operationslist() +{ + if ( operations.size() ) + { + operations .clear() ; + Refresh_Visual() ; + close_operationslist() ; + } +} + +void Win_GParted::optionmenu_devices_changed( ) +{ + //set new current device + current_device = optionmenu_devices.get_history() ; + + //refresh label_device_info + Fill_Label_Device_Info( ); + + //rebuild visualdisk and treeview + Refresh_Visual( ); +} + +void Win_GParted::menu_gparted_refresh_devices() +{ + //find out if there was any change in available devices (think about flexible media like zipdisks/usbsticks/whatever ;-) ) + Find_Devices() ; + + //refresh de pointer to the device in every operation + for ( unsigned int t=0; t< operations.size() ; t++ ) + for ( unsigned int i=0; i< devices.size() ; i++ ) + { + if ( operations[t] .device_path == devices[ i ] ->Get_Path() ) + operations[t] .device = devices[ i ] ; + if ( operations[t] .source_device_path == devices[ i ] ->Get_Path() ) + operations[t] .source_device = devices[ i ] ; + } + + //check if current_device is still available (think about hotpluggable shit like usbdevices) + if ( current_device >= devices .size() ) + current_device = 0 ; + + //rebuild visualdisk and treeview + Refresh_Visual( ); +} + +void Win_GParted::menu_gparted_quit() +{ + if ( Quit_Check_Operations() ) + this->hide(); +} + +void Win_GParted::menu_help_contents() +{ + os << _("Sorry, not yet implemented.") << "\n" << _( "Please visit http://gparted.sf.net for more information and support.") ; + Gtk::MessageDialog dialog( *this,os.str() ,false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); os.str("") ; + dialog.run(); +} + + +void Win_GParted::menu_help_about() +{ + Dialog_About dialog ; + dialog .set_transient_for( *this ) ; + + dialog.run(); +} + +void Win_GParted::mouse_click( GdkEventButton *event, const Partition & partition ) +{ + selected_partition = partition; + + Set_Valid_Operations() ; + + + treeview_detail .Set_Selected( partition ); + vbox_visual_disk ->Set_Selected( partition ); + + if ( event->type == GDK_2BUTTON_PRESS ) + activate_info() ; + else if ( event->button == 3 ) //right-click + { + //prepare convert menu + if ( selected_partition.type != GParted::UNALLOCATED ) + Set_Valid_Convert_Filesystems() ; + + menu_popup.popup( event->button, event->time ); + } +} + + +void Win_GParted::activate_resize() +{ + //show warning when one tries to resize a fat16 filesystem + if ( selected_partition .filesystem == "fat16" ) + { + os << "" ; + os << _( "Are you sure you want to resize/move this partition?" ) << "\n\n" ; + os << _( "Resizing a fat16 partition can be quite tricky! Especially growing such a partition is very error-prone. It is advisable to first convert the filesystem to fat32.") << "\n"; + + Gtk::MessageDialog dialog( *this,os.str(), true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CANCEL, true); os.str("") ; + //pffff this whole mess only for this f*cked up filesystem :-( + Gtk::Button button_resize_move ; + Gtk::HBox hbox_resize_move; + Gtk::Label label_resize_move( _("Resize/Move") ); + + image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) ); + hbox_resize_move .pack_start( *image, Gtk::PACK_SHRINK ) ; + hbox_resize_move .pack_start( label_resize_move, Gtk::PACK_SHRINK ) ; + button_resize_move .add( hbox_resize_move ) ; + + dialog .add_action_widget ( button_resize_move,Gtk::RESPONSE_OK ) ; + dialog .show_all_children() ; + + if ( dialog.run() == Gtk::RESPONSE_CANCEL ) + return ; + + } + + std::vector partitions = devices[ current_device ] -> Get_Partitions() ; + + if ( operations.size() ) + for (unsigned int t=0;tGet_Path() == devices[ current_device ] ->Get_Path() ) + partitions = operations[t].Apply_Operation_To_Visual( partitions ) ; + + + Dialog_Partition_Resize_Move dialog; + dialog.Set_Data( selected_partition, partitions); + dialog .set_transient_for( *this ) ; + + if ( dialog.run() == Gtk::RESPONSE_OK ) + { + dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) + + //if selected_partition is NEW we simply remove the NEW operation from the list and add it again with the new size and position ( unless it's an EXTENDED ) + if ( selected_partition .partition.substr( 0, 3 ) == "New" && selected_partition.type != GParted::EXTENDED ) + { + //remove operation which creates this partition + for ( unsigned int t=0;t= 4 ) + { + os << "" ; + os << _( "It's not possible to create more then four primary partitions") << "\n\n" ; + os << _( "If you want more then four partitions you should create an extended partition. Such an partition can contain at least 24 other partitions.") ; + + Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("") ; + dialog.run(); + return; + } + + Dialog_Partition_Copy dialog ; + dialog .Set_Data( selected_partition, copied_partition ) ; + dialog.set_transient_for( *this ); + + if ( dialog.run() == Gtk::RESPONSE_OK ) + { + dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) + Add_Operation( GParted::COPY, dialog.Get_New_Partition() ); + } + +} + +void Win_GParted::activate_new() +{ + //Display error if user tries to create more primary partitions then the partition table can hold. + if ( ! selected_partition.inside_extended && primary_count >= devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) + { + os << "" ; + sprintf( c_buf, _("It is not possible to create more then %d primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ; + os << c_buf << "\n\n" ; + os << _( "If you want more partitions you should first create an extended partition. Such an partition can contain other partitions.") ; + + Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("") ; + dialog.run(); + return; + } + + Dialog_Partition_New dialog; + dialog.Set_Data( selected_partition, any_extended, new_count ) ; + dialog.set_transient_for( *this ); + + if ( dialog.run() == Gtk::RESPONSE_OK ) + { + dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) + new_count++; + Add_Operation( GParted::CREATE, dialog.Get_New_Partition() ); + } + +} + +void Win_GParted::activate_delete() +{ + //since logicals are *always* numbered from 5 to there can be a shift in numbers after deletion. + //e.g. consider /dev/hda5 /dev/hda6 /dev/hda7. Now after removal of /dev/hda6, /dev/hda7 is renumbered to /dev/hda6 + //the new situation is now /dev/hda5 /dev/hda6. If /dev/hda7 was mounted the OS cannot find /dev/hda7 anymore and the results aren't that pretty + //it seems best to check for this and prohibit deletion with some explanation to the user. + if ( selected_partition.type == GParted::LOGICAL && selected_partition .partition.substr( 0, 3 ) != "New" && selected_partition.partition_number < highest_logic_busy ) + { + os << " " << selected_partition.partition_number ; + Gtk::MessageDialog dialog( *this, "" + (Glib::ustring) _( "Unable to delete partition!") + "\n\n" + (Glib::ustring) _( "Please unmount any logical partitions having a number higher than") + os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);os.str(""); + dialog.run() ; return; + } + + os << "" + (Glib::ustring) _( "Are you sure you want to delete" ) + " " + selected_partition.partition + " ?" ; + if ( selected_partition .partition == copied_partition .partition ) + os << "\n\n" + (Glib::ustring) _( "After deletion this partition is no longer available for copying.") ; + + Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); os.str(""); + dialog.set_title( _("Delete") + (Glib::ustring)" " + selected_partition.partition + " (" + selected_partition.filesystem + ")" ); + dialog.add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); + dialog.add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK ); + + dialog.show_all_children(); + if ( dialog.run() == Gtk::RESPONSE_OK ) + { + dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) + + //if deleted partition was on the clipboard we erase it... + if ( selected_partition .partition == copied_partition .partition ) + { + copied_partition .partition = "NONE" ; + source_device = current_device ; + } + + //if deleted one is NEW, it doesn't make sense to add it to the operationslist, we erase its creation + //and possible modifications like resize etc.. from the operationslist. Calling Refresh_Visual will wipe every memory of its existence ;-) + if ( selected_partition .partition.substr( 0, 3 ) == "New" ) + { + //remove all operations done on this new partition (this includes creation) + for ( int t=0;t<(int) operations.size() ; t++ ) //i removed the unsigned 'cause t will be negative at times... + { + if ( operations[t] .partition_new .partition == selected_partition .partition ) + { + operations.erase( operations .begin() + t ) ; + t-- ; + } + } + + + //determine lowest possible new_count + new_count = 0 ; + for ( unsigned int t=0;t new_count ) + new_count = operations[t] .partition_new .partition_number ; + + new_count += 1 ; + + Refresh_Visual( ); + + if ( ! operations .size() ) + close_operationslist() ; + } + else //deletion of a real partition... + Add_Operation( GParted::DELETE, selected_partition ); //in this case selected_partition is just a "dummy" + + + } +} + +void Win_GParted::activate_info() +{ + Dialog_Partition_Info dialog( selected_partition ); + dialog.set_transient_for( *this ); + dialog.run(); +} + +void Win_GParted::activate_convert( const Glib::ustring & new_fs ) +{ + //standard warning.. + Gtk::MessageDialog dialog( *this, "" + (Glib::ustring) _( "Are you sure you want to convert this filesystem to") + " " + new_fs + " ?\n\n" + (Glib::ustring) _( "This operation will destroy all data on") + " " + selected_partition .partition ,true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true); + dialog. add_button( Gtk::Stock::CONVERT, Gtk::RESPONSE_OK ) ; + dialog. show_all_children() ; + + if ( dialog.run() == Gtk::RESPONSE_CANCEL ) + return ; + + dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) + + //check for the FAT limits... + if ( new_fs == "fat16" || new_fs == "fat32" ) + { + Glib::ustring message ; + + if ( new_fs == "fat16" && selected_partition.Get_Length_MB() < 32 ) + message = (Glib::ustring) _("Can not convert this filesystem to fat16.") + "\n\n" + (Glib::ustring) _( "A fat16 filesystem requires a partition of at least 32 MB.") ; + else if ( new_fs == "fat16" && selected_partition.Get_Length_MB() > 1023 ) + message = (Glib::ustring) _("Can not convert this filesystem to fat16.") + "\n\n" + (Glib::ustring) _( "A partition with a fat16 filesystem has a maximum size of 1023 MB."); + else if ( new_fs == "fat32" && selected_partition.Get_Length_MB() < 256 ) + message = (Glib::ustring) _("Can not convert this filesystem to fat32.") + "\n\n" + (Glib::ustring) _( "A fat32 filesystem requires a partition of at least 256 MB."); + + if ( message != "" ) + { + Gtk::MessageDialog dialog( *this, "" + message ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); + dialog.run() ; + return ; + } + + } + + //ok we made it :P lets create an fitting partition object + Partition part_temp; + part_temp .Set( selected_partition .partition, selected_partition .partition_number, selected_partition .type, new_fs, selected_partition .sector_start, selected_partition .sector_end, -1, selected_partition .inside_extended, false ) ; + + + //if selected_partition is NEW we simply remove the NEW operation from the list and add it again with the new filesystem + if ( selected_partition .partition.substr( 0, 3 ) == "New" ) + { + //remove operation which creates this partition + for ( unsigned int t=0;t" + (Glib::ustring) _( "Are you sure you want to apply the pending operations?" ) + "\n\n" + (Glib::ustring) _( "It is recommended to backup valueable data before proceeding.") ,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true); + dialog.set_title( _( "Apply operations to harddisk" ) ); + + dialog.add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); + dialog.add_button( Gtk::Stock::APPLY, Gtk::RESPONSE_OK ); + + dialog.show_all_children(); + if ( dialog.run() == Gtk::RESPONSE_OK ) + { + dialog.hide() ; //hide confirmationdialog + + apply = true; + dialog_progress = new Dialog_Progress ( operations.size(), operations.front().Get_String() ) ; + s3 = dispatcher_next_operation.connect( sigc::mem_fun(*dialog_progress, &Dialog_Progress::Set_Next_Operation) ); + thread_operations = Glib::Thread::create(SigC::slot_class(*this, &Win_GParted::apply_operations_thread), true); + + dialog_progress->set_transient_for( *this ); + while ( dialog_progress->run() != Gtk::RESPONSE_OK ) + apply = false;//finish current operation . then stop applying operations + + //after hiding the progressdialog + s3.disconnect(); + delete ( dialog_progress ) ; + thread_operations->join() ; + + //wipe operations... + operations.clear(); + + //reread devices and their layouts... + menu_gparted_refresh_devices() ; + + //then clean up the rest + new_count = 1; + close_operationslist() ; + + //show warning is necesarry + if ( devices[ current_device ] ->Get_any_busy() ) + { + os << "" ; + os << _("The kernel was unable to re-read the partition table on") << " " << devices[ current_device ] ->Get_Path() ; + os << "\n\n" << _( "This means Linux won't know anything about the modifications you made until you reboot.") << "\n\n" ; + os << _( "You should reboot your computer before doing anything with") << " " << devices[ current_device ] ->Get_Path() ; + Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); os.str("") ; + dialog.run() ; + } + + } + +} +//-------AFAIK it's not possible to use a C++ memberfunction as a callback for a C libary function (if you know otherwise, PLEASE contact me------------ +Dialog_Progress *dp; +Glib::Dispatcher dispatcher_current_operation; + +void progress_callback(PedTimer * timer, void *context ) +{ + if ( time(NULL) - timer ->start > 0 ) + { + dp ->time_left = timer ->predicted_end - time(NULL) ; + dp ->fraction_current = timer ->frac ; + dispatcher_current_operation() ; + } +} +//--------------------------------------------------------------------------------------- + +void Win_GParted::apply_operations_thread() +{ + dp = dialog_progress ; + sigc::connection signal = dispatcher_current_operation.connect( sigc::mem_fun(*dialog_progress, &Dialog_Progress::Set_Progress_Current_Operation) ); + PedTimer *timer = ped_timer_new( progress_callback, NULL ) ; + + for ( unsigned int t=0;tcurrent_operation = operations[ t +1 ] .Get_String() ; + dispatcher_next_operation() ; + } + } + + dialog_progress->response( Gtk::RESPONSE_OK ); + signal.disconnect() ; +} + + +} // GParted diff --git a/src/main.cc b/src/main.cc new file mode 100644 index 00000000..bc0abcf7 --- /dev/null +++ b/src/main.cc @@ -0,0 +1,39 @@ +/* Copyright (C) 2004 Bart + * + * 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 Library 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 "../include/Win_GParted.h" + +int main( int argc, char *argv[] ) +{ + //initialize thread system + Glib::thread_init(); + + Gtk::Main kit(argc, argv); + + //check UID + if ( getuid() != 0 ) + { + Gtk::MessageDialog dialog( "" + (Glib::ustring) _( "Root privileges are required for running GParted" ) + "\n\n" + (Glib::ustring) _( "Since GParted can be a weapon of mass destruction only root may run it.") ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); + dialog.run(); + exit( 0 ); + } + + GParted::Win_GParted win_gparted; + Gtk::Main::run( win_gparted ); + + return 0; +}