]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - Makeconfig
Update.
[thirdparty/glibc.git] / Makeconfig
index 5936f237adef78bc8d8982db5a33748bf881953c..38437d4dd2ed05b0e0e5aa1f5a627ec46abfa0f9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -12,9 +12,9 @@
 # Library General Public License for more details.
 
 # You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB.  If
-# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-# Cambridge, MA 02139, USA.
+# License along with the GNU C Library; see the file COPYING.LIB.  If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
 
 #
 #      Makefile configuration options for the GNU C library.
@@ -59,8 +59,8 @@ endif
 # $(common-objdir) is the place to put objects and
 # such that are not specific to a single subdir.
 ifdef objdir
-objpfx = $(objdir)/
-common-objpfx = $(objpfx)
+objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
+common-objpfx = $(objdir)/
 common-objdir = $(objdir)
 else
 objpfx :=
@@ -74,28 +74,36 @@ common-objdir = .
 endif
 endif
 
+# Root of the sysdeps tree.
+sysdep_dir := $(..)sysdeps
+export sysdep_dir := $(sysdep_dir)
 
 # Get the values defined by options to `configure'.
 include $(common-objpfx)config.make
 
+# Complete path to sysdep dirs.
+full-config-sysdirs := $(filter /%, $(config-sysdirs)) \
+                      $(addprefix $(..), $(filter-out /%, $(config-sysdirs)))
+export full-config-sysdirs := $(full-config-sysdirs)
+
 # Run config.status to update config.make and config.h.  We don't show the
 # dependence of config.h to Make, because it is only touched when it
 # changes and so config.status would be run every time; the dependence of
 # config.make should suffice to force regeneration and re-exec, and the new
 # image will notice if config.h changed.
-$(common-objpfx)config.make: $(common-objpfx)config.status $(..)config.h.in
+$(common-objpfx)config.make: $(common-objpfx)config.status \
+                            $(..)config.make.in $(..)config.h.in
        cd $(<D); $(SHELL) $(<F)
 
 # Find all the sysdeps configure fragments, to make sure we re-run
 # configure when any of them changes.
