--- /tmp/mklib	2007-12-08 11:03:23.000000000 +0100
+++ Mesa-7.0.2/bin/mklib	2007-12-08 11:04:02.509863000 +0100
@@ -106,6 +106,9 @@
 	-L*)
 	    DEPS="$DEPS $1"
 	    ;;
+        -Wl*)
+            DEPS="$DEPS $1"
+            ;;
 	-pthread)
 	    # this is a special case (see bugzilla 10876)
 	    DEPS="$DEPS $1"
--- /tmp/default	2007-12-08 11:04:17.000000000 +0100
+++ Mesa-7.0.2/configs/default	2007-12-08 11:05:06.279863000 +0100
@@ -76,7 +76,7 @@
 GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11
 
 # Program dependencies - specific GL/glut libraries added in Makefiles
-APP_LIB_DEPS = -lm
+APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lm