remove the -dlopen option. Always make both kinds of libs for AIX, Darwin.

This commit is contained in:
Brian Paul
2006-04-13 15:17:50 +00:00
parent cbed2f8061
commit 56e0ee8efe

View File

@@ -5,7 +5,7 @@
# Improvements/fixes are welcome. # Improvements/fixes are welcome.
# Copyright (C) 1999-2005 Brian Paul All Rights Reserved. # Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"), # copy of this software and associated documentation files (the "Software"),
@@ -36,7 +36,6 @@ DEPS=""
LINK="" LINK=""
CPLUSPLUS=0 CPLUSPLUS=0
STATIC=0 STATIC=0
DLOPEN=0
INSTALLDIR="." INSTALLDIR="."
ARCH="auto" ARCH="auto"
ARCHOPT="" ARCHOPT=""
@@ -65,7 +64,6 @@ do
echo ' Not observed on all systems at this time.' echo ' Not observed on all systems at this time.'
echo ' -cplusplus link with C++ runtime' echo ' -cplusplus link with C++ runtime'
echo ' -static make a static library (default is dynamic/shared)' echo ' -static make a static library (default is dynamic/shared)'
echo ' -dlopen make a shared library suitable for dynamic loading'
echo ' -install DIR put resulting library file(s) in DIR' echo ' -install DIR put resulting library file(s) in DIR'
echo ' -arch ARCH override using `uname` to determine host system' echo ' -arch ARCH override using `uname` to determine host system'
echo ' -archopt OPT specify an extra achitecture-specific option OPT' echo ' -archopt OPT specify an extra achitecture-specific option OPT'
@@ -106,9 +104,6 @@ do
'-static') '-static')
STATIC=1 STATIC=1
;; ;;
'-dlopen')
DLOPEN=1
;;
'-install') '-install')
shift 1; shift 1;
INSTALLDIR=$1 INSTALLDIR=$1
@@ -214,8 +209,10 @@ case $ARCH in
elif [ $STATIC = 1 ] ; then elif [ $STATIC = 1 ] ; then
LIBNAME="lib${LIBNAME}" # prefix with "lib" LIBNAME="lib${LIBNAME}" # prefix with "lib"
echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
rm -f ${LIBNAME}.a LINK="ar"
ar -ru ${LIBNAME}.a ${OBJECTS} OPTS="-ru"
# make lib
${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
ranlib ${LIBNAME}.a ranlib ${LIBNAME}.a
# finish up # finish up
FINAL_LIBS=${LIBNAME}.a FINAL_LIBS=${LIBNAME}.a
@@ -323,11 +320,8 @@ case $ARCH in
if [ "$ARCHOPT" = "SUNV9" ] ; then if [ "$ARCHOPT" = "SUNV9" ] ; then
ARCHOPTS="-xarch=v9" ARCHOPTS="-xarch=v9"
fi fi
echo "mklib: linker is" ${LINK} ${OPTS} ${ARCHOPTS}
# for debug: # for debug:
#echo "mklib: linker is" ${LINK} ${OPTS} #echo "mklib: linker is" ${LINK} ${OPTS} ${ARCHOPTS}
rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
${LINK} ${OPTS} ${ARCHOPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} ${LINK} ${OPTS} ${ARCHOPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
@@ -459,16 +453,18 @@ case $ARCH in
if [ $STATIC = 1 ] ; then if [ $STATIC = 1 ] ; then
LIBNAME="lib${LIBNAME}.a" LIBNAME="lib${LIBNAME}.a"
echo "mklib: Making AIX static library: " ${LIBNAME} echo "mklib: Making AIX static library: " ${LIBNAME}
rm -f ${LIBNAME}
ar -ruv ${X64} ${LIBNAME} ${OBJECTS} ar -ruv ${X64} ${LIBNAME} ${OBJECTS}
FINAL_LIBS=${LIBNAME} FINAL_LIBS=${LIBNAME}
else else
# We make both .a (normal shared lib) and .so (which can be
# loaded with dlopen).
EXPFILE="lib${LIBNAME}.exp" EXPFILE="lib${LIBNAME}.exp"
if [ $ARCH = "AIX64" ] ; then if [ $ARCH = "AIX64" ] ; then
OFILE=shr_64.o OFILE=shr_64.o
else else
OFILE=shr.o #Want to be consistent with the IBM libGL.a OFILE=shr.o #Want to be consistent with the IBM libGL.a
fi fi
DLOPENLIBNAME="lib${LIBNAME}.so" # different libs required for dlopen
LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries
if [ $ARCH = "AIX64" ] ; then if [ $ARCH = "AIX64" ] ; then
OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry -q64" OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry -q64"
@@ -495,13 +491,13 @@ case $ARCH in
# On AIX a shared library is linked differently when # On AIX a shared library is linked differently when
# you want to dlopen the file # you want to dlopen the file
if [ $DLOPEN = "1" ] ; then cc -G ${OPTS} -o ${DLOPENLIBNAME} ${OBJECTS} ${DEPS}
cc -G ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
else # Traditional link-time binding compatible with system lib
cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS} cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS}
ar ${X64} -r ${LIBNAME} ${OFILE} ar ${X64} -r ${LIBNAME} ${OFILE}
fi
FINAL_LIBS="${LIBNAME}" FINAL_LIBS="${LIBNAME} ${DLOPENLIBNAME}"
fi fi
;; ;;
@@ -546,20 +542,23 @@ case $ARCH in
${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
FINAL_LIBS=${LIBNAME} FINAL_LIBS=${LIBNAME}
else else
# may need these:
# CFLAGS += -fno-common
# LDFLAGS += -bundle -flat_namespace -undefined suppress
# On Darwin a .bundle is used for a library that you want to dlopen # On Darwin a .bundle is used for a library that you want to dlopen
if [ $DLOPEN = "1" ] ; then FLAGS="${ARCHOPT} -bundle -multiply_defined suppress"
LIBSUFFIX="bundle" BLINKNAME="lib${LIBNAME}.bundle"
FLAGS="${ARCHOPT} -bundle -multiply_defined suppress" BLIBNAME="lib${LIBNAME}.${MAJOR}.bundle"
else echo "mklib: Making Darwin bundle: " ${BLIBNAME}
LIBSUFFIX="dylib" if [ $CPLUSPLUS = 1 ] ; then
FLAGS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" LINK="g++"
fi else
LINKNAME="lib${LIBNAME}.${LIBSUFFIX}" LINK="cc"
LIBNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" fi
${LINK} ${FLAGS} -o ${BLIBNAME} ${OBJECTS} ${DEPS}
ln -s ${BLIBNAME} ${BLINKNAME}
# A .dylib is for link-time binding
FLAGS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}"
LINKNAME="lib${LIBNAME}.dylib"
LIBNAME="lib${LIBNAME}.${MAJOR}.dylib"
echo "mklib: Making Darwin shared library: " ${LIBNAME} echo "mklib: Making Darwin shared library: " ${LIBNAME}
if [ $CPLUSPLUS = 1 ] ; then if [ $CPLUSPLUS = 1 ] ; then
LINK="g++" LINK="g++"
@@ -568,7 +567,8 @@ case $ARCH in
fi fi
${LINK} ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} ${LINK} ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME} ${LINKNAME} ln -s ${LIBNAME} ${LINKNAME}
FINAL_LIBS="${LIBNAME} ${LINKNAME}"
FINAL_LIBS="${LIBNAME} ${LINKNAME} ${BLIBNAME} ${BLINKNAME}"
fi fi
;; ;;