diff --git xf86-video-fbdev-clean/configure.ac xf86-video-fbdev-workdir/configure.ac
index 27778cd..67436db 100644
--- xf86-video-fbdev-clean/configure.ac
+++ xf86-video-fbdev-workdir/configure.ac
@@ -86,6 +86,8 @@ AC_SUBST([moduledir])
 DRIVER_NAME=fbdev
 AC_SUBST([DRIVER_NAME])
 
+AC_SUBST([SYSROOT])
+
 AC_CONFIG_FILES([
                 Makefile
                 src/Makefile
diff --git xf86-video-fbdev-clean/src/Makefile.am xf86-video-fbdev-workdir/src/Makefile.am
index fbe420e..1ef5f49 100644
--- xf86-video-fbdev-clean/src/Makefile.am
+++ xf86-video-fbdev-workdir/src/Makefile.am
@@ -25,7 +25,7 @@
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
 AM_CFLAGS = @XORG_CFLAGS@
 fbdev_drv_la_LTLIBRARIES = fbdev_drv.la
-fbdev_drv_la_LDFLAGS = -module -avoid-version
+fbdev_drv_la_LDFLAGS = -module -avoid-version -R@moduledir@ -L@SYSROOT@@moduledir@ -lfbdevhw -lshadow
 fbdev_drv_ladir = @moduledir@/drivers
 
 fbdev_drv_la_SOURCES = \
diff --git xf86-video-fbdev-clean/src/fbdev.c xf86-video-fbdev-workdir/src/fbdev.c
index f25ef72..7facb9f 100644
--- xf86-video-fbdev-clean/src/fbdev.c
+++ xf86-video-fbdev-workdir/src/fbdev.c
@@ -339,7 +339,7 @@ FBDevProbe(DriverPtr drv, int flags)
 
 	    dev = xf86FindOptionValue(devSections[i]->options,"fbdev");
 	    if (devSections[i]->busID) {
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 	        if (xf86ParsePciBusString(devSections[i]->busID,&bus,&device,
 					  &func)) {
 		    if (!xf86CheckPciSlot(bus,device,func))
@@ -358,7 +358,7 @@ FBDevProbe(DriverPtr drv, int flags)
 	    if (fbdevHWProbe(NULL,dev,NULL)) {
 		pScrn = NULL;
 		if (isPci) {
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 		    /* XXX what about when there's no busID set? */
 		    int entity;
 		    
@@ -444,6 +444,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
 	fPtr->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
 
 #ifndef XSERVER_LIBPCIACCESS
+#if 0
 	pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
 	/* XXX Is this right?  Can probably remove RAC_FB */
 	pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
@@ -454,6 +455,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
 		   "xf86RegisterResources() found resource conflicts\n");
 		return FALSE;
 	}
+#endif
 #else
 	if (fPtr->pEnt->location.type == BUS_PCI)
 	    pci_dev = fPtr->pEnt->location.id.pci;
@@ -1010,7 +1012,7 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
 	fPtr->CloseScreen = pScreen->CloseScreen;
 	pScreen->CloseScreen = FBDevCloseScreen;
 
-#if XV
+#ifdef XV
 	{
 	    XF86VideoAdaptorPtr *ptr;
 