-sysdep-configures = $(foreach dir,$(config-sysdirs),\
-                             $(patsubst %.in,%,\
-                                        $(firstword $(wildcard \
-                                           $(dir)/configure \
-                                           $(dir)/configure.in)))
-
-# Force the user to configure before making.
-$(common-objpfx)config.status: $(..)configure $(sysdep-configures)
+$(common-objpfx)config.status: $(..)version.h $(..)configure \
+                              $(foreach dir,$(full-config-sysdirs),\
+                                        $(wildcard \
+                                          $(dir)/Implies) \
+                                        $(patsubst %.in,%,\
+                                                   $(firstword $(wildcard \
+ $(addprefix $(dir)/,configure configure.in)))))
        @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
         echo The GNU C library has not been configured. >&2; \
         echo Run \`configure\' to configure it before building. >&2; \
@@ -107,13 +115,10 @@ ifneq ($(wildcard $(..)configparms),)
 include $(..)configparms
 endif
 ifneq ($(objpfx),)
-ifneq ($(wildcard $(objpfx)configparms),)
-include $(objpfx)configparms
+ifneq ($(wildcard $(common-objpfx)configparms),)
+include $(common-objpfx)configparms
 endif
 endif
-
-sysdep_dir := $(..)sysdeps
-export sysdep_dir := $(sysdep_dir)
 \f
 ####
 ####   These are the configuration variables.  You can define values for
@@ -142,11 +147,13 @@ endif
 ifndef libdir
 libdir = $(exec_prefix)/lib
 endif
+inst_libdir = $(install_root)$(libdir)
 
 # Where to install the shared library and dynamic linker.
 ifndef slibdir
 slibdir = $(exec_prefix)/lib
 endif
+inst_slibdir = $(install_root)$(slibdir)
 
 # Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
 # the prefix is spliced between `lib' and the name, so the linker switch
@@ -160,50 +167,64 @@ endif
 ifndef includedir
 includedir = $(exec_prefix)/include
 endif
+inst_includedir = $(install_root)$(includedir)
 
 # Where to install machine-independent data files.
 # These are the timezone database, and the locale database.
 ifndef datadir
 datadir = $(prefix)/share
 endif
+inst_datadir = $(install_root)$(datadir)
 
 # Where to install the timezone data files (which are machine-independent).
 ifndef zonedir
 zonedir = $(datadir)/zoneinfo
 endif
+inst_zonedir = $(install_root)$(zonedir)
 
 # Where to install the locale and message catalog data files (which are
 # machine-independent).
 ifndef localedir
 localedir = $(datadir)/locale
 endif
+inst_localedir = $(install_root)$(localedir)
 
 # Where to install the locale charmap source files.
 ifndef i18ndir
 i18ndir = $(datadir)/i18n
 endif
+inst_i18ndir = $(install_root)$(i18ndir)
 
 
 # Where to install programs.
 ifndef bindir
 bindir = $(exec_prefix)/bin
 endif
+inst_bindir = $(install_root)$(bindir)
 
 # Where to install administrative programs.
+ifndef rootsbindir
+rootsbindir = $(exec_prefix)/sbin
+endif
+inst_rootsbindir = $(install_root)$(rootsbindir)
+
 ifndef sbindir
 sbindir = $(exec_prefix)/sbin
 endif
+inst_sbindir = $(install_root)$(sbindir)
 
 # Where to install the Info files.
 ifndef infodir
 infodir = $(prefix)/info
 endif
+inst_infodir = $(install_root)$(infodir)
 
 # Where to install default configuration files.  These include the local
 # timezone specification and network data base files.
 ifndef sysconfdir
 sysconfdir = $(prefix)/etc
 endif
+inst_sysconfdir = $(install_root)$(sysconfdir)
 
 # What timezone should be the installed default (e.g., US/Eastern).
 # Run `make -C time echo-zonenames' to see a list of available zone names.
@@ -219,6 +240,17 @@ endif
 # localizing the configuration data elsewhere.
 ifndef localtime-file
 localtime-file = $(sysconfdir)/localtime
+inst_localtime-file = $(install_root)$(localtime-file)
+endif
+
+# What to use for leap second specifications in compiling the default
+# timezone files.  Set this to `/dev/null' for no leap second handling as
+# 1003.1 requires, or to `leapseconds' for proper leap second handling.
+# Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
+# This variable determines the default: if it's `/dev/null',
+# ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
+ifndef leapseconds
+leapseconds = /dev/null
 endif
 
 # What timezone's DST rules should be used when a POSIX-style TZ
@@ -273,7 +305,7 @@ endif
 
 # Default flags to pass the C compiler.
 ifndef default_cflags
-default_cflags := -g
+default_cflags := -g -O
 endif
 
 # Flags to pass the C compiler when assembling preprocessed assembly code
@@ -288,9 +320,10 @@ endif
 ifndef +link
 +link = $(CC) -nostdlib -nostartfiles -o $@ \
              $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS)  \
-             $(addprefix $(csu-objpfx),start.o $(+preinit)) \
-             $(filter-out $(common-objpfx)libc%,$^) $(link-libc) \
-             $(addprefix $(csu-objpfx),$(+postinit))
+             $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+prector) \
+             $(filter-out $(addprefix $(csu-objpfx),start.o) $(+preinit) \
+               $(link-extra-libs) $(common-objpfx)libc% $(+postinit),$^) \
+             $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
 endif
 ifndef config-LDFLAGS
 ifeq (yes,$(build-shared))
@@ -302,8 +335,9 @@ ifeq (yes,$(build-shared))
 # We need the versioned name of libc.so in the deps of $(others) et al
 # so that the symlink to libc.so is created before anything tries to
 # run the linked programs.
-link-libc = -Wl,-rpath-link=$(common-objdir) \
+link-libc = -Wl,-rpath-link=$(rpath-link) \
            $(common-objpfx)libc.so$(libc.so-version) \
+           $(elfobjdir)/$(rtld-installed-name) \
            $(common-objpfx)libc.a $(gnulib)
 # Choose the default search path for the dynamic linker based on
 # where we will install libraries.
@@ -312,30 +346,40 @@ default-rpath = $(slibdir):$(libdir)
 else
 default-rpath = $(libdir)
 endif
+# This is how to find at build-time things that will be installed there.
+rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir)
+mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
+elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
 else
 link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
 endif
 endif
