gallium: replace assertion with conditional/recovery code
[mesa.git] / bin / mklib
index 0637662ff7c27e0256902f67a19a9b330a0696e0..031e049c615584ea026de641d30aa3e96e30518e 100755 (executable)
--- a/bin/mklib
+++ b/bin/mklib
@@ -100,6 +100,13 @@ do
        -L*)
            DEPS="$DEPS $1"
            ;;
+       -pthread)
+           # this is a special case (see bugzilla 10876)
+           DEPS="$DEPS $1"
+           ;;
+       '-pthread')
+           DEPS="$DEPS -pthread"
+           ;;
        '-cplusplus')
            CPLUSPLUS=1
            ;;
@@ -195,8 +202,13 @@ case $ARCH in
        if [ $NOPREFIX = 1 ] ; then
            # No "lib" or ".so" part
            echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
-           #OPTS="-shared -Wl,-soname,${LIBNAME}"  # soname???
-           OPTS="-shared"
+           case $ARCH in 'Linux' | 'GNU' | GNU/*)
+               OPTS="-Xlinker -Bsymbolic -shared"
+           ;;
+           *)
+               OPTS="-shared"
+           ;;
+           esac
 
            # Check if objects are 32-bit and we're running in 64-bit
            # environment.  If so, pass -m32 flag to linker.
@@ -212,15 +224,16 @@ case $ARCH in
             # finish up
             FINAL_LIBS="${LIBNAME}"
         elif [ $STATIC = 1 ] ; then
-           LIBNAME="lib${LIBNAME}"     # prefix with "lib"
-            echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
+            LIBNAME="lib${LIBNAME}.a"     # prefix with "lib", suffix with ".a"
+            echo "mklib: Making" $ARCH "static library: " ${LIBNAME}
             LINK="ar"
             OPTS="-ru"
+            rm -f ${LIBNAME}
             # make lib
-            ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
-           ranlib ${LIBNAME}.a
+            ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
+            ranlib ${LIBNAME}
             # finish up
-            FINAL_LIBS=${LIBNAME}.a
+            FINAL_LIBS=${LIBNAME}
         else
            LIBNAME="lib${LIBNAME}"     # prefix with "lib"
            case $ARCH in 'Linux' | 'GNU' | GNU/*)
@@ -233,7 +246,7 @@ case $ARCH in
            if [ $EXPORTS ] ; then
                #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
                # Make the 'exptmp' file for --version-script option
-               echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
+               echo "{" > exptmp
                echo "global:" >> exptmp
                sed 's/$/;/' ${EXPORTS} >> exptmp
                echo "local:" >> exptmp
@@ -283,7 +296,9 @@ case $ARCH in
            ar -ruv ${LIBNAME} ${OBJECTS}
            FINAL_LIBS=${LIBNAME}
        else
-           LIBNAME="lib${LIBNAME}.so"
+           if [ $NOPREFIX = 0 ] ; then
+               LIBNAME="lib${LIBNAME}.so"
+           fi
            echo "mklib: Making SunOS shared library: " ${LIBNAME}
 
            if [ "x$LINK" = "x" ] ; then
@@ -333,9 +348,14 @@ case $ARCH in
 
            # for debug:
            #echo "mklib: linker is" ${LINK} ${OPTS}
-           rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
-           ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
-           ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
+           if [ $NOPREFIX = 1 ] ; then
+               rm -f ${LIBNAME}
+               ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+           else
+               rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
+               ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
+               ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
+           fi
            FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
        fi
        ;;