diff --git a/ldiskfs/configure.ac b/ldiskfs/configure.ac
index 322b6c4d635abc782d4f3e5af761d1935eac90ac..fee6f5689c6d95c1471affa6341ff57e9f38c102 100644
--- a/ldiskfs/configure.ac
+++ b/ldiskfs/configure.ac
@@ -92,9 +92,13 @@ case $LINUXRELEASE in
 2.6.12*) LDISKFS_SERIES="2.6.12-vanilla.series" ;;
 2.6.15*) LDISKFS_SERIES="2.6-fc5.series";;
 2.6.16*) LDISKFS_SERIES="2.6-sles10.series";;
-2.6.18-*el5*) LDISKFS_SERIES="2.6-rhel5.series";;
-2.6.18-*prep*) LDISKFS_SERIES="2.6-rhel5.series";;
-2.6.18*) LDISKFS_SERIES="2.6.18-vanilla.series";;
+2.6.18*)
+	if test x$RHEL_KENEL = xyes; then
+		LDISKFS_SERIES="2.6-rhel5.series"
+	else
+		LDISKFS_SERIES="2.6.18-vanilla.series"
+	fi
+	;;
 2.6.22*) LDISKFS_SERIES="2.6.22-vanilla.series";;
 *) AC_MSG_WARN([Unknown kernel version $LINUXRELEASE, fix ldiskfs/configure.ac])
 esac