added jam build system, please try it out - the advantage would be that it already...
authorMatthias Braun <matze@braunis.de>
Tue, 23 Nov 2004 16:47:26 +0000 (16:47 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 23 Nov 2004 16:47:26 +0000 (16:47 +0000)
SVN-Revision: 2153

84 files changed:
Jamfile [new file with mode: 0644]
Jamrules [new file with mode: 0644]
autogen.sh
configure.ac
contrib/tilemanager/Application.cs
contrib/tilemanager/TileSet.cs
data/Jamfile [new file with mode: 0644]
lib/Jamfile [new file with mode: 0644]
lib/utils/configfile.h
lib/video/drawing_context.cpp
lib/video/surface.cpp
lib/video/surface.h
mk/autoconf/acx_pthread.m4 [new file with mode: 0644]
mk/autoconf/ax_check_gl.m4 [new file with mode: 0644]
mk/autoconf/ax_type_socklen_t.m4 [new file with mode: 0644]
mk/autoconf/codeset.m4 [new file with mode: 0644]
mk/autoconf/config.guess [new file with mode: 0755]
mk/autoconf/config.sub [new file with mode: 0755]
mk/autoconf/gettext.m4 [new file with mode: 0644]
mk/autoconf/glibc21.m4 [new file with mode: 0644]
mk/autoconf/iconv.m4 [new file with mode: 0644]
mk/autoconf/initjamfile.m4 [new file with mode: 0644]
mk/autoconf/install-sh [new file with mode: 0755]
mk/autoconf/installdirs.m4 [new file with mode: 0644]
mk/autoconf/intdiv0.m4 [new file with mode: 0644]
mk/autoconf/inttypes-pri.m4 [new file with mode: 0644]
mk/autoconf/inttypes.m4 [new file with mode: 0644]
mk/autoconf/inttypes_h.m4 [new file with mode: 0644]
mk/autoconf/isc-posix.m4 [new file with mode: 0644]
mk/autoconf/lcmessage.m4 [new file with mode: 0644]
mk/autoconf/lib-ld.m4 [new file with mode: 0644]
mk/autoconf/lib-link.m4 [new file with mode: 0644]
mk/autoconf/lib-prefix.m4 [new file with mode: 0644]
mk/autoconf/nls.m4 [new file with mode: 0644]
mk/autoconf/np_findlib.m4 [new file with mode: 0644]
mk/autoconf/np_lang_program.m4 [new file with mode: 0644]
mk/autoconf/po.m4 [new file with mode: 0644]
mk/autoconf/progtest.m4 [new file with mode: 0644]
mk/autoconf/sdl.m4 [new file with mode: 0644]
mk/autoconf/stdint_h.m4 [new file with mode: 0644]
mk/autoconf/uintmax_t.m4 [new file with mode: 0644]
mk/autoconf/ulonglong.m4 [new file with mode: 0644]
mk/jam/application.jam [new file with mode: 0644]
mk/jam/autoconf.jam [new file with mode: 0644]
mk/jam/build.jam [new file with mode: 0644]
mk/jam/clean.jam [new file with mode: 0644]
mk/jam/compiler.jam [new file with mode: 0644]
mk/jam/flags.jam [new file with mode: 0644]
mk/jam/groups.jam [new file with mode: 0644]
mk/jam/help.jam [new file with mode: 0644]
mk/jam/helper.jam [new file with mode: 0644]
mk/jam/install.jam [new file with mode: 0644]
mk/jam/jamcompatibility.jam [new file with mode: 0644]
mk/jam/library.jam [new file with mode: 0644]
mk/jam/libtool.jam [new file with mode: 0644]
mk/jam/macosx.jam [new file with mode: 0644]
mk/jam/msvcgen.jam [new file with mode: 0644]
mk/jam/objects.jam [new file with mode: 0644]
mk/jam/options.jam [new file with mode: 0644]
mk/jam/resource.jam [new file with mode: 0644]
mk/jam/subdir.jam [new file with mode: 0644]
mk/jam/unix.jam [new file with mode: 0644]
mk/jam/variant.jam [new file with mode: 0644]
mk/jam/win32.jam [new file with mode: 0644]
src/Jamfile [new file with mode: 0644]
src/badguy/badguy.cpp
src/badguy/bomb.cpp
src/badguy/bouncing_snowball.cpp
src/badguy/jumpy.cpp
src/badguy/mrbomb.cpp
src/badguy/mriceblock.cpp
src/badguy/snowball.cpp
src/badguy/spiky.cpp
src/leveleditor.cpp
src/object/coin.cpp
src/object/flower.cpp
src/object/invisible_block.cpp
src/object/oneup.cpp
src/object/platform.cpp
src/player.cpp
src/trigger/door.cpp
src/trigger/sequence_trigger.cpp
src/trigger/sequence_trigger.h
src/trigger/trigger_base.cpp

diff --git a/Jamfile b/Jamfile
new file mode 100644 (file)
index 0000000..49fb497
--- /dev/null
+++ b/Jamfile
@@ -0,0 +1,7 @@
+SubDir TOP ;
+
+# Decend into subdirs
+SubInclude TOP lib ;
+SubInclude TOP src ;
+SubInclude TOP data ;
+
diff --git a/Jamrules b/Jamrules
new file mode 100644 (file)
index 0000000..abdd715
--- /dev/null
+++ b/Jamrules
@@ -0,0 +1,40 @@
+if ! $(top_builddir)
+{
+    top_builddir = $(TOP) ;
+}
+top_srcdir = $(TOP) ;
+
+JAMCONFIG ?= $(top_builddir)/Jamconfig ;
+include $(JAMCONFIG) ;
+if ! $(JAMCONFIG_READ)
+{
+  EXIT "Couldn't find config. Please run 'configure' first." ;
+}
+
+if $(USE_STLPORT_DEBUG)
+{
+  CPPFLAGS += -I/usr/include/stlport ;
+  CPPFLAGS += -D_STLP_DEBUG=1 -D_STLP_DEBUG_UNINITIALIZED=1 ;
+  CPPFLAGS += -D_STLP_SHRED_BYTE=0xA3 ;
+  LIBS += -lstlport_gcc_debug ;
+}
+
+COMPILER_CFLAGS += -Wall -W ;
+COMPILER_CFLAGS_optimize += -O3 -g3 ;
+COMPILER_C++FLAGS_optimize += -O3 -g3 ;
+COMPILER_LFLAGS_optimize += -O3 -g3 ;
+COMPILER_CFLAGS_debug += -DDEBUG -Werror -g3 ;
+COMPILER_CXXFLAGS_debug += -DDEBUG -Werror -g3 ;
+COMPILER_LFLAGS_debug += -g3 ;
+COMPILER_CFLAGS_profile += -O2 -g3 -pg ;
+COMPILER_CXXFLAGS_profile += -O2 -g3 -pg ;
+COMPILER_LFLAGS_profile += -g3 -pg ;
+
+LINK = $(CXX) ;
+
+# Include build rules
+include $(TOP)/mk/jam/build.jam ;
+
+# Include Dirs
+IncludeDir $(top_builddir) ; # for config.h
+IncludeDir lib src ;
index a728b16..c433b42 100755 (executable)
@@ -1,5 +1,19 @@
 #!/bin/sh
 
+# Correct working directory?
+if test ! -f configure.ac ; then
+  echo "*** Please invoke this script from directory containing configure.ac."
+  exit 1
+fi
+
+# generate Jamconfig.in
+autoconf --trace=AC_SUBST \
+  | sed -e 's/configure.ac:[0-9]*:AC_SUBST:\([^:]*\).*/\1 ?= "@\1@" ;/g' \
+  > Jamconfig.in
+sed -e 's/.*BACKSLASH.*//' -i Jamconfig.in
+echo 'INSTALL ?= "@INSTALL@" ;' >> Jamconfig.in
+echo 'JAMCONFIG_READ = yes ;' >> Jamconfig.in
+
 # we need a minimum of automake 1.6 and automake 1.8 seems to be buggy
 # this doesn't seem to work well
 # see AUTOMAKE_OPTIONS in Makefile.am
@@ -7,7 +21,7 @@ export WANT_AUTOMAKE=1.6
 
 autoheader
 libtoolize --force
-aclocal -I m4
+aclocal -I mk/autoconf
 automake --copy --add-missing
 autoconf
 
index f56ec98..71368a6 100644 (file)
@@ -11,7 +11,7 @@ dnl ===========================================================================
 
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ([2.54])
-AC_INIT(SuperTux, 0.2-cvs)
+AC_INIT(supertux, 0.2-cvs)
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_SRCDIR([src/supertux.cpp])
 AC_CANONICAL_TARGET
@@ -39,12 +39,14 @@ AC_C_CONST
 dnl ===========================================================================
 dnl Give advanced users some options to play with
 
+VARIANT=optimize
 AC_MSG_CHECKING(for gprof mode)
 AC_ARG_ENABLE(gprof,
               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
               [enable_gprof=$enableval], [enable_gprof=no])
 if test "$enable_gprof" = "yes"; then
-    CXXFLAGS="$CXXFLAGS -pg"
+    #CXXFLAGS="$CXXFLAGS -pg"
+    VARIANT=profile
     AC_MSG_RESULT([enabled])
 else
     AC_MSG_RESULT([disabled])
@@ -56,12 +58,15 @@ AC_ARG_ENABLE(debug,
               [enable_debug=$enableval], [enable_debug=no])
 if test "$enable_debug" = "yes"; then
     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
-    CXXFLAGS="$CXXFLAGS -Wall -Werror -O0 -g3"
+    #CXXFLAGS="$CXXFLAGS -Wall -Werror -O0 -g3"
+    VARIANT=debug
     AC_MSG_RESULT([enabled])
 else
-    CXXFLAGS="$CXXFLAGS -O2 -g"
+    #CXXFLAGS="$CXXFLAGS -O2 -g"
+    VARIANT=optimize
     AC_MSG_RESULT([disabled])
 fi
+AC_SUBST([VARIANT])
 
 AC_MSG_CHECKING(wether OpenGL should be used)
 AC_ARG_ENABLE(opengl,
@@ -81,37 +86,47 @@ SDL_VERSION=1.2.4
 AM_PATH_SDL($SDL_VERSION,
             :,
            AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
-CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-CFLAGS="$CFLAGS $SDL_CFLAGS"
-LIBS="$LIBS $SDL_LIBS"
-GL_LIBS="-lGL"
 
-dnl Checks for additional libraries.
-AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,,
-       AC_MSG_ERROR([SDL_mixer library required]))
-
-AC_CHECK_LIB(SDL_image, IMG_Load,,
-       AC_MSG_ERROR([SDL_image library required]))
+NP_FINDLIB([SDLMIXER], [SDL_mixer], [SDL_mixer >= 1.2],
+        NP_LANG_PROGRAM([#include <SDL_mixer.h>
+#if MIX_MAJOR_VERSION < 1
+# error SDLMix too old
+#else
+# if MIX_MAJOR_VERSION == 1
+#  if MIX_MINOR_VERSION < 2
+#   error SDLMix too old
+#  endif
+# endif
+#endif], [Mix_OpenAudio(0, 0, 0, 0);]),
+        [], [-lSDL_mixer],
+        [],
+        [AC_MSG_ERROR([Please install SDLMixer >=1.2.2])],
+        [$SDL_CFLAGS], [$SDL_LIBS])
+
+NP_FINDLIB([SDLIMAGE], [SDL_image], [SDL_image >= 1.2],
+        NP_LANG_PROGRAM([#include <SDL_image.h>], [IMG_Load("");]),
+        [], [-lSDL_image],
+        [],
+        [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
+        [$SDL_CFLAGS], [$SDL_LIBS])
 
 if test "$enable_opengl" = "yes"; then
   AX_CHECK_GL
 fi
 if test "$no_gl" = "yes" -o "$enable_opengl" = "no"; then
-  CXXFLAGS="$CXXFLAGS -DNOOPENGL"
-  enable_opengl=no
+  GL_AVAILABLE="no"
+  AC_DEFINE([NOOPENGL],, [Define if opengl should not be used])
 else
-  CFLAGS="$CFLAGS $GL_CFLAGS"
-  CXXFLAGS="$CXXFLAGS $GL_CFLAGS"
-  LIBS="$LIBS $GL_LIBS"
+  GL_AVAILABLE="yes"
 fi
-
-AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
-
-CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux\"'" 
+AC_SUBST([GL_AVAILABLE])
 
 dnl Checks for library functions.
 AC_CHECK_FUNCS(mkdir strdup strstr)
 
+AC_INIT_JAM
+AC_CONFIG_FILES([Jamconfig])
+
 AC_OUTPUT(Makefile m4/Makefile intl/Makefile
           src/Makefile
           data/Makefile
@@ -125,5 +140,3 @@ echo " Profile Mode:   $enable_gprof"
 echo " Debug Mode:     $enable_debug"
 echo " OpenGL Support: $enable_opengl"
 echo ""
-
-# EOF #
index ec842e2..457132f 100644 (file)
@@ -254,8 +254,18 @@ public class Application {
                 return;
             }
             foreach(Tile tile in Selection) {
-                if(tile.ID != -1)
-                    tile.ID = id++;
+                if(tile.ID == -1)
+                    continue;
+                
+                int oldid = tile.ID;
+                tile.ID = id++;
+                // remap in all tilegroups...
+                foreach(TileGroup tilegroup in tileset.TileGroups) {
+                    int idx = tilegroup.Tiles.IndexOf(oldid);
+                    if(idx >= 0) {
+                        tilegroup.Tiles[idx] = tile.ID;
+                    }
+                }
             }
             FillTileList();
             SelectionChanged();
index 0ef33db..0d50402 100644 (file)
@@ -30,7 +30,8 @@ public class TileGroup {
                         break;
                     case "tiles":
                         do {
-                            Tiles.Add(parser.IntegerValue);
+                            if(!Tiles.Contains(parser.IntegerValue))
+                                Tiles.Add(parser.IntegerValue);
                         } while(parser.Parse() 
                                 && parser.Type == Parser.LispType.INTEGER);
                         break;
diff --git a/data/Jamfile b/data/Jamfile
new file mode 100644 (file)
index 0000000..61f0297
--- /dev/null
@@ -0,0 +1,43 @@
+SubDir TOP data ;
+
+IMAGEPATHS =
+  images
+  images/background
+  images/fonts
+  images/highscore
+  images/icons
+  images/intro
+  images/leveleditor
+  images/map
+  images/shared/smalltux
+  images/shared/bigtux
+  images/status
+  images/tilesets
+  images/title
+  images/worldmap
+;
+
+for p in $(IMAGEPATHS) {
+    InstallData 
+        [ Wildcard $(p) : *.png *.jpg *.xpm *.strf *.ico *.stgt *.stwt ] 
+      : $(p)
+    ;
+}
+
+LEVELPATHS = 
+  levels/bonus1
+  levels/contribs
+  levels/misc
+  levels/test
+  levels/world1
+  levels/world2
+  levels/worldmap
+;
+
+for p in $(LEVELPATHS) {
+  InstallData [ Wildcard $(p) : info *.stl *.stwm ] : $(p) ;
+}
+InstallData [ Wildcard *.txt ] ;
+InstallData [ Wildcard music : *.mod *.ogg ] : music ;
+InstallData [ Wildcard sound : *.wav ] : sound ;
+
diff --git a/lib/Jamfile b/lib/Jamfile
new file mode 100644 (file)
index 0000000..cc8e991
--- /dev/null
@@ -0,0 +1,14 @@
+SubDir TOP lib ;
+
+Library supertuxlib :
+    [ Wildcard app : *.cpp *.h ]
+    [ Wildcard audio : *.cpp *.h ]
+    [ Wildcard gui : *.cpp *.h ]
+    [ Wildcard math : *.cpp *.h ]
+    [ Wildcard special : *.cpp *.h ]
+    [ Wildcard utils : *.cpp *.h ]
+    [ Wildcard video : *.cpp *.h ]
+;
+ExternalLibs supertuxlib : SDL SDLMIXER SDLIMAGE GL ;
+C++Flags supertuxlib : -DDATA_PREFIX='\"$(appdatadir)\"' -DLOCALEDIR='\"$(datadir)/locale\"' : export ;
+Help supertuxlib : "Build supertux library" ;
index 17ab2c3..17d1af2 100644 (file)
@@ -30,8 +30,10 @@ class Config {
   public:
   void load ();
   void save ();
-  virtual void customload(LispReader& reader) {};
-  virtual void customsave(FILE * config) {};
+  virtual void customload(LispReader& )
+  {};
+  virtual void customsave(FILE* )
+  {};
 };
 
 extern Config* config;
index 5c98f13..1b35337 100644 (file)
@@ -79,6 +79,22 @@ DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
   surfacepartrequest->size = size;
   surfacepartrequest->source = source;
   surfacepartrequest->surface = surface;
+
+  // clip on screen borders
+  if(request.pos.x < 0) {
+    surfacepartrequest->size.x += request.pos.x;
+    if(surfacepartrequest->size.x <= 0)
+      return;
+    surfacepartrequest->source.x -= request.pos.x;
+    request.pos.x = 0;
+  }
+  if(request.pos.y < 0) {
+    surfacepartrequest->size.y += request.pos.y;
+    if(surfacepartrequest->size.y <= 0)
+      return;
+    surfacepartrequest->source.y -= request.pos.y;
+    request.pos.y = 0;
+  }
   request.request_data = surfacepartrequest;
 
   drawingrequests.push_back(request);
index 8385766..5f51c87 100644 (file)
@@ -37,7 +37,8 @@ using namespace SuperTux;
 Surface::Surfaces Surface::surfaces;
 
 SurfaceData::SurfaceData(SDL_Surface* temp, bool use_alpha_)
-    : type(SURFACE), surface(0), use_alpha(use_alpha_)
+    : type(SURFACE), surface(0), use_alpha(use_alpha_),
+      x(0), y(0), w(0), h(0)
 {
   // Copy the given surface and make sure that it is not stored in
   // video memory
@@ -254,58 +255,41 @@ Surface::debug_check()
 }
 
 void
-Surface::resize(int w_, int h_)
-{
-  if (impl)
-  {
-    w = w_;
-    h = h_;
-    if (impl->resize(w_,h_) == -2)
-      reload();
-  }
-}
-
-void
 apply_filter_to_surface(SDL_Surface* surface, int filter, Color color)
 {
-if(filter == HORIZONTAL_FLIP_FILTER)
-  {
-  SDL_Surface* sur_copy = sdl_surface_from_sdl_surface(surface, true);
-  SDL_BlitSurface(surface, NULL, sur_copy, NULL);
-  SDL_SetAlpha(sur_copy,0,0);
-
-  SDL_Rect src, dst;
-  src.y = dst.y = 0;
-  src.w = dst.w = 1;
-  src.h = dst.h = sur_copy->h;
-  for(int x = 0; x < sur_copy->w; x++)
+  if(filter == HORIZONTAL_FLIP_FILTER) {
+    SDL_Surface* sur_copy = sdl_surface_from_sdl_surface(surface, true);
+    SDL_BlitSurface(surface, NULL, sur_copy, NULL);
+    SDL_SetAlpha(sur_copy,0,0);
+
+    SDL_Rect src, dst;
+    src.y = dst.y = 0;
+    src.w = dst.w = 1;
+    src.h = dst.h = sur_copy->h;
+    for(int x = 0; x < sur_copy->w; x++)
     {
-    src.x = x; dst.x = sur_copy->w-1 - x;
-    SDL_BlitSurface(sur_copy, &src, surface, &dst);
+      src.x = x; dst.x = sur_copy->w-1 - x;
+      SDL_BlitSurface(sur_copy, &src, surface, &dst);
     }
 
-  SDL_FreeSurface(sur_copy);
-  }
-else if(filter == MASK_FILTER)
-  {
-  SDL_Surface* sur_copy = sdl_surface_from_sdl_surface(surface, true);
+    SDL_FreeSurface(sur_copy);
+  } else if(filter == MASK_FILTER) {
+    SDL_Surface* sur_copy = sdl_surface_from_sdl_surface(surface, true);
 
-  Uint8 r,g,b,a;
+    Uint8 r,g,b,a;
 
-  SDL_LockSurface(sur_copy);
-  for(int x = 0; x < sur_copy->w; x++)
-    for(int y = 0; y < sur_copy->h; y++)
-      {
-      SDL_GetRGBA(getpixel(sur_copy,x,y), sur_copy->format, &r,&g,&b,&a);
-      if(a != 0)
-        {
-        putpixel(sur_copy, x,y, color.map_rgba(sur_copy));
+    SDL_LockSurface(sur_copy);
+    for(int x = 0; x < sur_copy->w; x++)
+      for(int y = 0; y < sur_copy->h; y++) {
+        SDL_GetRGBA(getpixel(sur_copy,x,y), sur_copy->format, &r,&g,&b,&a);
+        if(a != 0) {
+          putpixel(sur_copy, x,y, color.map_rgba(sur_copy));
         }
       }
-  SDL_UnlockSurface(sur_copy);
+    SDL_UnlockSurface(sur_copy);
 
-  SDL_BlitSurface(sur_copy, NULL, surface, NULL);
-  SDL_FreeSurface(sur_copy);
+    SDL_BlitSurface(sur_copy, NULL, surface, NULL);
+    SDL_FreeSurface(sur_copy);
   }
 }
 
@@ -329,19 +313,12 @@ sdl_surface_part_from_file(const std::string& file, int x, int y, int w, int h,
   src.w = w;
   src.h = h;
 
-  conv = SDL_CreateRGBSurface(temp->flags, w, h, temp->format->BitsPerPixel,
+  conv = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, temp->format->BitsPerPixel,
                               temp->format->Rmask,
                               temp->format->Gmask,
                               temp->format->Bmask,
                               temp->format->Amask);
 
-  /* #if SDL_BYTEORDER == SDL_BIG_ENDIAN
-     0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff);
-     #else
-
-     0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
-     #endif*/
-
   SDL_SetAlpha(temp,0,0);
 
   SDL_BlitSurface(temp, &src, conv, NULL);
@@ -480,20 +457,6 @@ SDL_Surface* SurfaceImpl::get_sdl_surface() const
   return sdl_surface;
 }
 
-int SurfaceImpl::resize(int w_, int h_)
-{
-  w = w_;
-  h = h_;
-  SDL_Rect dest;
-  dest.x = 0;
-  dest.y = 0;
-  dest.w = w;
-  dest.h = h;
-  int ret = SDL_SoftStretch(sdl_surface, NULL,
-                            sdl_surface, &dest);
-  return ret;
-}
-
 #ifndef NOOPENGL
 SurfaceOpenGL::SurfaceOpenGL(SDL_Surface* surf, bool use_alpha)
 {
@@ -1089,4 +1052,3 @@ SurfaceSDL::apply_filter(int filter, Color color)
 SurfaceSDL::~SurfaceSDL()
 {}
 
-/* EOF */
index 2a27db8..1491e84 100644 (file)
@@ -17,7 +17,6 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //  02111-1307, USA.
-
 #ifndef SUPERTUX_TEXTURE_H
 #define SUPERTUX_TEXTURE_H
 
@@ -25,7 +24,7 @@
 #include <list>
 
 #ifndef NOOPENGL
-#include "SDL_opengl.h"
+#include <SDL_opengl.h>
 #endif
 
 #include "SDL.h"
@@ -122,8 +121,6 @@ namespace SuperTux
       /** Reload the surface, which is necesarry in case of a mode swich */
       void reload();
 
-      void resize(int widht, int height);
-
       void apply_filter(int filter, Color color = Color(0,0,0));
     };
 
@@ -148,8 +145,6 @@ namespace SuperTux
       virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
 
 
-      int resize(int w_, int h_);
-
       SDL_Surface* get_sdl_surface() const; // @evil@ try to avoid this function
 
       virtual void apply_filter(int filter, Color color = Color(0,0,0)) = 0;
diff --git a/mk/autoconf/acx_pthread.m4 b/mk/autoconf/acx_pthread.m4
new file mode 100644 (file)
index 0000000..cd56a30
--- /dev/null
@@ -0,0 +1,196 @@
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+                pthread-config)
+                AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+                if test x"$acx_pthread_config" = xno; then continue; fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: threads are created detached by default
+        # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        AC_TRY_LINK([#include <pthread.h>],
+                    [int attr=PTHREAD_CREATE_JOINABLE;],
+                    ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
+        if test x"$ok" = xunknown; then
+                AC_TRY_LINK([#include <pthread.h>],
+                            [int attr=PTHREAD_CREATE_UNDETACHED;],
+                            ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
+        fi
+        if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
+                AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
+                          [Define to the necessary symbol if this constant
+                           uses a non-standard name on your system.])
+        fi
+        AC_MSG_RESULT(${ok})
+        if test x"$ok" = xunknown; then
+                AC_MSG_WARN([we do not know how to create joinable pthreads])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
+                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+                PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
diff --git a/mk/autoconf/ax_check_gl.m4 b/mk/autoconf/ax_check_gl.m4
new file mode 100644 (file)
index 0000000..0977fcd
--- /dev/null
@@ -0,0 +1,76 @@
+AC_DEFUN([AX_CHECK_GL],
+[AC_REQUIRE([AC_PATH_X])dnl
+AC_REQUIRE([ACX_PTHREAD])dnl
+
+#
+# There isn't a reliable way to know we should use the Apple OpenGL framework
+# without a configure option.  A Mac OS X user may have installed an
+# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
+#
+AC_ARG_WITH([apple-opengl-framework],
+            [AC_HELP_STRING([--with-apple-opengl-framework],
+                            [use Apple OpenGL framework (Mac OS X only)])])
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+  AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
+            [Use the Apple OpenGL framework.])
+  GL_CFLAGS="-framework OpenGL"
+else
+  GL_CFLAGS="${PTHREAD_CFLAGS}"
+  GL_LIBS="${PTHREAD_LIBS} -lm"
+
+  #
+  # Use x_includes and x_libraries if they have been set (presumably by
+  # AC_PATH_X).
+  #
+  if test "X$no_x" != "Xyes"; then
+    if test -n "$x_includes"; then
+      GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
+    fi
+    if test -n "$x_libraries"; then
+      GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
+    fi
+  fi
+
+  AC_LANG_PUSH(C)
+
+  AC_CHECK_HEADERS([windows.h])
+
+  AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
+  [ax_cv_check_gl_libgl="no"
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lopengl32 -lGL"
+    for ax_lib in ${ax_check_libs}; do
+    if test "X$CC" = "Xcl"; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+    AC_TRY_LINK([
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/gl.h>
+],
+    [glBegin(0)],
+    [ax_cv_check_gl_libgl="${ax_try_lib}"; break])
+  done
+  LIBS=${ax_save_LIBS}
+  CPPFLAGS=${ax_save_CPPFLAGS}])
+
+  if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
+    no_gl="yes"
+    GL_CFLAGS=""
+    GL_LIBS=""
+  else
+    GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
+  fi
+  AC_LANG_POP(C)
+fi
+
+AC_SUBST([GL_CFLAGS])
+AC_SUBST([GL_LIBS])
+])dnl
diff --git a/mk/autoconf/ax_type_socklen_t.m4 b/mk/autoconf/ax_type_socklen_t.m4
new file mode 100644 (file)
index 0000000..0cb2607
--- /dev/null
@@ -0,0 +1,23 @@
+dnl @synopsis TYPE_SOCKLEN_T
+dnl
+dnl Check whether sys/socket.h defines type socklen_t. Please note
+dnl that some systems require sys/types.h to be included before
+dnl sys/socket.h can be compiled.
+dnl
+dnl @version $Id$
+dnl @author Lars Brinkhoff <lars@nocrew.org>
+dnl
+AC_DEFUN([AX_TYPE_SOCKLEN_T],
+[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
+[
+  AC_TRY_COMPILE(
+  [#include <sys/types.h>
+   #include <sys/socket.h>],
+  [socklen_t len = 42; return 0;],
+  ac_cv_type_socklen_t=yes,
+  ac_cv_type_socklen_t=no)
+])
+  if test $ac_cv_type_socklen_t != yes; then
+    AC_DEFINE(socklen_t, int, [define socklen_t if sys headers don't do that])
+  fi
+])
diff --git a/mk/autoconf/codeset.m4 b/mk/autoconf/codeset.m4
new file mode 100644 (file)
index 0000000..59535eb
--- /dev/null
@@ -0,0 +1,23 @@
+# codeset.m4 serial AM1 (gettext-0.10.40)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
+    [AC_TRY_LINK([#include <langinfo.h>],
+      [char* cs = nl_langinfo(CODESET);],
+      am_cv_langinfo_codeset=yes,
+      am_cv_langinfo_codeset=no)
+    ])
+  if test $am_cv_langinfo_codeset = yes; then
+    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
+      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+  fi
+])
diff --git a/mk/autoconf/config.guess b/mk/autoconf/config.guess
new file mode 100755 (executable)
index 0000000..9b1384b
--- /dev/null
@@ -0,0 +1,1400 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-11-30'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       rm -f $files ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;
+unset files'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit 0 ;;
+    amiga:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    arc:OpenBSD:*:*)
+       echo mipsel-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    hp300:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    macppc:OpenBSD:*:*)
+       echo powerpc-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+       echo m88k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+       echo powerpc-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    pmax:OpenBSD:*:*)
+       echo mipsel-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sgi:OpenBSD:*:*)
+       echo mipseb-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sun3:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+       echo mipsel-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    *:OpenBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    alpha:OSF1:*:*)
+       if test $UNAME_RELEASE = "V4.0"; then
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+       fi
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       eval $set_cc_for_build
+       cat <<EOF >$dummy.s
+       .data
+\$Lformat:
+       .byte 37,100,45,37,120,10,0     # "%d-%x\n"
+
+       .text
+       .globl main
+       .align 4
+       .ent main
+main:
+       .frame \$30,16,\$26,0
+       ldgp \$29,0(\$27)
+       .prologue 1
+       .long 0x47e03d80 # implver \$0
+       lda \$2,-1
+       .long 0x47e20c21 # amask \$2,\$1
+       lda \$16,\$Lformat
+       mov \$0,\$17
+       not \$1,\$18
+       jsr \$26,printf
+       ldgp \$29,0(\$26)
+       mov 0,\$16
+       jsr \$26,exit
+       .end main
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
+       if test "$?" = 0 ; then
+               case `$dummy` in
+                       0-0)
+                               UNAME_MACHINE="alpha"
+                               ;;
+                       1-0)
+                               UNAME_MACHINE="alphaev5"
+                               ;;
+                       1-1)
+                               UNAME_MACHINE="alphaev56"
+                               ;;
+                       1-101)
+                               UNAME_MACHINE="alphapca56"
+                               ;;
+                       2-303)
+                               UNAME_MACHINE="alphaev6"
+                               ;;
+                       2-307)
+                               UNAME_MACHINE="alphaev67"
+                               ;;
+                       2-1307)
+                               UNAME_MACHINE="alphaev68"
+                               ;;
+                       3-1307)
+                               UNAME_MACHINE="alphaev7"
+                               ;;
+               esac
+       fi
+       rm -f $dummy.s $dummy && rmdir $tmpdir
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit 0 ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit 0 ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit 0 ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7 && exit 0 ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit 0 ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit 0 ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit 0 ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit 0 ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c \
+         && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+         && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+       rm -f $dummy.c $dummy && rmdir $tmpdir
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit 0 ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit 0 ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit 0 ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit 0 ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit 0 ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit 0 ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit 0 ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+               rm -f $dummy.c $dummy && rmdir $tmpdir
+               echo rs6000-ibm-aix3.2.5
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit 0 ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+                   rm -f $dummy.c $dummy && rmdir $tmpdir
+               fi ;;
+       esac
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+       rm -f $dummy.c $dummy && rmdir $tmpdir
+       echo unknown-hitachi-hiuxwe2
+       exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit 0 ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit 0 ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit 0 ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*T3D:*:*:*)
+       echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:FreeBSD:*:*)
+       # Determine whether the default compiler uses glibc.
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #if __GLIBC__ >= 2
+       LIBC=gnu
+       #else
+       LIBC=
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       rm -f $dummy.c && rmdir $tmpdir
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+       exit 0 ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit 0 ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit 0 ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit 0 ;;
+    x86:Interix*:3*)
+       echo i586-pc-interix3
+       exit 0 ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit 0 ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit 0 ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit 0 ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    *:GNU:*:*)
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit 0 ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit 0 ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       rm -f $dummy.c && rmdir $tmpdir
+       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       rm -f $dummy.c && rmdir $tmpdir
+       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit 0 ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit 0 ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit 0 ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit 0 ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit 0 ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit 0 ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit 0 ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #ifdef __INTEL_COMPILER
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       rm -f $dummy.c && rmdir $tmpdir
+       test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit 0 ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit 0 ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit 0 ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit 0 ;;
+    i*86:*:5:[78]*)
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit 0 ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit 0 ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit 0 ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit 0 ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit 0 ;;
+    M68*:*:R3V[567]*:*)
+       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit 0 ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit 0 ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit 0 ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit 0 ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit 0 ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit 0 ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit 0 ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit 0 ;;
+    *:Darwin:*:*)
+       echo `uname -p`-apple-darwin${UNAME_RELEASE}
+       exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit 0 ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit 0 ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit 0 ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit 0 ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit 0 ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit 0 ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit 0 ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit 0 ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit 0 ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit 0 ;;
+    c34*)
+       echo c34-convex-bsd
+       exit 0 ;;
+    c38*)
+       echo c38-convex-bsd
+       exit 0 ;;
+    c4*)
+       echo c4-convex-bsd
+       exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/mk/autoconf/config.sub b/mk/autoconf/config.sub
new file mode 100755 (executable)
index 0000000..f0675aa
--- /dev/null
@@ -0,0 +1,1469 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-11-30'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k \
+       | m32r | m68000 | m68k | m88k | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | ns16k | ns32k \
+       | openrisc | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+       | strongarm \
+       | tahoe | thumb | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xscale | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* \
+       | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+       | clipper-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* \
+       | m32r-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39 | mipstx39el \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+       | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+       | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       mmix*)
+               basic_machine=mmix-knuth
+               os=-mmixware
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       or32 | or32-*)
+               basic_machine=or32-unknown
+               os=-coff
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2)
+               basic_machine=i686-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3d)
+               basic_machine=alpha-cray
+               os=-unicos
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+        tic4x | c4x*)
+               basic_machine=tic4x-unknown
+               os=-coff
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+               basic_machine=sh-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparc | sparcv9 | sparcv9b)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+             | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/mk/autoconf/gettext.m4 b/mk/autoconf/gettext.m4
new file mode 100644 (file)
index 0000000..16070b4
--- /dev/null
@@ -0,0 +1,415 @@
+# gettext.m4 serial 20 (gettext-0.12)
+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+dnl    default (if it is not specified or empty) is 'no-libtool'.
+dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
+dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
+dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl    depending on --{enable,disable}-{shared,static} and on the presence of
+dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+dnl    $(top_builddir)/intl/libintl.a will be created.
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl    implementations (in libc or libintl) without the ngettext() function
+dnl    will be ignored.  If NEEDSYMBOL is specified and is
+dnl    'need-formatstring-macros', then GNU gettext implementations that don't
+dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries.  If empty,
+dnl    the value `$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl    and used.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl    Catalog format: none
+dnl    Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+  dnl Argument checking.
+  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
+    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])])
+  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
+  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
+
+  AC_REQUIRE([AM_PO_SUBDIRS])dnl
+  ifelse(gt_included_intl, yes, [
+    AC_REQUIRE([AM_INTL_SUBDIR])dnl
+  ])
+
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Sometimes libintl requires libiconv, so first search for libiconv.
+  dnl Ideally we would do this search only after the
+  dnl      if test "$USE_NLS" = "yes"; then
+  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+  dnl the configure script would need to contain the same shell code
+  dnl again, outside any 'if'. There are two solutions:
+  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+  dnl documented, we avoid it.
+  ifelse(gt_included_intl, yes, , [
+    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+  ])
+
+  dnl Set USE_NLS.
+  AM_NLS
+
+  ifelse(gt_included_intl, yes, [
+    BUILD_INCLUDED_LIBINTL=no
+    USE_INCLUDED_LIBINTL=no
+  ])
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+  dnl If we use NLS figure out what method
+  if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+    ifelse(gt_included_intl, yes, [
+      AC_MSG_CHECKING([whether included gettext is requested])
+      AC_ARG_WITH(included-gettext,
+        [  --with-included-gettext use the GNU gettext library included here],
+        nls_cv_force_use_gnu_gettext=$withval,
+        nls_cv_force_use_gnu_gettext=no)
+      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+    ])
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If GNU gettext is available we use this.  Else we have
+        dnl to fall back to GNU NLS library.
+
+        dnl Add a version number to the cache macros.
+        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
+
+        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+         [AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;],
+            [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+            gt_cv_func_gnugettext_libc=yes,
+            gt_cv_func_gnugettext_libc=no)])
+
+        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+          dnl Sometimes libintl requires libiconv, so first search for libiconv.
+          ifelse(gt_included_intl, yes, , [
+            AM_ICONV_LINK
+          ])
+          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+          dnl even if libiconv doesn't exist.
+          AC_LIB_LINKFLAGS_BODY([intl])
+          AC_CACHE_CHECK([for GNU gettext in libintl],
+            gt_cv_func_gnugettext_libintl,
+           [gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+            dnl Now see whether libintl exists and does not depend on libiconv.
+            AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();],
+              [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+              gt_cv_func_gnugettext_libintl=yes,
+              gt_cv_func_gnugettext_libintl=no)
+            dnl Now see whether libintl exists and depends on libiconv.
+            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();],
+                [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+               [LIBINTL="$LIBINTL $LIBICONV"
+                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                gt_cv_func_gnugettext_libintl=yes
+               ])
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"])
+        fi
+
+        dnl If an already present or preinstalled GNU gettext() is found,
+        dnl use it.  But if this macro is used in GNU gettext, and GNU
+        dnl gettext is already preinstalled in libintl, we update this
+        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
+        if test "$gt_cv_func_gnugettext_libc" = "yes" \
+           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
+                && test "$PACKAGE" != gettext-runtime \
+                && test "$PACKAGE" != gettext-tools; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+          dnl Reset the values set by searching for libintl.
+          LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+    ifelse(gt_included_intl, yes, [
+        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+          dnl GNU gettext is not found in the C library.
+          dnl Fall back on included GNU gettext library.
+          nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions used to generate GNU NLS library.
+        BUILD_INCLUDED_LIBINTL=yes
+        USE_INCLUDED_LIBINTL=yes
+        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
+        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
+        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+      fi
+
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions to use GNU gettext tools.
+        CATOBJEXT=.gmo
+      fi
+    ])
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+      AC_DEFINE(ENABLE_NLS, 1,
+        [Define to 1 if translation of program messages to the user's native language
+   is requested.])
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  AC_MSG_CHECKING([whether to use NLS])
+  AC_MSG_RESULT([$USE_NLS])
+  if test "$USE_NLS" = "yes"; then
+    AC_MSG_CHECKING([where the gettext function comes from])
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+        gt_source="external libintl"
+      else
+        gt_source="libc"
+      fi
+    else
+      gt_source="included intl directory"
+    fi
+    AC_MSG_RESULT([$gt_source])
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+        AC_MSG_CHECKING([how to link with libintl])
+        AC_MSG_RESULT([$LIBINTL])
+        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+      fi
+
+      dnl For backward compatibility. Some packages may be using this.
+      AC_DEFINE(HAVE_GETTEXT, 1,
+       [Define if the GNU gettext() function is already present or preinstalled.])
+      AC_DEFINE(HAVE_DCGETTEXT, 1,
+       [Define if the GNU dcgettext() function is already present or preinstalled.])
+    fi
+
+    dnl We need to process the po/ directory.
+    POSUB=po
+  fi
+
+  ifelse(gt_included_intl, yes, [
+    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+    dnl to 'yes' because some of the testsuite requires it.
+    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
+      BUILD_INCLUDED_LIBINTL=yes
+    fi
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(BUILD_INCLUDED_LIBINTL)
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATOBJEXT)
+
+    dnl For backward compatibility. Some configure.ins may be using this.
+    nls_cv_header_intl=
+    nls_cv_header_libgt=
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    DATADIRNAME=share
+    AC_SUBST(DATADIRNAME)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    INSTOBJEXT=.mo
+    AC_SUBST(INSTOBJEXT)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    GENCAT=gencat
+    AC_SUBST(GENCAT)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    if test "$USE_INCLUDED_LIBINTL" = yes; then
+      INTLOBJS="\$(GETTOBJS)"
+    fi
+    AC_SUBST(INTLOBJS)
+
+    dnl Enable libtool support if the surrounding package wishes it.
+    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
+  ])
+
+  dnl For backward compatibility. Some Makefiles may be using this.
+  INTLLIBS="$LIBINTL"
+  AC_SUBST(INTLLIBS)
+
+  dnl Make all documented variables known to autoconf.
+  AC_SUBST(LIBINTL)
+  AC_SUBST(LTLIBINTL)
+  AC_SUBST(POSUB)
+])
+
+
+dnl Checks for all prerequisites of the intl subdirectory,
+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+AC_DEFUN([AM_INTL_SUBDIR],
+[
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+  AC_REQUIRE([AC_PROG_CC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl
+  AC_REQUIRE([AC_PROG_RANLIB])dnl
+  AC_REQUIRE([AC_ISC_POSIX])dnl
+  AC_REQUIRE([AC_HEADER_STDC])dnl
+  AC_REQUIRE([AC_C_CONST])dnl
+  AC_REQUIRE([AC_C_INLINE])dnl
+  AC_REQUIRE([AC_TYPE_OFF_T])dnl
+  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+  AC_REQUIRE([AC_FUNC_MMAP])dnl
+  AC_REQUIRE([jm_GLIBC21])dnl
+  AC_REQUIRE([gt_INTDIV0])dnl
+  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
+  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
+  AC_REQUIRE([gt_INTTYPES_PRI])dnl
+
+  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
+stdlib.h string.h unistd.h sys/param.h])
+  AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
+geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
+strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
+__fsetlocking])
+
+  AM_ICONV
+  AM_LANGINFO_CODESET
+  if test $ac_cv_header_locale_h = yes; then
+    AM_LC_MESSAGES
+  fi
+
+  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+  dnl because plural.y uses bison specific features. It requires at least
+  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+  dnl compile.
+  dnl bison is only needed for the maintainer (who touches plural.y). But in
+  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+  dnl the rule in general Makefile. Now, some people carelessly touch the
+  dnl files or have a broken "make" program, hence the plural.c rule will
+  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+  dnl present or too old.
+  AC_CHECK_PROGS([INTLBISON], [bison])
+  if test -z "$INTLBISON"; then
+    ac_verc_fail=yes
+  else
+    dnl Found it, now check the version.
+    AC_MSG_CHECKING([version of bison])
+changequote(<<,>>)dnl
+    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+    case $ac_prog_version in
+      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+changequote([,])dnl
+         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+    esac
+    AC_MSG_RESULT([$ac_prog_version])
+  fi
+  if test $ac_verc_fail = yes; then
+    INTLBISON=:
+  fi
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/mk/autoconf/glibc21.m4 b/mk/autoconf/glibc21.m4
new file mode 100644 (file)
index 0000000..9c9f3db
--- /dev/null
@@ -0,0 +1,32 @@
+# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([jm_GLIBC21],
+  [
+    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
+      ac_cv_gnu_library_2_1,
+      [AC_EGREP_CPP([Lucky GNU user],
+       [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+  Lucky GNU user
+ #endif
+#endif
+       ],
+       ac_cv_gnu_library_2_1=yes,
+       ac_cv_gnu_library_2_1=no)
+      ]
+    )
+    AC_SUBST(GLIBC21)
+    GLIBC21="$ac_cv_gnu_library_2_1"
+  ]
+)
diff --git a/mk/autoconf/iconv.m4 b/mk/autoconf/iconv.m4
new file mode 100644 (file)
index 0000000..c5f3579
--- /dev/null
@@ -0,0 +1,103 @@
+# iconv.m4 serial AM4 (gettext-0.11.3)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed libiconv and not disabled its use
+  dnl via --without-libiconv-prefix, he wants to use it. The first
+  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+  am_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+      [iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);],
+      am_cv_func_iconv=yes)
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+        [iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);],
+        am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes)
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    AC_MSG_CHECKING([how to link with libiconv])
+    AC_MSG_RESULT([$LIBICONV])
+  else
+    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+    dnl either.
+    CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+  AC_SUBST(LIBICONV)
+  AC_SUBST(LTLIBICONV)
+])
+
+AC_DEFUN([AM_ICONV],
+[
+  AM_ICONV_LINK
+  if test "$am_cv_func_iconv" = yes; then
+    AC_MSG_CHECKING([for iconv declaration])
+    AC_CACHE_VAL(am_cv_proto_iconv, [
+      AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    AC_MSG_RESULT([$]{ac_t:-
+         }[$]am_cv_proto_iconv)
+    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+      [Define as const if the declaration of iconv() needs const.])
+  fi
+])
diff --git a/mk/autoconf/initjamfile.m4 b/mk/autoconf/initjamfile.m4
new file mode 100644 (file)
index 0000000..7886246
--- /dev/null
@@ -0,0 +1,24 @@
+#----------------------------------------------------------------------------
+#  AC_INIT_JAM
+#    This rule fixes several issues related to autoconf being make centric
+#----------------------------------------------------------------------------
+AC_DEFUN([AC_INIT_JAM],
+    [
+     AC_INIT_JAMFILE
+     AC_OUTPUT_INSTALLDIRS
+     AC_FIX_INSTALL])
+
+#----------------------------------------------------------------------------
+#  AC_INIT_JAMFILE
+#    This rule let's config.status create a wrapper Jamfile in case configure
+#    has been invoked from a directory outside the source directory
+#----------------------------------------------------------------------------
+AC_DEFUN([AC_INIT_JAMFILE],
+    [AC_CONFIG_COMMANDS([Jamfile],
+      [AS_IF([test ! -f "${ac_top_builddir}Jamfile"],
+       [echo Installing Jamfile wrapper.
+        echo "# This file was automatically create by config.status" > Jamfile
+        echo "TOP ?= $ac_top_srcdir ;" >> Jamfile
+        echo "top_builddir ?= . ;" >> Jamfile
+        echo "include \$(TOP)/Jamfile ;" >> Jamfile])])])
+
diff --git a/mk/autoconf/install-sh b/mk/autoconf/install-sh
new file mode 100755 (executable)
index 0000000..36f96f3
--- /dev/null
@@ -0,0 +1,276 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) instcmd=$cpprog
+           shift
+           continue;;
+
+       -d) dir_arg=true
+           shift
+           continue;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           shift
+           continue;;
+
+       -o) chowncmd="$chownprog $2"
+           shift
+           shift
+           continue;;
+
+       -g) chgrpcmd="$chgrpprog $2"
+           shift
+           shift
+           continue;;
+
+       -s) stripcmd=$stripprog
+           shift
+           continue;;
+
+       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+           shift
+           continue;;
+
+       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+           shift
+           continue;;
+
+       *)  if [ x"$src" = x ]
+           then
+               src=$1
+           else
+               # this colon is to work around a 386BSD /bin/sh bug
+               :
+               dst=$1
+           fi
+           shift
+           continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+       echo "$0: no input file specified" >&2
+       exit 1
+else
+       :
+fi
+
+if [ x"$dir_arg" != x ]; then
+       dst=$src
+       src=""
+
+       if [ -d "$dst" ]; then
+               instcmd=:
+               chmodcmd=""
+       else
+               instcmd=$mkdirprog
+       fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+       if [ -f "$src" ] || [ -d "$src" ]
+       then
+               :
+       else
+               echo "$0: $src does not exist" >&2
+               exit 1
+       fi
+
+       if [ x"$dst" = x ]
+       then
+               echo "$0: no destination specified" >&2
+               exit 1
+       else
+               :
+       fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+       if [ -d "$dst" ]
+       then
+               dst=$dst/`basename "$src"`
+       else
+               :
+       fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+       '
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+       pathcomp=$pathcomp$1
+       shift
+
+       if [ ! -d "$pathcomp" ] ;
+        then
+               $mkdirprog "$pathcomp"
+       else
+               :
+       fi
+
+       pathcomp=$pathcomp/
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+       $doit $instcmd "$dst" &&
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+       if [ x"$transformarg" = x ]
+       then
+               dstfile=`basename "$dst"`
+       else
+               dstfile=`basename "$dst" $transformbasename |
+                       sed $transformarg`$transformbasename
+       fi
+
+# don't allow the sed command to completely eliminate the filename
+
+       if [ x"$dstfile" = x ]
+       then
+               dstfile=`basename "$dst"`
+       else
+               :
+       fi
+
+# Make a couple of temp file names in the proper directory.
+
+       dsttmp=$dstdir/#inst.$$#
+       rmtmp=$dstdir/#rm.$$#
+
+# Trap to clean up temp files at exit.
+
+       trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+       trap '(exit $?); exit' 1 2 13 15
+
+# Move or copy the file name to the temp name
+
+       $doit $instcmd "$src" "$dsttmp" &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
+
+# Now remove or move aside any old file at destination location.  We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons.  In this case, the final cleanup
+# might fail but the new file should still install successfully.
+
+{
+       if [ -f "$dstdir/$dstfile" ]
+       then
+               $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+               $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+               {
+                 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                 (exit 1); exit
+               }
+       else
+               :
+       fi
+} &&
+
+# Now rename the file to the real destination.
+
+       $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+
+fi &&
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+
+{
+       (exit 0); exit
+}
diff --git a/mk/autoconf/installdirs.m4 b/mk/autoconf/installdirs.m4
new file mode 100644 (file)
index 0000000..8d6eea9
--- /dev/null
@@ -0,0 +1,91 @@
+#-----------------------------------------------------------------------------
+# installdirs.m4 (c) Matze Braun <matze@braunis.de>
+# Macros for outputing the installation paths which autoconf gathers into the
+# Jamconfig file.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# AC_OUTPUT_INSTALLDIRS
+#   Transforms the installation dirs which are gathered by autoconf and sets
+#   properties in the Jamconfig file for them. We deal with stuff like
+#   variable references inside the paths (often the paths contain ${prefix})
+#   and with correct quoting here.
+#   The script will set the INSTALLDIR.PREFIX, INSTALLDIR.EXEC_PREFIX,
+#   INSTALLDIR.APPLICATION, INSTALLDIR.SBIN, INSTALLDIR.LIBEXEC,
+#   INSTALLDIR.DATA, INSTALLDIR.MAP, INSTALLDIR.CONFIG, INSTALLDIR.SHAREDSTATE
+#   INSTALLDIR.LOCALSTATE, INSTALLDIR.PLUGIN, INSTALLDIR.DOC
+#   INSTALLDIR.LIBRARY, INSTALLDIR.INCLUDE, INSTALLDIR.OLDINCLUDE,
+#   INSTALLDIR.INFO, INSTALLDIR.MAN
+#-----------------------------------------------------------------------------
+AC_DEFUN([AC_OUTPUT_INSTALLDIRS],[
+# Handle the case when no prefix is given. And the special case when a path
+# contains more than 2 slashes, these paths seem to be correct but jam fails
+# on them.
+AS_IF([test $prefix = NONE], [prefix="$ac_default_prefix"],
+    [prefix=`echo "$prefix" | sed -e 's:///*:/:g'`])
+AS_IF([test $exec_prefix = NONE],
+    [exec_prefix="AS_ESCAPE([$(prefix)])"],
+    [exec_prefix=`echo "$exec_prefix" | sed -e 's:///*:/:g'`])
+
+prefix=AC_FIX_VARIABLEREF([$prefix])
+exec_prefix=AC_FIX_VARIABLEREF([$exec_prefix])
+bindir=AC_FIX_VARIABLEREF([$bindir])
+sbindir=AC_FIX_VARIABLEREF([$sbindir])
+libexecdir=AC_FIX_VARIABLEREF([$libexecdir])
+datadir=AC_FIX_VARIABLEREF([$datadir])
+sysconfdir=AC_FIX_VARIABLEREF([$sysconfdir])
+sharedstatedir=AC_FIX_VARIABLEREF([$sharedstatedir])
+localstatedir=AC_FIX_VARIABLEREF([$localstatedir])
+libdir=AC_FIX_VARIABLEREF([$libdir])
+includedir=AC_FIX_VARIABLEREF([$includedir])
+oldincludedir=AC_FIX_VARIABLEREF([$oldincludedir])
+infodir=AC_FIX_VARIABLEREF([$infodir])
+mandir=AC_FIX_VARIABLEREF([$mandir])
+
+#hack to get the order right :-/ (autoconf --trace reports wrong order...)
+AC_SUBST(prefix)
+AC_SUBST(exec_prefix)
+AC_SUBST(bindir)
+AC_SUBST(sbindir)
+AC_SUBST(libexecdir)
+AC_SUBST(datadir)
+AC_SUBST(sysconfdir)
+AC_SUBST(sharedstatedir)
+AC_SUBST(localstatedir)
+AC_SUBST(libdir)
+AC_SUBST(includedir)
+AC_SUBST(oldincludedir)
+AC_SUBST(infodir)
+AC_SUBST(mandir)
+])
+
+#-----------------------------------------------------------------------------
+# AC_FIX_INSTALL
+#   Fixes the output from AC_PROG_INSTALL
+#-----------------------------------------------------------------------------
+AC_DEFUN([AC_FIX_INSTALL], [
+AC_REQUIRE([AC_PROG_INSTALL])
+INSTALL=AC_FIX_VARIABLEREF([$INSTALL])
+INSTALL_PROGRAM=AC_FIX_VARIABLEREF([$INSTALL_PROGRAM])
+INSTALL_SCRIPT=AC_FIX_VARIABLEREF([$INSTALL_SCRIPT])
+INSTALL_DATA=AC_FIX_VARIABLEREF([$INSTALL_DATA])
+
+# fix for order...
+AC_SUBST([INSTALL])
+AC_SUBST([INSTALL_PROGRAM])
+AC_SUBST([INSTALL_SCRIPT])
+AC_SUBST([INSTALL_DATA])
+])
+
+#-----------------------------------------------------------------------------
+# AC_PREPARE_INSTALLPATH
+#   Transform variables of the form ${bla} to $(bla) inside the string and
+#   correctly quotes backslashes.
+#   This is needed if you want to output some of the paths that autoconf
+#   creates to the Jamconfig file.
+#-----------------------------------------------------------------------------
+AC_DEFUN([AC_FIX_VARIABLEREF],
+dnl We need all the strange \\\\ quoting here, because the command will be
+dnl inserted into a "" block and sed needs quoting as well
+[`echo "$1" | sed -e 's/\${\([[a-zA-Z_][a-zA-Z_]]*\)}/$(\1)/g' -e 's/\\\\/\\\\\\\\/g'`])
+
diff --git a/mk/autoconf/intdiv0.m4 b/mk/autoconf/intdiv0.m4
new file mode 100644 (file)
index 0000000..55dddcf
--- /dev/null
@@ -0,0 +1,72 @@
+# intdiv0.m4 serial 1 (gettext-0.11.3)
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gt_INTDIV0],
+[
+  AC_REQUIRE([AC_PROG_CC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
+    gt_cv_int_divbyzero_sigfpe,
+    [
+      AC_TRY_RUN([
+#include <stdlib.h>
+#include <signal.h>
+
+static void
+#ifdef __cplusplus
+sigfpe_handler (int sig)
+#else
+sigfpe_handler (sig) int sig;
+#endif
+{
+  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
+  exit (sig != SIGFPE);
+}
+
+int x = 1;
+int y = 0;
+int z;
+int nan;
+
+int main ()
+{
+  signal (SIGFPE, sigfpe_handler);
+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
+  signal (SIGTRAP, sigfpe_handler);
+#endif
+/* Linux/SPARC yields signal SIGILL.  */
+#if defined (__sparc__) && defined (__linux__)
+  signal (SIGILL, sigfpe_handler);
+#endif
+
+  z = x / y;
+  nan = y / y;
+  exit (1);
+}
+], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
+        [
+          # Guess based on the CPU.
+          case "$host_cpu" in
+            alpha* | i[34567]86 | m68k | s390*)
+              gt_cv_int_divbyzero_sigfpe="guessing yes";;
+            *)
+              gt_cv_int_divbyzero_sigfpe="guessing no";;
+          esac
+        ])
+    ])
+  case "$gt_cv_int_divbyzero_sigfpe" in
+    *yes) value=1;;
+    *) value=0;;
+  esac
+  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
+    [Define if integer division by zero raises signal SIGFPE.])
+])
diff --git a/mk/autoconf/inttypes-pri.m4 b/mk/autoconf/inttypes-pri.m4
new file mode 100644 (file)
index 0000000..fd007c3
--- /dev/null
@@ -0,0 +1,32 @@
+# inttypes-pri.m4 serial 1 (gettext-0.11.4)
+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
+# macros to non-string values.  This is the case on AIX 4.3.3.
+
+AC_DEFUN([gt_INTTYPES_PRI],
+[
+  AC_REQUIRE([gt_HEADER_INTTYPES_H])
+  if test $gt_cv_header_inttypes_h = yes; then
+    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
+      gt_cv_inttypes_pri_broken,
+      [
+        AC_TRY_COMPILE([#include <inttypes.h>
+#ifdef PRId32
+char *p = PRId32;
+#endif
+], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
+      ])
+  fi
+  if test "$gt_cv_inttypes_pri_broken" = yes; then
+    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
+      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
+  fi
+])
diff --git a/mk/autoconf/inttypes.m4 b/mk/autoconf/inttypes.m4
new file mode 100644 (file)
index 0000000..ab370ff
--- /dev/null
@@ -0,0 +1,27 @@
+# inttypes.m4 serial 1 (gettext-0.11.4)
+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
+# <sys/types.h>.
+
+AC_DEFUN([gt_HEADER_INTTYPES_H],
+[
+  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
+  [
+    AC_TRY_COMPILE(
+      [#include <sys/types.h>
+#include <inttypes.h>],
+      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
+  ])
+  if test $gt_cv_header_inttypes_h = yes; then
+    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
+      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
+  fi
+])
diff --git a/mk/autoconf/inttypes_h.m4 b/mk/autoconf/inttypes_h.m4
new file mode 100644 (file)
index 0000000..f342eba
--- /dev/null
@@ -0,0 +1,28 @@
+# inttypes_h.m4 serial 5 (gettext-0.12)
+dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
+[
+  AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
+  [AC_TRY_COMPILE(
+    [#include <sys/types.h>
+#include <inttypes.h>],
+    [uintmax_t i = (uintmax_t) -1;],
+    jm_ac_cv_header_inttypes_h=yes,
+    jm_ac_cv_header_inttypes_h=no)])
+  if test $jm_ac_cv_header_inttypes_h = yes; then
+    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
+      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+       and declares uintmax_t. ])
+  fi
+])
diff --git a/mk/autoconf/isc-posix.m4 b/mk/autoconf/isc-posix.m4
new file mode 100644 (file)
index 0000000..1319dd1
--- /dev/null
@@ -0,0 +1,26 @@
+# isc-posix.m4 serial 2 (gettext-0.11.2)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
+
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN([AC_ISC_POSIX],
+  [
+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+  ]
+)
diff --git a/mk/autoconf/lcmessage.m4 b/mk/autoconf/lcmessage.m4
new file mode 100644 (file)
index 0000000..ffd4008
--- /dev/null
@@ -0,0 +1,32 @@
+# lcmessage.m4 serial 3 (gettext-0.11.3)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+
+AC_DEFUN([AM_LC_MESSAGES],
+[
+  AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+  if test $am_cv_val_LC_MESSAGES = yes; then
+    AC_DEFINE(HAVE_LC_MESSAGES, 1,
+      [Define if your <locale.h> file defines LC_MESSAGES.])
+  fi
+])
diff --git a/mk/autoconf/lib-ld.m4 b/mk/autoconf/lib-ld.m4
new file mode 100644 (file)
index 0000000..11d0ce7
--- /dev/null
@@ -0,0 +1,110 @@
+# lib-ld.m4 serial 2 (gettext-0.12)
+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  acl_cv_prog_gnu_ld=yes
+else
+  acl_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]* | [A-Za-z]:[\\/]*)]
+      [re_direlt='/[^/][^/]*/\.\./']
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(acl_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+       test "$with_gnu_ld" != no && break
+      else
+       test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/mk/autoconf/lib-link.m4 b/mk/autoconf/lib-link.m4
new file mode 100644 (file)
index 0000000..eeb200d
--- /dev/null
@@ -0,0 +1,551 @@
+# lib-link.m4 serial 4 (gettext-0.12)
+dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  define([Name],[translit([$1],[./-], [___])])
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+    AC_LIB_LINKFLAGS_BODY([$1], [$2])
+    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+  ])
+  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+  dnl results of this search when this library appears as a dependency.
+  HAVE_LIB[]NAME=yes
+  undefine([Name])
+  undefine([NAME])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. If found, it
+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  define([Name],[translit([$1],[./-], [___])])
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed lib[]Name and not disabled its use
+  dnl via --without-lib[]Name-prefix, he wants to use it.
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+    ac_save_LIBS="$LIBS"
+    LIBS="$LIBS $LIB[]NAME"
+    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+    LIBS="$ac_save_LIBS"
+  ])
+  if test "$ac_cv_lib[]Name" = yes; then
+    HAVE_LIB[]NAME=yes
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+    AC_MSG_CHECKING([how to link with lib[]$1])
+    AC_MSG_RESULT([$LIB[]NAME])
+  else
+    HAVE_LIB[]NAME=no
+    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+    dnl $INC[]NAME either.
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    LIB[]NAME=
+    LTLIB[]NAME=
+  fi
+  AC_SUBST([HAVE_LIB]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  undefine([Name])
+  undefine([NAME])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
+dnl hardcode_direct, hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
+  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
+  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+  ])
+  wl="$acl_cv_wl"
+  libext="$acl_cv_libext"
+  shlibext="$acl_cv_shlibext"
+  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  hardcode_direct="$acl_cv_hardcode_direct"
+  hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  dnl Determine whether the user wants rpath handling at all.
+  AC_ARG_ENABLE(rpath,
+    [  --disable-rpath         do not hardcode runtime library paths],
+    :, enable_rpath=yes)
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_LIB_ARG_WITH([lib$1-prefix],
+[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
+  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+])
+  dnl Search the library and its dependencies in $additional_libdir and
+  dnl $LDFLAGS. Using breadth-first-seach.
+  LIB[]NAME=
+  LTLIB[]NAME=
+  INC[]NAME=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='$1 $2'
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+        dnl or AC_LIB_HAVE_LINKFLAGS call.
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+          else
+            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+            dnl that this library doesn't exist. So just drop it.
+            :
+          fi
+        else
+          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+          dnl and the already constructed $LIBNAME/$LTLIBNAME.
+          found_dir=
+          found_la=
+          found_so=
+          found_a=
+          if test $use_additional = yes; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+              found_dir="$additional_libdir"
+              found_so="$additional_libdir/lib$name.$shlibext"
+              if test -f "$additional_libdir/lib$name.la"; then
+                found_la="$additional_libdir/lib$name.la"
+              fi
+            else
+              if test -f "$additional_libdir/lib$name.$libext"; then
+                found_dir="$additional_libdir"
+                found_a="$additional_libdir/lib$name.$libext"
+                if test -f "$additional_libdir/lib$name.la"; then
+                  found_la="$additional_libdir/lib$name.la"
+                fi
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIB[]NAME; do
+              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                    found_dir="$dir"
+                    found_so="$dir/lib$name.$shlibext"
+                    if test -f "$dir/lib$name.la"; then
+                      found_la="$dir/lib$name.la"
+                    fi
+                  else
+                    if test -f "$dir/lib$name.$libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/lib$name.$libext"
+                      if test -f "$dir/lib$name.la"; then
+                        found_la="$dir/lib$name.la"
+                      fi
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+            dnl Found the library.
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+              dnl Linking with a shared library. We attempt to hardcode its
+              dnl directory into the executable's runpath, unless it's the
+              dnl standard /usr/lib.
+              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+                dnl No hardcoding is needed.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+              else
+                dnl Use an explicit option to hardcode DIR into the resulting
+                dnl binary.
+                dnl Potentially add DIR to ltrpathdirs.
+                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                dnl The hardcoding into $LIBNAME is system dependent.
+                if test "$hardcode_direct" = yes; then
+                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+                  dnl resulting binary.
+                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                else
+                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into the resulting
+                    dnl binary.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    dnl Potentially add DIR to rpathdirs.
+                    dnl The rpathdirs will be appended to $LIBNAME at the end.
+                    haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                    dnl Rely on "-L$found_dir".
+                    dnl But don't add it if it's already contained in the LDFLAGS
+                    dnl or the already constructed $LIBNAME
+                    haveit=
+                    for x in $LDFLAGS $LIB[]NAME; do
+                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                    fi
+                    if test "$hardcode_minus_L" != no; then
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    else
+                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+                      dnl here, because this doesn't fit in flags passed to the
+                      dnl compiler. So give up. No hardcoding. This affects only
+                      dnl very old systems.
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                dnl Linking with a static library.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+              else
+                dnl We shouldn't come here, but anyway it's good to have a
+                dnl fallback.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+              fi
+            fi
+            dnl Assume the include files are nearby.
+            additional_includedir=
+            case "$found_dir" in
+              */lib | */lib/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+              dnl Potentially add $additional_includedir to $INCNAME.
+              dnl But don't add it
+              dnl   1. if it's the standard /usr/include,
+              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
+              dnl   3. if it's already present in $CPPFLAGS or the already
+              dnl      constructed $INCNAME,
+              dnl   4. if it doesn't exist as a directory.
+              if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux*) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INC[]NAME; do
+                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                      dnl Really add $additional_includedir to $INCNAME.
+                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+            dnl Look for dependencies.
+            if test -n "$found_la"; then
+              dnl Read the .la file. It defines the variables
+              dnl dlname, library_names, old_library, dependency_libs, current,
+              dnl age, revision, installed, dlopen, dlpreopen, libdir.
+              save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+              dnl We use only dependency_libs.
+              for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+                    dnl But don't add it
+                    dnl   1. if it's the standard /usr/lib,
+                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
+                    dnl   3. if it's already present in $LDFLAGS or the already
+                    dnl      constructed $LIBNAME,
+                    dnl   4. if it doesn't exist as a directory.
+                    if test "X$additional_libdir" != "X/usr/lib"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/lib"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux*) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LIBNAME.
+                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LTLIBNAME.
+                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                      dnl Potentially add DIR to rpathdirs.
+                      dnl The rpathdirs will be appended to $LIBNAME at the end.
+                      haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                      dnl Potentially add DIR to ltrpathdirs.
+                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                      haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                    dnl Handle this in the next round.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                    dnl Handle this in the next round. Throw away the .la's
+                    dnl directory; it is already contained in a preceding -L
+                    dnl option.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                    dnl Most likely an immediate library name.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+            dnl Didn't find the library; assume it is in the system directories
+            dnl known to the linker and runtime loader. (All the system
+            dnl directories known to the linker should also be known to the
+            dnl runtime loader, otherwise the system is severely misconfigured.)
+            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$hardcode_libdir_separator"; then
+      dnl Weird platform: only the last -rpath option counts, the user must
+      dnl pass all path elements in one option. We can arrange that for a
+      dnl single library, but not when more than one $LIBNAMEs are used.
+      alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+      done
+      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+      acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+    else
+      dnl The -rpath options are cumulative.
+      for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+    dnl When using libtool, the option that works for both libraries and
+    dnl executables is -R. The -R options are cumulative.
+    for found_dir in $ltrpathdirs; do
+      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+    done
+  fi
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+  for element in [$2]; do
+    haveit=
+    for x in $[$1]; do
+      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      [$1]="${[$1]}${[$1]:+ }$element"
+    fi
+  done
+])
diff --git a/mk/autoconf/lib-prefix.m4 b/mk/autoconf/lib-prefix.m4
new file mode 100644 (file)
index 0000000..c719bc8
--- /dev/null
@@ -0,0 +1,155 @@
+# lib-prefix.m4 serial 2 (gettext-0.12)
+dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_LIB_ARG_WITH([lib-prefix],
+[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+  --without-lib-prefix    don't search for libraries in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+])
+  if test $use_additional = yes; then
+    dnl Potentially add $additional_includedir to $CPPFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/include,
+    dnl   2. if it's already present in $CPPFLAGS,
+    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_includedir" != "X/usr/include"; then
+      haveit=
+      for x in $CPPFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-I$additional_includedir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_includedir" = "X/usr/local/include"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_includedir"; then
+            dnl Really add $additional_includedir to $CPPFLAGS.
+            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+          fi
+        fi
+      fi
+    fi
+    dnl Potentially add $additional_libdir to $LDFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/lib,
+    dnl   2. if it's already present in $LDFLAGS,
+    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_libdir" != "X/usr/lib"; then
+      haveit=
+      for x in $LDFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-L$additional_libdir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_libdir" = "X/usr/local/lib"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_libdir"; then
+            dnl Really add $additional_libdir to $LDFLAGS.
+            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+          fi
+        fi
+      fi
+    fi
+  fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+  dnl Unfortunately, prefix and exec_prefix get only finally determined
+  dnl at the end of configure.
+  if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  $1
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+])
diff --git a/mk/autoconf/nls.m4 b/mk/autoconf/nls.m4
new file mode 100644 (file)
index 0000000..36bc493
--- /dev/null
@@ -0,0 +1,49 @@
+# nls.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_DEFUN([AM_NLS],
+[
+  AC_MSG_CHECKING([whether NLS is requested])
+  dnl Default is enabled NLS
+  AC_ARG_ENABLE(nls,
+    [  --disable-nls           do not use Native Language Support],
+    USE_NLS=$enableval, USE_NLS=yes)
+  AC_MSG_RESULT($USE_NLS)
+  AC_SUBST(USE_NLS)
+])
+
+AC_DEFUN([AM_MKINSTALLDIRS],
+[
+  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
+  dnl Try to locate it.
+  MKINSTALLDIRS=
+  if test -n "$ac_aux_dir"; then
+    case "$ac_aux_dir" in
+      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
+      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
+    esac
+  fi
+  if test -z "$MKINSTALLDIRS"; then
+    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+  fi
+  AC_SUBST(MKINSTALLDIRS)
+])
diff --git a/mk/autoconf/np_findlib.m4 b/mk/autoconf/np_findlib.m4
new file mode 100644 (file)
index 0000000..f2c2d2f
--- /dev/null
@@ -0,0 +1,51 @@
+#  NP_FINDLIB(VARNAME, NAME, STRING, TESTAPP, CFLAGS, LIBS, ACTION_IF_FOUND,
+#             ACTION_IF_NOT_FOUND, EXTRACFLAGS, EXTRALIBS)
+AC_DEFUN([NP_FINDLIB], [
+    AC_ARG_WITH([lib$2], [AC_HELP_STRING([--with-lib$2=dir],
+        [specify location of lib$2 if not detected automatically; uses
+        dir, dir/include and dir/lib])])
+            
+    save_CFLAGS="$CFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    save_LIBS="$LIBS"
+
+    RESCFLAGS="$5"
+    RESLIBS="$6"
+    CFLAGS="$CFLAGS $5 $9"
+    CPPFLAGS="$CPPFLAGS $5 $9"
+    LIBS="$LIBS $6 $10"
+
+    AS_IF([test -n "$with_lib$2"], [
+        CFLAGS="-I$with_lib$2/include $CFLAGS"
+        CPPFLAGS="-I$with_lib$2/include $CPPFLAGS"
+        LIBS="-L$with_lib$2/lib $LIBS"
+        RESCFLAGS="-I$with_lib$2/include $RESCFLAGS"
+        RESLIBS="-L$with_lib$2/lib $RESLIBS"
+    ])
+
+    AC_MSG_CHECKING([for $3])
+
+    AC_LINK_IFELSE([$4], [buildok=yes], [buildok=no])
+
+    LIBS=$save_LIBS
+    CPPFLAGS=$save_CPPFLAGS
+    CFLAGS=$save_CFLAGS
+
+    AS_IF([test $buildok = yes],
+       [AC_MSG_RESULT([found])
+        $1_AVAILABLE=yes
+        $1_CFLAGS="$RESCFLAGS"
+        $1_LIBS="$RESLIBS"],
+       [AC_MSG_RESULT([not found])
+        $1_AVAILABLE=no
+        $1_CFLAGS=""
+        $1_LIBS=""])
+    
+    AC_SUBST([$1_AVAILABLE])
+    AC_SUBST([$1_CFLAGS])
+    AC_SUBST([$1_LIBS])
+
+    AS_IF([test $buildok = yes],
+       [ifelse([$7], , :, [$7])],
+       [ifelse([$8], , :, [$8])])
+])
diff --git a/mk/autoconf/np_lang_program.m4 b/mk/autoconf/np_lang_program.m4
new file mode 100644 (file)
index 0000000..e6559d5
--- /dev/null
@@ -0,0 +1,13 @@
+# NP_LANG_PROGRAM, custom version of AC_LANG_PROGRAM (because SDL on win32
+# NEEDS main(int argc, char** argv)
+AC_DEFUN([NP_LANG_PROGRAM],
+[$1
+m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
+int
+main(int argc, char** argv)
+{
+$2
+  ;
+  return 0;
+}
+])
diff --git a/mk/autoconf/po.m4 b/mk/autoconf/po.m4
new file mode 100644 (file)
index 0000000..861e3de
--- /dev/null
@@ -0,0 +1,197 @@
+# po.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+dnl Checks for all prerequisites of the po subdirectory.
+AC_DEFUN([AM_PO_SUBDIRS],
+[
+  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+  AC_REQUIRE([AM_NLS])dnl
+
+  dnl Perform the following tests also if --disable-nls has been given,
+  dnl because they are needed for "make dist" to work.
+
+  dnl Search for GNU msgfmt in the PATH.
+  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
+  dnl The second test excludes FreeBSD msgfmt.
+  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+
+  dnl Search for GNU xgettext 0.12 or newer in the PATH.
+  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
+  dnl The second test excludes FreeBSD xgettext.
+  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  dnl Remove leftover from FreeBSD xgettext call.
+  rm -f messages.po
+
+  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
+  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
+    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
+
+  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
+  dnl Test whether we really found GNU msgfmt.
+  if test "$GMSGFMT" != ":"; then
+    dnl If it is no GNU msgfmt we define it as : so that the
+    dnl Makefiles still can work.
+    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
+       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
+      AC_MSG_RESULT(
+        [found $GMSGFMT program is not GNU msgfmt; ignore it])
+      GMSGFMT=":"
+    fi
+  fi
+
+  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
+  dnl Test whether we really found GNU xgettext.
+  if test "$XGETTEXT" != ":"; then
+    dnl If it is no GNU xgettext we define it as : so that the
+    dnl Makefiles still can work.
+    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+       (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      AC_MSG_RESULT(
+        [found xgettext program is not GNU xgettext; ignore it])
+      XGETTEXT=":"
+    fi
+    dnl Remove leftover from FreeBSD xgettext call.
+    rm -f messages.po
+  fi
+
+  AC_OUTPUT_COMMANDS([
+    for ac_file in $CONFIG_FILES; do
+      # Support "outfile[:infile[:infile...]]"
+      case "$ac_file" in
+        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+      esac
+      # PO directories have a Makefile.in generated from Makefile.in.in.
+      case "$ac_file" in */Makefile.in)
+        # Adjust a relative srcdir.
+        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+        # In autoconf-2.13 it is called $ac_given_srcdir.
+        # In autoconf-2.50 it is called $srcdir.
+        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+        case "$ac_given_srcdir" in
+          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+          /*) top_srcdir="$ac_given_srcdir" ;;
+          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+        esac
+        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+          rm -f "$ac_dir/POTFILES"
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          POMAKEFILEDEPS="POTFILES.in"
+          # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
+          # on $ac_dir but don't depend on user-specified configuration
+          # parameters.
+          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+            # The LINGUAS file contains the set of available languages.
+            if test -n "$OBSOLETE_ALL_LINGUAS"; then
+              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+            fi
+            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+            # Hide the ALL_LINGUAS assigment from automake.
+            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+          else
+            # The set of available languages was given in configure.in.
+            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+          fi
+          case "$ac_given_srcdir" in
+            .) srcdirpre= ;;
+            *) srcdirpre='$(srcdir)/' ;;
+          esac
+          POFILES=
+          GMOFILES=
+          UPDATEPOFILES=
+          DUMMYPOFILES=
+          for lang in $ALL_LINGUAS; do
+            POFILES="$POFILES $srcdirpre$lang.po"
+            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+          done
+          # CATALOGS depends on both $ac_dir and the user's LINGUAS
+          # environment variable.
+          INST_LINGUAS=
+          if test -n "$ALL_LINGUAS"; then
+            for presentlang in $ALL_LINGUAS; do
+              useit=no
+              if test "%UNSET%" != "$LINGUAS"; then
+                desiredlanguages="$LINGUAS"
+              else
+                desiredlanguages="$ALL_LINGUAS"
+              fi
+              for desiredlang in $desiredlanguages; do
+                # Use the presentlang catalog if desiredlang is
+                #   a. equal to presentlang, or
+                #   b. a variant of presentlang (because in this case,
+                #      presentlang can be used as a fallback for messages
+                #      which are not translated in the desiredlang catalog).
+                case "$desiredlang" in
+                  "$presentlang"*) useit=yes;;
+                esac
+              done
+              if test $useit = yes; then
+                INST_LINGUAS="$INST_LINGUAS $presentlang"
+              fi
+            done
+          fi
+          CATALOGS=
+          if test -n "$INST_LINGUAS"; then
+            for lang in $INST_LINGUAS; do
+              CATALOGS="$CATALOGS $lang.gmo"
+            done
+          fi
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+            if test -f "$f"; then
+              case "$f" in
+                *.orig | *.bak | *~) ;;
+                *) cat "$f" >> "$ac_dir/Makefile" ;;
+              esac
+            fi
+          done
+        fi
+        ;;
+      esac
+    done],
+   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
+    # from automake.
+    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+    # Capture the value of LINGUAS because we need it to compute CATALOGS.
+    LINGUAS="${LINGUAS-%UNSET%}"
+   ])
+])
diff --git a/mk/autoconf/progtest.m4 b/mk/autoconf/progtest.m4
new file mode 100644 (file)
index 0000000..8fe527c
--- /dev/null
@@ -0,0 +1,91 @@
+# progtest.m4 serial 3 (gettext-0.12)
+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+# Search path for a program which passes the given test.
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
+[
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+  [[\\/]]* | ?:[[\\/]]*)
+    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in ifelse([$5], , $PATH, [$5]); do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          if [$3]; then
+            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+    ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+  AC_MSG_RESULT([$]$1)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
diff --git a/mk/autoconf/sdl.m4 b/mk/autoconf/sdl.m4
new file mode 100644 (file)
index 0000000..ada3a41
--- /dev/null
@@ -0,0 +1,175 @@
+# Configure paths for SDL
+# Sam Lantinga 9/21/99
+# stolen from Manish Singh
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
+dnl
+AC_DEFUN([AM_PATH_SDL],
+[dnl 
+dnl Get the cflags and libraries from the sdl-config script
+dnl
+AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
+            sdl_prefix="$withval", sdl_prefix="")
+AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
+            sdl_exec_prefix="$withval", sdl_exec_prefix="")
+AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
+                   , enable_sdltest=yes)
+
+  if test x$sdl_exec_prefix != x ; then
+     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
+     if test x${SDL_CONFIG+set} != xset ; then
+        SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
+     fi
+  fi
+  if test x$sdl_prefix != x ; then
+     sdl_args="$sdl_args --prefix=$sdl_prefix"
+     if test x${SDL_CONFIG+set} != xset ; then
+        SDL_CONFIG=$sdl_prefix/bin/sdl-config
+     fi
+  fi
+
+  AC_REQUIRE([AC_CANONICAL_TARGET])
+  PATH="$prefix/bin:$prefix/usr/bin:$PATH"
+  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
+  min_sdl_version=ifelse([$1], ,0.11.0,$1)
+  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
+  no_sdl=""
+  if test "$SDL_CONFIG" = "no" ; then
+    no_sdl=yes
+  else
+    SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
+    SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
+
+    sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_sdltest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $SDL_CFLAGS"
+      LIBS="$LIBS $SDL_LIBS"
+dnl
+dnl Now check if the installed SDL is sufficiently new. (Also sanity
+dnl checks the results of sdl-config to some extent
+dnl
+      rm -f conf.sdltest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SDL.h"
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+  
+  if (str)
+    {
+      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+  
+  return new_str;
+}
+
+int main (int argc, char *argv[])
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  /* This hangs on some systems (?)
+  system ("touch conf.sdltest");
+  */
+  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_sdl_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_sdl_version");
+     exit(1);
+   }
+
+   if (($sdl_major_version > major) ||
+      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
+      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
+      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
+      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_sdl" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$SDL_CONFIG" = "no" ; then
+       echo "*** The sdl-config script installed by SDL could not be found"
+       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the SDL_CONFIG environment variable to the"
+       echo "*** full path to sdl-config."
+     else
+       if test -f conf.sdltest ; then
+        :
+       else
+          echo "*** Could not run SDL test program, checking why..."
+          CFLAGS="$CFLAGS $SDL_CFLAGS"
+          LIBS="$LIBS $SDL_LIBS"
+          AC_TRY_LINK([
+#include <stdio.h>
+#include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef  main
+#define main K_and_R_C_main
+],      [ return 0; ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding SDL or finding the wrong"
+          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
+          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
+          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     SDL_CFLAGS=""
+     SDL_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(SDL_CFLAGS)
+  AC_SUBST(SDL_LIBS)
+  rm -f conf.sdltest
+])
diff --git a/mk/autoconf/stdint_h.m4 b/mk/autoconf/stdint_h.m4
new file mode 100644 (file)
index 0000000..32ba7ae
--- /dev/null
@@ -0,0 +1,28 @@
+# stdint_h.m4 serial 3 (gettext-0.12)
+dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Paul Eggert.
+
+# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([jm_AC_HEADER_STDINT_H],
+[
+  AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
+  [AC_TRY_COMPILE(
+    [#include <sys/types.h>
+#include <stdint.h>],
+    [uintmax_t i = (uintmax_t) -1;],
+    jm_ac_cv_header_stdint_h=yes,
+    jm_ac_cv_header_stdint_h=no)])
+  if test $jm_ac_cv_header_stdint_h = yes; then
+    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
+      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
+       and declares uintmax_t. ])
+  fi
+])
diff --git a/mk/autoconf/uintmax_t.m4 b/mk/autoconf/uintmax_t.m4
new file mode 100644 (file)
index 0000000..b5f28d4
--- /dev/null
@@ -0,0 +1,32 @@
+# uintmax_t.m4 serial 7 (gettext-0.12)
+dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Paul Eggert.
+
+AC_PREREQ(2.13)
+
+# Define uintmax_t to 'unsigned long' or 'unsigned long long'
+# if it is not already defined in <stdint.h> or <inttypes.h>.
+
+AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
+[
+  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
+  if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
+    AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
+    test $ac_cv_type_unsigned_long_long = yes \
+      && ac_type='unsigned long long' \
+      || ac_type='unsigned long'
+    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
+      [Define to unsigned long or unsigned long long
+       if <stdint.h> and <inttypes.h> don't define.])
+  else
+    AC_DEFINE(HAVE_UINTMAX_T, 1,
+      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
+  fi
+])
diff --git a/mk/autoconf/ulonglong.m4 b/mk/autoconf/ulonglong.m4
new file mode 100644 (file)
index 0000000..c375e47
--- /dev/null
@@ -0,0 +1,23 @@
+# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
+dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Paul Eggert.
+
+AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
+[
+  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
+  [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
+    [unsigned long long ullmax = (unsigned long long) -1;
+     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
+    ac_cv_type_unsigned_long_long=yes,
+    ac_cv_type_unsigned_long_long=no)])
+  if test $ac_cv_type_unsigned_long_long = yes; then
+    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
+      [Define if you have the unsigned long long type.])
+  fi
+])
diff --git a/mk/jam/application.jam b/mk/jam/application.jam
new file mode 100644 (file)
index 0000000..10106ef
--- /dev/null
@@ -0,0 +1,84 @@
+#============================================================================
+# Rules for compiling applications
+#============================================================================
+
+##  Application appname : sources [ : options ]
+##    Build an application out of sourcefiles. All sourcefiles will be passed
+##    to the Objects rule which tries to compile them into object-files. You
+##    can create rules for your own filetypes with the UserObject rule. Header
+##    files will just be ignored. They are only used for MSVC projectfile
+##    generation.
+##    Possible options are "noinstall" if you don't want a default install
+##    target to be created and "console" if you're building a console
+##    application (an application without any graphical output which is
+##    intended to be used on commandline)
+##    Some notes: You should not add the .exe extension to the appname - jam
+##    will do that on win32.
+##    If you have sourcefiles in subdirectories, then you'll need to use the
+##    SearchSubdir rule. Never specify sourcefiles with paths, only specify
+##    the filenames.
+##    Options:
+##     console: Create a console application
+##     noinstall: Don't setup a default installation target.
+##     independent: The target will not be made a dependency of the apps and
+##                  all target.
+rule Application
+{
+  # check options
+  CheckOptions noinstall console independent : $(3) : $(<) ;
+
+  local target = [ ConstructApplicationTarget $(<) : $(3) ] ;
+  local sources = [ DoSourceGrist $(>) ] ;
+  local objects = [ CompileObjects $(sources) ] ;
+
+  $(<)_TYPE = application ;
+  $(<)_OBJECTS = $(objects) ;
+  $(<)_SOURCES = $(sources) ;
+  $(<)_TARGET = $(target) ;
+  $(<)_OPTIONS = $(3) ;
+  $(<)_INSTALLTARGET = ;
+
+  # create target clean rule
+  Always $(<)clean ;
+  NotFile $(<)clean ;
+  Clean $(<)clean : $(objects) ; # create target clean rule 
+  Depends clean : $(<)clean ;
+
+  # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
+  if $(target) != $(<)
+  {
+    Depends $(<) : $(target) ;
+    NotFile $(<) ;
+  }
+
+  # make dependency on apps target
+  if ! [ IsElem independent : $(3) ]
+  {
+    Depends apps : $(<) ;
+  }
+
+  # construct Install target
+  if ! [ IsElem noinstall : $(3) ]
+  {
+    $(<)_INSTALLTARGET = [ DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) ] ;
+    Depends install_bin : $($(<)_INSTALLTARGET) ;
+  }
+
+  # Link
+  MakeLocate $(target) : $(LOCATE_TARGETS) ;
+  SystemLinkApplication $(<) : $(objects) : $(3) ;
+
+  # Import default flags
+  CppFlags $(<) : $(CPPFLAGS) $(APPLICTION_CPPFLAGS) ;
+  CFlags $(<) : $(CFLAGS) $(APPLICATION_CFLAGS) ;
+  C++Flags $(<) : $(C++FLAGS) $(APPLICATION_C++FLAGS) ;
+  LFlags $(<) : $(LFLAGS) $(APPLICATION_LFLAGS) ;
+}
+
+#----------------------------------------------------------------------------
+# private part
+
+# Construct pseudo target apps
+Depends all : apps ;
+NotFile apps ;
+
diff --git a/mk/jam/autoconf.jam b/mk/jam/autoconf.jam
new file mode 100644 (file)
index 0000000..185b263
--- /dev/null
@@ -0,0 +1,15 @@
+# Clean rules for autoconf generated stuff
+
+# construct some clean targets
+Clean distclean : config.log config.status config.cache aclocal.m4
+                  Jamconfig config.h out.txt log.txt stamp-h1 
+                  libtool ;
+CleanDir distclean : autom4te.cache out ;
+Depends distclean : clean ;
+                                                                                
+Clean cvsclean : configure aclocal.m4 config.h.in Jamconfig.in ;
+Depends cvsclean : distclean ;
+                                                                                
+Help clean : "Cleanup objectfiles and targets" ;
+Help distclean : "Cleanup objectfiles and build configuration" ;
+Help cvsclean : "Cleanup all objectfiles, buildconfig and generated files." ;
diff --git a/mk/jam/build.jam b/mk/jam/build.jam
new file mode 100644 (file)
index 0000000..099c30c
--- /dev/null
@@ -0,0 +1,48 @@
+#============================================================================
+# Main rules file - Includes all important rulefiles in correct order
+#============================================================================
+
+# enable if you want debug messages
+JAM_DEBUG ?= 1 ;
+
+jamrulesdir = $(TOP)/mk/jam ;
+
+include $(jamrulesdir)/jamcompatibility.jam ;
+include $(jamrulesdir)/helper.jam ;
+include $(jamrulesdir)/subdir.jam ;
+
+include $(jamrulesdir)/variant.jam ;
+include $(jamrulesdir)/resource.jam ;
+
+include $(jamrulesdir)/help.jam ;
+include $(jamrulesdir)/groups.jam ;
+include $(jamrulesdir)/install.jam ;
+include $(jamrulesdir)/clean.jam ;
+
+include $(jamrulesdir)/objects.jam ;
+include $(jamrulesdir)/compiler.jam ;
+
+include $(jamrulesdir)/autoconf.jam ;
+
+include $(jamrulesdir)/flags.jam ;
+include $(jamrulesdir)/libtool.jam ;
+include $(jamrulesdir)/library.jam ;
+include $(jamrulesdir)/application.jam ;
+
+include $(jamrulesdir)/options.jam ;
+
+# Include OS specific rules
+switch $(target_os)
+{
+case cygwin* :
+  include $(jamrulesdir)/win32.jam ;
+case mingw32* :
+  include $(jamrulesdir)/win32.jam ;
+case apple-darwin :
+  include $(jamrulesdir)/macosx.jam ;
+case linux-gnu :
+  include $(jamrulesdir)/unix.jam ;
+case * :
+  include $(jamrulesdir)/unix.jam ;
+}
+
diff --git a/mk/jam/clean.jam b/mk/jam/clean.jam
new file mode 100644 (file)
index 0000000..59396ae
--- /dev/null
@@ -0,0 +1,21 @@
+#============================================================================
+# Rules for cleaning build detritus.
+#============================================================================
+
+DELTREE ?= "rm -rf" ;
+
+# CleanDir <tag> : <dir> ...
+#   Forcibly delete a set of directories, even if they are not empty.
+#   Tag is one of the standard targets used with the "Clean" rule, such as
+#   "clean" or "distclean".
+rule CleanDir
+{
+  Always $(<) ;
+  NotFile $(<) ;
+  NoCare $(>) ;
+}
+
+actions piecemeal together existing CleanDir
+{
+  $(DELTREE) $(>)
+}
diff --git a/mk/jam/compiler.jam b/mk/jam/compiler.jam
new file mode 100644 (file)
index 0000000..99cad1a
--- /dev/null
@@ -0,0 +1,81 @@
+#============================================================================
+# Rules for C and C++ files
+#============================================================================
+
+# convert autoconf style variablenames to jam style ones
+CCFLAGS += $(CFLAGS) ;
+C++FLAGS += $(CXXFLAGS) ;
+LFLAGS += $(LIBS) ;
+
+if $(CC)
+{
+
+rule CcRule
+{
+    local object ;
+
+    if [ IsElem shared : $(2) ]
+    {
+        object = [ DoObjectGrist $(<:S=.lo) ] ;
+        CC on $(object) = "$(LIBTOOL) --mode=compile $(CC)" ;
+    } else {
+        object = [ DoObjectGrist $(<:S=.o) ] ;
+    }
+
+    Cc $(object) : $(<) ;
+    return $(object) ;
+}
+RegisterFileType CcRule : .c ;
+RegisterHeaderRule HeaderRule : $(HDRPATTERN) : .c ;
+
+rule Cc
+{
+    Depends $(<) : $(>) ;
+}
+
+actions Cc
+{
+    $(CC) -c -o $(<) $(CPPFLAGS) $(CFLAGS) $(>)
+}
+} # end if $(CC)
+
+if $(CXX)
+{
+
+rule C++Rule
+{
+    local object ;
+    
+    if [ IsElem shared : $(2) ] {
+        object = [ DoObjectGrist $(<:S=.lo) ] ;
+        CXX on $(object) = "$(LIBTOOL) --mode=compile $(CXX)" ;
+    } else {
+        object = [ DoObjectGrist $(<:S=.o) ] ;
+    }
+    C++ $(object) : $(<) ;
+    return $(object) ;
+}
+RegisterFileType C++Rule : .cpp .cc .c++ ; # we can't register .C here because
+                                           # of windows being case-insensitive.
+RegisterHeaderRule HeaderRule : $(HDRPATTERN) : .cpp .cc .c++ ;
+
+rule C++
+{
+    Depends $(<) : $(>) ;
+}
+
+actions C++
+{
+    $(CXX) -c -o $(<) $(CPPFLAGS) $(C++FLAGS) $(>)
+}
+} # end if $(CXX)
+
+rule CreateIncludeFlags
+{
+    return -I$(<) ;
+}
+
+rule CreateDefineFlags
+{
+    return -D$(<) ;
+}
diff --git a/mk/jam/flags.jam b/mk/jam/flags.jam
new file mode 100644 (file)
index 0000000..1b8ea61
--- /dev/null
@@ -0,0 +1,159 @@
+#============================================================================
+# Rules for specifying compiler and linker flags
+#============================================================================
+
+##  LinkWith target : libs [ : options ]
+##    Link a target with libraries. The specified libraries should have
+##    build rules in the same project. For external libraries use the
+##    ExternalLibs rule. Specify the library names without any extensions or
+##    the leading "lib".
+rule LinkWith
+{
+    local i libs sharedlib ;
+
+    for i in $(>) {
+        if $($(i)_TYPE) = "library" {
+            if [ IsElem shared : $($(i)_OPTIONS) ] {
+                libs += $(i) ;
+                sharedlib = true ;
+            } else {
+                # for non shared libs add inherit the compile flags and libs
+                libs += $(i) $($(i)_LIBRARIES) ;
+                # inherit the exported flags
+                CppFlags $(<) : $($(i)_CPPFLAGS) : $(3) ;
+                CFlags $(<) : $($(i)_CFLAGS) : $(3) ;
+                C++Flags $(<) : $($(i)_C++FLAGS) : $(3) ;
+                LFlags $(<) : $($(i)_LFLAGS) : $(3) ;
+            }
+        } else {
+            echo "WARNING: Trying to link" $(i)
+                "with" $(<) "which is not a library." ;
+        }
+    }
+    # resolve library dependencies
+    libs = [ RemoveDups $(libs) ] ;    
+    $(<)_LIBRARIES = $(libs) ;
+
+    local libfiles ;
+    for i in $(libs) {
+        libfiles += $($(i)_TARGET) ;
+    }
+
+    DEPENDS $($(<)_TARGET) : $(libfiles) ;
+    NEEDLIBS on $($(<)_TARGET) += $(libfiles) ;
+    # the usual libtool hack...
+    if $(sharedlib) {
+        LINK on $($(<)_TARGET) = "$(LIBTOOL) $(LINK)" ;
+        INSTALL on $($(<)_INSTALLTARGET) = "$(LIBTOOL) --mode=install $(INSTALL)" ;
+    }
+}
+
+rule CppFlags
+{
+    CPPFLAGS on $($(<)_OBJECTS) += $(>) ;
+
+    if [ IsElem export : $(3) ] {
+       $(<)_CPPFLAGS = $(>) ;
+    }
+}
+
+##  CFlags target : flags [ : options ]
+##    Sets cflags on all sourcefiles of a target
+##    This rule affects c++ and c compiler flags. Options:
+##      export - export the cflags to dependent targets (for example in
+##              a library context this will inherit the cflags to the apps using
+##              the library)
+rule CFlags
+{
+    CFLAGS on $($(<)_OBJECTS) += $(>) ;
+
+    if [ IsElem export : $(3) ] {
+        $(<)_CFLAGS = $(>) ;
+    }
+}
+
+rule C++Flags
+{
+    C++FLAGS on $($(<)_OBJECTS) += $(>) ;
+
+    if [ IsElem export : $(3) ] {
+       $(<)_C++FLAGS = $(>) ;
+    }
+}
+
+##  LFlags target : flags [ : options ]
+##    Sets linker flags for a library, plugin or application target
+rule LFlags
+{
+    LFLAGS on $($(<)_TARGET) += $(>) ;
+
+    if [ IsElem export : $(3) ] {
+        $(<)_LFLAGS = $(>) ;
+    }
+}
+
+##  ExternalLibs appname : linkerflags [ : options ]
+##    Link an application/library/plugin with external libraries. It is
+##    possible to give a set of flags which will be passed to the linker when
+##    building the application (typically -L and -l flags).
+rule ExternalLibs
+{
+    local i ;
+  
+    for i in $(>)
+    {
+        CppFlags $(<) : $($(i)_CFLAGS) : $(3) ;
+        LFlags $(<) : $($(i)_LIBS) : $(3) ;
+    }
+}
+
+##  ExtraObjects target : objectfiles
+##    Link additional object files with a target
+rule ExtraObjects
+{
+    EXTRAOBJECTS on $($(<)_TARGET) += $(>) ;
+    Depends $($(<)_TARGET) : $(>) ;
+    Clean $(<)clean : $(>) ;
+    Clean clean : $(>) ;
+}
+
+##  IncludeDir [target : ] directories
+##    Description: Is used to specify the location of header files for a
+##    target or the whole project if no target is given.
+##    This rule will automatically generate the -I compiler flags and makes
+##    sure the dependency scanner is able to locate your header files. The
+##    directories are relative to the current subdir specified with the SubDir
+##    rule.
+##    Implementation: The directories are simply added to the HDRS variable
+##    which is respected by all jam rules.
+rule IncludeDir
+{
+    local dir i ;
+    
+    if $(>) {
+        for i in $(>) {
+            dir = [ ConcatDirs $(SUBDIR) $(i) ] ;
+            CppFlags $(<) : [ CreateIncludeFlags $(dir) ] ;
+
+            # needed for header scanning
+            HDRS on $($(<)_SOURCES) += $(dir) ;
+        }
+    } else {
+        for i in $(<) {
+            dir = [ ConcatDirs $(SUBDIR) $(i) ] ;
+            CPPFLAGS += [ CreateIncludeFlags $(dir) ] ;
+            # needed for header scanning
+            HDRS += $(dir) ;
+        }
+    }
+}
+
+rule DefineConst
+{
+    if $(>) {
+        CppFlags $(<) : [ CreateDefineFlags $(>) ] ;
+    } else {
+        CPPFLAGS += [ CreateDefineFlags $(<) ] ;
+    }
+}
+
diff --git a/mk/jam/groups.jam b/mk/jam/groups.jam
new file mode 100644 (file)
index 0000000..4f73420
--- /dev/null
@@ -0,0 +1,27 @@
+#============================================================================
+# Rules for building compile groups
+#============================================================================
+
+##  CompileGroups target : groups
+##    Adds a target to a list of compile groups. A compile group is a virtual
+##    target which combines several targets. This is usefull for things like a
+##    creating a target which compiles all image loaders, all renderers, ...
+rule CompileGroups
+{
+  local _i ;
+
+  for _i in $(>)
+  {
+    Depends $(_i) : $(<) ;
+    Depends $(_i)clean : $(<)clean ;
+  }
+}
+
+##  RegisterCompileGroups
+##    Registers compilegroups. You must specify all compile groups here before
+##    can use them.
+rule RegisterCompileGroups
+{
+# nothing here (but msvcgen will override this)
+}
+
diff --git a/mk/jam/help.jam b/mk/jam/help.jam
new file mode 100644 (file)
index 0000000..7e8b17b
--- /dev/null
@@ -0,0 +1,28 @@
+#============================================================================
+# Rules for displaying help messages about targets
+#============================================================================
+
+##  Help target : description
+##    Adds a description to a target which will be shown to the user when
+##    "jam help" is invoked.
+rule Help
+{
+  $(<)_help = $(>) ;
+  local target = $(<:G=help) ;
+  Depends help : $(target) ;
+  NotFile $(>) ;
+  PrintHelp $(target) : $(>) ;
+  Always $(target) ;
+}
+
+#----------------------------------------------------------------------------
+                                                                                
+NotFile help ;
+Always help ;
+
+actions quietly PrintHelp
+{
+  # target width:13, description width:51
+  echo "jam ->$(<)              <- =>$(>)                                                   <=" | \
+    sed 's/->\(..............\).*<-/\1/;s/=>\(...................................................\).*<=/\1/'
+}
diff --git a/mk/jam/helper.jam b/mk/jam/helper.jam
new file mode 100644 (file)
index 0000000..965f616
--- /dev/null
@@ -0,0 +1,177 @@
+#============================================================================
+# Helper rules
+#============================================================================
+
+CP ?= "cp" ;
+MV ?= "mv" ;
+
+##  Wildcard [ dir : ] patterns
+##    Create a list of files in a directory which match the pattern. You can
+##    optionally specify a subdirectory. The files will be returned with
+##    stripped pathnames. The difference from GLOB is that this rule respects
+##    subdirectories which may have been entered with the SubDir rule.
+rule Wildcard
+{
+  local files dir sdir wildcards ;
+  
+  # Is a directory given?
+  if $(>) {
+    dir = $(<)/ ;
+    sdir = $(<) ;
+    wildcards = $(>) ;
+  } else {
+    dir = "" ;
+    sdir = "" ;
+    wildcards = $(<) ;
+  }
+
+  files = [ GLOB [ ConcatDirs $(SUBDIR) $(dir) ] : $(wildcards) ] ;
+
+  return $(files:BSR=$(sdir)) ;
+}
+
+##  Prefix list : prefix
+##    Adds a prefix to a all elements in list.
+rule Prefix
+{
+  return $(>)$(<) ;
+}
+
+if $(JAMVERSION) >= 2.5
+{
+
+##  IsElem element : list
+##    Returns "true" if the elemnt is in the list. Otherwise nothing is
+##    returned.
+rule IsElem
+{
+  local i ;
+
+  for i in $(>)
+  {
+    if $(i) = $(<)
+    {
+      return "true" ;
+    }
+  }
+
+  return ;
+}
+
+}
+else
+{
+
+# jam<2.4's return statement doesn't exit the function
+rule IsElem
+{
+  local i result ;
+
+  for i in $(>)
+  {
+    if $(i) = $(<)
+    {
+      result = "true" ;
+      $(>) = ;
+    }
+  }
+
+  return $(result) ;
+}
+
+}
+
+##  Filter list : filter
+##    Returns the list without the words contained in filter.
+rule Filter
+{
+  local i result ;
+
+  for i in $(<)
+  {
+    if ! [ IsElem $(i) : $(>) ]
+    {
+      result += $(i) ;
+    }
+  }
+
+  return $(result) ;
+}
+
+##  RemoveDups list
+##    Removes duplicates in the list (this function tries to preserve the list
+##    order)
+rule RemoveDups
+{
+  local i result ;
+
+  for i in $(<)
+  {
+    if ! [ IsElem $(i) : $(result) ]
+    {
+      result += $(i) ;
+    }  
+  }
+
+  return $(result) ;
+} 
+
+rule Reverse
+{
+  local result ;
+  
+  for i in $(<)
+  {
+    result = $(i) $(result) ;
+  }
+  return $(result) ;
+}
+
+##  GetVar argument
+##    Simply returns the value of the variable with name argument.
+##    This is useful to query on target variables:
+##       bla = [ on TARGET GetVar CFlags ] ;
+rule GetVar
+{
+  return $($(<)) ;
+}
+
+##  ConcatDirs dirs
+##    Concatenates a set of directories. This is a substitute for FDirName in
+##    Jambase. It works also correctly for several rooted paths, where FDirName
+##    fails.
+##    The advantage over $(dir1)/$(dir2) is that this also works correctly if
+##    $(dir1) or $(dir2) is not set.
+rule ConcatDirs
+{
+  local i ;
+  local result = $(<[1]) ;
+  if ! $(result) { $result = "" ; }
+  local dir1 dir2 ;
+
+  for i in $(<[2-])
+  {
+    # eleminate multiple slashes because jam is somewhat buggy here
+    dir1 = [ MATCH (.*[^/]?) : $(result) ] ;
+    dir2 = [ MATCH ([^/].*) : $(i) ] ;
+    if ! $(dir1) { dir1 = "" ; }
+    if $(dir1) != "" { dir1 = $(dir1)/ ; }
+    if ! $(dir2) { dir2 = "" ; }
+    result = $(dir1)$(dir2) ;
+  }
+
+  return $(result) ;
+}
+
+##  Copy target : source
+##    Copy source file to target.
+actions Copy
+{
+  $(CP) $(>) $(<)
+}
+
+actions ignore Move
+{
+  $(MV) $(>) $(<)
+}
+
diff --git a/mk/jam/install.jam b/mk/jam/install.jam
new file mode 100644 (file)
index 0000000..9d3553f
--- /dev/null
@@ -0,0 +1,137 @@
+#============================================================================
+# Rules for installation
+#============================================================================
+
+COPYDIRS ?= "cp -R" ;
+
+INSTALL ?= "install" ;
+INSTALL_PROGRAM ?= $(INSTALL) ;
+INSTALL_SCRIPT ?= $(INSTALL) ;
+INSTALL_DATA ?= "$(INSTALL) -m644" ;
+
+# set some paths
+appdatadir ?= [ ConcatDirs $(datadir) $(PACKAGE_NAME) ] ;
+appdocdir ?= [ ConcatDirs $(datadir) doc $(PACKAGE_NAME)-$(PACKAGE_VERSION) ] ;
+appconfdir ?= [ ConcatDirs $(sysconfdir) $(PACKAGE_NAME) ] ;
+plugindir ?= [ ConcatDirs $(libdir) $(PACKAGE_NAME) ] ;
+
+##  InstallHeader headername [ : subdir ]
+##    DoInstall a headerfile into the includedir directory. A subdirectory
+##    relative to the includedir can be specified.
+rule InstallHeader
+{
+    SEARCH on $(<:G=installheader) = $(SUBDIR) ;
+    Depends install_include : [ DoInstall $(<:G=installheader) : $(includedir) $(2) ] ;
+}
+
+##  InstallShellScript scriptname [ : subdir ]
+##    Installs a shell script into the bindir directory. A subdirectory
+##    relative to the bindir can be specified.
+rule InstallShellScript
+{
+    SEARCH on $(<:G=installscript) = $(SUBDIR) ;
+    Depends install_shellscript 
+        : [ DoInstall $(<:G=installscript) : $(bindir) $(2) : $(INSTALL_SCRIPT) ]
+    ;
+}
+
+##  InstallData files [ : subdir ]
+##    Installs data files
+rule InstallData
+{
+    SEARCH on $(<:G=installdata) = $(SUBDIR) ;
+    Depends install_data : [ DoInstall $(<:G=installdata) : $(appdatadir) $(2) ] ;
+}
+
+##  InstallConfig files [ : subdir ]
+##    Installs configuration files
+rule InstallConfig
+{
+    SEARCH on $(<:G=installconfig) = $(SUBDIR) ;
+    Depends install_config : [ DoInstall $(<:G=installconfig) : $(appconfdir) $(2) ] ;
+}
+
+##  InstallDoc files [ : subdir ]
+##    Installs documentation files
+rule InstallDoc
+{
+    SEARCH on $(<:G=installdoc) = $(SUBDIR) ;
+    Depends install_doc : [ DoInstall $(<:G=installdoc) : $(appdocdir) $(2) ] ;
+}
+
+##  InstallMan files
+##    DoInstall man files
+rule InstallMan
+{
+    local dir i ;
+    
+    SEARCH on $(<:G=installman) = $(SUBDIR) ;
+    for i in $(<:G=installman) {
+        dir = $(mandir) ;
+        switch $(i:S) {
+            case .1 : dir += man1 ;
+            case .2 : dir += man2 ;
+            case .3 : dir += man3 ;
+            case .4 : dir += man4 ;
+            case .5 : dir += man5 ;
+            case .6 : dir += man6 ;
+            case .7 : dir += man7 ;
+            case .8 : dir += man8 ;
+            case .9 : dir += man9 ;
+            case * :
+                echo "WARNING: manfile has no *.[0-9] ending." ;
+        }
+        Depends install_man : [ DoInstall $(i) : $(dir) ] ;
+    }
+}
+
+##  DoInstall sourcename : directories [ : installapp ]
+##    Creates a new installtarget for the given sources. The target(s) are
+##    returned as function result.
+rule DoInstall
+{
+    local targets target i dir gdir ;
+    dir = [ ConcatDirs $(DESTDIR) $(2) ] ;
+
+    gdir = $(dir:G=dir) ;
+    MkDir $(gdir) ;
+  
+    for i in $(1) {
+        target = $(i:BSR=$(dir):G=install) ;
+        targets += $(target) ;
+        Depends $(target) : $(gdir) $(i) ;
+        Install1 $(target) : $(i) ;
+
+        if $(3) {
+            INSTALL on $(target) = $(3) ;
+        } else {
+            INSTALL on $(target) = $(INSTALL_DATA) ;
+        }
+    }
+
+    Always $(targets) ;
+    return $(targets) ;
+}
+
+#----------------------------------------------------------------------------
+
+INSTALLTARGETS = install_bin install_plugin install_lib install_header
+                install_shellscript install_data install_config
+                 install_doc ;
+
+Always install $(INSTALLTARGETS) ;
+NotFile install $(INSTALLTARGETS) ;
+Depends install : $(INSTALLTARGETS) ;
+
+Help install : "Install $(PACKAGE_NAME)" ;
+
+actions Install1
+{
+  $(INSTALL) "$(>)" "$(<:D)" $(INSTALLFLAGS) ;
+}
+
+actions CopyDirs
+{
+  $(COPYDIRS) "$(>)" "$(<)"
+}
+
diff --git a/mk/jam/jamcompatibility.jam b/mk/jam/jamcompatibility.jam
new file mode 100644 (file)
index 0000000..9cd0ce1
--- /dev/null
@@ -0,0 +1,336 @@
+#============================================================================
+# Several hacks to make the build compatible with certain old/broken jam
+# versions
+#============================================================================
+
+# boostjam is evil: It is compatible to jam 2.4 but has a version number 3.1, we# try to detect boostjam with the ARGV extension
+if $(ARGV[0])
+{
+# boostjam hacks
+  JAMVERSION = 2.4 ;
+  rule FIncludes
+  {
+    return -I$(<) ;
+  }
+  rule FDefines
+  {
+    return -D$(<) ;
+  }
+}
+
+if $(JAMVERSION) < 2.4
+{
+    EXIT "Error: This buildsystem requires jam version 2.4 or later." ;
+}
+# don't confuse users for now...
+#if $(JAMVERSION) = 2.4 & $(JAM_DEBUG)
+#{
+#    echo "Warning: It is recommended to use jam2.5rc3 or later." ;
+#}
+
+# All scripts invoked by the build system expect a Bourne or compatible shell.
+# Reject C-shell and its variants (such as tcsh).  Unfortunately, this is a bit
+# of an ugly hack.  It would be nicer to perform this logic at the very end of
+# this file as a last-minute assertion.  Unfortunately, however, it seems that
+# references to $(SHELL) in any of the included files get bound at the point
+# of reference, thus we need to perform this filtering as early as possible.
+if [ Match (csh) : $(SHELL) ]
+{
+  SHELL = "/bin/sh" ;
+}
+
+# jam 2.4s SubDir rule had some problems and misses the usefull SUBDIRRULES
+# extension. So we override it here with a better version (from jam 2.5rc3)
+if $(JAMVERSION) = 2.4
+{
+
+rule SubDir
+{
+       #
+       # SubDir TOP d1 d2 ... ;
+       #
+       # Support for a project tree spanning multiple directories.
+       #
+       # SubDir declares a Jamfile's location in a project tree, setting
+       # Jambase variables (SEARCH_SOURCE, LOCATE_TARGET) so that source
+       # files can be found.
+       #
+       # TOP is a user-select variable name for root of the tree, and
+       # d1 d2 ...  are the directory elements that lead from the root
+       # of the tree to the directory of the Jamfile.
+       #
+       # TOP can be set externally, but normally the first SubDir call
+       # computes TOP as the path up from the current directory; the
+       # path contains one ../ for each of d1 d2 ...
+       #
+       # SubDir reads once the project-specific rules file Jamrules 
+       # in the TOP directory, if present.  This can be overridden
+       # with the variable TOPRULES.
+       #
+       # SubDir supports multiple, overlaid project trees:  SubDir
+       # invocations with different TOPs can appear in the same Jamfile.
+       # The location established by the first SubDir call is used set
+       # the TOPs for the subsequent SubDir calls.
+       #
+       # SubDir's public variables:
+       #
+       #       $(TOP) = path from CWD to root.
+       #       $(SUBDIR) = path from CWD to the directory SubDir names.
+       #       $(SUBDIR_TOKENS) = path from $(TOP) to $(SUBDIR) as dir names
+       #       $(SEARCH_SOURCE) = $(SUBDIR)
+       #       $(LOCATE_SOURCE) = $(ALL_LOCATE_TARGET) $(SUBDIR)
+       #       $(LOCATE_TARGET) = $(ALL_LOCATE_TARGET) $(SUBDIR)
+       #       $(SOURCE_GRIST) = $(SUBDIR_TOKENS) with !'s 
+       #
+
+       local _top = $(<[1]) ;
+       local _tokens = $(<[2-]) ;
+
+       #
+       # First time through sets up relative root and includes Jamrules.
+       #
+
+       if ! $(_top)
+       {
+           Exit SubDir syntax error ;
+       }
+
+       if ! $($(_top)-SET)
+       {
+           $(_top)-SET = true ;
+
+           # First time we've seen this TOP.
+           # We'll initialize a number of internal variables:
+           #
+           #   $(TOP-UP) = directories from ROOT to a common point
+           #   $(TOP-DOWN) = directories from common point to TOP
+           #   $(TOP-ROOT) = root directory for UP/DOWN -- normally CWD
+           #   $(SUBDIR_UP) = current value of $(TOP-UP)
+           #   $(SUBDIR_DOWN) = current value of $(TOP-DOWN)
+           #   $(SUBDIR_ROOT) = current value of $(TOP-ROOT)
+           #
+
+           if $($(_top))
+           {
+               # TOP externally set.
+               # We'll ignore the relative (UP/DOWN) path that
+               # got us here, and instead remember the hard ROOT.
+
+               $(_top)-UP = ;
+               $(_top)-DOWN = ;
+               $(_top)-ROOT = $($(_top)) ;
+           }
+           else
+           {
+               # TOP not preset.
+
+               # Establishing a new TOP.  In the simplest case,
+               # (SUBDIR_UP/SUBDIR_DOWN/SUBDIR_ROOT unset), it's
+               # merely a certain number of directories down from
+               # the current directory, and FSubDirPath will set
+               # TOP to a path consisting of ../ for each of the
+               # elements of _tokens, because that represents how 
+               # far below TOP the current directory sits.
+               #
+               # In the more complicated case, the starting directory
+               # isn't the directory of jam's invocation but an 
+               # location established by previous SubDir call.  The
+               # starting directory is SUBDIR_UP directories up from
+               # SUBDIR_ROOT, and then SUBDIR_DOWN directories down
+               # from that.   If SUBDIR_ROOT is not set, that means
+               # SUBDIR_DOWN and SUBDIR_UP represent the path from
+               # the directory of jam's invocation.
+               #
+               # In the most complicated case, the _tokens also 
+               # represents directories down, because TOP is being
+               # estalished in a directory other than TOP's root.
+               # Hopefully, _tokens and SUBDIR_DOWN represent the
+               # same final directory, relative to the new TOP and
+               # the previous SubDIr's TOP.  To find the new TOP,
+               # we have to chop off any common directories from
+               # then ends of _tokens and SUBDIR_DOWN.  To do so,
+               # we reverse each of them, call FStripCommon to
+               # remove the initial common elements, and then
+               # reverse them again.  After this process, if
+               # both _tokens and SUBDIR_DOWN have elements, it
+               # means the directory names estalished by the two
+               # SubDir calls don't match, and a warning is issued.
+               # All hell will likely break loose at this point,
+               # since the whole SubDir scheme relies on the SubDir
+               # calls accurately naming the current directory.
+
+               # Strip common trailing elements of _tokens and SUBDIR_DOWN.
+
+               _tokens = [ FReverse $(_tokens) ] ;
+               SUBDIR_DOWN = [ FReverse $(SUBDIR_DOWN) ] ;
+               FStripCommon _tokens : SUBDIR_DOWN ;
+               SUBDIR_DOWN = [ FReverse $(SUBDIR_DOWN) ] ;
+               _tokens = [ FReverse $(_tokens) ] ;
+
+               if $(SUBDIR_DOWN) && $(_tokens) 
+               { 
+                   Echo Warning: SubDir $(<) misplaced! ; 
+               }
+
+               # We'll remember the relative (UP/DOWN) path that
+               # got us here, plus any hard ROOT starting point
+               # for the UP/DOWN.  If TOP is never set externally,
+               # ROOT will always be "" (directory of jam's invocation).
+
+               $(_top)-UP = $(SUBDIR_UP) $(_tokens) ;
+               $(_top)-DOWN = $(SUBDIR_DOWN) ;
+               $(_top)-ROOT = $(SUBDIR_ROOT:E="") ;
+               $(_top) = [ FSubDirPath $(_top) ] ;
+           }
+
+           # Set subdir vars for the inclusion of the Jamrules,
+           # just in case they have SubDir rules of their own.
+           # Note that SUBDIR_DOWN is empty: it's all the way
+           # up where the Jamrules live.  These gets overrided
+           # just after the inclusion.
+
+           SUBDIR_UP = $($(_top)-UP) ;
+           SUBDIR_DOWN = ;
+           SUBDIR_ROOT = $($(_top)-ROOT) ;
+
+           # Include $(TOPRULES) or $(TOP)/Jamrules.
+           # Include $(TOPRULES) if set.
+           # Otherwise include $(TOP)/Jamrules if present.
+
+           if $($(_top)RULES) { 
+               include $($(_top)RULES) ;
+           } else { 
+               NoCare $(JAMRULES:R=$($(_top)):G=$(_top)) ;
+               include $(JAMRULES:R=$($(_top)):G=$(_top)) ;
+           }
+       }
+
+       # Get path from $(TOP) to named directory.
+       # Save dir tokens for other potential uses.
+
+       SUBDIR_UP = $($(_top)-UP) ;
+        SUBDIR_DOWN = $($(_top)-DOWN) $(_tokens) ;
+       SUBDIR_ROOT = $($(_top)-ROOT) ;
+        SUBDIR_TOKENS = $(SUBDIR_DOWN) ;
+
+       SUBDIR = [ FSubDirPath $(<) ] ;
+
+       # Now set up SEARCH_SOURCE, LOCATE_TARGET, SOURCE_GRIST
+       # These can be reset if needed.  For example, if the source
+       # directory should not hold object files, LOCATE_TARGET can
+       # subsequently be redefined.
+
+#echo SS: $(SUBDIR) ;
+       SEARCH_SOURCE = $(SUBDIR) ;
+       LOCATE_SOURCE = $(ALL_LOCATE_TARGET) $(SUBDIR) ;
+       LOCATE_TARGET = $(ALL_LOCATE_TARGET) $(SUBDIR) ;
+       SOURCE_GRIST = [ FGrist $(SUBDIR_TOKENS) ] ;
+
+       # Reset per-directory ccflags, hdrs, etc,
+       # listed in SUBDIRRESET.
+       # Note use of variable expanded assignment var
+
+       SUBDIR$(SUBDIRRESET) = ;
+
+       # Invoke user-specific SubDir extensions,
+       # rule names listed in SUBDIRRULES.
+       # Note use of variable expanded rule invocation
+
+       $(SUBDIRRULES) $(<) ;
+}
+
+rule FSubDirPath
+{
+       # FSubDirPath TOP d1 ... ;
+
+       # Returns path to named directory.
+
+       # If jam is invoked in a subdirectory of the TOP, then we
+       # need to prepend a ../ for every level we must climb up
+       # (TOP-UP), and then append the directory names we must 
+       # climb down (TOP-DOWN), plus the named directories d1 ...
+       # If TOP was set externally, or computed from another TOP 
+       # that was, we'll have to reroot the whole thing at TOP-ROOT.
+
+       local _r = [ FRelPath $($(<[1])-UP) : $($(<[1])-DOWN) $(<[2-]) ] ;
+
+       return $(_r:R=$($(<[1])-ROOT)) ;
+}
+
+rule SubInclude
+{
+       # SubInclude TOP d1 ... ;
+       #
+       # Include a subdirectory's Jamfile.
+
+       # We use SubDir to get there, in case the included Jamfile
+       # either doesn't have its own SubDir (naughty) or is a subtree
+       # with its own TOP.
+
+       if ! $($(<[1]))
+       {
+           Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
+       }
+
+       SubDir $(<) ;
+
+       include $(JAMFILE:D=$(SUBDIR)) ;
+}
+
+rule SubRules
+{
+       # SubRules TOP d1 ... : Other-TOP ;
+       #
+       # Read another tree's Jamrules, by giving it's path according
+       # to this tree and it's own name.
+
+       if ! $($(<[1]))
+       {
+           Exit SubRules $(<[1]) without prior SubDir $(<[1]) ;
+       }
+
+       SubDir $(<) ;
+       SubDir $(>) ;
+}
+
+## Now we try to fix up the already messed settings
+## XXX We can only hope that jam2.4 users don't try starting jam from
+## subdirectories
+TOP-SET = true ;
+TOP-UP = ;
+TOP-DOWN = ;
+TOP-ROOT = $(TOP) ;
+SUBDIR_UP = $(TOP-UP) ;
+SUBDIR_DOWN = ;
+SUBDIR_ROOT = $(TOP-ROOT) ;
+
+#SubDir TOP ;
+
+} # end if $(JAMVERSION) = 2.4
+
+# MakeLocate rule from jam 2.4 isn't optimal. Use improved version from jam
+# 2.5
+if $(JAMVERSION) = 2.4
+{
+
+rule MakeLocate
+{
+       # MakeLocate targets : directory ;
+
+       # Sets special variable LOCATE on targets, and arranges    
+       # with MkDir to create target directory.
+
+       # Note we grist the directory name with 'dir',
+       # so that directory path components and other
+       # targets don't conflict.
+
+       if $(>)
+       {
+           LOCATE on $(<) = $(>) ;
+           Depends $(<) : $(>[1]:G=dir) ;
+           MkDir $(>[1]:G=dir) ;
+       }
+}
+
+}
+
diff --git a/mk/jam/library.jam b/mk/jam/library.jam
new file mode 100644 (file)
index 0000000..3a7bc0f
--- /dev/null
@@ -0,0 +1,164 @@
+#============================================================================
+# Rules for library creation
+#============================================================================
+
+##  Library libname : sources [ : options ]
+##    Build a library out of sourcefiles. All sourcefiles will be passed
+##    to the Objects rule which tries to compile them into object-files. You
+##    can create rules for your own filetypes with the UserObject rule. Header
+##    files will just be ignored. They are only used for MSVC projectfile
+##    generation.  If additional objects are given (fourth argument), they
+##    should be the output of CompileObjects, and will be included in the
+##    library.
+##    Available options are 'shared' if you want to build a shared library on
+##    platforms which support that. You can specify the 'noinstall' option if
+##    you don't want an install target is generated.
+##    Don't specify any extensions for the library name, also leave out the
+##    leading "lib".
+rule Library
+{
+    # check options
+    CheckOptions noinstall independent shared : $(3) : $(<) ;
+
+    local no_scan_archive = $(NOARSCAN) ;
+    local target = [ ConstructLibraryTarget $(<) : $(3) ] ;
+    local sources = [ DoSourceGrist $(>) ] ;
+    local objects = [ CompileObjects $(sources) : $(3) ] ;
+    local install_targets ;
+
+    $(<)_TYPE = library ;
+    $(<)_OBJECTS = $(objects) ;
+    $(<)_SOURCES = $(sources) ;
+    $(<)_TARGET = $(target) ;
+    $(<)_OPTIONS = $(3) ;
+
+    # create target clean rule
+    Always $(<)clean ;
+    NotFile $(<)clean ;
+    Clean $(<)clean : $(objects) ; # create target clean rule 
+
+    # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
+    if $(target) != $(<)
+    {
+        Depends $(<) : $(target) ;
+        NotFile $(<) ;                                                              }
+
+    # library depends on its member objects
+    if ! [ IsElem independent : $(3) ]
+    {
+        if $(KEEPOBJS)
+        {
+            Depends obj : $(objects) ;
+        }
+        else
+        {
+            Depends libs : $(<) ;
+        }
+    }
+
+    # Generate install rules
+    if ! [ IsElem noinstall : $(3) ]
+    {
+        install_targets = [ DoInstall $(target) : $(libdir) ] ;
+        Depends install_lib : $(install_targets) ;
+    }
+
+    if [ IsElem shared : $(3) ]
+    {
+        if ! $(LIBTOOL) {
+            exit "LIBTOOL not defined, can't create dynamic library." ;
+        }
+        no_scan_archive = 1 ;
+        DoLibToolClean ;
+
+        if $(install_targets) {
+            INSTALL on $(install_targets) = "$(LIBTOOL) --mode=install $(INSTALL)" ;
+            InvokeLibtoolFinish $(install_targets) ;
+        }
+    }
+
+    # Set LOCATE for the library and its contents.  The bound
+    # value shows up as $(NEEDLIBS) on the Link actions.
+    # For compatibility, we only do this if the library doesn't
+    # already have a path.
+    if ! $(target:D)
+    {
+        MakeLocate $(target) $(target)($(objects:BS)) : $(LOCATE_TARGET) ;
+    }
+
+    if ! $(no_scan_archive)
+    {
+        # If we can scan the library, we make the library depend
+        # on its members and each member depend on the on-disk
+        # object file.
+        Depends $(target) : $(target)($(objects:BS)) ;
+
+        local i ;
+        for i in $(objects)
+        {
+            Depends $(target)($(i:BS)) : $(i) ;
+        }
+    } else {
+        Depends $(target) : $(objects) ;
+    }
+
+    if $(CRELIB) { CreLib $(target) : $(objects[1]) ; }
+
+    SystemLinkLibrary $(<) : $(objects) : $(3) ;
+
+    # If we can't scan the library, we have to leave the .o's around.
+    if ! ( $(no_scan_archive) || $(NOARUPDATE) )
+    {
+        RmTemps $(target) : $(objects) ;
+    }
+
+    # Import default flags
+    CppFlags $(<) : $(CPPFLAGS) $(LIBRARY_CPPFLAGS) ;
+    CFlags $(<) : $(CFLAGS) $(LIBRARY_CFLAGS) ;
+    C++Flags $(<) : $(C++FLAGS) $(LIBRARY_C++FLAGS) ;
+    LFlags $(<) : $(LFLAGS) $(LIBRARY_LFLAGS) ;
+}
+
+##  LibraryVersion
+##    Specify the version of a library. The version should have the form
+##    major:minor:patchlevel
+rule LibraryVersion
+{
+    LFLAGS on $($(<)_TARGET) = -version-info $(>) ;
+}
+
+#----------------------------------------------------------------------------
+# private part
+
+# default implementation of SystemLinkLibrary
+rule SystemLinkLibrary
+{
+    local target = $($(<)_TARGET) ;
+   
+    if [ IsElem shared : $(3) ] {
+        LINK on $(target) = "$(LIBTOOL) --mode=link $(LINK) -rpath $(libdir)" ;
+        LinkLibrary $(target) : $(>) ;
+    } else {
+        Archive $(target) : $(>) ;
+        if $(RANLIB) { Ranlib $(target) ; }
+    }
+                                                                                
+    Clean clean : $(target) ;
+    Clean $(<)clean : $(target) ;
+}
+
+actions together Ranlib
+{
+    $(RANLIB) $(<)
+}
+
+actions LinkLibrary bind NEEDLIBS bind EXTRAOBJECTS
+{
+    $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LFLAGS)
+}
+
+# Construct pseudo target libs which is used instead of the pseudo target lib
+# in Jambase
+Depends lib : libs ;
+NotFile libs ;
+
diff --git a/mk/jam/libtool.jam b/mk/jam/libtool.jam
new file mode 100644 (file)
index 0000000..27e6231
--- /dev/null
@@ -0,0 +1,38 @@
+rule InvokeLibtoolFinish
+{
+    # eventually invoke libtool --mode=finish after installation
+    if ! $(INVOKE_LIBTOOL_FINISH) && ! $(DESTDIR) {
+        INVOKE_LIBTOOL_FINISH = true ; 
+        NotFile libtool_finish ;
+        Always libtool_finish ;
+        LibToolFinish libtool_finish ;
+        Depends install_lib : libtool_finish ;
+    }
+    Depends libtool_finish : $(<) ;
+}
+
+rule DoLibToolClean
+{
+    local target = libtoolclean ;
+    Always $(target) ;
+    NotFile $(target) ;
+
+    Depends clean : $(target) ;
+    LibToolClean $(target) ;
+}
+
+actions LibToolFinish bind INSTALLLIBS
+{
+    $(LIBTOOL) --mode=finish $(libdir)
+}
+
+actions LibToolClean
+{
+    $(LIBTOOL) --mode=clean $(RM)
+}
+
+if ! $(LIBTOOL_VERBOSE)
+{
+    LIBTOOL = "$(LIBTOOL) --quiet" ;
+}
+
diff --git a/mk/jam/macosx.jam b/mk/jam/macosx.jam
new file mode 100644 (file)
index 0000000..21c433d
--- /dev/null
@@ -0,0 +1,53 @@
+#============================================================================
+# Jam configuration and actions for MacOS/X
+# Copyright (C) 2003 by Eric Sunshine <sunshine@sunshineco.com>
+#============================================================================
+SHELL ?= "/bin/sh" ;
+DEEPCOPY ?= "cp -R" ;
+
+# Experience seems to indicate that library scanning misbehaves on MacOS/X with
+# Jam 2.4, consequently we disable it.
+AR = "ar ru" ;
+NOARUPDATE = true ;
+NOARSCAN = true ;
+actions Archive
+{
+  $(AR) $(<) $(>)
+}
+
+#------------------------------------------------------------------------------
+# Public rules.
+#------------------------------------------------------------------------------
+
+# ConstructApplicationTarget target : options
+#    Constructs the application target name (ie. foo.app for foo)
+rule ConstructApplicationTarget
+{
+  return $(<) ;
+}
+
+# ConstructLibraryTarget target : options
+rule ConstructLibraryTarget
+{
+  return lib$(<).a ;
+}
+
+# SystemLinkApplication target : objects : options
+rule SystemLinkApplication
+{
+  local target = $($(<)_TARGET) ;
+  Depends $(target) : $(>) ;
+    
+  LinkApplication $(target) : $(>) ;
+  Clean clean : $(target) ;
+  Clean $(<)clean : $(target) ;
+}
+
+# LinkApplicationConsole exe : objects
+#    Link a console (non-GUI) appliation from a set of object files.
+actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+{
+  $(MACOSX.ENVIRON)
+  $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LFLAGS)
+}
+
diff --git a/mk/jam/msvcgen.jam b/mk/jam/msvcgen.jam
new file mode 100644 (file)
index 0000000..cffffba
--- /dev/null
@@ -0,0 +1,383 @@
+#============================================================================
+# Rules for creating msvc projectfiles
+#============================================================================
+
+# BUGS & TODO 
+#------------
+# - Create a secondary target (such as "msvcinst") which copies the generated
+#   project files from the build/"out" directory back into the source
+#   directory.  This is useful for maintainers who, after having created and
+#   tested a new set of project files, want to then commit them to the CVS
+#   repository.
+#
+# - Either respect ExternaLibs() or fix all the Jamfiles which require special
+#   Windows libraries to invoke MsvcExternalLibrary().  This is necessary for
+#   modules such as cssocket and ensocket which require wsock32.lib, for
+#   instance.  There are a number of other such modules.  The current monlithic
+#   solution of placing this information in CS/mk/msvcgen/Jamconfig is ugly,
+#   error-prone, and a maintenance headache.
+#
+# - Overhaul the "config" file handling rule so that it associates
+#   configuration files with built targets.  This will allow the generated
+#   projects to reference configuration files.  Rather than the present
+#   InstallConfig rule, we either need a ConfigFile:<target>:<configs> rule, or
+#   we should upgrade the Application and Plugin rules to also accept
+#   configuration files.
+#
+# - Likewise, provide a generic Resources() rule which allows specification of
+#   additional textual resources for inclusion in generated projects.
+#
+# - Upgrade module Jamfiles to mention headers from the CS/include/module
+#   directory.  This will allow related headers to appear in the generated
+#   project files.  For instance, the libcsengine project should mention
+#   headers from CS/include/csengine, in addition to the ones from
+#   CS/libs/csengine which it currently mentions.
+#
+# - When PERL5.SDK.AVAILABLE is "yes", Jam reports that it doesn't know how to
+#   locate or create <grist>csperlxs.c.
+
+if $(MSVCGEN_CONFIG)
+{
+
+MSVCGEN = "$(PERL) $(TOP)/mk/msvcgen/msvcgen.pl" ;
+MKVERRES = "$(SHELL) $(TOP)/libs/cssys/win32/mkverres.sh" ;
+MKMETADATARES = "$(SHELL) $(TOP)/libs/cssys/win32/mkmetadatares.sh" ;
+MERGERES = "$(SHELL) $(TOP)/libs/cssys/win32/mergeres.sh" ;
+
+MSVCGEN_BUILD_ROOT = $(BUILDTOP)/out ;
+
+MSVC_VERSION ?= 6 ;
+if $(MSVC_VERSION) = 6
+{
+  MSVCGEN_LOCATE_TARGET ?= $(MSVCGEN_BUILD_ROOT)/mk/visualc6 ;
+  MSVCGEN_LOCATE_FRAGMENT ?= $(MSVCGEN_BUILD_ROOT)/mk/fragment6 ;
+  MSVCGEN_TEMPLATEDIR ?= $(TOP)/mk/msvcgen/template6 ;
+  MSVCGEN_EXTRA_OPTS = ;
+  SSUFPRJ = dsp ;
+  SSUFWSP = dsw ;
+  SUFPRJ = .dsp ;
+  SUFWSP = .dsw ;
+}
+else if $(MSVC_VERSION) = 7
+{
+  MSVCGEN_LOCATE_TARGET ?= $(MSVCGEN_BUILD_ROOT)/mk/visualc7 ;
+  MSVCGEN_LOCATE_FRAGMENT ?= $(MSVCGEN_BUILD_ROOT)/mk/fragment7 ;
+  MSVCGEN_TEMPLATEDIR ?= $(TOP)/mk/msvcgen/template7 ;
+  MSVCGEN_EXTRA_OPTS = --xml-protect ;
+  SSUFPRJ = vcproj ;
+  SUFPRJ = .vcproj ;
+  SSUFWSP = sln ;
+  SUFWSP = .sln ;
+}
+else
+{
+  EXIT "No support for MSVC version $(MSVC_VERSION) yet!" ;
+}
+  
+#----------------------------------------------------------------------------
+# Override some rules
+
+
+## MsvcProject target : sources : type : target-with-ext
+rule MsvcProject
+{
+  local rcpath resource msvcname target fragments fragroot files i ;
+
+  switch $(3)
+  {
+    case appgui :
+      msvcname = app$(<) ;
+    case appcon :
+      msvcname = app$(<) ;
+    case plugin :
+      msvcname = plg$(<) ;
+    case library :
+      msvcname = lib$(<) ;
+    case group :
+      msvcname = grp$(<) ;
+    case * :
+      exit "Unknown msvc projecttype: $(3) specified!" ;
+  }
+  $(<)_MSVCNAME = $(msvcname) ;
+      
+  fragroot = $(MSVCGEN_LOCATE_FRAGMENT)/$(msvcname).frag ;
+  NotFile $(fragroot) ;
+
+  fragments = [ FAppendSuffix $(msvcname) : .frag.cff ]
+             [ FAppendSuffix $(msvcname) : .frag.dpf ]
+             [ FAppendSuffix $(msvcname) : .frag.pjf ] ;
+  MakeLocate $(fragments) : $(MSVCGEN_LOCATE_FRAGMENT) ;
+  target = [ FAppendSuffix $(msvcname) : $(SUFPRJ) ] ;
+  MakeLocate $(target) : $(MSVCGEN_LOCATE_TARGET) ;
+  target += $(fragments) ;
+  $(<)_TARGET = $(target) ;
+
+  # Only include source and headers files for now.  In the future, we also
+  # want to include .cfg files and any other textual resources which which the
+  # user might care to read/view in the MSVC IDE.
+  for i in $(>)
+  {
+    i = $(i:G=$(LOCATE_SOURCE)) ;
+    switch $(i:S)
+    {
+      case .h   : files += $(i) ;
+      case .hpp : files += $(i) ;
+      case .H   : files += $(i) ;
+      case .c   : files += $(i) ;
+      case .cc  : files += $(i) ;
+      case .cpp : files += $(i) ;
+      case .m   : files += $(i) ;
+      case .mm  : files += $(i) ;
+      case .M   : files += $(i) ;
+    }
+  }
+  # Search at the correct place for the files
+  SEARCH on $(files) = $(SEARCH_SOURCE) ;
+
+  # Add resource file
+  if $(3) = "plugin" || $(3) = "appgui" || $(3) = "appcon"
+  {
+    resource = $(msvcname:S=.rc) ;
+    # @@@ Uber-ugly
+    rcpath = ../../../mk/visualc7/$(msvcname:S=.rc) ;
+    #files += $(resource) ;
+    Depends $(target) : $(resource) ;
+    LOCATE on $(resource) = $(MSVCGEN_LOCATE_TARGET) ;
+    SEARCH on $(resource) = $(MSVCGEN_LOCATE_FRAGMENT) ;
+    NAME on $(resource) = $(<) ;
+    #RCNAME on $(<) = $(resource) ;
+    $(<)_RCNAME = $(resource) ;
+    #ResourceGen $(resource) ;
+  
+    local versionrc = $(resource:S=.vrctmp) ;
+  
+    # normalize version list
+    local v1, v2, v3, v4 ;
+    v1 = $(PACKAGE.VERSION.LIST[1]) ;
+    if ! $(v1) { v1 = 0 ; }
+    v2 = $(PACKAGE.VERSION.LIST[2]) ;
+    if ! $(v2) { v2 = 0 ; }
+    v3 = $(PACKAGE.VERSION.LIST[3]) ;
+    if ! $(v3) { v3 = 0 ; }
+    v4 = $(PACKAGE.VERSION.LIST[4]) ;
+    if ! $(v4) { v4 = 0 ; }
+    PACKAGE.VERSION.LIST on $(versionrc) = $(v1) $(v2) $(v3) $(v4) ;
+       
+    # @@@ The "Help" rule is usually invoked after 'Plugin'/'Application',
+    # so "$(<)_help" is empty...
+    DESCRIPTION on $(versionrc) = $($(<)_help) ;
+       
+    LOCATE on $(versionrc) = $(MSVCGEN_LOCATE_FRAGMENT) ;
+    
+    GenerateWin32VersionRc $(versionrc) ;
+    Always $(versionrc) ;
+    Win32Resource $(<) : $(versionrc) ;
+    RmTemps $(target) : $(versionrc) ;
+    
+    if $(3) = "plugin" 
+    {
+      local metarc = $(resource:S=.mrctmp) ;
+    
+      LOCATE on $(metarc) = $(MSVCGEN_LOCATE_FRAGMENT) ;
+      SEARCH on $(metarc) = $(SEARCH_SOURCE) ;
+    
+      Depends $(metarc) : $($(<)_METAFILE) ;
+      GenerateWin32MetadataRc $(metarc) : $($(<)_METAFILE) ;
+      Always $(metarc) ;
+      Win32Resource $(<) : $(metarc) ;
+      RmTemps $(target) : $(metarc) ;
+    }
+  
+    Always $(resource) ;
+  }
+  
+  RAWNAME on $(target) = $(<) ;
+  PROJECTNAME on $(target) = $(msvcname) ;
+  TARGET on $(target) = $(4) ;
+  TYPE on $(target) = $(3) ;
+  FRAGMENT_ROOT on $(target) = $(fragroot) ;
+  DEPEND on $(target) += $(MSVC.DEPEND) $(MSVC.DEPEND.$(3)) ;
+  LIBRARIES on $(target) += $(MSVC.LIBRARY) $(MSVC.LIBRARY.$(3)) ;
+  LFLAGS on $(target) += $(MSVC.LFLAGS) $(MSVC.LFLAGS.$(3)) ;
+  CFLAGS on $(target) += $(MSVC.CFLAGS) $(MSVC.CFLAGS.$(3)) ;
+
+  Depends msvcgen : $(target) ;
+  Depends $(target) : $(files) $(MSVCGEN_LOCATE_FRAGMENT:G=dir) ;
+  MsvcProjectGen $(target) : $(files) $(rcpath) ;
+  Always $(target) ;
+
+  MSVCWorkspace csall : $(fragments) : $(fragroot) ;
+
+  Clean msvcclean : $(target) ;
+}
+
+#----------------------------------------------------------------------------
+
+rule Application
+{
+#  _Options $(<) : $(3) ;
+
+  local projtype ;
+  if $(CONSOLEAPP_$(<)) = "yes"
+  {
+    projtype = appcon ;
+  }
+  else
+  {
+    projtype = appgui ;
+  }
+
+  MsvcProject $(<) : $(>) : $(projtype) : $(<:S=.exe) ;
+  CompileGroups $(<) : all apps ;
+}
+
+rule Plugin
+{
+  local metafile ;
+  metafile = [ FAppendSuffix $(<) : $(SUFMETA) ] ;
+  SEARCH on $(metafile) = $(SEARCH_SOURCE) ;
+
+  $(<)_METAFILE = $(metafile) ;
+  
+  MsvcProject $(<) : $(>) : plugin : $(<:S=.dll) ;
+  CompileGroups $(<) : all plugins ;
+}
+
+rule Library
+{
+  MsvcProject $(<) : $(>) : library : $(<:S=.lib) ;
+  CompileGroups $(<) : all libs ;
+}
+
+rule RegisterCompileGroups
+{
+  local i ;
+  for i in $(<)
+  {
+    RegisterCompileGroup $(i) ;
+  }
+}
+
+rule RegisterCompileGroup
+{
+  MsvcProject $(<) : $(>) : group ; 
+}
+
+rule CompileGroups
+{
+  for i in $(>)
+  {
+    DEPEND on $($(i)_TARGET) += $($(<)_MSVCNAME) ;
+  }
+}
+
+rule LinkWith
+{
+  DEPEND on $($(<)_TARGET) += lib$(>) ;
+}
+
+rule MsvcExternalLibrary
+{
+  LIBRARIES on $($(<)_TARGET) += $(>) ;
+}
+
+rule CFlags
+{
+  if $(>) != ""
+  {
+    CFLAGS on $($(<)_TARGET) += $(>) ;
+  }
+}
+
+rule LFlags
+{
+  LFLAGS on $($(<)_TARGET) += $(>) ;
+}
+
+rule ExternalLibs
+{
+  local i ;
+  
+  for i in $(>)
+  {
+    CFlags $(<) : $($(i).CFLAGS) ;
+    LFlags $(<) : $($(i).LFLAGS) ;
+    MsvcExternalLibrary $(<) : $($(i).MSVCLIBS) ;
+  }
+}
+
+rule MSVCWorkspace
+{
+  local target ;
+
+  target = [ FAppendSuffix $(<) : $(SUFWSP) ] ;
+  MakeLocate $(target) : $(MSVCGEN_LOCATE_TARGET) ;
+
+  Depends msvcgen : $(target) ;
+  Depends $(target) : $(>[1]) ;
+  MsvcWorkspaceGen $(target) : $(3) ;
+
+  RmTemps $(target) : $(>) ;
+}
+
+rule Win32Resource
+{
+  Depends $(<) : $($(<)_RCNAME) ;
+  Depends $($(<)_RCNAME) : $(>) ;
+  MergeRcs $($(<)_RCNAME) : $(>) ;
+}
+
+#----------------------------------------------------------------------------
+
+actions MsvcProjectGen
+{
+  $(MSVCGEN) \
+  --quiet \
+  --project \
+  $(MSVCGEN_EXTRA_OPTS) \
+  --project-extension=$(SSUFPRJ) \
+  --name=$(RAWNAME) \
+  --template=$(TYPE) \
+  --template-dir=$(MSVCGEN_TEMPLATEDIR) \
+  --project-name=$(PROJECTNAME) \
+  --output=$(<[1]) \
+  --target=$(TARGET) \
+  --fragment=$(FRAGMENT_ROOT) \
+  --depend=$(DEPEND) \
+  --library=$(LIBRARIES) \
+  --lflags='$(LFLAGS)' \
+  --cflags='$(CFLAGS)' \
+  --strip-root='$(TOP)/' \
+  --strip-root='$(MSVCGEN_BUILD_ROOT)/' \
+  $(>)
+}
+
+actions together MsvcWorkspaceGen
+{
+  $(MSVCGEN) \
+  --quiet \
+  --workspace \
+  $(MSVCGEN_EXTRA_OPTS) \
+  --workspace-extension=$(SSUFWSP) \
+  --output=$(<) \
+  --template-dir=$(MSVCGEN_TEMPLATEDIR) \
+  $(>)
+}
+
+actions together MergeRcs
+{
+  $(MERGERES) '$(<)' '$(TOP)' '../..' '$(>)'
+}
+
+#----------------------------------------------------------------------------
+
+RegisterCompileGroups all apps plugins libs ;
+NotFile msvcgen ;
+Always msvcgen ;
+Clean clean : $(MSVCGEN_LOCATE_TARGET:G=dir) ;
+Clean clean : $(MSVCGEN_LOCATE_FRAGMENT:G=dir) ;
+Clean clean : $(MSVCGEN_BUILD_ROOT) ;
+Clean msvcclean : $(MSVCGEN_LOCATE_TARGET:G=dir) ;
+Clean msvcclean : $(MSVCGEN_LOCATE_FRAGMENT:G=dir) ;
+
+}
diff --git a/mk/jam/objects.jam b/mk/jam/objects.jam
new file mode 100644 (file)
index 0000000..aeec250
--- /dev/null
@@ -0,0 +1,203 @@
+#============================================================================
+# Rules for compiling a set of sources to object files
+#============================================================================
+# These are slightly modified versions of the Object and Objects rules from
+# jam. The problem with the original rules in Jambase is the handling of
+# custom file types. The solution with the UserObject rule is monolithic, you
+# can only have 1 such rule. Thus we construct a more flexible toolkit here
+# which let's you register rules for certain filetypes.
+
+##  RegisterFileType Rulename : extensions
+##    Register a rule which is used to compile a filetype into object
+##    files. The registered rule is called with the name of the
+##    sourcefile as argument and should return a list of objectfiles which are
+##    created. You should set the grist of the object files by using the
+##    DoObjectGrist function.
+rule RegisterFileType
+{
+    local suffix ;
+    for suffix in $(>)
+    {
+        FILETYPE_$(suffix) = $(<) ;
+    }
+}
+
+##  RegisterHeaderRule rulename : regexpattern : extensions
+##    Registers a rule and a regular expression which will be used for header
+##    file scanning of the specified extensions.
+rule RegisterHeaderRule
+{
+    local suffix ;
+    for suffix in $(3)
+    {
+        HDRRULE_$(suffix) = $(<) ;
+        HDRPATTERN_$(suffix) = $(>) ;
+    }
+}
+
+##  CompileObjects sources [ : options ]
+##    Compile a set of sourcefiles into objectfiles (extension: SUFOBJ,
+##    usually .o). This rule takes care of setting LOCATE and SEARCH
+##    variables to the $(SEARCH_SOURCE) and $(LOCATE_SOURCE) variables.
+##    The Application, Plugin and Library rules already use this rule
+##    internally. You should only use this rule if you have to avoid the
+##    Application, Plugin or Library rules.
+rule CompileObjects
+{
+    local source ;
+    local targets ;
+
+    # Search the source
+    SEARCH on $(<) = $(SEARCH_SOURCE) ;      
+
+    for source in $(<)
+    {
+        # compile the sourcefile to targetfile
+        targets += [ CompileObject $(source) : $(2) ] ;
+    }
+  
+    # locate the targets
+    MakeLocate $(targets) : $(LOCATE_TARGET) ;
+
+    return $(targets) ;
+}
+
+#----------------------------------------------------------------------------
+# private part
+
+# CompileObject sourcefile [ : options ]
+# helper rule: Compiles a source file to an object file. Does header file
+# scanning, sets LOCATE and SEARCH for source and target, grists the files
+# with the current subdir and searches for the correct registered rule.
+rule CompileObject
+{
+    # handle #includes for source: Jam scans for headers with
+    # the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
+    # with the scanned file as the target and the found headers
+    # as the sources.  HDRSEARCH is the value of SEARCH used for
+    # the found header files.  Finally, if jam must deal with 
+    # header files of the same name in different directories,
+    # they can be distinguished with HDRGRIST.
+
+    # $(SEARCH_SOURCE:E) is where cc first looks for #include 
+    # "foo.h" files.  If the source file is in a distant directory, 
+    # look there.  Else, look in "" (the current directory).
+    if $(HDRRULE_$(<:S))
+    {
+        HDRS on $(<) = [ ConcatDirs $(SUBDIR) $(<:D) ]
+            $(SEARCH_SOURCE:E) $(HDRS) $(STDHDRS) ;
+        HDRGRIST on $(<) = $(HDRGRIST) ;                               
+        HDRRULE on $(<) = $(HDRRULE_$(<:S)) ;
+        HDRSCAN on $(<) = $(HDRPATTERN_$(<:S)) ;
+    }
+
+    local targets ;
+    # Invoke filetype specific rule
+    if $(FILETYPE_$(<:S))
+    {
+        targets = [ $(FILETYPE_$(<:S)) $(<) : $(2) ] ;
+    }
+    else
+    {
+        echo "Warning: no rules for filetype $(>:S) defined (at file $(>))." ;
+    }
+
+    if $(targets)
+    {
+        # construct clean target
+        Clean clean : $(targets) ;
+    }
+
+    return $(targets) ;
+}
+
+##  HeaderRule source : headers
+##    This rule is the default header rule used by the objects rules. You
+##    might register custom rules with the RegisterHeaderRule rule.
+rule HeaderRule
+{
+    # N.B.  This rule is called during binding, potentially after
+    # the fate of many targets has been determined, and must be
+    # used with caution: don't add dependencies to unrelated
+    # targets, and don't set variables on $(<).
+                                                                                
+    # Tell Jam that anything depending on $(<) also depends on $(>),
+    # set SEARCH so Jam can find the headers, but then say we don't
+    # care if we can't actually find the headers (they may have been
+    # within ifdefs),
+    local s = $(>:G=$(HDRGRIST:E)) ;
+
+    Includes $(<) : $(s) ;
+    SEARCH on $(s) = $(HDRS) ;
+    NoCare $(s) ;
+    local i ;
+    for i in $(s)
+    {
+        HDRGRIST on $(s) = $(HDRGRIST) ;
+        HDRS on $(s) = $(HDRS) ;
+        HDRRULE on $(s) = [ on $(<) GetVar HDRRULE ] ;
+        HDRSCAN on $(s) = [ on $(<) GetVar HDRPATTERN ] ;
+    }
+}
+
+if $(JAMVERSION) < 2.5
+{
+## XXX XXX XXX a bug in jam 2.4 let's the version above fail. I'll let this
+##    non-optimal version in here until jam 2.5 is out.
+
+rule HeaderRule
+{
+    local s = $(>:G=$(HDRGRIST:E)) ;
+
+    Includes $(<) : $(s) ;
+    SEARCH on $(s) = $(HDRS) ;
+    NoCare $(s) ;
+    local i ;
+    for i in $(s)
+    {
+        if $(HDRRULE_$(i:S))
+        {
+            HDRGRIST on $(s) = $(HDRGRIST) ;
+            HDRS on $(s) = $(HDRS) ;
+            HDRRULE on $(s) = $(HDRRULE_$(i:S)) ;
+            HDRSCAN on $(s) = $(HDRPATTERN_$(i:S)) ;
+        }
+        else if $(JAM_DEBUG)
+        {
+            #echo "No Header rule for $(i:S) file $(i) " ;
+        }
+    }
+}
+
+} # end of if $(JAMVERSION) < 1.5
+
+# Dummy rule: .o files are used as is.
+rule UseObjectFile
+{
+    return $(<) ;
+}
+RegisterFileType UseObjectFile : .o ;
+
+# Ignore header files.
+rule UseHeaderFile
+{
+    return ;
+}
+RegisterFileType UseHeaderFile : .h .hpp ;
+RegisterHeaderRule HeaderRule : $(HDRPATTERN) : .h .hpp .inc ;
+
+# Generates a grist suitable for output objects based on
+# SUBVARIANT and SUBDIR variable.
+rule DoObjectGrist
+{
+    return $(<:G=$(SOURCE_GRIST:E)!$(SUBVARIANT)) ;
+}
+
+# Generates a grist suitable for source files based on SUBDIR variable.
+rule DoSourceGrist
+{
+    return $(<:G=$(SOURCE_GRIST:E)) ;
+}
+
diff --git a/mk/jam/options.jam b/mk/jam/options.jam
new file mode 100644 (file)
index 0000000..2b08cc1
--- /dev/null
@@ -0,0 +1,21 @@
+#============================================================================
+# Rule for setting options at targets
+#============================================================================
+
+#----------------------------------------------------------------------------
+# private rule - please specify the options in Application, Plugin or Library
+# rule and don't use this rule here directly.
+
+##  CheckOptions candidates : Options : target
+rule CheckOptions
+{
+  local i ;
+  for i in $(>)
+  {
+    if ! [ IsElem $(i) : $(<) ]
+    {
+      echo "WARNING: Unknown option $(i) specified at $(3)." ;
+    }
+  }
+}
+
diff --git a/mk/jam/resource.jam b/mk/jam/resource.jam
new file mode 100644 (file)
index 0000000..4486a51
--- /dev/null
@@ -0,0 +1,22 @@
+#============================================================================
+# Stub Rules for handling additional resources (the OS specific Jamfiles will
+# override these.
+#============================================================================
+
+##  Win32Resource
+##    Specify .rc files for targets. The .rc files should already have SEARCH
+##    set correctly.
+rule Win32Resource { }
+
+## ApplicationIconOSX basename : icon [ : pathcomponents ]
+##    Specify the icon for the application given by basename.  If
+##    pathcomponents is omitted, SEARCH_SOURCE is used.  If this rule is not
+##    invoked, then the icon specified via ApplicationIconDefaultOSX is used.
+##    If ApplicationIconDefaultOSX was never invoked, then no icon is used.
+rule ApplicationIconOSX { }
+
+## ApplicationIconDefaultOSX icon [ : pathcomponents ]
+##    Specify the default icon for GUI applications.  This setting can be
+##    overriden for a individual application with the ApplicationIconOSX rule.
+rule ApplicationIconDefaultOSX { }
+
diff --git a/mk/jam/subdir.jam b/mk/jam/subdir.jam
new file mode 100644 (file)
index 0000000..bb1ba50
--- /dev/null
@@ -0,0 +1,90 @@
+#============================================================================
+# Work around problems the SubDir rule of Jambase 
+#      (until jampeople accept my patches :-/ )
+#============================================================================
+
+LOCATE_OBJECTS ?= $(top_builddir)/out/$(target) ;
+LOCATE_TARGETS ?= $(top_builddir) ;
+LOCATE_DOCS ?= $(top_builddir)/out ;
+
+SUBDIRRULES += FixSubDirPath ;
+
+MKDIR ?= mkdir ;
+MKDIRS ?= "$(MKDIR) -p" ;
+
+rule FixSubDirPath
+{
+    LOCATE_SOURCE = [ ConcatDirs $(LOCATE_OBJECTS) $(SUBDIR_TOKENS) ] ;
+    LOCATE_TARGET = [ ConcatDirs $(LOCATE_OBJECTS) $(SUBDIR_TOKENS) ] ;
+}
+
+# fix bug in Jambase where SubInclude in the middle of a jam file made it break
+rule SubInclude
+{
+    if ! $($(<[1]))
+    {
+        Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
+    }
+
+    local save_SUBDIR_TOKENS = $(SUBDIR_TOKENS) ;
+
+    SubDir $(<) ;
+
+    include $(JAMFILE:D=$(SUBDIR)) ;
+
+    SubDir $(<[1]) $(save_SUBDIR_TOKENS) ;
+}
+
+# this MakeLocate rule differs from the Jambase one in that it also works with
+# files being in subdirectories
+rule MakeLocate
+{
+    # MakeLocate targets : directory ;
+                                                                           
+    # Sets special variable LOCATE on targets, and arranges
+    # with MkDir to create target directory.
+                                                                                    
+    # Note we grist the directory name with 'dir',
+    # so that directory path components and other
+    # targets don't conflict.
+    
+    if $(>) && $(>) != "" && $(>) != "."
+    {
+        local i ;
+        for i in $(<) {
+            LOCATE on $(i) = $(>) ;
+
+            local targetfile = $(i:R=$(>)) ;
+            Depends $(i) : $(targetfile:DG=dir) ;
+            MkDir $(targetfile:DG=dir) ;
+        }
+    }
+}
+
+# The default MkDir rule in Jambase has problems when paths contains a sequence
+# of multiple slashes (ie. bla////fup). We solve these problems and greatly
+# simply this rule by using the "mkdir -p" or mkdirs command.
+rule MkDir
+{
+    # MkDir directory ;
+
+    # Make a directory and all its parent directories.
+
+    # Ignore timestamps on directories: we only care if they 
+    # exist.
+
+    NoUpdate $(<) ;
+
+    # don't create the dir multiple times
+    if ! $($(<)-mkdir)
+    {
+        $(<)-mkdir = true ;
+        MkDir1 $(<) ;
+    }
+}
+
+actions MkDir1
+{
+        $(MKDIRS) "$(<)"
+}
+
diff --git a/mk/jam/unix.jam b/mk/jam/unix.jam
new file mode 100644 (file)
index 0000000..aafb52f
--- /dev/null
@@ -0,0 +1,47 @@
+#============================================================================
+# Jam configuration and actions for Linux/Unix
+#============================================================================
+SHELL ?= "/bin/sh" ;
+
+#----------------------------------------------------------------------------
+# platform specific rules
+
+##  ConstructApplicationTarget target : options
+##    Constructs the application atrget name (ie. foo.exe for foo)
+rule ConstructApplicationTarget
+{
+    return $(<) ;
+}
+rule ConstructLibraryTarget
+{
+    if [ IsElem shared : $(2) ] {
+        return lib$(<).la ;
+    } else {
+        return lib$(<).a ;
+    }
+}
+rule ConstructPluginTarget
+{
+    return $(<).so ;
+}
+
+# SystemLinkApplication target : objects : options
+#  do system specific actions needed for linking the application and construct
+#  correct clean targets.
+rule SystemLinkApplication
+{
+    local target = $($(<)_TARGET) ;
+  
+    Depends $(target) : $(>) ;
+    LinkApplication $(target) : $(>) ;
+    # setup clean rules
+    Clean clean : $(target) ;
+    Clean $(<)clean : $(target) ;
+}
+
+actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+{
+    $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LFLAGS)
+}
+
+
diff --git a/mk/jam/variant.jam b/mk/jam/variant.jam
new file mode 100644 (file)
index 0000000..2697579
--- /dev/null
@@ -0,0 +1,52 @@
+#============================================================================
+# Setup of compiler/linker flags for debug/optimize mode
+#============================================================================
+
+VARIANT ?= optimize ;
+if $(VARIANT) != "debug" && $(VARIANT) != "optimize" && $(VARIANT) != "profile"
+{
+  exit "Invalid modus set, please set VARIANT to debug, profile or optimize" ;
+}
+
+switch $(VARIANT)
+{
+case optimize :
+    SHORTVARIANT = opt ;
+case debug :
+    SHORTVARIANT = dbg ;
+case profile :
+    SHORTVARIANT = prof ;
+}
+
+# Set modus related flags
+CCFLAGS += $(COMPILER_CFLAGS) $(COMPILER_CFLAGS_$(VARIANT)) ;
+C++FLAGS += $(COMPILER_CFLAGS) $(COMPILER_C++FLAGS)
+           $(COMPILER_CFLAGS_$(VARIANT)) $(COMPILER_C++FLAGS_$(VARIANT)) ;
+LINKLIBS += $(LDFLAGS) $(COMPILER_LFLAGS) $(COMPILER_LFLAGS_$(VARIANT)) ;
+LOCATE_OBJECTS = $(LOCATE_OBJECTS)/$(SHORTVARIANT) ;
+
+##  SubVariant variantname
+##    Specify subvarianet which are placed in separate compilation directories.
+SUBVARIANT ?= "" ;
+rule SubVariant
+{
+  SUBVARIANT = $(<) ;
+  if ! $(<)
+  {
+    SUBVARIANT = "" ;
+    if $(SAVED_LOCATE_TARGET)
+    {
+      LOCATE_TARGET = $(SAVED_LOCATE_TARGET) ;
+    }
+    SAVED_LOCATE_TARGET = ;
+  }
+  else
+  {
+    if ! $(SAVED_LOCATE_TARGET)
+    {
+      SAVED_LOCATE_TARGET = $(LOCATE_TARGET) ;
+    }
+    LOCATE_TARGET = $(LOCATE_TARGET)/$(SUBVARIANT) ;
+  }
+}
+
diff --git a/mk/jam/win32.jam b/mk/jam/win32.jam
new file mode 100644 (file)
index 0000000..f3e8dbd
--- /dev/null
@@ -0,0 +1,73 @@
+#============================================================================
+# Jam configuration and actions for Win32
+#============================================================================
+SHELL ?= "/bin/sh" ;
+
+#----------------------------------------------------------------------------
+# resource handling
+# Unfortunately we can't simply specify resources on the source list, because
+# Mingw/Cygwin have the limitation that they can only link 1 resource file
+# in. So we have to concatenate all resourcefiles here before compiling them.
+
+actions together CompileResources
+{
+    cat $(>) | $(WINDRES) $(WINDRES_FLAGS) --include-dir=$(>:D) -o $(<)
+}
+
+rule CompileResources
+{
+    Depends $(<) : $(>) ;
+}
+
+rule Win32Resource
+{
+    local target = $($(<)_TARGET) ;
+    local rcobject = [ DoObjectGrist _resource.o ] ;
+    LOCATE on $(rcobject) = $(LOCATE_TARGET) ;
+    SEARCH on $(rcobject) = $(LOCATE_TARGET) ;
+    
+    # only add 1 resource object per target
+    if ! $($(<)_HASWIN32RESOURCE)
+    {
+       $(<)_HASWIN32RESOURCE = yes ;
+       ExtraObjects $(<) : $(rcobject) ;
+    }
+
+    CompileResources $(rcobject) : $(>) ;
+}
+
+#----------------------------------------------------------------------------
+# linking part
+
+##  ConstructApplicationTarget target : options
+##    Constructs the application atrget name (ie. foo.exe for foo)
+rule ConstructApplicationTarget
+{
+  return $(<).exe ;
+}
+rule ConstructLibraryTarget
+{
+  return lib$(<).a ;
+}
+rule ConstructPluginTarget
+{
+  return $(<).dll ;
+}
+
+# SystemLinkApplication target : objects : options
+rule SystemLinkApplication
+{
+  local target = $($(<)_TARGET) ;
+
+  Depends $(target) : $(>) ;
+  LinkApplication $(target) : $(>) ;
+  # setup clean rules
+  Clean clean : $(target) ;
+  Clean $(<)clean : $(target) ;
+}
+
+actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+{
+  $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LFLAGS)
+}
+
diff --git a/src/Jamfile b/src/Jamfile
new file mode 100644 (file)
index 0000000..004253f
--- /dev/null
@@ -0,0 +1,12 @@
+SubDir TOP src ;
+
+Application supertux : 
+    [ Wildcard *.cpp *.h ]
+    [ Wildcard object : *.cpp *.h ]
+    [ Wildcard badguy : *.cpp *.h ]
+    [ Wildcard trigger : *.cpp *.h ]
+;
+LinkWith supertux : supertuxlib ;
+ExternalLibs supertux : SDL SDLMIXER SDLIMAGE GL ;
+Help supertux : "Build the supertux executable" ;
+
index cef3304..cfa3af2 100644 (file)
@@ -81,7 +81,7 @@ BadGuy::active_action(float elapsed_time)
 }
 
 void
-BadGuy::inactive_action(float elapsed_time)
+BadGuy::inactive_action(float )
 {
 }
 
@@ -118,7 +118,7 @@ BadGuy::collision(GameObject& other, const CollisionHit& hit)
 }
 
 HitResponse
-BadGuy::collision_solid(GameObject& other, const CollisionHit& hit)
+BadGuy::collision_solid(GameObject& , const CollisionHit& )
 {
   return FORCE_MOVE;
 }
@@ -139,13 +139,13 @@ BadGuy::collision_player(Player& player, const CollisionHit& hit)
 }
 
 HitResponse
-BadGuy::collision_badguy(BadGuy& other, const CollisionHit& hit)
+BadGuy::collision_badguy(BadGuy& , const CollisionHit& )
 {
   return FORCE_MOVE;
 }
 
 bool
-BadGuy::collision_squished(Player& player)
+BadGuy::collision_squished(Player& )
 {
   return false;
 }
index 88ed94e..6f884f1 100644 (file)
@@ -18,13 +18,13 @@ Bomb::Bomb(const Vector& pos, Direction dir)
 }
 
 void
-Bomb::write(LispWriter& writer)
+Bomb::write(LispWriter& )
 {
   // bombs are only temporarily so don't write them out...
 }
 
 HitResponse
-Bomb::collision_solid(GameObject& other, const CollisionHit& hit)
+Bomb::collision_solid(GameObject& , const CollisionHit& hit)
 {
   if(fabsf(hit.normal.y) > .5)
     physic.set_velocity_y(0);
@@ -33,7 +33,7 @@ Bomb::collision_solid(GameObject& other, const CollisionHit& hit)
 }
 
 HitResponse
-Bomb::collision_player(Player& player, const CollisionHit& hit)
+Bomb::collision_player(Player& player, const CollisionHit& )
 {
   if(state == 1) {
     player.kill(Player::SHRINK);
@@ -42,7 +42,7 @@ Bomb::collision_player(Player& player, const CollisionHit& hit)
 }
 
 void
-Bomb::active_action(float elapsed_time)
+Bomb::active_action(float )
 {
   switch(state) {
     case 0:
index 97f40c3..734e60a 100644 (file)
@@ -40,7 +40,7 @@ BouncingSnowball::collision_squished(Player& player)
 }
 
 HitResponse
-BouncingSnowball::collision_solid(GameObject& other, const CollisionHit& hit)
+BouncingSnowball::collision_solid(GameObject& , const CollisionHit& hit)
 {
   if(hit.normal.y < -.5) { // hit floor
     physic.set_velocity_y(JUMPSPEED);
index 4ac9960..f5ce236 100644 (file)
@@ -24,7 +24,7 @@ Jumpy::write(LispWriter& writer)
 }
 
 HitResponse
-Jumpy::collision_solid(GameObject& other, const CollisionHit& hit)
+Jumpy::collision_solid(GameObject& , const CollisionHit& hit)
 {
   // hit floor?
   if(hit.normal.y < -.5) {
index 27c0d65..1bc384c 100644 (file)
@@ -41,7 +41,7 @@ MrBomb::collision_squished(Player& player)
 }
 
 HitResponse
-MrBomb::collision_solid(GameObject& other, const CollisionHit& hit)
+MrBomb::collision_solid(GameObject& , const CollisionHit& hit)
 {
   if(fabsf(hit.normal.y) > .5) { // hit floor or roof?
     physic.set_velocity_y(0);
index 5e71413..dccfb00 100644 (file)
@@ -46,7 +46,7 @@ MrIceBlock::active_action(float elapsed_time)
 }
 
 HitResponse
-MrIceBlock::collision_solid(GameObject& other, const CollisionHit& hit)
+MrIceBlock::collision_solid(GameObject& , const CollisionHit& hit)
 {
   if(fabsf(hit.normal.y) > .5) { // floor or roof
     physic.set_velocity_y(0);
index 4c9bdea..ce5ac61 100644 (file)
@@ -39,7 +39,7 @@ SnowBall::collision_squished(Player& player)
 }
 
 HitResponse
-SnowBall::collision_solid(GameObject& other, const CollisionHit& hit)
+SnowBall::collision_solid(GameObject& , const CollisionHit& hit)
 {
   if(fabsf(hit.normal.y) > .5) { // hit floor or roof?
     physic.set_velocity_y(0);
index 44bb376..ca414a4 100644 (file)
@@ -31,7 +31,7 @@ Spiky::activate()
 }
 
 HitResponse
-Spiky::collision_solid(GameObject& other, const CollisionHit& hit)
+Spiky::collision_solid(GameObject& , const CollisionHit& hit)
 {
   if(fabsf(hit.normal.y) > .5) { // hit floor or roof?
     physic.set_velocity_y(0);
index 0578d37..6ebe735 100644 (file)
@@ -855,6 +855,7 @@ void LevelEditor::test_level()
 
 void LevelEditor::change(int x, int y, int newtile, int layer)
 {  
+  (void) layer;
   // find the tilemap of the current layer, and then change the tile
   if(x < 0 || (unsigned int)x >= sector->solids->get_width()*32 ||
       y < 0 || (unsigned int)y >= sector->solids->get_height()*32)
index 04beb66..7bdded4 100644 (file)
@@ -31,7 +31,7 @@ Coin::draw(DrawingContext& context)
 }
 
 HitResponse
-Coin::collision(GameObject& other, const CollisionHit& hit)
+Coin::collision(GameObject& other, const CollisionHit& )
 {
   Player* player = dynamic_cast<Player*>(&other);
   if(player == 0)
index 8230f76..435be07 100644 (file)
@@ -39,7 +39,7 @@ Flower::draw(DrawingContext& context)
 }
 
 HitResponse
-Flower::collision(GameObject& other, const CollisionHit& hit)
+Flower::collision(GameObject& other, const CollisionHit& )
 {
   Player* player = dynamic_cast<Player*>(&other);
   if(!player)
index 49560ed..4db8c93 100644 (file)
@@ -20,7 +20,7 @@ InvisibleBlock::draw(DrawingContext& context)
 }
 
 void
-InvisibleBlock::hit(Player& player)
+InvisibleBlock::hit(Player& )
 {
   if(visible)
     return;
index 5a027a0..0f2a410 100644 (file)
@@ -33,7 +33,7 @@ OneUp::draw(DrawingContext& context)
 }
 
 HitResponse
-OneUp::collision(GameObject& other, const CollisionHit& hit)
+OneUp::collision(GameObject& other, const CollisionHit& )
 {
   Player* player = dynamic_cast<Player*> (&other);
   if(player) {
index e1a868d..d72b7ac 100644 (file)
@@ -26,7 +26,7 @@ Platform::~Platform()
 }
 
 HitResponse
-Platform::collision(GameObject& object, const CollisionHit& hit)
+Platform::collision(GameObject& , const CollisionHit& )
 {
 #if 0
   if(typeid(object) == typeid(Player)) {
@@ -38,7 +38,7 @@ Platform::collision(GameObject& object, const CollisionHit& hit)
 }
 
 void
-Platform::action(float elapsed_time)
+Platform::action(float )
 {
   // just some test code...
   if(state == 0) {
index 2ecaaad..f9fd8fb 100644 (file)
@@ -1010,7 +1010,7 @@ Player::check_bounds(Camera* camera)
 }
 
 void
-Player::bounce(BadGuy& badguy)
+Player::bounce(BadGuy& )
 {
   //Make sure we stopped flapping
   flapping = false;
index 79bfef8..a832da9 100644 (file)
@@ -87,7 +87,7 @@ Door::draw(DrawingContext& context)
 }
 
 void
-Door::event(Player& player, EventType type)
+Door::event(Player& , EventType type)
 {
   if(type == EVENT_ACTIVATE) {
     sprite->set_action("open");
index e173457..b02bb5e 100644 (file)
@@ -4,9 +4,9 @@
 #include "utils/lispwriter.h"
 #include "gameloop.h"
 
-SequenceTrigger::SequenceTrigger(LispReader& reader,
-    const std::string& sequence)
+SequenceTrigger::SequenceTrigger(LispReader& reader)
 {
+  (void) reader;
   // TODO
 }
 
@@ -38,7 +38,7 @@ SequenceTrigger::write(LispWriter& writer)
 }
 
 void
-SequenceTrigger::event(Player& player, EventType type)
+SequenceTrigger::event(Player& , EventType type)
 {
   if(type == triggerevent) {
     GameSession::current()->start_sequence(sequence_name);
index 35b86eb..b66e760 100644 (file)
@@ -7,7 +7,7 @@
 class SequenceTrigger : public TriggerBase, public Serializable
 {
 public:
-  SequenceTrigger(LispReader& reader, const std::string& sequence);
+  SequenceTrigger(LispReader& reader);
   SequenceTrigger(const Vector& pos, const std::string& sequence);
   ~SequenceTrigger();
  
index c994448..e6b143a 100644 (file)
@@ -48,7 +48,7 @@ TriggerBase::draw(DrawingContext& context)
 }
 
 HitResponse
-TriggerBase::collision(GameObject& other, const CollisionHit& collhit)
+TriggerBase::collision(GameObject& other, const CollisionHit& )
 {
   Player* player = dynamic_cast<Player*> (&other);
   if(player) {