1515# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1616# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717
18- OCONFIGURE_VERSION=" 0.5.1 "
18+ OCONFIGURE_VERSION=" 1.0.0 "
1919
2020#
2121# This script outputs two files: config.h and Makefile.configure.
@@ -131,7 +131,9 @@ LDADD_SCAN_SCALED=
131131LDADD_STATIC=
132132CPPFLAGS=
133133LDFLAGS=
134+ LINKER_SOFLAG=
134135LINKER_SONAME=
136+ LINKER_SOSUFFIX=
135137DESTDIR=
136138PREFIX=" /usr/local"
137139BINDIR=
192194 LDLIBS=" $val " ;;
193195 LDFLAGS)
194196 LDFLAGS=" $val " ;;
197+ LINKER_SOFLAG)
198+ LINKER_SOFLAG=" $val " ;;
195199 LINKER_SONAME)
196200 LINKER_SONAME=" $val " ;;
201+ LINKER_SOSUFFIX)
202+ LINKER_SOSUFFIX=" $val " ;;
197203 CPPFLAGS)
198204 CPPFLAGS=" $val " ;;
199205 DESTDIR)
217223 esac
218224done
219225
226+ # ----------------------------------------------------------------------
227+ # If the user doesn't specify how to link shared libraries, try
228+ # "-shared" or "-dynamiclib", the latter of which is Mac OS X only at
229+ # the moment. Also set the proper shared library suffix.
230+ #
231+ # This is for link-time shared library generation only: the "-shared"
232+ # should be used for creating dynamically-loaded libraries on all
233+ # Unix-like systems.
234+
235+ if [ -z " $LINKER_SOFLAG " ]
236+ then
237+ test_soname=" ` mktemp` " || {
238+ echo " mktemp: failed" 1>&2
239+ echo " mktemp: failed" 1>&3
240+ exit 1
241+ }
242+ echo " int foo(void) { return 1; }" > " ${test_soname} .c"
243+ ${CC} -fPIC -o ${test_soname} .o -c ${test_soname} .c || {
244+ echo " ${CC} -fPIC -o ${test_soname} .o -c ${test_soname} .c: failed" 1>&2
245+ echo " ${CC} -fPIC -o ${test_soname} .o -c ${test_soname} .c: failed" 1>&3
246+ }
247+ LINKER_SOFLAG=" -dynamiclib"
248+ LINKER_SOSUFFIX=" dylib"
249+ echo " LINKER_SOSUFFIX: testing ${LINKER_SOFLAG} " 1>&3
250+ ${CC} ${LINKER_SOFLAG} -o ${test_soname} .${LINKER_SOSUFFIX} .0 \
251+ ${test_soname} .o 2> /dev/null || {
252+ LINKER_SOFLAG=" -shared"
253+ LINKER_SOSUFFIX=" so"
254+ echo " LINKER_SOFLAG: testing ${LINKER_SOFLAG} " 1>&3
255+ ${CC} ${LINKER_SOFLAG} -o ${test_soname} .${LINKER_SOSUFFIX} .0 \
256+ ${test_soname} .o || {
257+ echo " LINKER_SOFLAG: cannot determine: default to -shared" 1>&2
258+ echo " LINKER_SOFLAG: cannot determine: default to -shared" 1>&3
259+ }
260+ }
261+ echo " LINKER_SOFLAG: $LINKER_SOFLAG " 1>&3
262+ echo " LINKER_SOSUFFIX: $LINKER_SOSUFFIX " 1>&3
263+ rm -f " $test_soname " " ${test_soname} .*"
264+ fi
265+
266+ if [ -z " $LINKER_SOSUFFIX " ]
267+ then
268+ if [ " $LINKER_SOFLAG " = " -shared" ]
269+ then
270+ LINKER_SOSUFFIX=" so"
271+ else
272+ LINKER_SOSUFFIX=" dylib"
273+ fi
274+ echo " LINKER_SOSUFFIX: $LINKER_SOSUFFIX " 1>&3
275+ fi
276+
220277# ----------------------------------------------------------------------
221278# If the user doesn't specify whether we want "-soname" or
222279# "-install_name" for the linker option to generate shared libraries,
@@ -237,10 +294,12 @@ then
237294 }
238295 LINKER_SONAME=" -soname"
239296 echo " LINKER_SONAME: testing -soname" 1>&3
240- ${CC} -shared -o ${test_soname} .so.0 ${test_soname} .o -Wl,${LINKER_SONAME} ,${test_soname} .so.0 || {
297+ ${CC} -shared -o ${test_soname} .so.0 ${test_soname} .o \
298+ -Wl,${LINKER_SONAME} ,${test_soname} .so.0 2> /dev/null || {
241299 LINKER_SONAME=" -install_name"
242300 echo " LINKER_SONAME: testing -install_name" 1>&3
243- ${CC} -shared -o ${test_soname} .so.0 ${test_soname} .o -Wl,-install_name,${test_soname} .so.0 || {
301+ ${CC} -shared -o ${test_soname} .so.0 ${test_soname} .o \
302+ -Wl,-install_name,${test_soname} .so.0 || {
244303 echo " LINKER_SONAME: cannot determine: default to -soname" 1>&2
245304 echo " LINKER_SONAME: cannot determine: default to -soname" 1>&3
246305 LINKER_SONAME=" -soname"
@@ -2559,8 +2618,9 @@ LDADD_SHA2 = ${LDADD_SHA2}
25592618LDADD_SCAN_SCALED= ${LDADD_SCAN_SCALED}
25602619LDADD_STATIC = ${LDADD_STATIC}
25612620LDFLAGS = ${LDFLAGS}
2621+ LINKER_SOFLAG = ${LINKER_SOFLAG}
25622622LINKER_SONAME = ${LINKER_SONAME}
2563- STATIC = ${STATIC }
2623+ LINKER_SOSUFFIX = ${LINKER_SOSUFFIX }
25642624PREFIX = ${PREFIX}
25652625BINDIR = ${BINDIR}
25662626SHAREDIR = ${SHAREDIR}
0 commit comments