-ifndef gnulib
-gnulib := -lgcc
-endif
-ifeq ($(elf),yes)
-+preinit = crti.o
-+postinit = crtn.o
+ifndef link-extra-libs
+ifeq (yes,$(build-shared))
+ifneq ($(common-objpfx),$(objpfx))
+link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),\
+       $(wildcard $(common-objpfx)$(lib).so$($(notdir $(lib)).so-version) \
+                  $(objpfx)$(lib).so$($(notdir $(lib)).so-version)))
+else
+link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).so$($(notdir $(lib)).so-version))
 endif
-ifdef objpfx
-csu-objpfx = $(objpfx)
-elf-objpfx = $(objpfx)
 else
-csu-objpfx = $(..)csu/
-elf-objpfx = $(..)elf/
+link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
 endif
-
-ifeq (yes,$(build-shared))
-ifndef rtld-installed-name
-rtld-installed-name = ld.so
 endif
+ifndef gnulib
+gnulib := -lgcc
+endif
+ifeq ($(elf),yes)
++preinit = $(addprefix $(csu-objpfx),crti.o)
++postinit = $(addprefix $(csu-objpfx),crtn.o)
++prector = `$(CC) --print-file-name=crtbegin.o`
++postctor = `$(CC) --print-file-name=crtend.o`
 endif
+csu-objpfx = $(common-objpfx)csu/
+elf-objpfx = $(common-objpfx)elf/
+db-objpfx = $(common-objpfx)db/
 
 # How to run a program we just linked with our library.
 # The program binary is assumed to be $(word 2,$^).
@@ -344,11 +388,13 @@ ifneq (yes,$(build-shared))
 built-program-cmd = $(built-program-file)
 else
 comma = ,
+sysdep-library-path = \
+$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
+                                      $(filter -Wl$(comma)-rpath-link=%,\
+                                               $(sysdep-LDFLAGS)))))
 define built-program-cmd
-LD_LIBRARY_PATH=$(common-objdir)$(patsubst -Wl$(comma)-rpath-link=%,:%,\
-                                          $(filter -Wl$(comma)-rpath-link=%,\
-                                                   $(sysdep-LDFLAGS))) \
-$(elf-objpfx)ld.so $(built-program-file)
+LD_LIBRARY_PATH=$(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+$(elf-objpfx)$(rtld-installed-name) $(built-program-file)
 endef
 endif
 
@@ -384,7 +430,7 @@ M4 = m4
 .NOEXPORT:
 
 # We want to echo the commands we're running without
-# umpteem zillion filenames along with it (we use `...' instead)
+# umpteen zillion filenames along with it (we use `...' instead)
 # but we don't want this echoing done when the user has said
 # he doesn't want to see commands echoed by using -s.
 ifneq  "$(findstring s,$(MAKEFLAGS))" ""       # if -s
@@ -402,7 +448,7 @@ ifdef               CFLAGS
 endif          # CFLAGS
 endif  # +cflags
 
-# If none of the above worked, default to "-g".
+# If none of the above worked, default to "-g -O".
 ifeq   "$(strip $(+cflags))" ""
 +cflags        := $(default_cflags)
 endif  # $(+cflags) == ""
@@ -427,9 +473,10 @@ libio-include = -I$(..)libio
 
 # These are the variables that the implicit compilation rules use.
 CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
-          $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
+          $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) \
+          $(CPPFLAGS-$(@F))
 override CFLAGS        = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) \
-                 $(CFLAGS-$(<F))
+                 $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
 
 
 # This is the macro that the implicit linking rules use.
@@ -444,13 +491,14 @@ endif
 # to pass different flags for each flavor.
 libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
 object-suffixes := .o
+all-object-suffixes := .o .so .po .go .bo
 libtype.o := lib%.a
 ifeq (yes,$(build-shared))
 # Under --enable-shared, we will build a shared library of PIC objects.
 # The PIC object files are named foo.so.
 object-suffixes += .so
 CPPFLAGS-.so = -DPIC
-CFLAGS-.so = -fPIC
+CFLAGS-.so = -fPIC -fno-common
 libtype.so := lib%_pic.a
 endif
 ifeq (yes,$(build-profile))
@@ -468,13 +516,25 @@ ifeq (yes,$(build-omitfp))
 object-suffixes += .go
 CFLAGS-.go = -g
 CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
-CFLAGS-.so += $(CFLAGS.o)
+CFLAGS-.so += $(CFLAGS-.o)
 libtype.go = lib%_g.a
 endif
