xref: /aoo42x/main/RepositoryExternal.mk (revision 1d3e2386)
1###############################################################
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20###############################################################
21
22
23
24# this file describes all the external libraries
25# depending on the configure options these may be taken from the system,
26# or the internal/bundled copy may be built.
27
28# for every external, a function gb_LinkTarget_use__FOO is defined,
29# once for the system case, once for the internal case.
30
31# in the system case, no libraries should be registered, but the target-local
32# variable LIBS should be set to FOO_LIBS, and INCLUDES to FOO_CFLAGS.
33
34
35ifeq ($(SYSTEM_ZLIB),YES)
36
37define gb_LinkTarget__use_zlib
38$(call gb_LinkTarget_add_defs,$(1),\
39	-DSYSTEM_ZLIB \
40)
41$(call gb_LinkTarget_add_libs,$(1),-lz)
42endef
43
44else # !SYSTEM_ZLIB
45
46$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
47	zlib \
48))
49
50define gb_LinkTarget__use_zlib
51$(call gb_LinkTarget_add_linked_static_libs,$(1),\
52	zlib \
53)
54endef
55
56endif # SYSTEM_ZLIB
57
58
59ifeq ($(SYSTEM_JPEG),YES)
60
61define gb_LinkTarget__use_jpeg
62$(call gb_LinkTarget_add_libs,$(1),-ljpeg)
63$(call gb_LinkTarget_set_ldflags,$(1),\
64	$$(filter-out -L/usr/lib/jvm%,$$(T_LDFLAGS)) \
65)
66ifeq ($(OS),FREEBSD)
67# JDK jpeg library on FreeBSD lives under ${JAVA_HOME}/jre/lib/${ARCH}/
68$(call gb_LinkTarget_set_ldflags,$(1),\
69	$$(filter-out -L$$(JAVA_HOME)/jre/lib/%,$$(T_LDFLAGS)) \
70)
71endif
72endef
73
74else # !SYSTEM_JPEG
75
76$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
77	jpeglib \
78))
79
80define gb_LinkTarget__use_jpeg
81$(call gb_LinkTarget_add_linked_static_libs,$(1),\
82	jpeglib \
83)
84endef
85
86endif # SYSTEM_JPEG
87
88
89ifeq ($(SYSTEM_EXPAT),YES)
90
91define gb_LinkTarget__use_expat
92$(if $(2),,$(error gb_LinkTarget__use_expat needs additional parameter))
93
94$(call gb_LinkTarget_add_defs,$(1),\
95	-DSYSTEM_EXPAT \
96)
97
98$(call gb_LinkTarget_add_libs,$(1),-lexpat)
99endef
100
101else # !SYSTEM_EXPAT
102
103$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
104	ascii_expat_xmlparse \
105	expat_xmlparse \
106	expat_xmltok \
107))
108
109define gb_LinkTarget__use_expat
110$(if $(2),,$(error gb_LinkTarget__use_expat needs additional parameter))
111
112$(if $(filter-out ascii_expat_xmlparse,$(2)),\
113	$(call gb_LinkTarget_add_defs,$(1),\
114		-DXML_UNICODE \
115))
116
117$(call gb_LinkTarget_add_linked_static_libs,$(1),\
118	$(2) \
119	expat_xmltok \
120)
121endef
122
123endif # SYSTEM_EXPAT
124
125# now define 2 wrappers that select which internal static library to use...
126define gb_LinkTarget__use_expat_utf8
127$(call gb_LinkTarget__use_expat,$(1),ascii_expat_xmlparse)
128endef
129
130define gb_LinkTarget__use_expat_utf16
131$(call gb_LinkTarget__use_expat,$(1),expat_xmlparse)
132endef
133
134
135ifeq ($(SYSTEM_LIBXML),YES)
136
137define gb_LinkTarget__use_libxml2
138$(call gb_LinkTarget_add_defs,$(1),\
139	-DSYSTEM_LIBXML \
140)
141$(call gb_LinkTarget_set_include,$(1),\
142	$$(INCLUDE) \
143	$(LIBXML_CFLAGS) \
144)
145$(call gb_LinkTarget_add_libs,$(1),$(LIBXML_LIBS))
146endef
147
148else # !SYSTEM_LIBXML
149
150$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
151	xml2 \
152))
153
154define gb_LinkTarget__use_libxml2
155$(call gb_LinkTarget_add_linked_libs,$(1),\
156	xml2 \
157)
158endef
159
160endif # SYSTEM_LIBXML
161
162
163ifeq ($(SYSTEM_LIBXSLT),YES)
164
165define gb_LinkTarget__use_libxslt
166$(call gb_LinkTarget_set_include,$(1),\
167	$$(INCLUDE) \
168	$(LIBXSLT_CFLAGS) \
169)
170$(call gb_LinkTarget_add_libs,$(1),$(LIBXSLT_LIBS))
171endef
172
173else # !SYSTEM_LIBXSLT
174
175$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
176	xslt \
177))
178
179define gb_LinkTarget__use_libxslt
180$(call gb_LinkTarget_add_linked_libs,$(1),\
181	xslt \
182)
183endef
184
185endif # SYSTEM_LIBXSLT
186
187
188ifeq ($(SYSTEM_REDLAND),YES)
189
190define gb_LinkTarget__use_librdf
191$(call gb_LinkTarget_add_defs,$(1),\
192	-DSYSTEM_REDLAND \
193)
194$(call gb_LinkTarget_set_include,$(1),\
195	$$(INCLUDE) \
196	$(REDLAND_CFLAGS) \
197)
198$(call gb_LinkTarget_add_libs,$(1),$(REDLAND_LIBS))
199endef
200
201else # !SYSTEM_REDLAND
202
203$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
204	rdf \
205))
206
207define gb_LinkTarget__use_librdf
208$(call gb_LinkTarget_add_linked_libs,$(1),\
209	rdf \
210)
211endef
212
213endif # SYSTEM_REDLAND
214
215
216ifeq ($(SYSTEM_CAIRO),YES)
217
218# FREETYPE_CLAGS from environment if ENABLE_CAIRO is used
219define gb_LinkTarget__use_cairo
220$(call gb_LinkTarget_set_include,$(1),\
221	$$(INCLUDE) \
222	$(FREETYPE_CFLAGS) \
223	$(CAIRO_CFLAGS) \
224)
225$(call gb_LinkTarget_add_libs,$(1),$(CAIRO_LIBS))
226endef
227
228else # !SYSTEM_CAIRO
229
230$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
231	cairo \
232))
233ifneq ($(OS),WNT)
234$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
235	pixman-1 \
236))
237endif # WNT
238
239define gb_LinkTarget__use_cairo
240$(call gb_LinkTarget_set_include,$(1),\
241	$$(INCLUDE) \
242	-I$(OUTDIR)/inc/cairo \
243	$(FREETYPE_CFLAGS) \
244)
245$(call gb_LinkTarget_add_linked_libs,$(1),\
246	cairo \
247)
248ifneq ($(OS),WNT)
249$(call gb_LinkTarget_add_linked_libs,$(1),\
250	pixman-1 \
251)
252endif
253endef
254
255endif # SYSTEM_CAIRO
256
257
258ifeq ($(SYSTEM_GRAPHITE),YES)
259
260#check for building with stlport, but graphite was not built with stlport
261define gb_LinkTarget__use_graphite
262ifneq ($(USE_SYSTEM_STL),YES)
263$(call gb_LinkTarget_add_defs,$(1),\
264	-DADAPT_EXT_STL \
265)
266endif
267$(call gb_LinkTarget_set_include,$(1),\
268	$$(INCLUDE) \
269	$(GRAPHITE_CFLAGS) \
270)
271$(call gb_LinkTarget_add_libs,$(1),$(GRAPHITE_LIBS))
272endef
273
274else # !SYSTEM_GRAPHITE
275
276$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
277    graphite \
278))
279define gb_LinkTarget__use_graphite
280$(call gb_LinkTarget_add_linked_static_libs,$(1),\
281    graphite \
282)
283endef
284
285endif # SYSTEM_GRAPHITE
286
287
288ifeq ($(SYSTEM_ICU),YES)
289
290define gb_LinkTarget__use_icule
291$(call gb_LinkTarget_add_libs,$(1),-licule)
292endef
293define gb_LinkTarget__use_icuuc
294$(call gb_LinkTarget_add_libs,$(1),-licuuc)
295endef
296
297else # !SYSTEM_ICU
298
299$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
300	icule \
301	icuuc \
302))
303
304define gb_LinkTarget__use_icule
305$(call gb_LinkTarget_add_linked_libs,$(1),\
306	icule \
307)
308endef
309define gb_LinkTarget__use_icuuc
310$(call gb_LinkTarget_add_linked_libs,$(1),\
311	icuuc \
312)
313endef
314
315endif # SYSTEM_ICU
316
317
318ifeq ($(SYSTEM_OPENSSL),YES)
319
320define gb_LinkTarget__use_openssl
321$(call gb_LinkTarget_set_include,$(1),\
322	$$(INCLUDE) \
323	$(OPENSSL_CFLAGS) \
324)
325$(call gb_LinkTarget_add_libs,$(1),$(OPENSSL_LIBS))
326endef
327
328else # !SYSTEM_OPENSSL
329
330ifeq ($(OS),WNT)
331$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
332    crypto \
333    ssl \
334))
335else
336$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
337    crypto \
338    ssl \
339))
340endif
341
342define gb_LinkTarget__use_openssl
343ifeq ($(OS),WNT)
344$(call gb_LinkTarget_add_linked_libs,$(1),\
345	crypto \
346	ssl \
347)
348else
349$(call gb_LinkTarget_add_linked_static_libs,$(1),\
350	crypto \
351	ssl \
352)
353ifeq ($(OS),SOLARIS)
354$(call gb_LinkTarget_add_libs,$(1),\
355	-lnsl \
356	-lsocket \
357)
358endif
359endif
360endef
361
362endif # SYSTEM_OPENSSL
363
364
365ifeq ($(SYSTEM_APR),YES)
366
367define gb_LinkTarget__use_apr
368$(call gb_LinkTarget_add_defs,$(1),\
369        -DSYSTEM_APR \
370)
371$(call gb_LinkTarget_set_include,$(1),\
372	$$(INCLUDE) \
373	$(APR_CFLAGS) \
374)
375$(call gb_LinkTarget_add_libs,$(1),$(APR_LIBS))
376endef
377
378else # !SYSTEM_APR
379
380ifeq ($(OS),WNT)
381$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,libapr-1))
382else
383$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,apr-1))
384endif
385
386define gb_LinkTarget__use_apr
387$(call gb_LinkTarget_set_include,$(1),\
388	$$(INCLUDE) \
389	-I$(OUTDIR)/inc/apr \
390)
391ifeq ($(OS),WNT)
392$(call gb_LinkTarget_add_linked_libs,$(1),libapr-1)
393else
394$(call gb_LinkTarget_add_linked_libs,$(1),apr-1)
395endif
396endef
397
398endif # SYSTEM_APR
399
400
401ifeq ($(SYSTEM_APR_UTIL),YES)
402
403define gb_LinkTarget__use_apr_util
404$(call gb_LinkTarget_add_defs,$(1),\
405	-DSYSTEM_APR_UTIL \
406)
407$(call gb_LinkTarget_set_include,$(1),\
408	$$(INCLUDE) \
409	$(APR_UTIL_CFLAGS) \
410)
411$(call gb_LinkTarget_add_libs,$(1),$(APR_UTIL_LIBS))
412endef
413
414else # !SYSTEM_APR_UTIL
415
416# on Windows apr-util is registered by ext_libraries/Repository.mk
417ifneq ($(OS),WNT)
418$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,aprutil-1))
419endif
420
421define gb_LinkTarget__use_apr_util
422$(call gb_LinkTarget_set_include,$(1),\
423	$$(INCLUDE) \
424	-I$(OUTDIR)/inc/apr-util \
425)
426ifeq ($(OS),WNT)
427$(call gb_LinkTarget_add_linked_libs,$(1),apr-util)
428else
429$(call gb_LinkTarget_add_linked_libs,$(1),aprutil-1)
430endif
431endef
432
433endif # SYSTEM_APR_UTIL
434
435
436ifeq ($(SYSTEM_SERF),YES)
437
438define gb_LinkTarget__use_serf
439$(call gb_LinkTarget_add_defs,$(1),\
440	-DSYSTEM_SERF \
441)
442$(call gb_LinkTarget_set_include,$(1),\
443	$$(INCLUDE) \
444	$(SERF_CFLAGS) \
445)
446$(call gb_LinkTarget_add_libs,$(1),$(SERF_LIBS))
447endef
448
449else # !SYSTEM_SERF
450
451# on Windows serf is registered by ext_libraries/Repository.mk
452ifneq ($(OS),WNT)
453$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,serf-1))
454endif
455
456define gb_LinkTarget__use_serf
457$(call gb_LinkTarget_set_include,$(1),\
458	$$(INCLUDE) \
459	-I$(OUTDIR)/inc/serf \
460)
461ifeq ($(OS),WNT)
462$(call gb_LinkTarget_add_linked_libs,$(1),serf)
463else
464$(call gb_LinkTarget_add_linked_libs,$(1),serf-1)
465endif
466endef
467
468endif # SYSTEM_SERF
469
470
471ifeq ($(SYSTEM_CURL),YES)
472
473define gb_LinkTarget__use_curl
474$(call gb_LinkTarget_add_defs,$(1),\
475	-DSYSTEM_CURL \
476)
477$(call gb_LinkTarget_set_include,$(1),\
478	$$(INCLUDE) \
479	$(CURL_CFLAGS) \
480)
481$(call gb_LinkTarget_add_libs,$(1),$(CURL_LIBS))
482endef
483
484else # !SYSTEM_CURL
485
486ifeq ($(OS),WNT)
487$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,libcurl))
488else
489$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,curl))
490endif
491
492define gb_LinkTarget__use_curl
493ifeq ($(OS),WNT)
494$(call gb_LinkTarget_add_linked_libs,$(1),libcurl)
495else
496$(call gb_LinkTarget_add_linked_libs,$(1),curl)
497endif
498endef
499
500endif # SYSTEM_CURL
501
502
503ifeq ($(SYSTEM_COINMP),YES)
504
505define gb_LinkTarget__use_coinmp
506$(call gb_LinkTarget_add_defs,$(1),\
507	-DSYSTEM_COINMP \
508)
509$(call gb_LinkTarget_set_include,$(1),\
510	$$(INCLUDE) \
511	$(COINMP_CFLAGS) \
512)
513$(call gb_LinkTarget_add_libs,$(1),$(COINMP_LIBS))
514endef
515
516else # !SYSTEM_COINMP
517
518$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
519	CoinMP \
520	CoinUtils \
521	Clp \
522	Cbc \
523	Osi \
524	OsiClp \
525	Cgl \
526	CbcSolver \
527))
528
529define gb_LinkTarget__use_coinmp
530$(call gb_LinkTarget_set_include,$(1),\
531	$$(INCLUDE) \
532	-I$(OUTDIR)/inc/coinmp \
533)
534$(call gb_LinkTarget_add_linked_libs,$(1),\
535	CoinMP \
536	CoinUtils \
537	Clp \
538	Cbc \
539	Osi \
540	OsiClp \
541	Cgl \
542	CbcSolver \
543)
544endef
545
546endif # SYSTEM_COINMP
547
548# vim: set noet sw=4 ts=4:
549