1 diff --git a/configure.ac b/configure.ac
2 index 1cf877d..0cf0974 100644
5 @@ -34,6 +34,9 @@ AC_SYS_LARGEFILE
7 pkgconfigdir=${libdir}/pkgconfig
9 +AC_ARG_ENABLE(udev, AS_HELP_STRING([--enable-udev],
10 + [Enable support for using udev instead of mknod (default: disabled)]),
11 + [UDEV=$enableval], [UDEV=no])
14 dnl ===========================================================================
15 @@ -101,6 +104,10 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
16 AC_MSG_CHECKING([which warning flags were supported])])
17 WARN_CFLAGS="$libdrm_cv_warn_cflags"
19 +if test "x$UDEV" = xyes; then
20 + AC_DEFINE(UDEV, 1, [Have UDEV support])
26 diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
27 index 150dd5f..5d8819a 100644
28 --- a/libdrm/xf86drm.c
29 +++ b/libdrm/xf86drm.c
30 @@ -297,6 +297,7 @@ static int drmOpenDevice(long dev, int minor)
31 group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
35 if (stat(DRM_DIR_NAME, &st)) {
37 return DRM_ERR_NOT_ROOT;
38 @@ -317,6 +318,30 @@ static int drmOpenDevice(long dev, int minor)
39 chown(buf, user, group);
43 + /* if we modprobed then wait for udev */
47 + if (stat(DRM_DIR_NAME, &st)) {
51 + if (udev_count == 50)
56 + if (stat(buf, &st)) {
60 + if (udev_count == 50)
67 fd = open(buf, O_RDWR, 0);
68 drmMsg("drmOpenDevice: open result is %d, (%s)\n",