Module Name:    xsrc
Committed By:   mrg
Date:           Mon Mar 17 09:20:46 UTC 2014

Modified Files:
        xsrc/external/mit/xauth/dist: process.c
        xsrc/external/mit/xconsole/dist: xconsole.c
Added Files:
        xsrc/external/mit/xclipboard/dist: compile
        xsrc/external/mit/xfd/dist: compile
Removed Files:
        xsrc/external/mit/xconsole/dist: xconsole.man

Log Message:
merge xauth 1.0.7, xclipboard 1.1.2, xclock 1.0.6, xconsole 1.0.4
and xfd 1.1.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xauth/dist/process.c
cvs rdiff -u -r0 -r1.3 xsrc/external/mit/xclipboard/dist/compile
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xconsole/dist/xconsole.c
cvs rdiff -u -r1.1.1.1 -r0 xsrc/external/mit/xconsole/dist/xconsole.man
cvs rdiff -u -r0 -r1.3 xsrc/external/mit/xfd/dist/compile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xauth/dist/process.c
diff -u xsrc/external/mit/xauth/dist/process.c:1.3 xsrc/external/mit/xauth/dist/process.c:1.4
--- xsrc/external/mit/xauth/dist/process.c:1.3	Sun Jun 30 11:31:42 2013
+++ xsrc/external/mit/xauth/dist/process.c	Mon Mar 17 09:20:46 2014
@@ -38,7 +38,11 @@ from The Open Group.
 #include <ctype.h>
 #include <errno.h>
 #include <sys/stat.h>
+#ifndef WIN32
 #include <sys/socket.h>
+#else
+#include <X11/Xwinsock.h>
+#endif
 
 #include <signal.h>
 #include <X11/X.h>			/* for Family constants */
