1# $Id: sosuffix.m4,v 12.0 2004/11/17 03:43:38 bostic Exp $
2# Determine shared object suffixes.
3#
4# Our method is to use the libtool variable $library_names_spec,
5# set by using AC_PROG_LIBTOOL.  This variable is a snippet of shell
6# defined in terms of $versuffix, $release, $libname and $module
7# We want to eval it and grab the suffix used for shared objects.
8# By setting $module to yes/no, we obtain the suffixes
9# used to create dlloadable, or java loadable modules.
10# On many (*nix) systems, these all evaluate to .so, but there
11# are some notable exceptions.
12# Before calling this macro, $LIBTOOL_PROG must be set to
13# the correct method of invoking libtool (e.g. $SHELL ./libtool)
14
15# This macro is used internally to discover the suffix for the current
16# settings of $module.  The result is stored in $_SOSUFFIX.
17AC_DEFUN(_SOSUFFIX_INTERNAL, [
18	versuffix=""
19	release=""
20	libname=libfoo
21	eval _SOSUFFIX=\"$shrext_cmds\"
22	if test "$_SOSUFFIX" = "" ; then
23		_SOSUFFIX=".so"
24		if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then
25			if test "$_SOSUFFIX_MESSAGE" = ""; then
26				_SOSUFFIX_MESSAGE=yes
27        			AC_MSG_WARN([libtool may not know about this architecture.])
28               			AC_MSG_WARN([assuming $_SUFFIX suffix for dynamic libraries.])
29			fi
30        	fi
31        fi
32])
33
34# SOSUFFIX_CONFIG will set the variable SOSUFFIX to be the
35# shared library extension used for general linking, not dlopen.
36AC_DEFUN(SOSUFFIX_CONFIG, [
37	AC_MSG_CHECKING([SOSUFFIX from libtool])
38	module=no
39        _SOSUFFIX_INTERNAL
40        SOSUFFIX=$_SOSUFFIX
41	AC_MSG_RESULT($SOSUFFIX)
42	AC_SUBST(SOSUFFIX)
43])
44
45# MODSUFFIX_CONFIG will set the variable MODSUFFIX to be the
46# shared library extension used for dlopen'ed modules.
47# To discover this, we set $module, simulating libtool's -module option.
48AC_DEFUN(MODSUFFIX_CONFIG, [
49	AC_MSG_CHECKING([MODSUFFIX from libtool])
50	module=yes
51        _SOSUFFIX_INTERNAL
52        MODSUFFIX=$_SOSUFFIX
53	AC_MSG_RESULT($MODSUFFIX)
54	AC_SUBST(MODSUFFIX)
55])
56
57# JMODSUFFIX_CONFIG will set the variable JMODSUFFIX to be the
58# shared library extension used JNI modules opened by Java.
59# To discover this, we set $jnimodule, simulating libtool's -shrext option.
60##########################################################################
61# Robert Boehne:  Not much point in this macro any more because apparently
62# Darwin is the only OS that wants or needs the .jnilib extension.
63##########################################################################
64AC_DEFUN(JMODSUFFIX_CONFIG, [
65	AC_MSG_CHECKING([JMODSUFFIX from libtool])
66	module=yes
67        _SOSUFFIX_INTERNAL
68	if test `uname` = "Darwin"; then
69	    JMODSUFFIX=".jnilib"
70	else
71            JMODSUFFIX=$_SOSUFFIX
72	fi
73	AC_MSG_RESULT($JMODSUFFIX)
74	AC_SUBST(JMODSUFFIX)
75])
76
77