Index: lib/configure.m4
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/configure.m4,v
retrieving revision 1.92
diff -u -p -r1.92 configure.m4
--- lib/configure.m4	2005/02/17 13:21:08	1.92
+++ lib/configure.m4	2005/02/25 23:43:04
@@ -31,31 +31,53 @@ changequote([,])dnl
 MSG_CHECKING($1)
 MSG_RESULT(($3))
 $2=
-for ac_prog in $3
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog ; ac_word=$[2]
-if test -n "$ac_word"; then
-  MSG_CHECKING([for \"$ac_word\"],[+])
-  IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -x [$ac_dir/$ac_word]; then
-      $2="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
 
-  if test -n "[$]$2"; then
-    ac_result=yes
-    ifelse($4,,,[$4])
-  else
-    ac_result=no
-  fi
-  MSG_RESULT($ac_result)
-  test -n "[$]$2" && break
-fi
+ac_save_path=$PATH
+
+# Try additional paths from $ac_prefix_candidates in outer loop
+for ac_pathprefix in "$ac_pathprefix_list" $ac_pathprefix_candidates; do
+	for ac_prog in $3
+	do
+        PATH=$ac_pathprefix:ac_save_path
+	    # Extract the first word of "$ac_prog", so it can be a program name with args.
+	    set dummy $ac_prog ; ac_word=$[2]
+	    if test -n "$ac_word"; then
+	      MSG_CHECKING([for \"$ac_word\"],[+])
+	      IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
+	      for ac_dir in $PATH; do
+	        test -z "$ac_dir" && ac_dir=.
+	        if test -x [$ac_dir/$ac_word]; then
+	          $2="$ac_prog"
+	          break
+	        fi
+	      done
+	      IFS="$ac_save_ifs"
+	
+	      PATH=$ac_save_path
+	
+	      if test -n "[$]$2"; then
+	        ac_result=yes
+	        ifelse($4,,,[$4])
+	      else
+	        ac_result=no
+	      fi
+	      MSG_RESULT($ac_result)
+	      test -n "[$]$2" && break
+	    fi
+	done
+    # also exit the outer loop if found
+    if test -n "[$]$2"; then
+        # check if program was found in additional path
+        if test "$ac_pathprefix" != "$ac_pathprefix_list"; then
+            echo "+adding $ac_pathprefix to path_prefix."
+            if test -n "$ac_pathprefix_list"; then
+                ac_pathprefix_list="$ac_pathprefix_list:$ac_pathprefix"
+            else
+                ac_pathprefix_list="$ac_pathprefix"
+            fi            
+        fi
+        break
+    fi
 done
 
 if test -z "[$]$2" ; then
@@ -203,6 +225,9 @@ for dir in bind clipart doc examples hel
   test ! -d $dir && mkdir $dir
 done
 
+####
+ac_pathprefix_list=
+ac_pathprefix_candidates="/usr/local/bin /opt/local/bin /sw/bin /usr/local/teTeX/bin/powerpc-apple-darwin-current/"
 
 #### Searching some useful programs
 define(CHECKLATEX2E,[
@@ -701,6 +726,12 @@ if test ! $num = 0 ; then
 fi
 rm -f xfonts/tmpfonts
 
+# remember pathprefix if necessary
+
+if test -n $ac_pathprefix_list; then
+  echo "\\path_prefix $ac_pathprefix_list" >> $outfile
+  echo "+++ system path prefix is: $ac_pathprefix_list"
+fi
 
 # Remove superfluous files if we are not writing in the main lib
 # directory
Index: src/lyx_main.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyx_main.C,v
retrieving revision 1.203
diff -u -p -r1.203 lyx_main.C
--- src/lyx_main.C	2005/02/20 19:09:40	1.203
+++ src/lyx_main.C	2005/02/25 23:43:05
@@ -480,6 +480,8 @@ void LyX::init(bool gui)
 	os::cygwin_path_fix(lyxrc.cygwin_path_fix);
 	if (!lyxrc.path_prefix.empty())
 		prependEnvPath("PATH", lyxrc.path_prefix);
+	else if (!system_lyxrc.path_prefix.empty())
+		prependEnvPath("PATH", system_lyxrc.path_prefix);
 
 	// Having reset the PATH we're now in a position to run configure
 	// if necessary.