+ifeq (yes,$(build-bounded))
+# Under --enable-bounded, we build the library with `-fbounded-pointers -g'
+# to runtime bounds checking.  The bounded-pointer objects are named foo.bo.
+object-suffixes += .bo
+CPPFLAGS-.bo = -DBOUNDED_POINTERS
+CFLAGS-.bo = -g -fbounded-pointers
+libtype.bo = lib%_b.a
+endif
 
 
 +gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
 
+ifndef BUILD_CC
+BUILD_CC = $(CC)
+endif
+
 ifneq ($(BUILD_CC),$(CC))
 cross-compiling := yes
 else
@@ -489,4 +549,86 @@ $(common-objpfx)version.mk: $(..)version.h $(..)Makeconfig
            < $< > $@-new
        mv -f $@-new $@
 
+ifeq (yes, $(build-shared))
+
+# Process the shlib-versions file, which tells us what shared library
+# version numbers to use when we install shared objects on this system.
+-include $(common-objpfx)soversions.mk
+$(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makeconfig \
+                              $(wildcard $(patsubst %, $(..)%/shlib-versions,\
+                                                       $(add-ons))) \
+                              $(common-objpfx)config.make
+       (file="$(wildcard $(patsubst %,$(..)%/shlib-versions,$(add-ons))) \
+              $(..)shlib-versions"; \
+        for f in $$file; do \
+          sed 's/#.*$$//' $$f | while read conf versions; do \
+            test -n "$$versions" && \
+            test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
+                       : "$$conf"` != 0 || continue; \
+            for v in $$versions; do \
+              lib=`echo $$v | sed 's/=.*$$//'`; \
+              if eval "test -z \"\$$vers_lib$$lib\""; then \
+                eval vers_lib$${lib}=yes; \
+                number=`echo $$v | sed "s/^.*=//"`; \
+                case $$number in \
+                  [0-9]*) echo "$$lib.so-version=.$$number"; \
+                          echo "all-sonames+=$$lib.so\$$($$lib.so-version)";;\
+                  *) echo "$$lib.so-version=$$number"; \
+                     echo "all-sonames+=\$$($$lib.so-version)";;  \
+                esac; \
+              fi; \
+            done; \
+          done; \
+        done;) > $@T; exit 0
+       mv -f $@T $@
+
+# Get $(version) defined with the release version number.
+-include $(common-objpfx)version.mk
+
+# Generate the header containing the names of all shared libraries.
+# We use a stamp file to avoid uncessary recompilations.
+before-compile += $(common-objpfx)gnu/lib-names.h
+$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp
+$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
+       $(make-target-directory)
+       @rm -f ${@:stmp=T} $@
+       (echo '/* This file is automatically generated.';\
+        echo '   It defines macros to allow user program to find the shared';\
+        echo '   library files which come as part of GNU libc.  */';\
+        echo '#ifndef __GNU_LIB_NAMES_H'; \
+        echo '#define __GNU_LIB_NAMES_H        1'; \
+        echo; \
+        (libs='$(all-sonames)';\
+         for l in $$libs; do \
+           upname=`echo $$l | sed 's/[.]so.*//' | \
+                   tr 'abcdefghijklmnopqrstuvwxyz-' \
+                      'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
+           echo "#define       $${upname}_SO   \"$$l\""; \
+         done;) | sort; \
+        echo; \
+        echo '#endif   /* gnu/lib-names.h */';) > ${@:stmp=T}
+       if test -r ${@:stmp=h} && cmp -s ${@:stmp=h} ${@:stmp=T}; \
+       then rm -f ${@:stmp=T}; \
+       else mv -f ${@:stmp=T} ${@:stmp=h}; fi
+       touch $@
+
+common-generated += gnu/lib-names.h gnu/lib-names.stmp
+
+# The name under which the run-time dynamic linker is installed.
+# We are currently going for the convention that `/lib/ld.so.1'
+# names the SVR4/ELF ABI-compliant dynamic linker.
+ifndef rtld-installed-name
+ifdef ld.so-version
+rtld-installed-name = $(ld.so-version)
+else
+rtld-installed-name = ld.so.1
+endif
+endif
+
+ifndef rtld-version-installed-name
+rtld-version-installed-name = ld-$(version).so
+endif
+
+endif # build-shared
+
 endif # Makeconfig not yet included