--- opengl.eselect.save	2010-07-28 18:33:43.566634518 +0200
+++ opengl.eselect.fixed.reviewable	2010-07-30 13:10:05.724012250 +0200
@@ -135,6 +135,7 @@ set_new_implementation() {
 	local avail_implems=$(get_implementations)
 	local libdir
 	local gl_local
+	local gl_dir
 	local moduledir
 
 	# Set a sane umask... bug #83115
@@ -167,14 +168,19 @@ set_new_implementation() {
 			# If even mesa is not around then simply die
 			if [[ -d "${PREFIX}/${libdir}/opengl/${gl_implem}" ]] ; then
 				gl_local="${gl_implem}"
+				gl_dir="${libdir}"
 			else
 				if [[ -d "${PREFIX}/${libdir}/opengl/xorg-x11" ]]; then
 					gl_local="xorg-x11"
-				else
-					# bail out, no implementation around
-					die -q "No proper ${gl_implem} or xorg-x11 opengl implementation found"
+					gl_dir="${libdir}"
 				fi
 			fi
+		done
+
+		if [[ ! -n "${gl_dir}" ]] ; then
+					# bail out, no implementation around
+					die -q "No proper ${gl_implem} or xorg-x11 opengl implementation found"
+		fi
 
 			setup_lib_symlinks \
 				"${PREFIX}/${libdir}/opengl/${gl_local}/lib" \
@@ -199,7 +205,6 @@ set_new_implementation() {
 
 			# Setup the $LDPATH
 			ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib"
-		done
 
 		store_config ${ENV_FILE} LDPATH "${ldpath}"
 		store_config ${ENV_FILE} OPENGL_PROFILE "${gl_implem}"