-------------------------------------------------------------------------
WHAT IS MK-CONFIGURE?

mk-configure is a lightweight replacement for GNU autotools, written
in and for bmake (portable version of NetBSD make).  FreeBSD and
OpenBSD make are not good. They are incompatible with NetBSD
bmake. Also NetBSD bmake is more functional. GNU make is not good too,
it is COMPLETELY incompatible with NetBSD make.

mk-configure consists of a number of Mk files written for bmake and a
a number of standalone programs which should be installed to user's
host for configuring and building mk-configure based software.

-------------------------------------------------------------------------
HOW TO USE MK-CONFIGURE?

 For developers:
    - Install bmake and pkgsrc's mk scripts to your system.
    - Install mk-configure to your system.
    - Develop your software using bmake and mkc.*.mk files provided
      by mk-configure.
    - Include code for autoconfiguration directly to Makefile.
    - Run bmake for configuring and building your project.
      You need not autoconf/autoheader/automake/aclocal/config.guess/
      /autoreconf/config.status/config.sub and blah-blah-blah.

      BMAKE is enough for everything! ;-)

 For users and software packagers:
    - Install bmake and pkgsrc's mk files to your system.
    - Install mk-configure to your system.
    - Run bmake for configuring and building your project and pass to it
      building parameters, e.g.

         env CC=pcc CFLAGS='-O0 -g' PREFIX=/home/you/software-dir \
              bmake all install

      You need not remember about configure script, their options and
      many other things.
      BMAKE is enough for everything! ;-)

-------------------------------------------------------------------------
WHAT'S WRONG WITH GNU AUTOTOOLS (IN SHORT)?

 1) Autotools are toooooo big and toooooo complex.  I fear most free
   and open source developers do not understand how to use autotools
   in a proper way to make software REALLY portable.

 2) configure script generated by autoconf is too big.  Trivial
   configure.ac results in hundreds of kilobytes of unreadable textual
   blobs.  What the hell?

 3) The goal of autotools was to make building software easier.  But
   it is VERY inconvenient to develop autotools-based software.
   Autotools is a hell for development/developers.  Too much of
   top-level commands: automake, autoconf, aclocal, autoheader...
   All its functionality can be implemented using one top-level
   command -- make. It is also a well known source of headaches for
   users and software packagers.

 4) In theory, configure script generated by autoconf is portable
   because it is written in portable shell. In practice this is not
   always true. Users aften need to update autoconf for regenerating
   an upstream configure script. They also often need to patch
   a configure and Makefile blobs.

 5) autoconf doesn't support efficient results caching from different
   projects. In theory this can make building thousands of projects
   (e.g. software packages in OS distros) drammatically faster.

 6) configure script generated by autoconf is too slow even on modern
   hardware and systems with fast fork(2) system call (*BSD, Linux).

 7) Many (most?) real-life configure.ac break the cross-compiling.

 8) In my view autotools (automake and autoconf) is BADLY designed.  I
   personally dislike code generation idea because it is ... extreamly
   ugly :-/ approach even if the generated code is claimed to be
   "portable".  Today it is not a problem to install any kind of
   software building tools and use them more efficiently.

 9) Generated files, configure and Makefile, are practically unreadable.

-------------------------------------------------------------------------
WHAT DOES MK-CONFIGURE PROVIDES?

- mkc.{files,info,lib,man,own,prog,subdir}.mk files.
      They are wrappers over appropriate bsd.*.mk files.

      In addition to functionality provided by bsd.*.mk file mkc.*.mk
      equivalents provide the following features.

      - PREFIX, BINDIR etc. variables default to /usr/local/xxx
        directories unless you set NOMKC_PATHS to YES.
        By default bsd.*.mk are set /usr because they are mainly
        used for NetBSD's own code.
      - BINOWN, BINGRP, MANOWN etc. variables are set to 'id -u' and
        'id -g' if bmake is run under unprivileged user unless you
        set NOMKC_PERMS to YES.
        By default bsd.*.mk use root, wheel etc.
      - 'install' target also runs 'includes' target to install include
        files listed in INCS unless you set NOMKC_INCS to YES.
        By default bsd.*.mk files doesn't install include files.
      - DPLIBDIRS variable, if set, contains a list of directories
        of the libraries your project depends on. If this variable is set
        LDFLAGS is modified accordingly. See examples/3 project.
        You can disable this by setting NOMKC_DPLIBS to YES.
      - All features mensioned above are disabled if NOMKC_ATALL is
        set to YES.

