From 6737908f74ff566748864548cf35bb1da8e64af6 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 31 Oct 2002 18:20:21 +0000 Subject: Ok, this commit is _huge_ and its gonna change the world. I've been working on a new config system on and off for about 6 months now, but I've never been fully satisfied. Well, I'm finally am happy with the new config system, so here it is. This completely removes the old uClibc configuration system, and replaces it with an entirely new system based on LinuxKernelConf, from http://www.xs4all.nl/~zippel/lc/ As it turns out, Linus has just merged LinuxKernelConf into Linux 2.5.45, so it looks like I made the right choice. I have thus far updated only x86. I'll be updating the other architectures shortly. -Erik --- .cvsignore | 1 + Makefile | 221 +- Rules.mak | 53 +- extra/Configs/Config.i386 | 370 ++- extra/Configs/Config.i386.default | 73 + extra/Configs/Config.in | 260 ++ extra/config/Makefile | 83 + extra/config/conf | Bin 0 -> 163714 bytes extra/config/conf.c | 565 +++++ extra/config/confdata.c | 370 +++ extra/config/expr.c | 1054 ++++++++ extra/config/expr.h | 242 ++ extra/config/lex.zconf.c | 3270 +++++++++++++++++++++++++ extra/config/lex.zconf.c_shipped | 3270 +++++++++++++++++++++++++ extra/config/lkc.h | 106 + extra/config/lkc_defs.h | 38 + extra/config/lkc_proto.h | 38 + extra/config/lxdialog/BIG.FAT.WARNING | 4 + extra/config/lxdialog/Makefile | 51 + extra/config/lxdialog/checklist.c | 369 +++ extra/config/lxdialog/colors.h | 161 ++ extra/config/lxdialog/dialog.h | 184 ++ extra/config/lxdialog/inputbox.c | 240 ++ extra/config/lxdialog/lxdialog | Bin 0 -> 34594 bytes extra/config/lxdialog/lxdialog.c | 226 ++ extra/config/lxdialog/menubox.c | 443 ++++ extra/config/lxdialog/msgbox.c | 85 + extra/config/lxdialog/textbox.c | 556 +++++ extra/config/lxdialog/util.c | 359 +++ extra/config/lxdialog/yesno.c | 118 + extra/config/mconf | Bin 0 -> 178758 bytes extra/config/mconf.c | 711 ++++++ extra/config/menu.c | 309 +++ extra/config/symbol.c | 618 +++++ extra/config/zconf.l | 323 +++ extra/config/zconf.tab.c | 1866 ++++++++++++++ extra/config/zconf.tab.c_shipped | 1866 ++++++++++++++ extra/config/zconf.tab.h | 53 + extra/config/zconf.tab.h_shipped | 53 + extra/config/zconf.y | 651 +++++ extra/gcc-uClibc/Makefile | 12 +- extra/gcc-uClibc/gcc-uClibc.c | 2 +- extra/locale/Makefile | 2 +- include/features.h | 10 +- include/sys/cdefs.h | 2 +- ldso/Makefile | 4 +- ldso/ldso/Makefile | 2 - libc/inet/Makefile | 2 +- libc/inet/rpc/Makefile | 15 +- libc/misc/Makefile | 6 +- libc/misc/dirent/alphasort64.c | 4 +- libc/misc/dirent/readdir64.c | 4 +- libc/misc/dirent/readdir64_r.c | 4 +- libc/misc/dirent/scandir64.c | 4 +- libc/misc/glob/glob64.c | 2 +- libc/misc/internals/Makefile | 2 +- libc/misc/internals/tempname.c | 2 +- libc/misc/locale/Makefile | 4 +- libc/misc/statfs/Makefile | 2 +- libc/misc/statfs/fstatfs64.c | 4 +- libc/misc/statfs/fstatvfs64.c | 2 +- libc/misc/statfs/statfs64.c | 2 +- libc/misc/statfs/statvfs64.c | 2 +- libc/misc/time/Makefile | 2 +- libc/pwd_grp/Makefile | 2 +- libc/stdio/Makefile | 25 +- libc/stdio/tmpfile.c | 2 +- libc/stdlib/Makefile | 14 +- libc/stdlib/getpt.c | 18 +- libc/stdlib/grantpt.c | 8 +- libc/stdlib/ptsname.c | 10 +- libc/string/Makefile | 2 +- libc/sysdeps/linux/common/Makefile | 4 +- libc/sysdeps/linux/common/bits/posix_opt.h | 4 +- libc/sysdeps/linux/common/bits/uClibc_stdio.h | 12 +- libc/sysdeps/linux/common/creat64.c | 4 +- libc/sysdeps/linux/common/ftruncate64.c | 4 +- libc/sysdeps/linux/common/getdirname.c | 4 +- libc/sysdeps/linux/common/getrlimit64.c | 2 +- libc/sysdeps/linux/common/initfini.c | 2 +- libc/sysdeps/linux/common/llseek.c | 2 +- libc/sysdeps/linux/common/mmap64.c | 4 +- libc/sysdeps/linux/common/open64.c | 4 +- libc/sysdeps/linux/common/pread_write.c | 20 +- libc/sysdeps/linux/common/setrlimit64.c | 2 +- libc/sysdeps/linux/common/syscalls.c | 24 +- libc/sysdeps/linux/common/truncate64.c | 4 +- libc/sysdeps/linux/cris/Makefile | 2 +- libc/sysdeps/linux/h8300/Makefile | 2 +- libc/sysdeps/linux/h8300/crt0.S | 2 +- libc/sysdeps/linux/h8300/vfork.S | 2 +- libc/sysdeps/linux/i960/README | 4 +- libc/sysdeps/linux/m68k/Makefile | 8 +- libc/sysdeps/linux/m68k/clone.S | 2 +- libc/sysdeps/linux/m68k/crt0.S | 2 +- libc/sysdeps/linux/m68k/vfork.S | 2 +- libc/sysdeps/linux/powerpc/Makefile | 6 +- libc/sysdeps/linux/sh/sysdep.h | 6 +- libc/unistd/Makefile | 2 +- libc/unistd/daemon.c | 5 + libc/unistd/fpathconf.c | 2 +- libc/unistd/pathconf.c | 2 +- libm/Makefile | 4 +- libm/powerpc/Makefile | 4 +- libpthread/Makefile | 6 +- libpthread/linuxthreads/attr.c | 2 +- libpthread/linuxthreads/weaks.c | 2 +- libpthread/linuxthreads/wrapsyscall.c | 8 +- libutil/Makefile | 2 +- 109 files changed, 19093 insertions(+), 518 deletions(-) create mode 100644 extra/Configs/Config.i386.default create mode 100644 extra/Configs/Config.in create mode 100644 extra/config/Makefile create mode 100755 extra/config/conf create mode 100644 extra/config/conf.c create mode 100644 extra/config/confdata.c create mode 100644 extra/config/expr.c create mode 100644 extra/config/expr.h create mode 100644 extra/config/lex.zconf.c create mode 100644 extra/config/lex.zconf.c_shipped create mode 100644 extra/config/lkc.h create mode 100644 extra/config/lkc_defs.h create mode 100644 extra/config/lkc_proto.h create mode 100644 extra/config/lxdialog/BIG.FAT.WARNING create mode 100644 extra/config/lxdialog/Makefile create mode 100644 extra/config/lxdialog/checklist.c create mode 100644 extra/config/lxdialog/colors.h create mode 100644 extra/config/lxdialog/dialog.h create mode 100644 extra/config/lxdialog/inputbox.c create mode 100755 extra/config/lxdialog/lxdialog create mode 100644 extra/config/lxdialog/lxdialog.c create mode 100644 extra/config/lxdialog/menubox.c create mode 100644 extra/config/lxdialog/msgbox.c create mode 100644 extra/config/lxdialog/textbox.c create mode 100644 extra/config/lxdialog/util.c create mode 100644 extra/config/lxdialog/yesno.c create mode 100755 extra/config/mconf create mode 100644 extra/config/mconf.c create mode 100644 extra/config/menu.c create mode 100644 extra/config/symbol.c create mode 100644 extra/config/zconf.l create mode 100644 extra/config/zconf.tab.c create mode 100644 extra/config/zconf.tab.c_shipped create mode 100644 extra/config/zconf.tab.h create mode 100644 extra/config/zconf.tab.h_shipped create mode 100644 extra/config/zconf.y diff --git a/.cvsignore b/.cvsignore index 19c5ad2af..49273e8e3 100644 --- a/.cvsignore +++ b/.cvsignore @@ -9,3 +9,4 @@ lib Config _install build-stamp +.config* diff --git a/Makefile b/Makefile index c5f69e132..a23e5727a 100644 --- a/Makefile +++ b/Makefile @@ -22,29 +22,27 @@ # other sundry sources. Files within this library are copyright by their # respective copyright holders. -#-------------------------------------------------------- -# -#There are a number of configurable options in "Config" -# -#-------------------------------------------------------- +#-------------------------------------------------------------- +# You shouldn't need to mess with anything beyond this point... +#-------------------------------------------------------------- +noconfig_targets := menuconfig config oldconfig randconfig \ + defconfig allyesconfig allnoconfig clean distclean \ + release tags TAGS TOPDIR=./ include Rules.mak DIRS = extra ldso libc libcrypt libresolv libutil libm libpthread -all: headers uClibc_config subdirs shared utils finished +ifdef include-config -Config: - @echo - @echo "You didn't read the README, did you... =)" - @echo "Choose a configuration file in extras/Config/ and then run" - @echo " ln -s ./extra/Configs/Config. ./Config" - @echo - @exit 1 +all: headers subdirs shared utils finished + +# In this section, we need .config +-include .config.cmd shared: -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) @$(MAKE) -C libc shared @$(MAKE) -C ldso shared @$(MAKE) -C libcrypt shared @@ -67,7 +65,7 @@ finished: shared # Target for uClinux distro # romfs: -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) install -d $(ROMFSDIR)/lib install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ $(ROMFSDIR)/lib @@ -79,13 +77,18 @@ ifeq ($(strip $(HAVE_SHARED)),true) fi; endif -headers: dummy +include/bits/uClibc_config.h: .config + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf -o extra/Configs/Config.$(TARGET_ARCH) + +headers: include/bits/uClibc_config.h rm -f include/asm; - @if [ $(TARGET_ARCH) = "powerpc" ];then \ + @if [ "$(TARGET_ARCH)" = "powerpc" ];then \ ln -fs $(KERNEL_SOURCE)/include/asm-ppc include/asm; \ - elif [ $(TARGET_ARCH) = "mips" ];then \ + elif [ "$(TARGET_ARCH)" = "mips" ];then \ ln -fs $(KERNEL_SOURCE)/include/asm-mips include/asm; \ - elif [ $(TARGET_ARCH) = "mipsel" ];then \ + elif [ "$(TARGET_ARCH)" = "mipsel" ];then \ ln -fs $(KERNEL_SOURCE)/include/asm-mips include/asm; \ cd $(shell pwd)/libc/sysdeps/linux; \ ln -fs mips mipsel; \ @@ -93,10 +96,10 @@ headers: dummy ln -fs mips mipsel; \ cd $(shell pwd)/libpthread/linuxthreads/sysdeps; \ ln -fs mips mipsel; \ - elif [ $(TARGET_ARCH) = "cris" ];then \ + elif [ "$(TARGET_ARCH)" = "cris" ];then \ ln -fs $(KERNEL_SOURCE)/include/asm-cris include/asm; \ else \ - if [ $(HAS_MMU) != "true" ]; then \ + if [ "$(UCLIBC_HAS_MMU)" != "y" ]; then \ if [ -d $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu ] ; then \ ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\ else \ @@ -110,16 +113,14 @@ headers: dummy set -e; \ echo " "; \ echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \ - echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \ - echo "correctly. Please edit \`Config' and fix these settings."; \ + echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or UCLIBC_HAS_MMU"; \ + echo "correctly when you configured uClibc. Please fix these settings."; \ echo " "; \ false; \ fi; rm -f include/linux include/scsi ln -fs $(KERNEL_SOURCE)/include/linux include/linux ln -fs $(KERNEL_SOURCE)/include/scsi include/scsi - rm -rf include/bits - mkdir -p include/bits @cd include/bits; \ set -e; \ for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \ @@ -146,97 +147,6 @@ headers: dummy TOPDIR=. CC=$(CC) /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers -uClibc_config: Makefile Config - @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > include/bits/uClibc_config.h - @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> include/bits/uClibc_config.h - @echo "#error Never include directly; use instead." >> include/bits/uClibc_config.h - @echo "#endif" >> include/bits/uClibc_config.h - @echo "#define __UCLIBC_MAJOR__ $(MAJOR_VERSION)" >> include/bits/uClibc_config.h - @echo "#define __UCLIBC_MINOR__ $(MINOR_VERSION)" >> include/bits/uClibc_config.h - @echo "#define __UCLIBC_SUBLEVEL__ $(SUBLEVEL)" >> include/bits/uClibc_config.h - @echo "#define linux 1" >> include/bits/uClibc_config.h - @echo "#define __linux__ 1" >> include/bits/uClibc_config.h - @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_IPV6__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_IPV6__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(HAS_MMU)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_MMU__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "For now we make the assumption that a linux system without an"; \ - echo "MMU must be uClinux, and must have a broken munmap (both"; \ - echo "assumptions are a bit dodgy, but can be changed in the future)."; \ - echo "#undef __UCLIBC_HAS_MMU__" >> include/bits/uClibc_config.h ; \ - echo "#define __UCLIBC_UCLINUX_BROKEN_MUNMAP__ 1" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_FLOATS__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_FLOATS__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(HAS_LOCALE)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_LOCALE__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_LOCALE__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(HAS_WCHAR)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_WCHAR__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_WCHAR__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(HAVE_ELF)" = "false" ] ; then \ - echo "#undef HAVE_ELF" >> include/bits/uClibc_config.h ; \ - else \ - echo "#define HAVE_ELF 1" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(HAVE_SHARED)" = "false" ] ; then \ - echo "#undef HAVE_SHARED" >> include/bits/uClibc_config.h ; \ - else \ - echo "#define HAVE_SHARED 1" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(TARGET_ARCH)" = "sh" ] ; then \ - echo "#define NO_UNDERSCORES 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef NO_UNDERSCORES" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(INCLUDE_RPC)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_RPC__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_RPC__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(DOLFS)" = "true" ] ; then \ - echo "#define __UCLIBC_HAVE_LFS__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAVE_LFS__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(INCLUDE_THREADS)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_THREADS__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_THREADS__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(INCLUDE_REGEX)" = "true" ] ; then \ - echo "#define __UCLIBC_HAS_REGEX__ 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef __UCLIBC_HAS_REGEX__" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(UNIX98PTY_ONLY)" = "true" ] ; then \ - echo "#define UNIX98PTY_ONLY 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef UNIX98PTY_ONLY" >> include/bits/uClibc_config.h ; \ - fi - @if [ "$(ASSUME_DEVPTS)" = "true" ] ; then \ - echo "#define ASSUME_DEVPTS 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef ASSUME_DEVPTS" >> include/bits/uClibc_config.h ; \ - fi - @echo "#define C_SYMBOL_PREFIX "\""$(C_SYMBOL_PREFIX)"\" >> include/bits/uClibc_config.h - @if [ "$(HAVE_DOT_HIDDEN)" = "true" ] ; then \ - echo "#define HAVE_DOT_HIDDEN 1" >> include/bits/uClibc_config.h ; \ - else \ - echo "#undef HAVE_DOT_HIDDEN" >> include/bits/uClibc_config.h ; \ - fi - subdirs: $(patsubst %, _dir_%, $(DIRS)) $(patsubst %, _dir_%, $(DIRS)) : dummy @@ -260,7 +170,7 @@ install_dev: done; -find $(PREFIX)$(DEVEL_PREFIX) -name CVS | xargs rm -rf; -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1.\2/'` $(PREFIX)$(DEVEL_PREFIX) -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) -find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';' # If we build shared libraries then the static libs are PIC... # Make _pic.a symlinks to make mklibs.py and similar tools happy. @@ -274,7 +184,7 @@ endif # allowing cross development. If you want to deploy to a target # system, use the "install_target" target instead... install_runtime: -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) install -d $(PREFIX)$(DEVEL_PREFIX)/lib install -d $(PREFIX)$(DEVEL_PREFIX)/bin install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ @@ -297,7 +207,7 @@ install_toolchain: install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin $(MAKE) -C extra/gcc-uClibc install -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) utils: $(TOPDIR)ldso/util/ldd $(MAKE) -C ldso utils else @@ -305,7 +215,7 @@ utils: dummy endif install_utils: utils -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) install -d $(PREFIX)$(DEVEL_TOOL_PREFIX)/bin; install -m 755 ldso/util/ldd \ $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd @@ -332,7 +242,7 @@ endif # $PREFIX is set to, allowing you to package up the result for # deployment onto your target system. install_target: -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) install -d $(PREFIX)$(TARGET_PREFIX)/lib install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ @@ -349,7 +259,7 @@ ifeq ($(strip $(HAVE_SHARED)),true) endif install_target_utils: -ifeq ($(strip $(HAVE_SHARED)),true) +ifeq ($(strip $(HAVE_SHARED)),y) @$(MAKE) -C ldso/util ldd.target readelf.target #ldconfig.target install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin; install -m 755 ldso/util/ldd.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/ldd @@ -367,8 +277,60 @@ finished2: @echo Finished installing... @echo +else # ifdef include-config + +all: menuconfig + +ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) +# Targets which don't need .config + +# configuration +# --------------------------------------------------------------------------- + +extra/config/conf extra/config/mconf: + make -C extra/config + -@if [ ! -f .config ] ; then \ + cp extra/Configs/Config.$(TARGET_ARCH).default .config; \ + fi -distclean clean: +menuconfig: extra/config/mconf + make -C extra/config/lxdialog + rm -rf include/bits + mkdir -p include/bits + @./extra/config/mconf extra/Configs/Config.$(TARGET_ARCH) + +config: extra/config/conf + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf extra/Configs/Config.$(TARGET_ARCH) + +oldconfig: extra/config/conf + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf -o extra/Configs/Config.$(TARGET_ARCH) + +randconfig: extra/config/conf + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf -r extra/Configs/Config.$(TARGET_ARCH) + +allyesconfig: extra/config/conf + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf -y extra/Configs/Config.$(TARGET_ARCH) + +allnoconfig: extra/config/conf + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf -n extra/Configs/Config.$(TARGET_ARCH) + +defconfig: extra/config/conf + rm -rf include/bits + mkdir -p include/bits + @./extra/config/conf -d extra/Configs/Config.$(TARGET_ARCH) + + +clean: - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \; @rm -rf tmp lib include/bits libc/tmp _install $(MAKE) -C test clean @@ -390,14 +352,17 @@ distclean clean: @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \ $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \ fi; - @if [ $(TARGET_ARCH) = "mipsel" ]; then \ + @if [ "$(TARGET_ARCH)" = "mipsel" ]; then \ $(MAKE) -C libc/sysdeps/linux/mips clean; \ rm -f ldso/ldso/mipsel; \ rm -f libc/sysdeps/linux/mipsel; \ rm -f libpthread/linuxthreads/sysdeps/mipsel; \ fi; -dist release: distclean +distclean: clean + rm -f .config .config.old .config.cmd + +release: distclean cd ..; \ rm -rf uClibc-$(VERSION); \ cp -a uClibc uClibc-$(VERSION); \ @@ -406,5 +371,9 @@ dist release: distclean \ tar -cvzf uClibc-$(VERSION).tar.gz --exclude CVS uClibc-$(VERSION)/; -.PHONY: dummy subdirs release distclean clean +endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) +endif # ifdef include-config + +.PHONY: dummy subdirs release distclean clean config oldconfig menuconfig + diff --git a/Rules.mak b/Rules.mak index 4c27771b6..3a8dcec56 100644 --- a/Rules.mak +++ b/Rules.mak @@ -21,22 +21,41 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --include $(TOPDIR)Config +# If you are running a cross compiler, you may want to set this +# to something more interesting... Target architecture is determined +# by asking this compiler what arch it compiles stuff for. +CROSS= +CC = $(CROSS)gcc-3.2 +AR = $(CROSS)ar +LD = $(CROSS)ld +NM = $(CROSS)nm +STRIPTOOL = $(CROSS)strip +#STRIPTOOL = /bin/true + +# Select the compiler needed to build binaries for your development system +NATIVE_CC = gcc + # Be sure to update include/features.h when changing this... MAJOR_VERSION:=0 MINOR_VERSION:=9 SUBLEVEL:=15 VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) +export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION - -LIBNAME:=libc.a SHARED_FULLNAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so SHARED_MAJORNAME:=libc.so.$(MAJOR_VERSION) UCLIBC_LDSO:=ld-uClibc.so.$(MAJOR_VERSION) -LIBC:=$(TOPDIR)libc/libc.a +LIBNAME:=libc.a +LIBC:=$(TOPDIR)libc/$(LIBNAME) LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name) +# Pull in the user's uClibc configuration +ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) +include-config := 1 +-include $(TOPDIR).config +endif + # A nifty macro to make testing gcc features easier check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ then echo "$(1)"; else echo "$(2)"; fi) @@ -45,7 +64,7 @@ check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; AWK:=$(shell if [ -x /usr/bin/nawk ]; then echo "/usr/bin/nawk"; \ else echo "/usr/bin/awk"; fi) -NATIVE_ARCH:= ${shell uname -m | sed \ +NATIVE_ARCH:= $(shell uname -m | sed \ -e 's/i.86/i386/' \ -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' \ @@ -54,9 +73,9 @@ NATIVE_ARCH:= ${shell uname -m | sed \ -e 's/v850.*/v850/g' \ -e 's/sh[234].*/sh/' \ -e 's/mips.*/mips/' \ - } + ) ifeq ($(strip $(TARGET_ARCH)),) -TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ +TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/i.86/i386/' \ -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' \ @@ -66,7 +85,7 @@ TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/sh[234]/sh/' \ -e 's/mips.*/mips/' \ -e 's/cris.*/cris/' \ - } + ) endif # Ensure consistent filename sort order @@ -80,7 +99,7 @@ ifndef OPTIMIZATION # use '-Os' optimization if available, else use -O2, allow Config to override OPTIMIZATION:= -OPTIMIZATION+=${call check_gcc,-Os,-O2} +OPTIMIZATION+=$(call check_gcc,-Os,-O2) ifeq ($(strip $(TARGET_ARCH)),arm) OPTIMIZATION+=-fstrict-aliasing endif @@ -100,7 +119,7 @@ CFLAGS:=$(WARNINGS) $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) \ -I$(TOPDIR)include -iwithprefix include -I. -D_LIBC $(ARCH_CFLAGS) NATIVE_CFLAGS:=-O2 -Wall -ifeq ($(strip $(DODEBUG)),true) +ifeq ($(strip $(DODEBUG)),y) CFLAGS += -g LDFLAGS:= -shared --warn-common --warn-once -z combreloc STRIPTOOL:= true -Since_we_are_debugging @@ -109,27 +128,21 @@ else LDFLAGS := -s -shared --warn-common --warn-once -z combreloc endif -ifeq ($(strip $(HAVE_SHARED)),true) - DOPIC:=true +ifeq ($(strip $(HAVE_SHARED)),y) LIBRARY_CACHE:=#-DUSE_CACHE - ifeq ($(strip $(BUILD_UCLIBC_LDSO)),true) + ifeq ($(strip $(BUILD_UCLIBC_LDSO)),y) LDSO:=$(TOPDIR)lib/$(UCLIBC_LDSO) DYNAMIC_LINKER:=$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) - BUILD_DYNAMIC_LINKER:=${shell cd $(TOPDIR) && pwd}/lib/$(UCLIBC_LDSO) + BUILD_DYNAMIC_LINKER:=$(shell cd $(TOPDIR) && pwd)/lib/$(UCLIBC_LDSO) else LDSO:=$(SYSTEM_LDSO) - BUILD_UCLIBC_LDSO:=false DYNAMIC_LINKER:=/lib/$(notdir $(SYSTEM_LDSO)) BUILD_DYNAMIC_LINKER:=/lib/$(notdir $(SYSTEM_LDSO)) endif endif -ifeq ($(strip $(DOPIC)),true) +ifeq ($(strip $(DOPIC)),y) CFLAGS += -fPIC endif -# Currently locale support requires wide char support. -ifeq ($(strip $(HAS_LOCALE)),true) - HAS_WCHAR:=true -endif # TARGET_PREFIX is the directory under which which the uClibc runtime # environment will be installed and used on the target system. The diff --git a/extra/Configs/Config.i386 b/extra/Configs/Config.i386 index 13e4916bb..4b3ff7b5a 100644 --- a/extra/Configs/Config.i386 +++ b/extra/Configs/Config.i386 @@ -1,189 +1,187 @@ -# Library Configuration rules for uClibc # -# This file contains rules which are shared between multiple Makefiles. All -# normal configuration options live in the file named "Config". You probably -# should not mess with this file unless you know what you are doing... -# -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt. # -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library 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 Library 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 -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. - -NATIVE_CC = gcc - -# If you are running a cross compiler, you may want to set this -# to something more interesting... Target architecture is determined -# by asking this compiler what arch it compiles stuff for. -CROSS = #$(TARGET_ARCH)-linux- -CC = $(CROSS)gcc -AR = $(CROSS)ar -LD = $(CROSS)ld -NM = $(CROSS)nm -STRIPTOOL = $(CROSS)strip -#STRIPTOOL = /bin/true - -# Set the following to `true' to make a debuggable build, and `false' for -# production builds. -DODEBUG = false - -# Compiler warnings you want to see -WARNINGS=-Wall - -# Note that the kernel source you use to compile with should be the same as the -# Linux kernel you run your apps on. uClibc doesn't even try to achieve binary -# compatibility across kernel versions. So don't expect, for example, uClibc -# compiled with Linux kernel 2.0.x to implement lchown properly, since 2.0.x -# can't do that. Similarly, if you compile uClibc vs Linux 2.4.x kernel headers, -# but then run on Linux 2.0.x, lchown will be compiled into uClibc, but won't -# work at all. You have been warned. -KERNEL_SOURCE=/usr/src/linux - -# Set this to `false' if your CPU doesn't have a memory management unit (MMU). -# Set it to `true' otherwise. -HAS_MMU = true - -# Set this to `false' if you don't have/need basic floating point support -# support in libc (strtod, printf, scanf). Set it to `true' otherwise. -# If this is not true, then libm will not be built. -HAS_FLOATING_POINT = true - -# Set to `true' if you want the math library to contain the full set -# of C99 math library features. Costs an extra 35k or so on x86. -DO_C99_MATH = false - -# Set this to 'false if you don't need shadow password support. -HAS_SHADOW = false - -# Set this to `false' if you don't have/need locale support; `true' otherwise. -# NOTE: Currently does not affect collation. -# You must also generate the locale data and associated .h file. -# See the README in directory extra/locale for details. -HAS_LOCALE = false - -# Set this to `false' if you don't have/need wide char support. -HAS_WCHAR = false - -# This specifies which malloc implementation is used. -# -# "malloc" use mmap for all allocations and so works very well on MMU-less -# systems that do not support the brk() system call. It is pretty smart -# about reusing already allocated memory, and minimizing memory wastage. -# -# "malloc-930716" is derived from libc-5.3.12 and uses the brk() system call -# for all memory allocations. This makes it very fast. It is also pretty -# smart about reusing already allocated memory, and minimizing memory wastage. -# Because this uses brk() it will not work on uClinux MMU-less systems. -#MALLOC = malloc -MALLOC = malloc-930716 - -# If you want large file support (greater then 2 GiB) turn this on. -# Do not enable this unless your kernel provides large file support. -DOLFS = false - -# Posix regular expression code is really big -- 27k all by itself. -# If you don't use regular expressions, turn this off and save space. -# Of course, if you only staticly link, leave this on, since it will -# only be included in your apps if you use regular expressions. -INCLUDE_REGEX=true - -# If you want to include RPC support, enable this. RPC is almost never used -# for anything except NFS support, so unless you plan to use NFS, leave this -# disabled. This is off by default. -INCLUDE_RPC = false - -# Normally we enable just enough RPC support for things like rshd and -# nfs mount to work. If you find you need the rest of the RPC stuff, -# then enable this. -INCLUDE_FULL_RPC = false - -# If you want to include support for the next version of the Internet -# Protocol: IP version 6, enable this. This is off by default. -INCLUDE_IPV6 = false - -# If you want to include threads support, enable this. The C library will -# be compiled thread-safe, and the libpthread library will be built. -INCLUDE_THREADS = true - -# If you want to support only Unix 98 PTYs enable this. Some older -# applications may need this disabled. For most current programs, -# you can generally leave this true. -UNIX98PTY_ONLY = true - -# Enable this if /dev/pts is on a devpts or devfs file system. Both -# these filesystems automatically manage permissions on the /dev/pts -# devices. You may need to mount this fs on /dev/pts for this to work. -# This is true by default. -ASSUME_DEVPTS = true - - -# If you want to compile the library as PIC code, turn this on. -# This is automagically enabled when HAVE_SHARED is true -DOPIC = false - -# Enable support for shared libraries? If this is false, you can -# ignore all the rest of the options in this file... -HAVE_SHARED = true - -# uClibc has a native shared library loader for some architectures. -BUILD_UCLIBC_LDSO=true - -# If you are using shared libraries, but do not want/have a native -# uClibc shared library loader, please specify the name of your -# system's shared library loader here... -#SYSTEM_LDSO=/lib/ld-linux.so.2 - -# When using shared libraries, this path is the location where the -# shared library will be invoked. This value will be compiled into -# every binary compiled with uClibc. -# -# BIG FAT WARNING: -# If you do not have a shared library loader with the correct name -# sitting in the directory this points to, your binaries will not run. -SHARED_LIB_LOADER_PATH=$(DEVEL_PREFIX)/lib - -# DEVEL_PREFIX is the directory into which the uClibc development -# environment will be installed. The result will look something -# like the following: -# DEVEL_PREFIX/ -# lib/ -# include/ -# This value is used by the 'make install' Makefile target. Since this -# directory is compiled into the uclibc cross compiler spoofer, you -# have to recompile if you change this value... -DEVEL_PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc - -# SYSTEM_DEVEL_PREFIX is the directory prefix used when installing -# bin/arch-uclibc-gcc, bin/arch-uclibc-ld, etc. This is only used by -# the 'make install' target, and is not compiled into anything. This -# defaults to $DEVEL_PREFIX/usr, but makers of .rpms and .debs will -# want to set this to "/usr" instead. -SYSTEM_DEVEL_PREFIX = $(DEVEL_PREFIX) - -# DEVEL_TOOL_PREFIX is the directory prefix used when installing -# bin/gcc, bin/ld, etc. This is only used by the 'make install' -# target, and is not compiled into anything. This defaults to -# $DEVEL_PREFIX/usr, but makers of .rpms and .debs may want to -# set this to something else. -DEVEL_TOOL_PREFIX = $(DEVEL_PREFIX)/usr - -# If you want 'make install' to install everything under a temporary -# directory, the define PREFIX during the install step, -# i.e., 'make PREFIX=/var/tmp/uClibc install'. -#PREFIX = $(TOPDIR)/_install + +mainmenu "uClibc C Library Configuration" + +menu "Target Architecture Features and Options" + +choice + prompt "Target Processor Type" + default CONFIG_386 + help + This is the processor type of your CPU. This information is used for + optimizing purposes. To build a library that will run on all x86 CPU + types (albeit not optimally fast), you can specify "386" here. If + you pick anything other than "386", there is no guarantee that uClibc + will even run on anything other than the selected processor type. + + Here are the settings recommended for greatest speed: + - "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI + 486DLC/DLC2, UMC 486SX-S and NexGen Nx586. Only "386" kernels + will run on a 386 class machine. + - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or + SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S. + - "586" for generic Pentium CPUs lacking the TSC + (time stamp counter) register. + - "Pentium-Classic" for the Intel Pentium. + - "Pentium-MMX" for the Intel Pentium MMX. + - "Pentium-Pro" for the Intel Pentium Pro/Celeron/Pentium II. + - "Pentium-III" for the Intel Pentium III + and Celerons based on the Coppermine core. + - "Pentium-4" for the Intel Pentium 4. + - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D). + - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird). + - "Crusoe" for the Transmeta Crusoe series. + - "Winchip-C6" for original IDT Winchip. + - "Winchip-2" for IDT Winchip 2. + - "Winchip-2A" for IDT Winchips with 3dNow! capabilities. + - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3. + + If you don't know what to do, choose "386". + +config CONFIG_386 + bool "386" + +config CONFIG_486 + bool "486" + +config CONFIG_586 + bool "586/K5/5x86/6x86/6x86MX" + +config CONFIG_586TSC + bool "Pentium-Classic" + +config CONFIG_586MMX + bool "Pentium-MMX" + +config CONFIG_686 + bool "Pentium-Pro/Celeron/Pentium-II" + +config CONFIG_PENTIUMIII + bool "Pentium-III/Celeron(Coppermine)" + +config CONFIG_PENTIUM4 + bool "Pentium-4" + +config CONFIG_K6 + bool "K6/K6-II/K6-III" + +config CONFIG_K7 + bool "Athlon/Duron/K7" + +config CONFIG_ELAN + bool "Elan" + +config CONFIG_CRUSOE + bool "Crusoe" + +config CONFIG_WINCHIPC6 + bool "Winchip-C6" + +config CONFIG_WINCHIP2 + bool "Winchip-2" + +config CONFIG_WINCHIP3D + bool "Winchip-2A/Winchip-3" + +config CONFIG_CYRIXIII + bool "CyrixIII/VIA-C3" + +endchoice + +config UCLIBC_HAS_MMU + bool "Target CPU has a memory management unit (MMU)" + default y + help + If your target CPU does not have a memory management unit (MMU), + then answer N here. Normally, Linux runs on systems with an MMU. + If you are building a uClinux system, answer N. + + Most people will answer Y. + +config UCLIBC_HAS_FLOATS + bool "Enable floating point number support" + default y + help + This option allows you to entirely omit all floating point number + support from uClibc. This will cause floating point functions like + strtod() to be entirely omitted from uClibc. Other functions, such + as printf() and scanf() will still be included in the library, but + will not contain support for floating point numbers. + + Answering N to this option can reduce the size of uClibc. Most people + will answer Y. + +config HAS_FPU + bool "Target CPU has a floating point unit (FPU)" + depends on UCLIBC_HAS_FLOATS + default y + help + If your target CPU does not have a floating management unit (FPU), + but you wish to support floating point functions, then uClibc will + need to be compiled with soft floating point support (-msoft-float). + If your target CPU does not have an FPU or an FPU emulator within the + Linux kernel, then you should answer N. + + Most people will answer Y. + +config DO_C99_MATH + bool "Enable full C99 math library support" + depends on UCLIBC_HAS_FLOATS + default n + help + If you want the uClibc math library to contain the full set C99 + math library features, then answer Y. If you leave this set to + N the math library will contain only the math functions that were + listed as part of the traditionla POSIX/IEEE 1003.1b-1993 standard. + Leaving this option set to N will save around 35k on an x86 system. + + If your applications require the newer C99 math library functions, + then answer Y. + +config WARNINGS + string "Compiler Warnings" + default "-Wall" + help + Set this to the set of gcc warnings you wish to see while compiling. + +config KERNEL_SOURCE + string "Linux kernel header location" + default "/usr/src/linux" + help + The kernel source you use to compile with should be the same as the + Linux kernel you run your apps on. uClibc doesn't even try to achieve binary + compatibility across kernel versions. So don't expect, for example, uClibc + compiled with Linux kernel 2.0.x to implement lchown properly, since 2.0.x + can't do that. Similarly, if you compile uClibc vs Linux 2.4.x kernel headers, + but then run on Linux 2.0.x, lchown will be compiled into uClibc, but won't + work at all. You have been warned. + +config C_SYMBOL_PREFIX + string + default "" + +config UCLIBC_UCLINUX_BROKEN_MUNMAP + bool + depends on !HAS_MMU + default y + +config HAVE_ELF + bool + default y + +config NO_UNDERSCORES + bool + default n + +config HAVE_DOT_HIDDEN + bool + default n + +endmenu + +source "extra/Configs/Config.in" + diff --git a/extra/Configs/Config.i386.default b/extra/Configs/Config.i386.default new file mode 100644 index 000000000..3fdaa05b7 --- /dev/null +++ b/extra/Configs/Config.i386.default @@ -0,0 +1,73 @@ +# +# Automatically generated make config: don't edit +# + +# +# Target Architecture Features and Options +# +CONFIG_386=y +# CONFIG_486 is not set +# CONFIG_586 is not set +# CONFIG_586TSC is not set +# CONFIG_586MMX is not set +# CONFIG_686 is not set +# CONFIG_PENTIUMIII is not set +# CONFIG_PENTIUM4 is not set +# CONFIG_K6 is not set +# CONFIG_K7 is not set +# CONFIG_ELAN is not set +# CONFIG_CRUSOE is not set +# CONFIG_WINCHIPC6 is not set +# CONFIG_WINCHIP2 is not set +# CONFIG_WINCHIP3D is not set +# CONFIG_CYRIXIII is not set +UCLIBC_HAS_MMU=y +UCLIBC_HAS_FLOATS=y +HAS_FPU=y +# DO_C99_MATH is not set +WARNINGS="-Wall" +KERNEL_SOURCE="/usr/src/linux" +C_SYMBOL_PREFIX="" +UCLIBC_UCLINUX_BROKEN_MUNMAP=y +HAVE_ELF=y +# NO_UNDERSCORES is not set +# HAVE_DOT_HIDDEN is not set + +# +# General Library Settings +# +HAVE_PIC=y +HAVE_SHARED=y +BUILD_UCLIBC_LDSO=y +UCLIBC_HAS_THREADS=y +UCLIBC_HAS_LFS=y +# MALLOC is not set +MALLOC_930716=y +HAS_SHADOW=y +UCLIBC_HAS_REGEX=y +UNIX98PTY_ONLY=y +ASSUME_DEVPTS=y + +# +# Networking Support +# +# UCLIBC_HAS_IPV6 is not set +# UCLIBC_HAS_RPC is not set + +# +# String and Stdio Support +# +# UCLIBC_HAS_WCHAR is not set +# USE_OLD_VFPRINTF is not set + +# +# Library Installation Options +# +SHARED_LIB_LOADER_PATH="$(DEVEL_PREFIX)/lib" +DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" +SYSTEM_DEVEL_PREFIX="$(DEVEL_PREFIX)" + +# +# uClibc hacking options +# +# DODEBUG is not set diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in new file mode 100644 index 000000000..43bc9a68c --- /dev/null +++ b/extra/Configs/Config.in @@ -0,0 +1,260 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt. +# + + +menu "General Library Settings" + +config HAVE_PIC + bool "Generate Position Independent Code (PIC)" + default y + help + If you wish to build uClibc with support for shared libraries then + answer Y here. If you only want to build uClibc as a static library, + then answer N. + +config HAVE_SHARED + bool "Enable support for shared libraries" + depends on HAVE_PIC + default y + help + If you wish to build uClibc with support for shared libraries then + answer Y here. If you only want to build uClibc as a static library, + then answer N. + +config BUILD_UCLIBC_LDSO + bool "Compile native shared library loader" + depends on HAVE_SHARED + default y + help + uClibc has a native shared library loader for some architectures. + If you answer Y here, the uClibc native shared library loader will + be built for your target architecture. If this option is available, + to you, then you almost certainly want to answer Y. + +config UCLIBC_HAS_THREADS + bool "POSIX Threading Support" + default y + help + If you want to compile uClibc with pthread support, then answer Y. + This will increase the size of uClibc by adding a bunch of locking + to critical data structures, and adding extra code to ensure that + functions are properly reentrant. + + If your applications require pthreads, answer Y. + +config UCLIBC_HAS_LFS + bool "Large File Support" + default y + help + If you wish to build uClibc with support for accessing large files + (i.e. files greater then 2 GiB) then answer Y. Do not enable this + if you are using an older Linux kernel (2.0.x) that lacks large file + support. Enabling this option will increase the size of uClibc. + +choice + prompt "Malloc Implementation" + default "malloc-930716" + help + "malloc" use mmap for all allocations and so works very well on MMU-less + systems that do not support the brk() system call. It is pretty smart + about reusing already allocated memory, and minimizing memory wastage. + + "malloc-930716" is derived from libc-5.3.12 and uses the brk() system call + for all memory allocations. This makes it very fast. It is also pretty + smart about reusing already allocated memory, and minimizing memory wastage. + Because this uses brk() it will not work on uClinux MMU-less systems. + + If unsure, answer "malloc". + +config MALLOC + bool "malloc" + +config MALLOC_930716 + bool "malloc-930716" + depends on UCLIBC_HAS_MMU + +endchoice + +config HAS_SHADOW + bool "Shadow Password Support" + default y + help + Answer N if you do not need shadow password support. + Most people will answer Y. + +config UCLIBC_HAS_REGEX + bool "Regular Expression Support" + default y + help + Posix regular expression code is really big -- 27k all by itself. + If you don't use regular expressions, turn this off and save space. + Of course, if you only staticly link, leave this on, since it will + only be included in your apps if you use regular expressions. + +config UNIX98PTY_ONLY + bool "Support only Unix 98 PTYs" + default y + help + If you want to support only Unix 98 PTYs enable this. Some older + applications may need this disabled. For most current programs, + you can generally answer Y. + +config ASSUME_DEVPTS + bool "Assume that /dev/pts is a devpts or devfs file system" + default y + help + Enable this if /dev/pts is on a devpts or devfs filesystem. Both + these filesystems automatically manage permissions on the /dev/pts + devices. You may need to mount your devpts or devfs filesystem on + /dev/pts for this to work. + + Most people should answer Y. + +endmenu + + + +menu "Networking Support" + +config UCLIBC_HAS_IPV6 + bool "IP version 6 Support" + default n + help + If you want to include support for the next version of the Internet + Protocol (IP version 6) then answer Y. + + Most people should answer N. + +config UCLIBC_HAS_RPC + bool "Remote Procedute Call (RPC) support" + default n + help + If you want to include RPC support, enable this. RPC is rarely used + for anything except for the NFS filesystem. Unless you plan to use NFS, + you can probably leave this set to N and save some space. If you need + to use NFS then you should answer Y. + +config UCLIBC_HAS_FULL_RPC + bool "Full RPC support" + depends on UCLIBC_HAS_RPC + default n + help + Normally we enable just enough RPC support for things like rshd and + nfs mounts to work. If you find you need the rest of the RPC stuff, + then enable this option. Most people can safely answer N. + +endmenu + + +menu "String and Stdio Support" + +config UCLIBC_HAS_WCHAR + bool "Wide Charactor Support" + default n + help + Answer Y to enable wide char support. This will make uClibc much + bigger. + + Most people will answer N. + +config UCLIBC_HAS_LOCALE + bool "Locale Support" + depends on UCLIBC_HAS_WCHAR + default n + help + Answer Y to enable locale support. This will make uClibc much + bigger. + + Most people will answer N. + +config USE_OLD_VFPRINTF + bool "Use the old vfprintf implementation" + default n + help + Set to true to use the old vfprintf instead of the new. This is roughly + C89 compliant, but doesn't deal with qualifiers on %n and doesn't deal with + %h correctly or %hh at all on the interger conversions. But on i386 it is + over 1.5k smaller than the new code. Of course, the new code fixes the + above mentioned deficiencies and adds custom specifier support similar to + glibc, as well as handling positional args. This will be rewritten at some + point to bring it to full C89 standards compliance. + + Most people will answer N. + +endmenu + +menu "Library Installation Options" + +config SHARED_LIB_LOADER_PATH + string "Shared library loader path" + depends on BUILD_UCLIBC_LDSO + default "$(DEVEL_PREFIX)/lib" + help + When using shared libraries, this path is the location where the + shared library will be invoked. This value will be compiled into + every binary compiled with uClibc. + + BIG FAT WARNING: + If you do not have a shared library loader with the correct name + sitting in the directory this points to, your binaries will not + run. + +config SYSTEM_LDSO + string "System shared library loader" + depends on !BUILD_UCLIBC_LDSO + default "/lib/ld-linux.so.2" + help + If you are using shared libraries, but do not want/have a native + uClibc shared library loader, please specify the name of your + target system's shared library loader here... + + BIG FAT WARNING: + If you do not have a shared library loader with the correct name + sitting in the directory this points to, your binaries will not + run. + +config DEVEL_PREFIX + string "uClibc development environment directory" + default "/usr/$(TARGET_ARCH)-linux-uclibc" + help + DEVEL_PREFIX is the directory into which the uClibc development + environment will be installed. The result will look something + like the following: + $(DEVEL_PREFIX)/ + lib/ + include/ + This value is used by the 'make install' Makefile target. Since this + directory is compiled into the uclibc cross compiler spoofer, you + have to recompile uClibc if you change this value... + +config SYSTEM_DEVEL_PREFIX + string "uClibc development environment system directory" + default "$(DEVEL_PREFIX)" + help + SYSTEM_DEVEL_PREFIX is the directory prefix used when installing + bin/arch-uclibc-gcc, bin/arch-uclibc-ld, etc. This is only used by + the 'make install' target, and is not compiled into anything. This + defaults to $(DEVEL_PREFIX)/usr, but makers of .rpms and .debs will + want to set this to "/usr" instead. + +endmenu + +menu "uClibc hacking options" + +config DODEBUG + bool "Build uClibc with debugging symbols" + default n + help + Say Y here if you wish to compile uClibc with debugging symbols. + This will allow you to use a debugger to examine uClibc internals + while applications are running. This increases the size of the + library considerably and should only be used when doing development. + If you are doing development and want to debug uClibc, answer Y. + + Otherwise, answer N. +endmenu + + + diff --git a/extra/config/Makefile b/extra/config/Makefile new file mode 100644 index 000000000..5b283a297 --- /dev/null +++ b/extra/config/Makefile @@ -0,0 +1,83 @@ +# Makefile for uClibc +# +# Copyright (C) 2002 Erik Andersen +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library 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 Library 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 + +TOPDIR=../../ +include $(TOPDIR)Rules.mak + + +all: conf mconf + +NATIVE_CFLAGS=-Wall -g -O0 + + +CONF_SRC =conf.c zconf.tab.c +MCONF_SRC =mconf.c zconf.tab.c +CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC)) +MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC)) + +conf: $(CONF_OBJS) + $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ + +mconf: $(MCONF_OBJS) + $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ + +lkc_deps:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h + +conf.o: conf.c $(lkc_deps) + +mconf.o: mconf.c $(lkc_deps) + +zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps) + +lex.zconf.o: lex.zconf.c $(lkc_deps) + +%.o : %.c + $(NATIVE_CC) $(NATIVE_CFLAGS) -I. -c $< -o $@ + +lkc_defs.h: lkc_proto.h + sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' + +### +# The following requires flex/bison +# By default we use the _shipped versions, uncomment the +# following line if you are modifying the flex/bison src. +# LKC_GENPARSER := 1 + +#ifdef LKC_GENPARSER +# +#%.tab.c %.tab.h: %.y +# bison -t -d -v -b $* -p $(notdir $*) $< +# +#lex.%.c: %.l +# flex -P$(notdir $*) -o$@ $< +#else + +lex.zconf.c: lex.zconf.c_shipped + cp lex.zconf.c_shipped lex.zconf.c + +zconf.tab.c: zconf.tab.c_shipped + cp zconf.tab.c_shipped zconf.tab.c + +zconf.tab.h: zconf.tab.h_shipped + cp zconf.tab.h_shipped zconf.tab.h +#endif + +clean: + rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \ + conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h + diff --git a/extra/config/conf b/extra/config/conf new file mode 100755 index 000000000..ed1a65310 Binary files /dev/null and b/extra/config/conf differ diff --git a/extra/config/conf.c b/extra/config/conf.c new file mode 100644 index 000000000..bf82f6664 --- /dev/null +++ b/extra/config/conf.c @@ -0,0 +1,565 @@ +/* + * Copyright (C) 2002 Roman Zippel + * Released under the terms of the GNU GPL v2.0. + */ + +#include +#include +#include +#include +#include +#include + +#define LKC_DIRECT_LINK +#include "lkc.h" + +static void conf(struct menu *menu); +static void check_conf(struct menu *menu); + +enum { + ask_all, + ask_new, + ask_silent, + set_default, + set_yes, + set_mod, + set_no, + set_random +} input_mode = ask_all; + +static int indent = 1; +static int valid_stdin = 1; +static int conf_cnt; +static char line[128]; +static struct menu *rootEntry; + +static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; + +#if 0 +static void printc(int ch) +{ + static int sep = 0; + + if (!sep) { + putchar('['); + sep = 1; + } else if (ch) + putchar('/'); + if (!ch) { + putchar(']'); + putchar(' '); + sep = 0; + } else + putchar(ch); +} +#endif + +static void printo(const char *o) +{ + static int sep = 0; + + if (!sep) { + putchar('('); + sep = 1; + } else if (o) { + putchar(','); + putchar(' '); + } + if (!o) { + putchar(')'); + putchar(' '); + sep = 0; + } else + printf("%s", o); +} + +static void strip(char *str) +{ + char *p = str; + int l; + + while ((isspace(*p))) + p++; + l = strlen(p); + if (p != str) + memmove(str, p, l + 1); + if (!l) + return; + p = str + l - 1; + while ((isspace(*p))) + *p-- = 0; +} + +static void conf_askvalue(struct symbol *sym, const char *def) +{ + enum symbol_type type = sym_get_type(sym); + tristate val; + + if (!sym_has_value(sym)) + printf("(NEW) "); + + line[0] = '\n'; + line[1] = 0; + + switch (input_mode) { + case ask_new: + case ask_silent: + if (sym_has_value(sym)) { + printf("%s\n", def); + return; + } + if (!valid_stdin && input_mode == ask_silent) { + printf("aborted!\n\n"); + printf("Console input/output is redirected. "); + printf("Run 'make oldconfig' to update configuration.\n\n"); + exit(1); + } + case ask_all: + fgets(line, 128, stdin); + return; + case set_default: + printf("%s\n", def); + return; + default: + break; + } + + switch (type) { + case S_INT: + case S_HEX: + case S_STRING: + printf("%s\n", def); + return; + default: + ; + } + switch (input_mode) { + case set_yes: + if (sym_tristate_within_range(sym, yes)) { + line[0] = 'y'; + line[1] = '\n'; + line[2] = 0; + break; + } + case set_mod: + if (type == S_TRISTATE) { + if (sym_tristate_within_range(sym, mod)) { + line[0] = 'm'; + line[1] = '\n'; + line[2] = 0; + break; + } + } else { + if (sym_tristate_within_range(sym, yes)) { + line[0] = 'y'; + line[1] = '\n'; + line[2] = 0; + break; + } + } + case set_no: + if (sym_tristate_within_range(sym, no)) { + line[0] = 'n'; + line[1] = '\n'; + line[2] = 0; + break; + } + case set_random: + do { + val = (tristate)(random() % 3); + } while (!sym_tristate_within_range(sym, val)); + switch (val) { + case no: line[0] = 'n'; break; + case mod: line[0] = 'm'; break; + case yes: line[0] = 'y'; break; + } + line[1] = '\n'; + line[2] = 0; + break; + default: + break; + } + printf("%s", line); +} + +int conf_string(struct menu *menu) +{ + struct symbol *sym = menu->sym; + const char *def, *help; + + while (1) { + printf("%*s%s ", indent - 1, "", menu->prompt->text); + printf("(%s) ", sym->name); + def = sym_get_string_value(sym); + if (sym_get_string_value(sym)) + printf("[%s] ", def); + conf_askvalue(sym, def); + switch (line[0]) { + case '\n': + break; + case '?': + /* print help */ + if (line[1] == 0) { + help = nohelp_text; + if (menu->sym->help) + help = menu->sym->help; + printf("\n%s\n", menu->sym->help); + def = NULL; + break; + } + default: + line[strlen(line)-1] = 0; + def = line; + } + if (def && sym_set_string_value(sym, def)) + return 0; + } +} + +static int conf_sym(struct menu *menu) +{ + struct symbol *sym = menu->sym; + int type; + tristate oldval, newval; + const char *help; + + while (1) { + printf("%*s%s ", indent - 1, "", menu->prompt->text); + if (sym->name) + printf("(%s) ", sym->name); + type = sym_get_type(sym); + putchar('['); + oldval = sym_get_tristate_value(sym); + switch (oldval) { + case no: + putchar('N'); + break; + case mod: + putchar('M'); + break; + case yes: + putchar('Y'); + break; + } + if (oldval != no && sym_tristate_within_range(sym, no)) + printf("/n"); + if (oldval != mod && sym_tristate_within_range(sym, mod)) + printf("/m"); + if (oldval != yes && sym_tristate_within_range(sym, yes)) + printf("/y"); + if (sym->help) + printf("/?"); + printf("] "); + conf_askvalue(sym, sym_get_string_value(sym)); + strip(line); + + switch (line[0]) { + case 'n': + case 'N': + newval = no; + if (!line[1] || !strcmp(&line[1], "o")) + break; + continue; + case 'm': + case 'M': + newval = mod; + if (!line[1]) + break; + continue; + case 'y': + case 'Y': + newval = yes; + if (!line[1] || !strcmp(&line[1], "es")) + break; + continue; + case 0: + newval = oldval; + break; + case '?': + goto help; + default: + continue; + } + if (sym_set_tristate_value(sym, newval)) + return 0; +help: + help = nohelp_text; + if (sym->help) + help = sym->help; + printf("\n%s\n", help); + } +} + +static int conf_choice(struct menu *menu) +{ + struct symbol *sym, *def_sym; + struct menu *cmenu, *def_menu; + const char *help; + int type, len; + bool is_new; + + sym = menu->sym; + type = sym_get_type(sym); + is_new = !sym_has_value(sym); + if (sym_is_changable(sym)) { + conf_sym(menu); + sym_calc_value(sym); + switch (sym_get_tristate_value(sym)) { + case no: + return 1; + case mod: + return 0; + case yes: + break; + } + } else { + sym->def = sym->curr; + if (S_TRI(sym->curr) == mod) { + printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); + return 0; + } + } + + while (1) { + printf("%*s%s ", indent - 1, "", menu_get_prompt(menu)); + def_sym = sym_get_choice_value(sym); + def_menu = NULL; + for (cmenu = menu->list; cmenu; cmenu = cmenu->next) { + if (!menu_is_visible(cmenu)) + continue; + printo(menu_get_prompt(cmenu)); + if (cmenu->sym == def_sym) + def_menu = cmenu; + } + printo(NULL); + if (def_menu) + printf("[%s] ", menu_get_prompt(def_menu)); + else { + printf("\n"); + return 1; + } + switch (input_mode) { + case ask_new: + case ask_silent: + case ask_all: + conf_askvalue(sym, menu_get_prompt(def_menu)); + strip(line); + break; + default: + line[0] = 0; + printf("\n"); + } + if (line[0] == '?' && !line[1]) { + help = nohelp_text; + if (menu->sym->help) + help = menu->sym->help; + printf("\n%s\n", help); + continue; + } + if (line[0]) { + len = strlen(line) - 1; + line[len] = 0; + + def_menu = NULL; + for (cmenu = menu->list; cmenu; cmenu = cmenu->next) { + if (!cmenu->sym || !menu_is_visible(cmenu)) + continue; + if (!strncmp(line, menu_get_prompt(cmenu), len)) { + def_menu = cmenu; + break; + } + } + } + if (def_menu) { + sym_set_choice_value(sym, def_menu->sym); + if (def_menu->list) { + indent += 2; + conf(def_menu->list); + indent -= 2; + } + return 1; + } + } +} + +static void conf(struct menu *menu) +{ + struct symbol *sym; + struct property *prop; + struct menu *child; + + if (!menu_is_visible(menu)) + return; + + sym = menu->sym; + prop = menu->prompt; + if (prop) { + const char *prompt; + + switch (prop->type) { + case P_MENU: + if (input_mode == ask_silent && rootEntry != menu) { + check_conf(menu); + return; + } + case P_COMMENT: + prompt = menu_get_prompt(menu); + if (prompt) + printf("%*c\n%*c %s\n%*c\n", + indent, '*', + indent, '*', prompt, + indent, '*'); + default: + ; + } + } + + if (!sym) + goto conf_childs; + + if (sym_is_choice(sym)) { + conf_choice(menu); + if (S_TRI(sym->curr) != mod) + return; + goto conf_childs; + } + + switch (sym->type) { + case S_INT: + case S_HEX: + case S_STRING: + conf_string(menu); + break; + default: + conf_sym(menu); + break; + } + +conf_childs: + if (sym) + indent += 2; + for (child = menu->list; child; child = child->next) + conf(child); + if (sym) + indent -= 2; +} + +static void check_conf(struct menu *menu) +{ + struct symbol *sym; + struct menu *child; + + if (!menu_is_visible(menu)) + return; + + sym = menu->sym; + if (!sym) + goto conf_childs; + + if (sym_is_choice(sym)) { + if (!sym_has_value(sym)) { + if (!conf_cnt++) + printf("*\n* Restart config...\n*\n"); + rootEntry = menu_get_parent_menu(menu); + conf(rootEntry); + } + if (sym_get_tristate_value(sym) != mod) + return; + goto conf_childs; + } + + if (!sym_has_value(sym)) { + if (!conf_cnt++) + printf("*\n* Restart config...\n*\n"); + rootEntry = menu_get_parent_menu(menu); + conf(rootEntry); + } + +conf_childs: + for (child = menu->list; child; child = child->next) + check_conf(child); +} + +int main(int ac, char **av) +{ + const char *name; + struct stat tmpstat; + + if (ac > 1 && av[1][0] == '-') { + switch (av[1][1]) { + case 'o': + input_mode = ask_new; + break; + case 's': + input_mode = ask_silent; + valid_stdin = isatty(0) && isatty(1) && isatty(2); + break; + case 'd': + input_mode = set_default; + break; + case 'n': + input_mode = set_no; + break; + case 'm': + input_mode = set_mod; + break; + case 'y': + input_mode = set_yes; + break; + case 'r': + input_mode = set_random; + srandom(time(NULL)); + break; + case 'h': + case '?': + printf("%s [-o|-s] config\n", av[0]); + exit(0); + } + name = av[2]; + } else + name = av[1]; + conf_parse(name); + //zconfdump(stdout); + switch (input_mode) { + case set_default: + name = conf_get_default_confname(); + if (conf_read(name)) { + printf("***\n" + "*** Can't find default configuration \"%s\"!\n" + "***\n", name); + exit(1); + } + break; + case ask_silent: + if (stat(".config", &tmpstat)) { + printf("***\n" + "*** You have not yet configured uClibc!\n" + "***\n" + "*** Please run some configurator (e.g. \"make oldconfig\"\n" + "*** or \"make menuconfig\").\n" + "***\n"); + exit(1); + } + case ask_all: + case ask_new: + conf_read(NULL); + break; + default: + break; + } + + if (input_mode != ask_silent) { + rootEntry = &rootmenu; + conf(&rootmenu); + if (input_mode == ask_all) { + input_mode = ask_silent; + valid_stdin = 1; + } + } + do { + conf_cnt = 0; + check_conf(&rootmenu); + } while (conf_cnt); + conf_write(NULL); + return 0; +} diff --git a/extra/config/confdata.c b/extra/config/confdata.c new file mode 100644 index 000000000..00e87486a --- /dev/null +++ b/extra/config/confdata.c @@ -0,0 +1,370 @@ +/* + * Copyright (C) 2002 Roman Zippel + * Released under the terms of the GNU GPL v2.0. + */ + +#include +#include +#include +#include +#include +#include + +#define LKC_DIRECT_LINK +#include "lkc.h" + +const char conf_def_filename[] = ".config"; +char conf_filename[PATH_MAX+1]; + +const char conf_defname[] = "extra/Configs/Config.$TARGET_ARCH.default"; + +const char *conf_confnames[] = { + ".config", + conf_defname, + NULL, +}; + +static char *conf_expand_value(const char *in) +{ + struct symbol *sym; + const char *src; + static char res_value[SYMBOL_MAXLENGTH]; + char *dst, name[SYMBOL_MAXLENGTH]; + + res_value[0] = 0; + dst = name; + while ((src = strchr(in, '$'))) { + strncat(res_value, in, src - in); + src++; + dst = name; + while (isalnum(*src) || *src == '_') + *dst++ = *src++; + *dst