1763
|
1 dnl
|
|
2 dnl Copyright (c) 2007, Jonathan Schleifer <js@h3c.de>
|
|
3 dnl
|
|
4 dnl Permission to use, copy, modify, and/or distribute this software for any
|
|
5 dnl purpose with or without fee is hereby granted, provided that the above
|
|
6 dnl copyright notice and this permission notice is present in all copies.
|
|
7 dnl
|
|
8 dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
9 dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
10 dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
11 dnl ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
12 dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
13 dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
14 dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
15 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
16 dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
17 dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
18 dnl POSSIBILITY OF SUCH DAMAGE.
|
|
19 dnl
|
|
20
|
|
21 AC_DEFUN([AM_SHARED_LIB], [
|
|
22 AC_MSG_CHECKING(for shared library system)
|
|
23 case "$target" in
|
|
24 intel-apple-*)
|
|
25 AC_MSG_RESULT([Mac OS X (Intel)])
|
|
26 LIB_CPPFLAGS='-DPIC'
|
|
27 LIB_CFLAGS='-fPIC'
|
|
28 LIB_LDFLAGS='-dynamiclib -fPIC -install_name ${libdir}/${LIB}'
|
|
29 LIB_PREFIX='lib'
|
|
30 LIB_SUFFIX='.dylib'
|
|
31 PLUGIN_CPPFLAGS=''
|
|
32 PLUGIN_CFLAGS=''
|
|
33 PLUGIN_LDFLAGS='-bundle -fno-common -flat_namespace -undefined suppress'
|
|
34 PLUGIN_SUFFIX='.impl'
|
|
35 INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$$i'
|
|
36 UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib'
|
|
37 CLEAN_LIB=''
|
|
38 ;;
|
|
39 *-apple-*)
|
|
40 AC_MSG_RESULT(Mac OS X)
|
|
41 LIB_CPPFLAGS='-DPIC'
|
|
42 LIB_CFLAGS=''
|
|
43 LIB_LDFLAGS='-dynamiclib -fPIC -install_name ${libdir}/${LIB}'
|
|
44 LIB_PREFIX='lib'
|
|
45 LIB_SUFFIX='.dylib'
|
|
46 PLUGIN_CPPFLAGS=''
|
|
47 PLUGIN_CFLAGS=''
|
|
48 PLUGIN_LDFLAGS='-bundle -fno-common -flat_namespace -undefined suppress'
|
|
49 PLUGIN_SUFFIX='.impl'
|
|
50 INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$$i'
|
|
51 UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib'
|
|
52 CLEAN_LIB=''
|
|
53 ;;
|
|
54 *-sun-* | *-openbsd-* | *-mirbsd-*)
|
|
55 AC_MSG_RESULT(Solaris)
|
|
56 LIB_CPPFLAGS='-DPIC'
|
|
57 LIB_CFLAGS='-fPIC'
|
|
58 LIB_LDFLAGS='-shared -fPIC -Wl,-soname=${LIB}.${LIB_MAJOR}.${LIB_MINOR}'
|
|
59 LIB_PREFIX='lib'
|
|
60 LIB_SUFFIX='.so'
|
|
61 PLUGIN_CPPFLAGS='-DPIC'
|
|
62 PLUGIN_CFLAGS='-fPIC'
|
|
63 PLUGIN_LDFLAGS='-shared -fPIC'
|
|
64 PLUGIN_SUFFIX='.so'
|
|
65 INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR} ${DESTDIR}${libdir}/$$i'
|
|
66 UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}'
|
|
67 CLEAN_LIB=''
|
|
68 ;;
|
|
69 *-*-mingw32)
|
|
70 AC_MSG_RESULT(MinGW32)
|
|
71 LIB_CPPFLAGS='-DPIC'
|
|
72 LIB_CFLAGS=''
|
|
73 LIB_LDFLAGS='-shared -Wl,--out-implib,${LIB}.a'
|
|
74 LIB_PREFIX='lib'
|
|
75 LIB_SUFFIX='.dll'
|
|
76 PLUGIN_CPPFLAGS=''
|
|
77 PLUGIN_CFLAGS=''
|
|
78 PLUGIN_LDFLAGS=''
|
|
79 PLUGIN_SUFFIX='.dll'
|
|
80 INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i && ${INSTALL} -m 755 $$i.a ${DESTDIR}${libdir}/$$i.a'
|
|
81 UNINSTALL_LIB='rm -f ${DESTDIR}${bindir}/$$i ${DESTDIR}${libdir}/$$i.a'
|
|
82 CLEAN_LIB='${LIB}.a'
|
|
83 ;;
|
|
84 *)
|
|
85 AC_MSG_RESULT(POSIX)
|
|
86 LIB_CPPFLAGS='-DPIC'
|
|
87 LIB_CFLAGS='-fPIC'
|
|
88 LIB_LDFLAGS='-shared -fPIC -Wl,-soname=${LIB}.${LIB_MAJOR}.${LIB_MINOR}.0'
|
|
89 LIB_PREFIX='lib'
|
|
90 LIB_SUFFIX='.so'
|
|
91 PLUGIN_CPPFLAGS='-DPIC'
|
|
92 PLUGIN_CFLAGS='-fPIC'
|
|
93 PLUGIN_LDFLAGS='-shared -fPIC'
|
|
94 PLUGIN_SUFFIX='.so'
|
|
95 INSTALL_LIB='${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0 && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i'
|
|
96 UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0'
|
|
97 CLEAN_LIB=''
|
|
98 ;;
|
|
99 esac
|
|
100
|
|
101 AC_SUBST(LIB_CPPFLAGS)
|
|
102 AC_SUBST(LIB_CFLAGS)
|
|
103 AC_SUBST(LIB_LDFLAGS)
|
|
104 AC_SUBST(LIB_PREFIX)
|
|
105 AC_SUBST(LIB_SUFFIX)
|
|
106 AC_SUBST(PLUGIN_CPPFLAGS)
|
|
107 AC_SUBST(PLUGIN_CFLAGS)
|
|
108 AC_SUBST(PLUGIN_LDFLAGS)
|
|
109 AC_SUBST(PLUGIN_SUFFIX)
|
|
110 AC_SUBST(INSTALL_LIB)
|
|
111 AC_SUBST(UNINSTALL_LIB)
|
|
112 AC_SUBST(CLEAN_LIB)
|
|
113 ])
|