1
2
3
4
5
6
7
8
9
10
11
12
|
1
2
3
4
5
6
7
8
9
10
11
12
|
-
-
+
+
-
+
|
dnl
dnl Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
dnl Jonathan Schleifer <js@webkeks.org>
dnl Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017
dnl Jonathan Schleifer <js@heap.zone>
dnl
dnl https://webkeks.org/git/?p=buildsys.git
dnl https://heap.zone/git/?p=buildsys.git
dnl
dnl Permission to use, copy, modify, and/or distribute this software for any
dnl purpose with or without fee is hereby granted, provided that the above
dnl copyright notice and this permission notice is present in all copies.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
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
|
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
|
-
+
-
+
+
-
+
|
AC_DEFUN([BUILDSYS_PROG_IMPLIB], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_MSG_CHECKING(whether we need an implib)
case "$host_os" in
cygwin* | mingw*)
AC_MSG_RESULT(yes)
PROG_IMPLIB_NEEDED='yes'
PROG_IMPLIB_LDFLAGS='-Wl,-export-all-symbols,--out-implib,lib${PROG}.a'
PROG_IMPLIB_LDFLAGS='-Wl,--export-all-symbols,--out-implib,lib${PROG}.a'
;;
*)
AC_MSG_RESULT(no)
PROG_IMPLIB_NEEDED='no'
PROG_IMPLIB_LDFLAGS=''
;;
esac
AC_SUBST(PROG_IMPLIB_NEEDED)
AC_SUBST(PROG_IMPLIB_LDFLAGS)
])
AC_DEFUN([BUILDSYS_SHARED_LIB], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_MSG_CHECKING(for shared library system)
case "$host_os" in
darwin*)
AC_MSG_RESULT(Darwin)
LIB_CFLAGS='-fPIC -DPIC'
LIB_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR} -Wl,-install_name,${libdir}/$${out%.dylib}.${LIB_MAJOR}.dylib'
LIB_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}'
LIB_PREFIX='lib'
LIB_SUFFIX='.dylib'
LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
LDFLAGS_INSTALL_NAME='-Wl,-install_name,${libdir}/$${out%.dylib}.${LIB_MAJOR}.dylib'
PLUGIN_CFLAGS='-fPIC -DPIC'
PLUGIN_LDFLAGS='-bundle -undefined dynamic_lookup'
PLUGIN_SUFFIX='.bundle'
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'
UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib'
CLEAN_LIB=''
;;
mingw* | cygwin*)
AC_MSG_RESULT(MinGW / Cygwin)
LIB_CFLAGS=''
LIB_LDFLAGS='-shared -Wl,--out-implib,${SHARED_LIB}.a'
LIB_LDFLAGS='-shared -Wl,--export-all-symbols,--out-implib,${SHARED_LIB}.a'
LIB_PREFIX='lib'
LIB_SUFFIX='.dll'
LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
PLUGIN_CFLAGS=''
PLUGIN_LDFLAGS='-shared'
PLUGIN_SUFFIX='.dll'
INSTALL_LIB='&& ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i && ${INSTALL} -m 755 $$i.a ${DESTDIR}${libdir}/$$i.a'
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
PLUGIN_CFLAGS='-fPIC -DPIC'
PLUGIN_LDFLAGS='-shared'
PLUGIN_SUFFIX='.so'
INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR} && rm -f ${DESTDIR}${libdir}/$$i && ${LN_S} $$i.${LIB_MAJOR}.${LIB_MINOR} ${DESTDIR}${libdir}/$$i'
UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}'
CLEAN_LIB=''
;;
*-android*)
AC_MSG_RESULT(Android)
LIB_CFLAGS='-fPIC -DPIC'
LIB_LDFLAGS='-shared -Wl,-soname=${SHARED_LIB}.${LIB_MAJOR}'
LIB_PREFIX='lib'
LIB_SUFFIX='.so'
LDFLAGS_RPATH=''
PLUGIN_CFLAGS='-fPIC -DPIC'
PLUGIN_LDFLAGS='-shared'
PLUGIN_SUFFIX='.so'
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'
UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0'
CLEAN_LIB=''
;;
*)
AC_MSG_RESULT(ELF)
LIB_CFLAGS='-fPIC -DPIC'
LIB_LDFLAGS='-shared -Wl,-soname=${SHARED_LIB}.${LIB_MAJOR}'
LIB_PREFIX='lib'
LIB_SUFFIX='.so'
LDFLAGS_RPATH='-Wl,-rpath,${libdir}'
|
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
+
|
esac
AC_SUBST(LIB_CFLAGS)
AC_SUBST(LIB_LDFLAGS)
AC_SUBST(LIB_PREFIX)
AC_SUBST(LIB_SUFFIX)
AC_SUBST(LDFLAGS_RPATH)
AC_SUBST(LDFLAGS_INSTALL_NAME)
AC_SUBST(PLUGIN_CFLAGS)
AC_SUBST(PLUGIN_LDFLAGS)
AC_SUBST(PLUGIN_SUFFIX)
AC_SUBST(INSTALL_LIB)
AC_SUBST(UNINSTALL_LIB)
AC_SUBST(CLEAN_LIB)
])
|