1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
#
# This offers a nice overview how to build shared libraries on all platforms
# http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
#
AC_DEFUN([AC_LD_EXPORT_DYNAMIC],
[
saved_LDFLAGS="$LDFLAGS"
if AC_TRY_COMMAND([${CC-cc} $CFLAGS -Wl,--version 2>&1 | grep "GNU ld" >/dev/null]); then
LD_EXPORT_DYNAMIC="-Wl,-export-dynamic"
else
case "$host_os" in
hpux* )
LD_EXPORT_DYNAMIC="-Wl,-E"
;;
*)
LD_EXPORT_DYNAMIC=""
;;
esac
fi
AC_SUBST(LD_EXPORT_DYNAMIC)
LDFLAGS="$saved_LDFLAGS"
])
AC_DEFUN([AC_LD_PICFLAG],
[
case "$host_os" in
*linux*)
PICFLAG="-fPIC"
;;
*solaris*)
if test "${GCC}" = "yes"; then
PICFLAG="-fPIC"
else
PICFLAG="-KPIC"
fi
;;
*sunos*)
PICFLAG="-KPIC" # Is this correct for SunOS
;;
*netbsd* | *freebsd* | *dragonfly* )
PICFLAG="-fPIC -DPIC"
;;
*openbsd*)
PICFLAG="-fPIC"
;;
*irix*)
if test "${GCC}" = "yes"; then
PICFLAG="-fPIC"
else
PICFLAG="-KPIC"
fi
;;
*aix*)
# as AIX code is always position independent...
PICFLAG="-O2"
;;
*hpux*)
if test $ac_cv_prog_cc_Ae = yes; then
PICFLAG="+z +ESnolit"
elif test "${GCC}" = "yes"; then
PICFLAG="-fPIC"
fi
if test "$host_cpu" = "ia64"; then
PICFLAG="+z"
fi
;;
*osf*)
PICFLAG="-fPIC"
;;
*unixware*)
PICFLAG="-KPIC"
;;
*darwin*)
PICFLAG="-fno-common"
;;
esac
AC_SUBST(PICFLAG)
])
AC_DEFUN([AC_LD_SHLDFLAGS],
[
SHLD_FLAGS="-shared"
case "$host_os" in
*linux*)
SHLD_FLAGS="-shared -Wl,-Bsymbolic"
;;
*solaris*)
SHLD_FLAGS="-G"
if test "${GCC}" = "no"; then
## ${CFLAGS} added for building 64-bit shared
## libs using Sun's Compiler
SHLD_FLAGS="-G \${CFLAGS}"
fi
;;
*sunos*)
SHLD_FLAGS="-G"
;;
*irix*)
SHLD_FLAGS="-shared"
;;
*aix*)
SHLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
;;
*hpux*)
if test "${GCC}" = "yes"; then
SHLD_FLAGS="-shared"
else
SHLD_FLAGS="-b"
fi
;;
*osf*)
SHLD_FLAGS="-shared -warning_unresolved"
;;
*darwin*)
SHLD_FLAGS="-bundle -flat_namespace -undefined warning -Wl,-search_paths_first"
;;
esac
AC_SUBST(SHLD_FLAGS)
])
AC_DEFUN([AC_LD_SHLIBEXT],
[
SHLIBEXT="so"
case "$host_os" in
*hpux*)
if test "$host_cpu" = "ia64"; then
SHLIBEXT="so"
else
SHLIBEXT="sl"
fi
;;
*darwin*)
SHLIBEXT="dylib"
;;
esac
AC_SUBST(SHLIBEXT)
])
AC_DEFUN([AC_LD_SONAMEFLAG],
[
AC_SUBST(SONAMEFLAG)
SONAMEFLAG=""
case "$host_os" in
*linux*)
SONAMEFLAG="-Wl,-soname="
;;
*solaris*)
SONAMEFLAG="-h "
if test "${GCC}" = "yes"; then
SONAMEFLAG="-Wl,-soname="
fi
;;
*sunos*)
SONAMEFLAG="-Wl,-h,"
;;
*netbsd* | *freebsd* | *dragonfly* )
SONAMEFLAG="-Wl,-soname,"
;;
*openbsd*)
SONAMEFLAG="-Wl,-soname,"
;;
*irix*)
SONAMEFLAG="-Wl,-soname,"
;;
*hpux*)
SONAMEFLAG="-Wl,+h,"
;;
*osf*)
SONAMEFLAG="-Wl,-soname,"
;;
*unixware*)
SONAMEFLAG="-Wl,-soname,"
;;
*darwin*)
SONAMEFLAG="#"
;;
*aix*)
# Not supported
SONAMEFLAG="#"
;;
esac
])
AC_DEFUN([AC_LIBREPLACE_MDLD],
[
MDLD="${CC}"
case "$host_os" in
*irix*)
MDLD="${PROG_LD}"
;;
esac
AC_SUBST(MDLD)
])
AC_DEFUN([AC_LIBREPLACE_MDLD_FLAGS],
[
MDLD_FLAGS="-shared"
case "$host_os" in
*linux*)
MDLD_FLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined"
;;
*solaris*)
MDLD_FLAGS="-G"
if test "${GCC}" = "no"; then
## ${CFLAGS} added for building 64-bit shared
## libs using Sun's Compiler
NDLD_FLAGS="-G \${CFLAGS}"
fi
;;
*sunos*)
MDLD_FLAGS="-G"
;;
*aix*)
MDLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
;;
*hpux*)
if test "${GCC}" = "yes"; then
MDLD_FLAGS="-shared"
else
MDLD_FLAGS="-b"
fi
;;
*osf*)
MDLD_FLAGS="-shared -expect_unresolved '*'"
;;
*darwin*)
MDLD_FLAGS="-bundle -flat_namespace -undefined suppress -Wl,-search_paths_first"
;;
esac
AC_SUBST(MDLD_FLAGS)
])
|