xref: /aoo42x/main/RepositoryExternal.mk (revision e350def3)
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_icudata
291$(call gb_LinkTarget_add_libs,$(1),-licudata)
292endef
293define gb_LinkTarget__use_icui18n
294$(call gb_LinkTarget_add_libs,$(1),-licui18n)
295endef
296define gb_LinkTarget__use_icule
297$(call gb_LinkTarget_add_libs,$(1),-licule)
298endef
299define gb_LinkTarget__use_icuuc
300$(call gb_LinkTarget_add_libs,$(1),-licuuc)
301endef
302
303else # !SYSTEM_ICU
304
305define gb_LinkTarget__use_icudata
306ifeq ($(OS)$(COM),WNTMSC)
307$(call gb_LinkTarget_add_libs,$(1),icudata.lib)
308else ifeq ($(OS)$(COM),WNTGCC)
309$(call gb_LinkTarget_add_libs,$(1),-licudt40)
310else ifeq ($(OS),OS2)
311$(call gb_LinkTarget_add_libs,$(1),-licudt)
312else
313$(call gb_LinkTarget_add_libs,$(1),-licudata)
314endif
315endef
316
317define gb_LinkTarget__use_icui18n
318ifeq ($(OS)$(COM),WNTMSC)
319$(call gb_LinkTarget_add_libs,$(1),icuin.lib)
320else ifeq ($(OS)$(COM),WNTGCC)
321$(call gb_LinkTarget_add_libs,$(1),-licuin40)
322else ifeq ($(OS),OS2)
323$(call gb_LinkTarget_add_libs,$(1),-licuin)
324else
325$(call gb_LinkTarget_add_libs,$(1),-licui18n)
326endif
327endef
328
329define gb_LinkTarget__use_icule
330ifeq ($(OS)$(COM),WNTMSC)
331$(call gb_LinkTarget_add_libs,$(1),icule.lib)
332else ifeq ($(OS)$(COM),WNTGCC)
333$(call gb_LinkTarget_add_libs,$(1),-licule40)
334else
335$(call gb_LinkTarget_add_libs,$(1),-licule)
336endif
337endef
338
339define gb_LinkTarget__use_icuuc
340ifeq ($(OS)$(COM),WNTMSC)
341$(call gb_LinkTarget_add_libs,$(1),icuuc.lib)
342else ifeq ($(OS)$(COM),WNTGCC)
343$(call gb_LinkTarget_add_libs,$(1),-licuuc40)
344else
345$(call gb_LinkTarget_add_libs,$(1),-licuuc)
346endif
347endef
348
349endif # SYSTEM_ICU
350
351
352ifeq ($(SYSTEM_OPENSSL),YES)
353
354define gb_LinkTarget__use_openssl
355$(call gb_LinkTarget_set_include,$(1),\
356	$$(INCLUDE) \
357	$(OPENSSL_CFLAGS) \
358)
359$(call gb_LinkTarget_add_libs,$(1),$(OPENSSL_LIBS))
360endef
361
362else # !SYSTEM_OPENSSL
363
364$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
365	crypto \
366	ssl \
367))
368
369define gb_LinkTarget__use_openssl
370$(call gb_LinkTarget_add_linked_libs,$(1),\
371	crypto \
372	ssl \
373)
374ifeq ($(OS),SOLARIS)
375$(call gb_LinkTarget_add_libs,$(1),\
376	-lnsl \
377	-lsocket \
378)
379endif
380ifeq ($(OS),LINUX)
381$(call gb_LinkTarget_add_libs,$(1),\
382	-lpthread \
383)
384endif
385endef
386
387endif # SYSTEM_OPENSSL
388
389
390ifeq ($(SYSTEM_CURL),YES)
391
392define gb_LinkTarget__use_curl
393$(call gb_LinkTarget_add_defs,$(1),\
394	-DSYSTEM_CURL \
395)
396$(call gb_LinkTarget_set_include,$(1),\
397	$$(INCLUDE) \
398	$(CURL_CFLAGS) \
399)
400$(call gb_LinkTarget_add_libs,$(1),$(CURL_LIBS))
401endef
402
403else # !SYSTEM_CURL
404
405ifeq ($(OS),WNT)
406$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,libcurl))
407else
408$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,curl))
409endif
410
411define gb_LinkTarget__use_curl
412ifeq ($(OS),WNT)
413$(call gb_LinkTarget_add_linked_libs,$(1),libcurl)
414else
415$(call gb_LinkTarget_add_linked_libs,$(1),curl)
416endif
417endef
418
419endif # SYSTEM_CURL
420
421
422ifeq ($(SYSTEM_COINMP),YES)
423
424define gb_LinkTarget__use_coinmp
425$(call gb_LinkTarget_add_defs,$(1),\
426	-DSYSTEM_COINMP \
427)
428$(call gb_LinkTarget_set_include,$(1),\
429	$$(INCLUDE) \
430	$(COINMP_CFLAGS) \
431)
432$(call gb_LinkTarget_add_libs,$(1),$(COINMP_LIBS))
433endef
434
435else # !SYSTEM_COINMP
436
437$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,CoinMP))
438ifneq ($(OS),WNT)
439$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
440	CoinUtils \
441	Clp \
442	Cbc \
443	Osi \
444	OsiClp \
445	Cgl \
446	CbcSolver \
447))
448endif
449
450define gb_LinkTarget__use_coinmp
451$(call gb_LinkTarget_set_include,$(1),\
452	$$(INCLUDE) \
453	-I$(OUTDIR)/inc/coinmp \
454)
455$(call gb_LinkTarget_add_linked_libs,$(1),CoinMP)
456ifneq ($(OS),WNT)
457ifneq ($(OS),OS2)
458$(call gb_LinkTarget_add_linked_libs,$(1),\
459	CoinUtils \
460	Clp \
461	Cbc \
462	Osi \
463	OsiClp \
464	Cgl \
465	CbcSolver \
466)
467endif
468endif
469endef
470
471endif # SYSTEM_COINMP
472
473
474ifeq ($(SYSTEM_HYPH),YES)
475
476define gb_LinkTarget__use_hyphen
477$(call gb_LinkTarget_add_defs,$(1),\
478		-DSYSTEM_HYPH \
479)
480$(call gb_LinkTarget_add_libs,$(1),$(HYPHEN_LIB))
481endef
482
483else # !SYSTEM_HYPH
484
485$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
486		hyphen \
487))
488
489define gb_LinkTarget__use_hyphen
490$(call gb_LinkTarget_add_linked_static_libs,$(1),\
491		hyphen \
492)
493endef
494
495endif # SYSTEM_HYPH
496
497
498ifeq ($(SYSTEM_LIBTEXTCAT),YES)
499
500define gb_LinkTarget__use_libtextcat
501$(call gb_LinkTarget_add_libs,$(1),-ltextcat)
502endef
503
504else # !SYSTEM_LIBTEXTCAT
505
506$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
507	libtextcat \
508	textcat \
509))
510
511define gb_LinkTarget__use_libtextcat
512ifeq ($(OS),WNT)
513$(call gb_LinkTarget_add_linked_libs,$(1),libtextcat)
514else
515$(call gb_LinkTarget_add_linked_libs,$(1),textcat)
516endif
517endef
518
519endif # SYSTEM_LIBTEXTCAT
520
521
522ifeq ($(SYSTEM_MYTHES),YES)
523
524define gb_LinkTarget__use_mythes
525$(call gb_LinkTarget_set_include,$(1),\
526	$$(INCLUDE) \
527	$(MYTHES_CFLAGS) \
528)
529$(call gb_LinkTarget_add_libs,$(1),$(MYTHES_LIBS))
530endef
531
532else # !SYSTEM_MYTHES
533
534ifeq ($(OS),WNT)
535$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,libmythes))
536else
537$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,mythes-1.2))
538endif
539
540define gb_LinkTarget__use_mythes
541ifeq ($(OS),WNT)
542$(call gb_LinkTarget_add_linked_static_libs,$(1),libmythes)
543else
544$(call gb_LinkTarget_add_linked_static_libs,$(1),mythes-1.2)
545endif
546endef
547
548endif # SYSTEM_MYTHES
549
550
551ifeq ($(SYSTEM_HUNSPELL),YES)
552
553define gb_LinkTarget__use_hunspell
554$(call gb_LinkTarget_set_include,$(1),\
555		$$(INCLUDE) \
556		$(HUNSPELL_CFLAGS) \
557)
558$(call gb_LinkTarget_add_libs,$(1),$(HUNSPELL_LIBS))
559endef
560
561else # !SYSTEM_HUNSPELL
562
563ifeq ($(GUI),WNT)
564$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,libhunspell))
565else ifeq ($(GUI),OS2)
566$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,hunspell))
567else
568$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,hunspell-1.3))
569endif
570
571define gb_LinkTarget__use_hunspell
572$(call gb_LinkTarget_set_include,$(1),\
573	$$(INCLUDE) \
574	-I$(OUTDIR)/inc/hunspell \
575)
576$(call gb_LinkTarget_add_defs,$(1),\
577	-DHUNSPELL_STATIC
578)
579ifeq ($(GUI),WNT)
580$(call gb_LinkTarget_add_linked_static_libs,$(1),libhunspell)
581else ifeq ($(GUI),OS2)
582$(call gb_LinkTarget_add_linked_static_libs,$(1),hunspell)
583else
584$(call gb_LinkTarget_add_linked_static_libs,$(1),hunspell-1.3)
585endif
586endef
587
588endif # SYSTEM_HUNSPELL
589
590
591
592ifeq ($(SYSTEM_PYTHON),YES)
593
594define gb_LinkTarget__use_python
595$(call gb_LinkTarget_set_include,$(1),\
596        $$(INCLUDE) \
597        $(filter -I%,$(PYTHON_CFLAGS)) \
598)
599$(call gb_LinkTarget_add_defs,$(1),\
600        $(filter-out -I%,$(PYTHON_CFLAGS)) \
601)
602$(call gb_LinkTarget_add_libs,$(1),\
603        $(PYTHON_LIBS) \
604)
605endef
606
607else # !SYSTEM_PYTHON
608
609include $(SRCDIR)/python/pyversion.mk
610
611define gb_LinkTarget__use_python
612$(call gb_LinkTarget_set_include,$(1),\
613        $$(INCLUDE) \
614        -I$(OUTDIR)/inc/python \
615)
616$(call gb_LinkTarget_add_libs,$(1),$(PYTHONLIB))
617endef
618
619endif # SYSTEM_PYTHON
620
621# vim: set noet sw=4 ts=4:
622