cmake/
[obnox/wireshark/wip.git] / cmake / modules / LICENSE.txt
1 All files in this directory are dual licensed by the licenses
2 included below, unless the individual license of a file says
3 otherwise.
4
5  $Id$
6
7 ###################################################################
8 #
9 #  Copyright (c) 2004 Jan Woetzel
10 #  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 # Boston, MA  02110-1301, USA.
26 #
27 ###################################################################
28 #
29 #  Copyright (c) 2004 Jan Woetzel
30 #  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
31 #  All rights reserved.
32 #
33 # Redistribution and use in source and binary forms, with or without
34 # modification, are permitted provided that the following conditions
35 # are met:
36 #
37 # * Redistributions of source code must retain the above copyright
38 #   notice, this list of conditions and the following disclaimer.
39 #
40 # * Redistributions in binary form must reproduce the above copyright
41 #   notice, this list of conditions and the following disclaimer in
42 #   the documentation and/or other materials provided with the
43 #   distribution.
44 #
45 # * Neither the name of the <ORGANIZATION> nor the names of its
46 #   contributors may be used to endorse or promote products derived
47 #   from this software without specific prior written permission.
48 #
49 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
52 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
53 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
57 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
59 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
60 # POSSIBILITY OF SUCH DAMAGE.
61 #
62
63 IF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
64   # in cache already
65   SET(GTK2_FOUND TRUE)
66 ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
67   IF(UNIX)
68     # use pkg-config to get the directories and then use these values
69     # in the FIND_PATH() and FIND_LIBRARY() calls
70     INCLUDE(UsePkgConfig)
71
72     PKGCONFIG(gtk+-2.0 _GTK22IncDir _GTK22LinkDir _GTK22LinkFlags _GTK22Cflags)
73
74     FIND_PATH(GTK2_GTK_INCLUDE_PATH gtk/gtk.h
75       $ENV{GTK2_HOME}
76       ${_GTK22IncDir}
77       /usr/include/gtk-2.0
78       /usr/local/include/gtk-2.0
79       /opt/gnome/include/gtk-2.0
80     )
81
82     # Some Linux distributions (e.g. Red Hat) have glibconfig.h
83     # and glib.h in different directories, so we need to look
84     # for both.
85     #  - Atanas Georgiev <atanas@cs.columbia.edu>
86     PKGCONFIG(glib-2.0 _GLIB2IncDir _GLIB2inkDir _GLIB2LinkFlags _GLIB2Cflags)
87     PKGCONFIG(gmodule-2.0 _GMODULE2IncDir _GMODULE2inkDir _GMODULE2LinkFlags _GMODULE2Cflags)
88     SET(GDIR /opt/gnome/lib/glib-2.0/include)
89     FIND_PATH(GTK2_GLIBCONFIG_INCLUDE_PATH glibconfig.h
90       ${_GLIB2IncDir}
91       /opt/gnome/lib64/glib-2.0/include
92       /opt/gnome/lib/glib-2.0/include
93       /usr/lib64/glib-2.0/include
94       /usr/lib/glib-2.0/include
95     )
96     #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
97
98     FIND_PATH(GTK2_GLIB_INCLUDE_PATH glib.h
99       ${_GLIB2IncDir}
100       /opt/gnome/include/glib-2.0
101       /usr/include/glib-2.0
102     )
103     #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
104
105     FIND_PATH(GTK2_GTKGL_INCLUDE_PATH gtkgl/gtkglarea.h
106       ${_GLIB2IncDir}
107       /usr/include
108       /usr/local/include
109       /usr/openwin/share/include
110       /opt/gnome/include
111     )
112
113     PKGCONFIG(pango _PANGOIncDir _PANGOinkDir _PANGOLinkFlags _PANGOCflags)
114
115     FIND_PATH(GTK2_PANGO_INCLUDE_PATH pango/pango.h
116       ${_PANGOIncDir}
117       /opt/gnome/include/pango-1.0
118       /usr/include/pango-1.0
119     )
120
121     PKGCONFIG(gdk-2.0 _GDK2IncDir _GDK2inkDir _GDK2LinkFlags _GDK2Cflags)
122
123     FIND_PATH(GTK2_GDKCONFIG_INCLUDE_PATH gdkconfig.h
124       ${_GDK2IncDir}
125       /opt/gnome/lib/gtk-2.0/include
126       /opt/gnome/lib64/gtk-2.0/include
127       /usr/lib/gtk-2.0/include
128       /usr/lib64/gtk-2.0/include
129     )
130
131     PKGCONFIG(cairo _CAIROIncDir _CAIROinkDir _CAIROLinkFlags _CAIROCflags)
132
133     FIND_PATH(GTK2_CAIRO_INCLUDE_PATH cairo.h
134       ${_CAIROIncDir}
135       /opt/gnome/include/cairo
136       /usr/include
137       /usr/include/cairo
138     )
139     #MESSAGE(STATUS "DEBUG: GTK2_CAIRO_INCLUDE_PATH = ${GTK2_CAIRO_INCLUDE_PATH}")
140
141     PKGCONFIG(atk _ATKIncDir _ATKinkDir _ATKLinkFlags _ATKCflags)
142
143     FIND_PATH(GTK2_ATK_INCLUDE_PATH atk/atk.h
144       ${_ATKIncDir}
145       /opt/gnome/include/atk-1.0
146       /usr/include/atk-1.0
147     )
148     #MESSAGE(STATUS "DEBUG: GTK2_ATK_INCLUDE_PATH = ${GTK2_ATK_INCLUDE_PATH}")
149
150     FIND_LIBRARY(GTK2_GTKGL_LIBRARY
151       NAMES
152         gtkgl
153       PATHS
154         ${_GTK22IncDir}
155         /usr/lib
156         /usr/local/lib
157         /usr/openwin/lib
158         /usr/X11R6/lib
159         /opt/gnome/lib
160     )
161
162     FIND_LIBRARY(GTK2_GTK_LIBRARY
163       NAMES
164         gtk-x11-2.0
165       PATHS
166         ${_GTK22LinkDir}
167         /usr/lib
168         /usr/local/lib
169         /usr/openwin/lib
170         /usr/X11R6/lib
171         /opt/gnome/lib
172     )
173
174     FIND_LIBRARY(GTK2_GDK_LIBRARY
175       NAMES
176         gdk-x11-2.0
177       PATHS
178         ${_GDK2LinkDir}
179         /usr/lib
180         /usr/local/lib
181         /usr/openwin/lib
182         /usr/X11R6/lib
183         /opt/gnome/lib
184     )
185
186     FIND_LIBRARY(GTK2_GMODULE_LIBRARY
187       NAMES
188         gmodule-2.0
189       PATHS
190         ${_GMODULE2inkDir}
191         /usr/lib
192         /usr/local/lib
193         /usr/openwin/lib
194         /usr/X11R6/lib
195         /opt/gnome/lib
196     )
197
198     FIND_LIBRARY(GTK2_GLIB_LIBRARY
199       NAMES
200         glib-2.0
201       PATHS
202         ${_GLIB2inkDir}
203         /usr/lib
204         /usr/local/lib
205         /usr/openwin/lib
206         /usr/X11R6/lib
207         /opt/gnome/lib
208     )
209
210     FIND_LIBRARY(GTK2_Xi_LIBRARY 
211       NAMES
212         Xi
213       PATHS 
214         /usr/lib
215         /usr/local/lib
216         /usr/openwin/lib
217         /usr/X11R6/lib
218         /opt/gnome/lib
219     )
220
221     FIND_LIBRARY(GTK2_GTHREAD_LIBRARY
222       NAMES
223         gthread-2.0
224       PATHS
225         /usr/lib
226         /usr/local/lib
227         /usr/openwin/lib
228         /usr/X11R6/lib
229         /opt/gnome/lib
230     )
231
232
233     FIND_LIBRARY(GTK2_GOBJECT_LIBRARY
234       NAMES
235         gobject-2.0
236       PATHS
237         /usr/lib
238         /usr/local/lib
239         /usr/openwin/lib
240         /usr/X11R6/lib
241         /opt/gnome/lib
242     )
243
244     IF(GTK2_GTK_INCLUDE_PATH)
245       IF(GTK2_GLIBCONFIG_INCLUDE_PATH)
246         IF(GTK2_GLIB_INCLUDE_PATH)
247           IF(GTK2_GTK_LIBRARY)
248             IF(GTK2_GLIB_LIBRARY)
249               IF(GTK2_PANGO_INCLUDE_PATH)
250                 IF(GTK2_ATK_INCLUDE_PATH)
251                   IF(GTK2_CAIRO_INCLUDE_PATH)
252                     # Assume that if gtk and glib were found, the other
253                     # supporting libraries have also been found.
254
255                     SET(GTK2_FOUND TRUE)
256
257                     SET(GTK2_INCLUDE_DIRS
258                       ${GTK2_GTK_INCLUDE_PATH}
259                       ${GTK2_GLIBCONFIG_INCLUDE_PATH}
260                       ${GTK2_GLIB_INCLUDE_PATH}
261                       ${GTK2_PANGO_INCLUDE_PATH}
262                       ${GTK2_GDKCONFIG_INCLUDE_PATH}
263                       ${GTK2_ATK_INCLUDE_PATH}
264                       ${GTK2_CAIRO_INCLUDE_PATH}
265                       CACHE INTERNAL "The include directories for GTK2"
266                     )
267
268                     SET(GTK2_LIBRARIES
269                       ${GTK2_GTK_LIBRARY}
270                       ${GTK2_GDK_LIBRARY}
271                       ${GTK2_GLIB_LIBRARY}
272                     )
273                     #${GTK2_GOBJECT_LIBRARY})
274
275                     IF(GTK2_GMODULE_LIBRARY)
276                       SET(GTK2_LIBRARIES
277                         ${GTK2_LIBRARIES}
278                         ${GTK2_GMODULE_LIBRARY}
279                       )
280                     ENDIF(GTK2_GMODULE_LIBRARY)
281
282                     IF(GTK2_GTHREAD_LIBRARY)
283                       SET(GTK2_LIBRARIES
284                         ${GTK2_LIBRARIES}
285                         ${GTK2_GTHREAD_LIBRARY}
286                       )
287                     SET(GTK2_LIBRARIES ${GTK2_LIBRARIES} CACHE INTERNAL "The libraries for GTK2"
288                     ENDIF(GTK2_GTHREAD_LIBRARY)
289                   ELSE(GTK2_CAIRO_INCLUDE_PATH)
290                     MESSAGE(STATUS "Can not find cairo")
291                   ENDIF(GTK2_CAIRO_INCLUDE_PATH)
292                 ELSE(GTK2_ATK_INCLUDE_PATH)
293                   MESSAGE(STATUS "Can not find atk")
294                 ENDIF(GTK2_ATK_INCLUDE_PATH)
295               ELSE(GTK2_PANGO_INCLUDE_PATH)
296                 MESSAGE(STATUS "Can not find pango includes")
297               ENDIF(GTK2_PANGO_INCLUDE_PATH)
298             ELSE(GTK2_GLIB_LIBRARY)
299               MESSAGE(STATUS "Can not find glib lib")
300             ENDIF(GTK2_GLIB_LIBRARY)
301           ELSE(GTK2_GTK_LIBRARY)
302             MESSAGE(STATUS "Can not find gtk lib")
303           ENDIF(GTK2_GTK_LIBRARY)
304         ELSE(GTK2_GLIB_INCLUDE_PATH)
305           MESSAGE(STATUS "Can not find glib includes")
306         ENDIF(GTK2_GLIB_INCLUDE_PATH)
307       ELSE(GTK2_GLIBCONFIG_INCLUDE_PATH)
308         MESSAGE(STATUS "Can not find glibconfig")
309       ENDIF(GTK2_GLIBCONFIG_INCLUDE_PATH)
310     ELSE (GTK2_GTK_INCLUDE_PATH)
311       MESSAGE(STATUS "Can not find gtk includes")
312     ENDIF (GTK2_GTK_INCLUDE_PATH)
313
314     IF (GTK2_FOUND)
315       IF (NOT GTK2_FIND_QUIETLY)
316         MESSAGE(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
317       ENDIF (NOT GTK2_FIND_QUIETLY)
318     ELSE (GTK2_FOUND)
319       IF (GTK2_FIND_REQUIRED)
320         MESSAGE(SEND_ERROR "Could NOT find GTK2")
321       ENDIF (GTK2_FIND_REQUIRED)
322     ENDIF (GTK2_FOUND)
323
324     MARK_AS_ADVANCED(
325       GTK2_GDK_LIBRARY
326       GTK2_GLIB_INCLUDE_PATH
327       GTK2_GLIB_LIBRARY
328       GTK2_GLIBCONFIG_INCLUDE_PATH
329       GTK2_GMODULE_LIBRARY
330       GTK2_GTHREAD_LIBRARY
331       GTK2_Xi_LIBRARY
332       GTK2_GTK_INCLUDE_PATH
333       GTK2_GTK_LIBRARY
334       GTK2_GTKGL_INCLUDE_PATH
335       GTK2_GTKGL_LIBRARY
336       GTK2_ATK_INCLUDE_PATH
337       GTK2_GDKCONFIG_INCLUDE_PATH
338       #GTK2_GOBJECT_LIBRARY
339       GTK2_PANGO_INCLUDE_PATH
340     )
341   ENDIF(UNIX)
342 ENDIF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
343
344 # vim:et ts=2 sw=2 comments=\:\#