From a379e56acc0955dd1ec03740cfbb632ce54b7416 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 23 Sep 1998 15:28:54 +0000 Subject: Update. 1998-09-23 15:25 Ulrich Drepper * libio/stdio.h: Define __need_getopt and include getopt.h to define getopt stuff. * posix/unistd.h: Likewise. * stdio/stdio.h: Likewise. * posix/getopt.h: Remove _GNU_SOURCE use. If __need_getopt is defined define only getopt and the variables. (CPPFLAGS): Add -DUSE_LIBDB1 --- ChangeLog | 11 ++++++++++- FAQ | 52 ++++++++++++++++++++++++++++++++++++++-------------- FAQ.in | 27 ++++++++++++++------------- libio/stdio.h | 11 ++--------- posix/getopt.h | 40 +++++++++++++++++++++++++++++++++++----- posix/unistd.h | 36 +++++------------------------------- stdio/stdio.h | 11 ++--------- 7 files changed, 106 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ba61e1224..6f9517cac0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1998-09-23 15:25 Ulrich Drepper + + * libio/stdio.h: Define __need_getopt and include getopt.h to define + getopt stuff. + * posix/unistd.h: Likewise. + * stdio/stdio.h: Likewise. + * posix/getopt.h: Remove _GNU_SOURCE use. If __need_getopt is defined + define only getopt and the variables. + 1998-09-23 Andreas Jaeger * scripts/test-installation.pl (installation_problem): Don't link @@ -14,7 +23,7 @@ (distribute): Add $(db1-headers). (install-others): Define to install symlink libdb.so.NN and the $(db1-headers). - (CPPFLAGS): Add -USE_LIBDB1 + (CPPFLAGS): Add -DUSE_LIBDB1 Remove rules to build makedb. * db/Versions: Rename libdb to libdb1. * include/db.h: If USE_LIBDB1 is defined include db/db.h. diff --git a/FAQ b/FAQ index a345194167..1709786828 100644 --- a/FAQ +++ b/FAQ @@ -39,6 +39,7 @@ please let me know. librt? I don't even use threads. 1.14. What's the problem with configure --enable-omitfp? 1.15. I get failures during `make check'. What shall I do? +1.16. What is symbol versioning good for? Do I need it? 2. Installation and configuration issues @@ -182,8 +183,8 @@ a local mirror first. You should always try to use the latest official release. Older versions may not have all the features GNU libc requires. The current releases of -egcs (1.0.2) and GNU CC (2.8.1) should work with the GNU C library (for -powerpc see question question 1.5). +egcs (1.0.3 and 1.1) and GNU CC (2.8.1) should work with the GNU C library +(for powerpc see question question 1.5). 1.3. When I try to compile glibc I get only error messages. @@ -210,6 +211,10 @@ system's tools. Always get the newest release of GNU binutils available. Older releases are known to have bugs that prevent a successful compilation. +{AJ} Please don't use binutils 2.7. That release contains some bugs which +might make it necessary that you've got to recompile all your glibc2 +binaries when upgrading the GNU C library. + {ZW} As of release 2.1 a linker supporting symbol versions is required. For Linux, get binutils-2.8.1.0.23 or later. Other systems may have native linker support, but it's moot right now, because glibc has not been ported @@ -300,11 +305,10 @@ new options. 1.8. The compiler hangs while building iconvdata modules. What's wrong? -{ZW} This is a problem with all current releases of GCC. Initialization of -large static arrays is very slow. The compiler will eventually finish; give -it time. +{ZW} This is a problem of older GCC. Initialization of large static arrays +is very slow. The compiler will eventually finish; give it time. -The problem will be fixed in egcs 1.1 but probably not before then. +The problem is fixed in egcs 1.1 but not in earlier releases. 1.9. When I run `nm -u libc.so' on the produced library I still @@ -426,15 +430,32 @@ command line which failed and run the test from the subdirectory for this test in the sources. There are some failures which are not directly related to the GNU libc: -- Some compiler produce buggy code. The current egcs snapshots are ok and - the not yet released egcs 1.1 should be ok. gcc 2.8.1 might cause some - failures, gcc 2.7.2.x is so buggy, that explicit checks have been used so - that you can't build with it. +- Some compiler produce buggy code. The egcs 1.1 release should be ok. gcc + 2.8.1 might cause some failures, gcc 2.7.2.x is so buggy, that explicit + checks have been used so that you can't build with it. - The kernel might have bugs. For example on Linux/Alpha 2.0.34 the floating point handling has quite a number of bugs and therefore most of the test cases in the math subdirectory will fail. The current Linux 2.1 development kernels have fixes for the floating point support on Alpha. + +1.16. What is symbol versioning good for? Do I need it? + +{AJ} Symbol versioning solves problems that are related to interface +changes. One version of an interface might have been introduced in a +previous version of the GNU C library but the interface or the semantics of +the function has been changed in the meantime. For binary compatibility +with the old library, a newer library needs to still have the old interface +for old programs. On the other hand new programs should use the new +interface. Symbol versioning is the solution for this problem. The GNU +libc version 2.1 uses by default symbol versioning if the binutils support +it. + +We don't advise to build without symbol versioning since you lose binary +compatibility if you do - for ever! The binary compatibility you lose is +not only against the previous version of the GNU libc (version 2.0) but also +against future versions. + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @@ -556,11 +577,14 @@ US. user specifies a -dynamic-linker argument. This is the name of the libc5 dynamic linker, which does not work with glibc. -For casual use of GNU libc you can just specify - -dynamic-linker=/lib/ld-linux.so.2 +For casual use of GNU libc you can just specify to the linker + --dynamic-linker=/lib/ld-linux.so.2 which is the glibc dynamic linker, on Linux systems. On other systems the -name is /lib/ld.so.1. +name is /lib/ld.so.1. When linking via gcc, you've got to add + -Wl,--dynamic-linker=/lib/ld-linux.so.2 + +to the gcc command line. To change your environment to use GNU libc for compiling you need to change the `specs' file of your gcc. This file is normally found at @@ -749,7 +773,7 @@ file is usually the culprit. {AJ} If you have an entry "db" in /etc/nsswitch.conf you should also create the database files. The glibc sources contain a Makefile which does the -neccessary conversion and calls to create those files. The file is +necessary conversion and calls to create those files. The file is `db-Makefile' in the subdirectory `nss' and you can call it with `make -f db-Makefile'. Please note that not all services are capable of using a database. Currently passwd, group, ethers, protocol, rpc, services shadow diff --git a/FAQ.in b/FAQ.in index 75992effd7..36228ea765 100644 --- a/FAQ.in +++ b/FAQ.in @@ -59,8 +59,8 @@ a local mirror first. You should always try to use the latest official release. Older versions may not have all the features GNU libc requires. The current releases of -egcs (1.0.2) and GNU CC (2.8.1) should work with the GNU C library (for -powerpc see question ?powerpc). +egcs (1.0.3 and 1.1) and GNU CC (2.8.1) should work with the GNU C library +(for powerpc see question ?powerpc). ?? When I try to compile glibc I get only error messages. What's wrong? @@ -176,11 +176,10 @@ new options. ?? The compiler hangs while building iconvdata modules. What's wrong? -{ZW} This is a problem with all current releases of GCC. Initialization of -large static arrays is very slow. The compiler will eventually finish; give -it time. +{ZW} This is a problem of older GCC. Initialization of large static arrays +is very slow. The compiler will eventually finish; give it time. -The problem will be fixed in egcs 1.1 but probably not before then. +The problem is fixed in egcs 1.1 but not in earlier releases. ?? When I run `nm -u libc.so' on the produced library I still find unresolved symbols. Can this be ok? @@ -295,10 +294,9 @@ command line which failed and run the test from the subdirectory for this test in the sources. There are some failures which are not directly related to the GNU libc: -- Some compiler produce buggy code. The current egcs snapshots are ok and - the not yet released egcs 1.1 should be ok. gcc 2.8.1 might cause some - failures, gcc 2.7.2.x is so buggy, that explicit checks have been used so - that you can't build with it. +- Some compiler produce buggy code. The egcs 1.1 release should be ok. gcc + 2.8.1 might cause some failures, gcc 2.7.2.x is so buggy, that explicit + checks have been used so that you can't build with it. - The kernel might have bugs. For example on Linux/Alpha 2.0.34 the floating point handling has quite a number of bugs and therefore most of the test cases in the math subdirectory will fail. The current Linux 2.1 @@ -435,11 +433,14 @@ US. user specifies a -dynamic-linker argument. This is the name of the libc5 dynamic linker, which does not work with glibc. -For casual use of GNU libc you can just specify - -dynamic-linker=/lib/ld-linux.so.2 +For casual use of GNU libc you can just specify to the linker + --dynamic-linker=/lib/ld-linux.so.2 which is the glibc dynamic linker, on Linux systems. On other systems the -name is /lib/ld.so.1. +name is /lib/ld.so.1. When linking via gcc, you've got to add + -Wl,--dynamic-linker=/lib/ld-linux.so.2 + +to the gcc command line. To change your environment to use GNU libc for compiling you need to change the `specs' file of your gcc. This file is normally found at diff --git a/libio/stdio.h b/libio/stdio.h index 912a30e198..c800300dce 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -710,15 +710,8 @@ extern void funlockfile __P ((FILE *__stream)); /* The X/Open standard requires some functions and variables to be declared here which do not belong into this header. But we have to follow. In GNU mode we don't do this nonsense. */ - -/* For more information on these symbols look in . */ -extern char *optarg; -extern int optind; -extern int opterr; -extern int optopt; - -extern int getopt __P ((int __argc, char *__const *__argv, - __const char *__shortopts)); +# define __need_getopt +# include #endif __END_DECLS diff --git a/posix/getopt.h b/posix/getopt.h index c9414373a5..c8950ee4a1 100644 --- a/posix/getopt.h +++ b/posix/getopt.h @@ -18,7 +18,10 @@ Boston, MA 02111-1307, USA. */ #ifndef _GETOPT_H -#define _GETOPT_H 1 + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif #ifdef __cplusplus extern "C" { @@ -55,7 +58,7 @@ extern int opterr; extern int optopt; -#ifdef _GNU_SOURCE +#ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is @@ -96,8 +99,32 @@ struct option # define no_argument 0 # define required_argument 1 # define optional_argument 2 -#endif /* GNU source */ +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `--', then non-option arguments are treated as + arguments to the option '\0'. This behavior is specific to the GNU + `getopt'. */ #if defined __STDC__ && __STDC__ # ifdef __GNU_LIBRARY__ @@ -109,7 +136,7 @@ extern int getopt (int argc, char *const *argv, const char *shortopts); extern int getopt (); # endif /* __GNU_LIBRARY__ */ -# ifdef _GNU_SOURCE +# ifdef __need_getopt extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, @@ -124,7 +151,7 @@ extern int _getopt_internal (int argc, char *const *argv, # endif #else /* not __STDC__ */ extern int getopt (); -# ifdef _GNU_SOURCE +# ifndef __need_getopt extern int getopt_long (); extern int getopt_long_only (); @@ -136,4 +163,7 @@ extern int _getopt_internal (); } #endif +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + #endif /* getopt.h */ diff --git a/posix/unistd.h b/posix/unistd.h index aa7deffd57..3ea24818d3 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -718,37 +718,11 @@ extern int setlogin __P ((__const char *__name)); #ifdef __USE_POSIX2 -/* Process the arguments in ARGV (ARGC of them, minus - the program name) for options given in OPTS. - - If `opterr' is zero, no messages are generated - for invalid options; it defaults to 1. - `optind' is the current index into ARGV. - `optarg' is the argument corresponding to the current option. - Return the option character from OPTS just read. - Return -1 when there are no more options. - For unrecognized options, or options missing arguments, - `optopt' is set to the option letter, and '?' is returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is optional. - This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument scanning, - explicitly telling `getopt' that there are no more options. - - If OPTS begins with `--', then non-option arguments - are treated as arguments to the option '\0'. - This behavior is specific to the GNU `getopt'. */ -extern int getopt __P ((int __argc, char *__const * __argv, - __const char *__opts)); -extern int opterr; -extern int optind; -extern int optopt; -extern char *optarg; +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. */ +# define __need_getopt +# include #endif diff --git a/stdio/stdio.h b/stdio/stdio.h index 2ec55c486a..c2d2060e33 100644 --- a/stdio/stdio.h +++ b/stdio/stdio.h @@ -832,15 +832,8 @@ extern void funlockfile __P ((FILE *__stream)); /* The X/Open standard requires some functions and variables to be declared here which do not belong into this header. But we have to follow. In GNU mode we don't do this nonsense. */ - -/* For more information on these symbols look in . */ -extern char *optarg; -extern int optind; -extern int opterr; -extern int optopt; - -extern int getopt __P ((int __argc, char *__const *__argv, - __const char *__shortopts)); +# define __need_getopt +# include #endif __END_DECLS -- cgit 1.4.1