(dl_main): Rename paths_initialized to rtld_is_main. Don't call
[kopensolaris-gnu/glibc.git] / sysdeps / unix / sysv / linux / i386 / dl-librecon.h
1 /* Optional code to distinguish library flavours.
2    Copyright (C) 1998 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
5
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Library General Public License as
8    published by the Free Software Foundation; either version 2 of the
9    License, or (at your option) any later version.
10
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
15
16    You should have received a copy of the GNU Library General Public
17    License along with the GNU C Library; see the file COPYING.LIB.  If not,
18    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 #ifndef _DL_LIBRECON_H
22 #define _DL_LIBRECON_H  1
23
24 #define DISTINGUISH_LIB_VERSIONS \
25   do                                                                          \
26     {                                                                         \
27       /* We have to find out whether the binary is linked against             \
28          libc 5 or glibc.  We do this by looking at all the DT_NEEDED         \
29          entries.  If one is libc.so.5 this is a libc 5 linked binary.  */    \
30       if (_dl_loaded->l_info[DT_NEEDED])                                      \
31         {                                                                     \
32           /* We have dependencies.  */                                        \
33           const ElfW(Dyn) *d;                                                 \
34           const char *strtab;                                                 \
35                                                                               \
36           strtab = ((void *) _dl_loaded->l_addr                               \
37                     + _dl_loaded->l_info[DT_STRTAB]->d_un.d_ptr);             \
38                                                                               \
39           for (d = _dl_loaded->l_ld; d->d_tag != DT_NULL; ++d)                \
40             if (d->d_tag == DT_NEEDED                                         \
41                 && strcmp (strtab + d->d_un.d_val, "libc.so.5") == 0)         \
42               break;                                                          \
43                                                                               \
44           /* We print a `5' or `6' depending on the outcome.  */              \
45           _dl_sysdep_message (d->d_tag != DT_NULL ? "5\n" : "6\n", NULL);     \
46         }                                                                     \
47     }                                                                         \
48   while (0)
49
50 /* Recognizing extra environment variables.  */
51 #define EXTRA_LD_ENVVARS \
52   case 15:                                                                    \
53     if (memcmp (&envline[3], "LIBRARY_VERSION", 15) == 0)                     \
54       {                                                                       \
55         _dl_correct_cache_id = envline[19] == '5' ? 2 : 3;                    \
56         break;                                                                \
57       }
58
59 /* Extra unsecure variables.  */
60 #define EXTRA_UNSECURE_ENVVARS "LD_AOUT_LIBRARY_PATH", "LD_AOUT_PRELOAD"
61
62 #endif /* dl-librecon.h */