# MCONFIG -- Configuration stuff for util-linux
# Created: Sat Feb  4 15:50:30 1995
# Revised: Sun Nov 10 20:10:13 1996 by faith@cs.unc.edu
# Revised: Fri Aug 22 23:57:41 1997 by volkerdi@slackware.com
# Copyright 1995 Rickard E. Faith (faith@cs.unc.edu)
#

# Not all utils work with all architectures, select yours here. 

# NOTE: UTIL-LINUX has not been tested extensively on anything but
# INTEL.  If you find problems in compiling on other architectures
# please provide fix to util-linux@math.uio.no.

CPU=intel
#CPU=alpha
#CPU=sparc
#CPU=arm
#CPU=m68k
#CPU=mips

# If HAVE_SHADOW is set to "yes", then login, chfn, chsh, newgrp, passwd,
# and vipw will not be built or installed from the login-utils
# subdirectory.
#HAVE_SHADOW=no
HAVE_SHADOW=yes

# If you use chfn and chsh from this package, REQUIRE_PASSWORD will require
# non-root users to enter the account password before updating /etc/passwd.
REQUIRE_PASSWORD=yes
#REQUIRE_PASSWORD=no

# If you use chsh from this package, ONLY_LISTED_SHELLS will require that
# the selected shell be listed in /etc/shells -- otherwise only a warning is
# printed.  This prevents someone from setting their shell to /bin/false.
#ONLY_LISTED_SHELLS=yes
ONLY_LISTED_SHELLS=no


# If HAVE_PASSWD is set to "yes", then passwd will not be built or
# installed from the login-utils subdirectory (but login, chfn, chsh,
# newgrp, and vipw *will* be installed).
#HAVE_PASSWD=no
HAVE_PASSWD=yes

# If HAVE_SYSVINIT is set to "yes", then simpleinit and shutdown will not
# be built or installed from the login-utils subdirectory.  (The shutdown
# and halt that come with the SysVinit package should be used with the init
# found in that package.)
#HAVE_SYSVINIT=no
HAVE_SYSVINIT=yes

# If HAVE_SYSVINIT_UTILS is set to "yes", then last, mesg, and wall will
# not be built or installed from the login-utils subdirectory.  (The
# shutdown and init from the SysVinit package do not depend on the last,
# mesg, and wall from that package.)
HAVE_SYSVINIT_UTILS=no
#HAVE_SYSVINIT_UTILS=yes

# If HAVE_ANOTHER_GETTY is set to "yes", then agetty will not be built or
# installed from the login-utils subdirectory.  Note that agetty can
# co-exist with other gettys, so this option should never be used.
HAVE_GETTY=no
#HAVE_GETTY=yes

# If USE_TTY_GROUP is set to "yes", then wall and write will be installed
# setgid to the "tty" group, and mesg will only set the group write bit.
# Note that this is only useful if login/xterm/etc. change the group of the
# user's tty to "tty" [The login in util-linux does this correctly, and
# xterm will do it correctly if X is compiled with USE_TTY_GROUP set
# properly.]
USE_TTY_GROUP=yes
#USE_TTY_GROUP=no

# If HAVE_STRINGS is set to "yes", then strings won't be installed.  This
# is the quick fix until the strings in GNU binutils is in wide use and has
# internationalization support.
HAVE_STRINGS=no
#HAVE_STRINGS=yes

# If HAVE_CLEAR is set to "yes", then clear won't be installed, since a
# version of clear comes with the ncurses package.
HAVE_CLEAR=no
#HAVE_CLEAR=yes

# If HAVE_RESET is set to "yes", then reset won't be installed, since a
# (less aggressive) version of reset comes with the ncurses package.
HAVE_RESET=no
#HAVE_RESET=yes

# You _have_ to have ncurses.  Get it from prep.ai.mit.edu:/pub/gnu
HAVE_NCURSES=yes

# If HAVE_ANOTHER_FDISK is set to "yes", then fdisk will not be built or
# installed from the disk-utils subdirectory.  This anticipates the
# replacement of fdisk 2.x by fdisk 3.x, which will be distributed
# separately. 
HAVE_FDISK=no
#HAVE_FDISK=yes

# If HAVE_HOSTNAME is set to "yes", then hostname, domainname, and
# dnsdomainname will not be installed.  You should use the versions from
# the net-tools instead of the version here.
HAVE_HOSTNAME=yes
#HAVE_HOSTNAME=no

CC=		gcc

# Different optimalizations for different cpus.
ifeq "$(CPU)" "intel"
  OPT=		-pipe -O -m486 -fomit-frame-pointer
else 
  ifeq "$(CPU)" "arm"
    OPT=	-O2 -m3 -fomit-frame-pointer
  else
    OPT=	-O3 -fomit-frame-pointer
  endif
endif

BSD= ../bsd

LDFLAGS=	-s
CFLAGS=         $(OPT) -I. -I$(BSD) $(XTRACFLAGS) \
			-DSBINDIR=\"$(SBINDIR)\" \
			-DUSRSBINDIR=\"$(USRSBINDIR)\" \
			-DLOGDIR=\"$(LOGDIR)\" \
			-DVARPATH=\"$(VARPATH)\"

# ncurses.h is sometimes installed in /usr/include, and sometimes in
# /usr/include/ncurses (-I/usr/include/ncurses).  Sometimes it's
# called curses.h (NCH=0) and sometimes it's called ncurses.h (NCH=1)
# XTRACFLAGS=-I/usr/include/ncurses -DNCH=1 
XTRACFLAGS=-DNCH=0
LIBCURSES=-lncurses

ifeq "$(CPU)" "alpha"
XTRACFLAGS=-D_GNU_SOURCE
endif

DEVDIR=		$(DESTDIR)/dev
ETCDIR=		$(DESTDIR)/etc
SBINDIR=	$(DESTDIR)/sbin
USRSBINDIR=	$(DESTDIR)/usr/sbin
USRLIBDIR=      $(DESTDIR)/usr/lib
USRBINDIR=      $(DESTDIR)/usr/bin
USRGAMESDIR=    $(DESTDIR)/usr/games
BINDIR=         $(DESTDIR)/bin
VARPATH=	$(DESTDIR)/var
LOGDIR=		$(DESTDIR)/var/log
MANDIR=		$(DESTDIR)/usr/man
MAN1DIR=	$(DESTDIR)/usr/man/man1
MAN3DIR=	$(DESTDIR)/usr/man/man3
MAN5DIR=	$(DESTDIR)/usr/man/man5
MAN6DIR=	$(DESTDIR)/usr/man/man6
MAN8DIR=	$(DESTDIR)/usr/man/man8
INFODIR=	$(DESTDIR)/usr/info

# Directory for shutdown, halt, reboot, etc.
SHUTDOWNDIR=	$(SBINDIR)

# Directory for fsck
FSCKDIR=	$(SBINDIR)

# Directory for passwd
PASSWDDIR=	$(USRBINDIR)

# Modes
DIRMODE=	755
BINMODE=	755
MANMODE=	644
DATMODE=	644
INFOMODE=	644
SUIDMODE=      4755

CHMOD=		chmod
INSTALL=	install
INSTALLDIR=	$(INSTALL) -d -m $(DIRMODE)
INSTALLBIN=	$(INSTALL) -m $(BINMODE)
INSTALLMAN=	$(INSTALL) -m $(MANMODE)
INSTALLDAT=	$(INSTALL) -m $(DATMODE)
INSTALLSUID=    $(INSTALL) -m $(SUIDMODE) -o root

%.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@

%: %.cc
	$(CXX) $(CFLAGS) $< -o $@
