This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: fix DOS absolute path handling in configure



DJ Delorie wrote:
> It's not often you see a smiley in a patch.  Could we add some
> specific test at the beginning to trap cases where the path has a
> drive letter, but is not absolute?  Configure will have a hard time
> with those.

A good idea. Of course, nobody uses yet another DOS brain damage 'c:file'
nowadays, but the patch is below. Feel free to tweak error messages.

2001-01-02  Laurynas Biveinis  <lauras@softhome.net>

	* configure: update copyright years.  Check if ${cache_file} is not
	a relative path with drive letter.  Set up ${makesrcdir} right after
	${srcdir}.  Check if the later is not a relative path with drive letters.

--- configure.old	Tue Jan  2 17:41:16 2001
+++ configure	Tue Jan  2 19:00:16 2001
@@ -3,7 +3,7 @@
 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
 
 # Configuration script
-# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -227,6 +227,18 @@
 		;;
 	--cache*)
 		cache_file=$optarg
+	 	# Check if cache file name is valid
+		case "${cache_file}" in
+		/* | [A-Za-z]:[\\/]* ) # absolute path is OK
+			;;
+                [A-Za-z]:*) # Relative path with a drive letter is not OK
+	                echo '***' "${progname}: cache file ${cache_file} is a relative path with drive letter" 1>&2
+		        echo '***' "Please specify absolute path or relative one without drive letter" 1>&2
+		        exit 1
+		        ;;
+		*) 
+			;;
+		esac
 		;;
 	--da*)
 		datadir=$optarg
@@ -571,6 +583,25 @@
 	if [ "${pwd}" = "${srcpwd}" ] ; then
 		srcdir=.
 	fi
+        ### Also set up makesrcdir
+        case "${srcdir}" in
+            ".")  # no -srcdir option.  We're building in place.
+                   makesrcdir=. ;;
+            /* | [A-Za-z]:[\\/]* ) # absolute path
+                   makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
+                   ;;
+    	    [A-Za-z]:*) # Relative path with a drive letter
+		   echo '***' "${progname}: source dir ${srcdir} is a relative path with drive letter" 1>&2
+		   echo '***' "Please specify absolute path or relative one without drive letter" 1>&2
+		   exit 1
+		   ;;
+            *) # otherwise relative
+                   case "${subdir}" in
+                     .) makesrcdir=${srcdir} ;;
+                     *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
+                   esac
+                   ;;
+        esac
 esac
 
 ### warn about some conflicting configurations.
@@ -1092,20 +1123,6 @@
     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
 
-    ### figure out what to do with srcdir
-    case "${srcdir}" in
-        ".")  # no -srcdir option.  We're building in place.
-                makesrcdir=. ;;
-        /* | [A-Za-z]:[\\/]* ) # absolute path
-                makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
-                ;;
-        *) # otherwise relative
-                case "${subdir}" in
-                .) makesrcdir=${srcdir} ;;
-                *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
-                esac
-                ;;
-    esac
 
     if [ "${subdir}/" != "./" ] ; then
         Makefile=${subdir}/Makefile
@@ -1320,6 +1337,10 @@
 EOF
 	    esac
 
+	    # No need to check for unsupported relative paths with
+	    # drive letters below - ${*_makefile_frag} are constructed
+	    # from ${srcdir}, which has been already checked.
+
             case "${package_makefile_frag}" in
               "") ;;
               /* | [A-Za-z]:[\\/]* ) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]