- mkc.intexts.in
  This file is analogue for autoconf's AC_CONFIG_FILES macro.
  Given a list of files in INFILES or INSCRIPTS mkc.intexts.mk
  generates them from appropriate *.in file replacing @prefix@,
  @sysconfdir@, @libdir@, @bindir@, @sbindir@, @datadir@ with real
  ${PREFIX}, ${SYSCONFDIR} etc. See examples/ projects.

- mkc.configure.mk script which is very powerful but lightweight
  replacement for GNU autoconf. Its documentation is large enough to
  describe here.  It short, it allows to check for presense of header
  files, function or variable declarations, presense of function in a
  particular library, defines, sizeof of data types. See documentation
  inside configure.mk file. Also see examples/ projects.

- mkc.common.mk script is a place where all mkc.*.mk additions and
  overrides (over bsd.*.mk) are implemented. If you want to use
  bsd.xxx.mk file for which there are no mkc.xxx.mk analogs, make sure
  you .include mkc.common.mk before it.

- Standalone full-functional mkc_check_{funclib,header,sizeof,decl}
  programs that can be used without bmake and without configure.mk.
  Read appropriate man pages.

-------------------------------------------------------------------------
DOCUMENTATION:
   - Read README file
   - See examples/ directory, there you'll find a number of samples.
   - Read configure.mk file for a help about autoconfiguring part
     of mk-configure.
   - Read mkc.intexts.mk file
   - Read BSD mk-file's documentation. Usually it is in bsd.README file.
   - See other mkc.*.mk files
   - Read mkc_check_{decl,header,funclib,sizeof} -h and
     their manual pages if you want to use these scripts.

-------------------------------------------------------------------------
IS MK-CONFIGURE STABLE?

"mk-configure" is currently in alpha stage of development.

!!! API IS NOT STABLE YET AND MAY BE CHANGED IN THE NEXT RELEASE !!!

IF YOU WANT TO HELP ME STABILIZE IT,
SEND YOUR SUGGESTIONS AND IDEAS TO ME AS SOON AS POSSIBLE ;-)

-------------------------------------------------------------------------
INSTALLATION:

   1) Install bmake to your system.
      Sources are available here.

        ftp://ftp.NetBSD.org/pub/NetBSD/misc/sjg/
        http://www.crufty.net/help/sjg/bmake.html

   2) Install pkgsrc's mk-files to your system.
      Sources are available here

        http://www.mova.org/~cheusov/pub/netbsd-tools/pkgsrc-mk-files/

   3)
      cd  mk-configure-1.2.3/
      bmake all PREFIX=/usr/local MKFILESDIR=/usr/local/share/mk
      bmake test # for testing mk-configure
      bmake install-dirs
      bmake install

      Both PREFIX and MKFILESDIR are optional.
      Of course, you can change /usr/local to whatever you want.

Instead of pkgsrc's version of mk-files Simon Gerraty's mk-files can
also be used (See MKC_NOBSDMK variable) but they are not tested yet.
Look for mk-files tarball here
     ftp://ftp.NetBSD.org/pub/NetBSD/misc/sjg/

-------------------------------------------------------------------------
FEEDBACK

Send all your suggestions, bug reports etc.
to Aleksey Cheusov <vle@gmx.net>

Feel free to notify me about spelling errors.
English is not my first language.

-------------------------------------------------------------------------
