summaryrefslogtreecommitdiff
path: root/Build/source/libs/zziplib/zziplib-0.13.60/docs/configs.htm
blob: 49631e673defb48e8b13c68c81b2e27c99e6589d (plain)
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
<section> <date> February 2003 </date>
<h2> Configuration </h2>                    of other projects using zziplib

<!--border-->

<P>
  If using the zziplib with other project then you can use a number
  of possibility to configure and link. The zziplib had been usually
  included within the projects that made use of it - some did even
  pick up the advantage to be allowed to staticlink in a limited
  set of conditions. Recently however, the zziplib is shipped as a
  standard library of various linux/freebsd distros - mostly for
  the usage by the php-zip module. This allows third party software
  makers to link to the preinstalled library in the system and
  consequently reduce the memory consumption - even more than now
  with the zziplib being a lightweight anyway (the i386 .so is 
  usually less than 20k)
</P>

<section>
<h3> pkg-config --libs </h3>

<P>
  Within modern software development, one should be advised to use
  pkg-config as soon as it is available. The pkg-config helper can
  handle a lot of problems that can usually come up with linking
  to third party libraries in case that those link again dynamically
  with other libraries themselves. It does correctly order the
  list of "libs", it can throw away duplicate "-L" hints, and same
  for cflags "-I" hints, plus it will throw away some sys-includes
  that gcc3.2 will warn about with a false positive.
</P>
<P>
  There is a number of pkg-config targets installed in the system
  but the one you want to use is <b>pkg-config zziplib</b>. 
  Therefore, a simple Makefile could read like
  <pre>
    PROGRAM = my_prog
    CFLAGS = -Dhappy `pkg-config zziplib --cflags`
    LIBS   = -Wl,-E  `pkg-config zziplib --libs`

    my_prog.o : my_prog.c
       $(CC) $(CFLAGS) $&lt; -o $@
    my_prog : my_prog.o
       $(LINK) $&lt; $(LIBS)
  </pre>
</P>
<P>
   The `pkg-config zziplibs --libs` will usually expand to 
   something like <code>-lzzip -lz</code> which are the
   two (!!) libraries that you need to link with - in that
   order. The zziplib builds on top of the z-lib algorithms
   for compression of files within the zip-archive. That's
   the same for other lib-parts of the zziplib project as
   well, e.g. the sdl-rwops part which does also need to
   link with the sdl-lib - and that's where the pkg-config
   infrastructure can be of great help. That's the reason
   why zziplib installs a few more ".pc" files, you can
   get a list of them like this:
   <pre>
   $ pkg-config --list-all | sort | grep zzip
   zziplib               zziplib - ZZipLib - libZ-based ZIP-access Library
   zzip-sdl-config       zzip-sdl-config - SDL Config (for ZZipLib)
   zzip-sdl-rwops        zzip-sdl-rwops - SDL_rwops for ZZipLib
   zzipwrap              zzipwrap - Callback Wrappers for ZZipLib
   zzip-zlib-config      zzip-zlib-config - ZLib Config (for ZZipLib)
   </pre>
</P><P>
   The two entries like "zzip-sdl-config" and "zzip-zlib-config"
   happen to be ".pc" files for the libz.so and libSDL.so that
   were seen at configure-time of zziplib - you may want to reuse
   these in your projects as well whenever you need to link to
   either of zlib or libsdl even in places where there is no direct
   need for zziplib. It basically looks like:
   <pre>
   $ pkg-config zzip-zlib-config --modversion
   1.1.4
   $ pkg-config zzip-zlib-config --libs      
    -lz  
   </pre>
</P>

</section><section>
<h3> zzip-config </h3>
<P>
   The pkg-config ".pc" files are relativly young in the history of
   zziplib. A long time before that there was the `zzip-config`
   script installed in the system. These `*-config` were common
   before the pkg-config came about, and in fact the pkg-config
   infrastructure was invented to flatten away the problems of
   using multiple `*-config` scripts for a project. As long as you
   do not combine multiple `*-config`s then it should be well okay
   to use the `zzip-config` directly - it does also kill another
   dependency on the `pkg-config` tool to build your project, the
   zziplib is all that's needed.
</P>
<P>
   In its call-structure the `zzip-config` script uses the same
   options as `pkg-config`, (well they are historic cousins anyway).
   and that simply means you can replace each call above like
   `pkg-config zziplib...` with `zzip-config...`.

  <pre>
    PROGRAM = my_prog
    CFLAGS = -Dhappy `zzip-config --cflags`
    LIBS   = -Wl,-E  `zzip-config --libs`

    my_prog.o : my_prog.c
       $(CC) $(CFLAGS) $&lt; -o $@
    my_prog : my_prog.o
       $(LINK) $&lt; $(LIBS)
  </pre>
</P>
<P>
   Be informed that the zzip-config script is low-maintained and
   starting with 2004 it will be replaced with a one-line script 
   that simply reads `pkg-config zziplib $*`. By that time the
   rpm/deb packages will also list "pkgconfig" as a dependency
   on the zziplib-devel/zziplib-dev part.
</P>

</section><section>
<h3> autoconf macro </h3>

<P>
  There is currently an autoconf macro installed along into
  the usual /usr/share/aclocal space for making it easier for
  you to pick up the configure-time cflags/libs needed to
  build/link with zziplib. In any way it does look like
  this:
  <pre>
  dnl PKG_CHECK_ZZIPLIB(ZSTUFF, min-version, action-if, action-not)
  AC_DEFUN([PKG_CHECK_ZZIPLIB],[dnl
  PKG_CHECK_MODULES([$1], [zziplib $2], [$3], [$4])])
  </pre>
</P>
<P>
  You are strongly advised to take advantage of the pkgconfig's
  macro directly - you can find the macro in
  <code>/usr/share/aclocal/pkg.m4</code> and it allows to
  combine the flags of a list of library modules that you
  want to have. If it is only zziplib, than you could simply
  use this in your configure.ac:
<pre>
  <b>PKG_CHECK_MODULES</b>([<b>ZZIP</b>],[zziplib &gt;= 0.10.75])
  </pre>
</P><P>
  which will provide you with two autoconf/automake variables
  named <b><code>ZZIP_CFLAGS</code></b> and <b><code>ZZIP_LIBS</code></b> 
  respectivly.
</P>
<P>
  Up to 2004, the macro in zziplib.m4 will be however carry
  a copy of the pkg.m4 so that you do not need another
  dependency for your software project. The macro is called
  like shown above PKG_CHECK_ZZIPLIB and you would call it
  like
<br><code>&nbsp;&nbsp;&nbsp;&nbsp;
  PKG_CHECK_ZZIPLIB([ZZIP],[0.10.75])</code><br>
  which will give you the two autoconf/automake variables
  as well,  <code>ZZIP_CFLAGS</code> and <code>ZZIP_LIBS</code>
</P>

</section></section>