@@ -112,6 +116,7 @@ static int do_exit ( const char *inputfi
 static int do_quit ( const char *inputfilename, int lineno, int argc, const char **argv );
 static int do_source ( const char *inputfilename, int lineno, int argc, const char **argv );
 static int do_generate ( const char *inputfilename, int lineno, int argc, const char **argv );
+static int do_version ( const char *inputfilename, int lineno, int argc, const char **argv );
 
 static CommandTable command_table[] = {	/* table of known commands */
     { "add",      2, 3, do_add,
@@ -140,6 +145,8 @@ static CommandTable command_table[] = {	
 	"remove dpyname...              remove entries" },
     { "source",   1, 6, do_source,
 	"source filename                read commands from file" },
+    { "version",  1, 7, do_version,
+	"version                        show version number of xauth" },
     { "?",        1, 1, do_questionmark,
 	"?                              list available commands" },
     { "generate", 1, 8, do_generate,
@@ -244,17 +251,17 @@ skip_nonspace(register char *s)
     return s;
 }
 
-static char **
+static const char **
 split_into_words(char *src, int *argcp)  /* argvify string */
 {
     char *jword;
     char savec;
-    char **argv;
+    const char **argv;
     int cur, total;
 
     *argcp = 0;
 #define WORDSTOALLOC 4			/* most lines are short */
-    argv = (char **) malloc (WORDSTOALLOC * sizeof (char *));
+    argv = malloc (WORDSTOALLOC * sizeof (char *));
     if (!argv) return NULL;
     cur = 0;
     total = WORDSTOALLOC;
@@ -272,7 +279,7 @@ split_into_words(char *src, int *argcp) 
 	*src = '\0';
 	if (cur == total) {
 	    total += WORDSTOALLOC;
-	    argv = (char **) realloc (argv, total * sizeof (char *));
+	    argv = realloc (argv, total * sizeof (char *));
 	    if (!argv) return NULL;
 	}
 	argv[cur++] = jword;
@@ -633,18 +640,17 @@ static volatile Bool dieing = False;
 #define WRITES(fd, S) (void)write((fd), (S), strlen((S)))
 
 /* ARGSUSED */
-static RETSIGTYPE
+_X_NORETURN
+static void
 die(int sig)
 {
     dieing = True;
     _exit (auth_finalize ());
     /* NOTREACHED */
-#ifdef SIGNALRETURNSINT
-    return -1;				/* for picky compilers */
-#endif
 }
 
-static RETSIGTYPE
+_X_NORETURN
+static void
 catchsig(int sig)
 {
 #ifdef SYSV
@@ -661,9 +667,6 @@ catchsig(int sig)
 #endif
     die (sig);
     /* NOTREACHED */
-#ifdef SIGNALRETURNSINT
-    return -1;				/* for picky compilers */
-#endif
 }
 
 static void
@@ -1066,11 +1069,31 @@ eq_auth(Xauth *a, Xauth *b)
 static int
 match_auth_dpy(register Xauth *a, register Xauth *b)
 {
-    return ((a->family == b->family &&
-	     a->address_length == b->address_length &&
-	     a->number_length == b->number_length &&
-	     memcmp(a->address, b->address, a->address_length) == 0 &&
-	     memcmp(a->number, b->number, a->number_length) == 0) ? 1 : 0);
+    if (a->family != FamilyWild && b->family != FamilyWild) {
+        /* Both "a" and "b" are not FamilyWild, they are "normal" families. */
+	
+	/* Make sure, that both families match: */
+	if (a->family != b->family)
+            return 0;
+	
+	/* By looking at 'man Xsecurity' and the code in
+	 * GetAuthByAddr() and XauGetBestAuthByAddr() in libXau, we
+	 * decided, that the address is only relevant for "normal"
+	 * families and therefore should be ignored for
+	 * "FamilyWild". */
+	if (a->address_length != b->address_length ||
+            memcmp(a->address, b->address, a->address_length) != 0)
+            return 0;
+    }
+    
+    if (a->number_length != 0 && b->number_length != 0) {
+	/* Both "a" and "b" have a number, make sure they match: */
+	if (a->number_length != b->number_length ||
+	    memcmp(a->number, b->number, a->number_length) != 0)
+            return 0;
+    }
+    
+    return 1;
 }
 
 /* return non-zero iff display and authorization type are the same */
@@ -1282,8 +1305,11 @@ remove_entry(const char *inputfilename, 
     /*
      * unlink the auth we were asked to
      */
-    while (!eq_auth((list = *listp)->auth, auth))
-	listp = &list->next;
+    while (!eq_auth((list = *listp)->auth, auth)) {
+        listp = &list->next;
+        if (!*listp)
+            return 0;
+    }
     *listp = list->next;
     XauDisposeAuth (list->auth);                    /* free the auth */
     free (list);				    /* free the link */
@@ -1300,23 +1326,23 @@ remove_entry(const char *inputfilename, 
  * help
  */
 int
-print_help(FILE *fp, const char *cmd, const char *prefix)
+print_help(FILE *fp, const char *cmd, const char *line_prefix)
 {
     CommandTable *ct;
     int n = 0;
 
-    if (!prefix) prefix = "";
+    if (!line_prefix) line_prefix = "";
 
     if (!cmd) {				/* if no cmd, print all help */
 	for (ct = command_table; ct->name; ct++) {
-	    fprintf (fp, "%s%s\n", prefix, ct->helptext);
+	    fprintf (fp, "%s%s\n", line_prefix, ct->helptext);
 	    n++;
 	}
     } else {
 	int len = strlen (cmd);
 	for (ct = command_table; ct->name; ct++) {
 	    if (strncmp (cmd, ct->name, len) == 0) {
-		fprintf (fp, "%s%s\n", prefix, ct->helptext);
+		fprintf (fp, "%s%s\n", line_prefix, ct->helptext);
 		n++;
 	    }
 	}
@@ -1389,6 +1415,17 @@ do_questionmark(const char *inputfilenam
 }
 
 /*
+ * version
+ */
+/* ARGSUSED */
+static int
+do_version(const char *inputfilename, int lineno, int argc, const char **argv)
+{
+    puts (PACKAGE_VERSION);
+    return 0;
+}
+
+/*
  * list [displayname ...]
  */
 static int
@@ -1801,6 +1838,7 @@ do_generate(const char *inputfilename, i
     int authdatalen = 0;
     const char *hexdata;
     char *authdata = NULL;
+    char *hex;
 
     if (argc < 2 || !argv[1]) {
 	prefix (inputfilename, lineno);
@@ -1891,7 +1929,7 @@ do_generate(const char *inputfilename, i
 
     auth_in = XSecurityAllocXauth();
     if (strcmp (protoname, DEFAULT_PROTOCOL_ABBREV) == 0) {
-	 auth_in->name = DEFAULT_PROTOCOL;
+	 auth_in->name = copystring(DEFAULT_PROTOCOL, strlen(DEFAULT_PROTOCOL));
     }
     else
 	auth_in->name = copystring (protoname, strlen(protoname));
@@ -1916,18 +1954,18 @@ do_generate(const char *inputfilename, i
 	printf("authorization id is %ld\n", id_return);
 
     /* create a fake input line to give to do_add */
-
+    hex = bintohex(auth_return->data_length, auth_return->data);
     args[0] = "add";
     args[1] = displayname;
     args[2] = auth_in->name;
-    args[3] = bintohex(auth_return->data_length, auth_return->data);
+    args[3] = hex;
 
     status = do_add(inputfilename, lineno, 4, args);
 
     if (authdata) free(authdata);
     XSecurityFreeXauth(auth_in);
     XSecurityFreeXauth(auth_return);
-    free((char *) args[3]); /* hex data */
+    free(hex);
     XCloseDisplay(dpy);
     return status;
 }

Index: xsrc/external/mit/xconsole/dist/xconsole.c
diff -u xsrc/external/mit/xconsole/dist/xconsole.c:1.4 xsrc/external/mit/xconsole/dist/xconsole.c:1.5
--- xsrc/external/mit/xconsole/dist/xconsole.c:1.4	Thu Jul 12 10:14:50 2012
+++ xsrc/external/mit/xconsole/dist/xconsole.c	Mon Mar 17 09:20:46 2014
@@ -1,5 +1,4 @@
 /*
- * $Xorg: xconsole.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $
  *
 Copyright 1990, 1998  The Open Group
 
@@ -26,12 +25,13 @@ in this Software without prior written a
  * Author:  Keith Packard, MIT X Consortium
  */
 
-/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.31tsi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include <X11/Xfuncproto.h>
+
 #include <X11/Intrinsic.h>
 #include <X11/StringDefs.h>
 #include <X11/Xatom.h>
@@ -69,16 +69,14 @@ extern char *_XawTextGetSTRING(TextWidge
 # ifdef HAVE_UTIL_H
 #  include <util.h>
 # endif
+# ifdef HAVE_LIBUTIL_H
+#  include <libutil.h>
+# endif
 # ifdef HAVE_PTY_H
 #  include <pty.h>
 # endif
 #endif
 
-/* Fix ISC brain damage.  When using gcc fdopen isn't declared in <stdio.h>. */
-#if defined(ISC) && __STDC__ && !defined(ISC30)
-extern FILE *fdopen(int, char const *);
-#endif
-
 static void inputReady(XtPointer w, int *source, XtInputId *id);
 static long TextLength(Widget w);
 static void TextReplace(Widget w, int start, int end, XawTextBlock *block);
@@ -145,18 +143,6 @@ static XrmOptionDescRec options[] = {
     {"-saveLines",	"*saveLines",		XrmoptionSepArg,	NULL},
 };
 
-#ifdef ultrix
-#define USE_FILE
-#define FILE_NAME "/dev/xcons"
-#endif
-
-#ifdef __UNIXOS2__
-#define USE_FILE
-#define FILE_NAME "/dev/console$"
-#define INCL_DOSFILEMGR
-#define INCL_DOSDEVIOCTL
-#include <os2.h>
-#endif
 
 #ifdef linux
 #define USE_FILE
@@ -167,7 +153,7 @@ static XrmOptionDescRec options[] = {
  * devpts. This is the fallback if open file FILE_NAME fails.
  * <[email protected]>
  */
-#  define USE_PTS 
+#  define USE_PTS
 # endif
 #endif
 
@@ -189,7 +175,7 @@ static XrmOptionDescRec options[] = {
 #   include <sys/strredir.h>
 #  endif
 # endif
-# if defined(TIOCCONS) || defined(SRIOCSREDIR) || defined(Lynx)
+# if defined(TIOCCONS) || defined(SRIOCSREDIR)
 #  define USE_PTY
 static int  tty_fd, pty_fd;
 static char ttydev[64], ptydev[64];
@@ -215,11 +201,7 @@ static int child_pid;
 #ifdef __hpux
 #define PTYCHAR1        "zyxwvutsrqp"
 #else   /* !__hpux */
-#ifdef __UNIXOS2__
-#define PTYCHAR1        "pq"
-#else
 #define PTYCHAR1        "pqrstuvwxyzPQRSTUVWXYZ"
-#endif  /* !__UNIXOS2__ */
 #endif  /* !__hpux */
 #endif  /* !PTYCHAR1 */
 
@@ -235,16 +217,6 @@ static int child_pid;
 #endif  /* !__hpux */
 #endif  /* !PTYCHAR2 */
 
-#ifdef Lynx
-static void
-RestoreConsole(void)
-{
-    int fd;
-    if ((fd = open("/dev/con", O_RDONLY)) >= 0)
-	newconsole(fd);
-}
-#endif
-
 static void
 OpenConsole(void)
 {
@@ -254,7 +226,7 @@ OpenConsole(void)
 	if (!strcmp (app_resources.file, "console"))
 	{
 	    /* must be owner and have read/write permission */
-#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx) && !defined(__UNIXOS2__)
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
 	    struct stat sbuf;
 # if !defined (linux)
 	    if (!stat("/dev/console", &sbuf) &&
@@ -267,23 +239,9 @@ OpenConsole(void)
 # ifdef linux
 		if (!stat(FILE_NAME, &sbuf))
 # endif
-		input = fopen (FILE_NAME, "r");
-# ifdef __UNIXOS2__
-		if (input)
-		{
-		    ULONG arg = 1,arglen;
-		    APIRET rc;
-		    if ((rc=DosDevIOCtl(fileno(input), 0x76,0x4d,
-			&arg, sizeof(arg), &arglen,
-			NULL, 0, NULL)) != 0)
-		    {
-			fclose(input);
-			input = 0;
-		    }
-		}
-# endif
+		    input = fopen (FILE_NAME, "r");
 #endif
-		
+
 #ifdef USE_PTY
 		if (!input && get_pty (&pty_fd, &tty_fd, ttydev, ptydev) == 0)
 		{
@@ -292,7 +250,6 @@ OpenConsole(void)
 		    if (ioctl (tty_fd, TIOCCONS, (char *) &on) != -1)
 			input = fdopen (pty_fd, "r");
 # else
-#  ifndef Lynx
 		    int consfd = open("/dev/console", O_RDONLY);
 		    if (consfd >= 0)
 		    {
@@ -300,15 +257,6 @@ OpenConsole(void)
 			    input = fdopen (pty_fd, "r");
 			close(consfd);
 		    }
-#  else
-		    if (newconsole(tty_fd) < 0)
-			perror("newconsole");
-		    else
-		    {
-			input = fdopen (pty_fd, "r");
-			atexit(RestoreConsole);
-		    }
-#  endif
 # endif
 		}
 #endif /* USE_PTY */
@@ -329,16 +277,23 @@ OpenConsole(void)
 	}
 	else
 	{
-	    struct stat sbuf;
-
 	    regularFile = FALSE;
 	    if (access(app_resources.file, R_OK) == 0)
 	    {
-		input = fopen (app_resources.file, "r");
-		if (input)
-		    if (!stat(app_resources.file, &sbuf) &&
-			S_ISREG( sbuf.st_mode ) )
-			regularFile = TRUE;
+		int fd  = open (app_resources.file,
+				O_RDONLY | O_NONBLOCK | O_NOCTTY);
+		if (fd != -1) {
+		    input = fdopen (fd, "r");
+
+		    if (input) {
+			struct stat sbuf;
+
+			if ((fstat(fd, &sbuf) == 0) && S_ISREG(sbuf.st_mode))
+			    regularFile = TRUE;
+		    }
+		    else
+			close(fd);
+		}
 	    }
 	}
 	if (!input)
@@ -384,7 +339,7 @@ KillChild(int sig)
 #endif
 
 /*ARGSUSED*/
-static void
+static void _X_NORETURN
 Quit(Widget widget, XEvent *event, String *params, Cardinal *num_params)
 {
 #ifdef USE_OSM
@@ -434,7 +389,7 @@ Deiconified(Widget widget, XEvent *event
     Arg	    arglist[1];
     char    *oldName;
     char    *newName;
-    int	    oldlen;
+    size_t  oldlen;
 
     iconified = False;
     if (!app_resources.notify || !notified)
@@ -538,7 +493,7 @@ inputReady(XtPointer w, int *source, XtI
 	    stripNonprint (buffer);
 	    n = strlen (buffer);
 	}
-	
+
 	TextAppend ((Widget) text, buffer, n);
     }
 }
@@ -636,7 +591,7 @@ ConvertSelection(Widget w, Atom *selecti
     return False;
 }
 
-static void
+static void _X_NORETURN
 LoseSelection(Widget w, Atom *selection)
 {
     Quit (w, (XEvent*)NULL, (String*)NULL, (Cardinal*)NULL);
@@ -868,42 +823,6 @@ get_pty(int *pty, int *tty, char *ttydev
 #else
 	static int devindex, letter = 0;
 
-#if defined(umips) && defined (SYSTYPE_SYSV)
-	struct stat fstat_buf;
-
-	*pty = open ("/dev/ptc", O_RDWR);
-	if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0)
-	{
-	  return(1);
-	}
-	sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev));
-	sprintf (ptydev, "/dev/ptyq%d", minor(fstat_buf.st_rdev));
-	if ((*tty = open (ttydev, O_RDWR)) >= 0)
-	{
-	    /* got one! */
-	    return(0);
-	}
-	close (*pty);
-#else /* not (umips && SYSTYPE_SYSV) */
-#ifdef CRAY
-	for (; devindex < 256; devindex++) {
-	    sprintf (ttydev, "/dev/ttyp%03d", devindex);
-	    sprintf (ptydev, "/dev/pty/%03d", devindex);
-
-	    if ((*pty = open (ptydev, O_RDWR)) >= 0 &&
-		(*tty = open (ttydev, O_RDWR)) >= 0)
-	    {
-		/*
-		 * We need to set things up for our next entry
-		 * into this function!
-		 */
-		(void) devindex++;
-		return(0);
-	    }
-	    if (*pty >= 0)
-		close (*pty);
-	}
-#else /* !CRAY */
 #ifdef sgi
 	{
 	    char *slave;
@@ -939,8 +858,6 @@ get_pty(int *pty, int *tty, char *ttydev
 	    (void) letter++;
 	}
 #endif /* sgi else not sgi */
-#endif /* CRAY else not CRAY */
-#endif /* umips && SYSTYPE_SYSV */
 #endif /* USE_GET_PSEUDOTTY */
 #endif /* SVR4 */
 	/*
@@ -970,10 +887,6 @@ get_pty(int *pty, int *tty, char *ttydev
 #endif
 #endif
 
-#ifdef ISC
-#define NO_READAHEAD
-#endif
-
 static FILE *
 osm_pipe(void)
 {
@@ -984,7 +897,7 @@ osm_pipe(void)
 	return NULL;
 #if defined (_AIX)
     if ((tty = open("/dev/ptc", O_RDWR)) < 0)
-#else	    
+#else
     if ((tty = open("/dev/ptmx", O_RDWR)) < 0)
 #endif
 	return NULL;

Added files:

Index: xsrc/external/mit/xclipboard/dist/compile
diff -u /dev/null xsrc/external/mit/xclipboard/dist/compile:1.3
--- /dev/null	Mon Mar 17 09:20:46 2014
+++ xsrc/external/mit/xclipboard/dist/compile	Mon Mar 17 09:20:46 2014
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Written by Tom Tromey <[email protected]>.
+#
+# This program 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, 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, see <http://www.gnu.org/licenses/>.
+
+# 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.
+
+# This file is maintained in Automake, please report
+# bugs to <[email protected]> or send patches to
+# <[email protected]>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""	$nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+	# lazily determine how to convert abs files
+	case `uname -s` in
+	  MINGW*)
+	    file_conv=mingw
+	    ;;
+	  CYGWIN*)
+	    file_conv=cygwin
+	    ;;
+	  *)
+	    file_conv=wine
+	    ;;
+	esac
+      fi
+      case $file_conv/,$2, in
+	*,$file_conv,*)
+	  ;;
+	mingw/*)
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+	  ;;
+	cygwin/*)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
+	wine/*)
+	  file=`winepath -w "$file" || echo "$file"`
+	  ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  found=no
+  save_IFS=$IFS
+  IFS=';'
+  for dir in $lib_path $LIB
+  do
+    IFS=$save_IFS
+    if $shared && test -f "$dir/$lib.dll.lib"; then
+      found=yes
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+	-o)
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
+	  eat=1
+	  case $2 in
+	    *.o | *.[oO][bB][jJ])
+	      func_file_conv "$2"
+	      set x "$@" -Fo"$file"
+	      shift
+	      ;;
+	    *)
+	      func_file_conv "$2"
+	      set x "$@" -Fe"$file"
+	      shift
+	      ;;
+	  esac
+	  ;;
+	-I)
+	  eat=1
+	  func_file_conv "$2" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-I*)
+	  func_file_conv "${1#-I}" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-l)
+	  eat=1
+	  func_cl_dashl "$2"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-l*)
+	  func_cl_dashl "${1#-l}"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-L)
+	  eat=1
+	  func_cl_dashL "$2"
+	  ;;
+	-L*)
+	  func_cl_dashL "${1#-L}"
+	  ;;
+	-static)
+	  shared=false
+	  ;;
+	-Wl,*)
+	  arg=${1#-Wl,}
+	  save_ifs="$IFS"; IFS=','
+	  for flag in $arg; do
+	    IFS="$save_ifs"
+	    linker_opts="$linker_opts $flag"
+	  done
+	  IFS="$save_ifs"
+	  ;;
+	-Xlinker)
+	  eat=1
+	  linker_opts="$linker_opts $2"
+	  ;;
+	-*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+	  func_file_conv "$1"
+	  set x "$@" -Tp"$file"
+	  shift
+	  ;;
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+	  func_file_conv "$1" mingw
+	  set x "$@" "$file"
+	  shift
+	  ;;
+	*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
+case $1 in
+  '')
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <[email protected]>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
+	# So we strip '-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no '-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # '.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:

Index: xsrc/external/mit/xfd/dist/compile
diff -u /dev/null xsrc/external/mit/xfd/dist/compile:1.3
--- /dev/null	Mon Mar 17 09:20:46 2014
+++ xsrc/external/mit/xfd/dist/compile	Mon Mar 17 09:20:46 2014
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Written by Tom Tromey <[email protected]>.
+#
+# This program 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, 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, see <http://www.gnu.org/licenses/>.
+
+# 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.
+
+# This file is maintained in Automake, please report
+# bugs to <[email protected]> or send patches to
+# <[email protected]>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""	$nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+	# lazily determine how to convert abs files
+	case `uname -s` in
+	  MINGW*)
+	    file_conv=mingw
+	    ;;
+	  CYGWIN*)
+	    file_conv=cygwin
+	    ;;
+	  *)
+	    file_conv=wine
+	    ;;
+	esac
+      fi
+      case $file_conv/,$2, in
+	*,$file_conv,*)
+	  ;;
+	mingw/*)
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+	  ;;
+	cygwin/*)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
+	wine/*)
+	  file=`winepath -w "$file" || echo "$file"`
+	  ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  found=no
+  save_IFS=$IFS
+  IFS=';'
+  for dir in $lib_path $LIB
+  do
+    IFS=$save_IFS
+    if $shared && test -f "$dir/$lib.dll.lib"; then
+      found=yes
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+	-o)
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
+	  eat=1
+	  case $2 in
+	    *.o | *.[oO][bB][jJ])
+	      func_file_conv "$2"
+	      set x "$@" -Fo"$file"
+	      shift
+	      ;;
+	    *)
+	      func_file_conv "$2"
+	      set x "$@" -Fe"$file"
+	      shift
+	      ;;
+	  esac
+	  ;;
+	-I)
+	  eat=1
+	  func_file_conv "$2" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-I*)
+	  func_file_conv "${1#-I}" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-l)
+	  eat=1
+	  func_cl_dashl "$2"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-l*)
+	  func_cl_dashl "${1#-l}"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-L)
+	  eat=1
+	  func_cl_dashL "$2"
+	  ;;
+	-L*)
+	  func_cl_dashL "${1#-L}"
+	  ;;
+	-static)
+	  shared=false
+	  ;;
+	-Wl,*)
+	  arg=${1#-Wl,}
+	  save_ifs="$IFS"; IFS=','
+	  for flag in $arg; do
+	    IFS="$save_ifs"
+	    linker_opts="$linker_opts $flag"
+	  done
+	  IFS="$save_ifs"
+	  ;;
+	-Xlinker)
+	  eat=1
+	  linker_opts="$linker_opts $2"
+	  ;;
+	-*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+	  func_file_conv "$1"
+	  set x "$@" -Tp"$file"
+	  shift
+	  ;;
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+	  func_file_conv "$1" mingw
+	  set x "$@" "$file"
+	  shift
+	  ;;
+	*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
+case $1 in
+  '')
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <[email protected]>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
+	# So we strip '-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no '-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # '.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:

Reply via email to