Make
[shermanaquarium] / sherman-aquarium / configure.in
1 dnl
2 dnl Sherman's aquarium 3.0.1 configure script.
3 dnl Written by Jonas Aaberg <cja@gmx.net> 2002-2005
4 dnl
5 dnl run autoconf to generate a configure script from this file.
6 dnl
7
8 AC_PREREQ(2.13)
9 AC_INIT()
10
11 dnl **************************************************************************
12 dnl                 Change those things between the star lines.
13 dnl ***************************************************************************
14
15 dnl This is the name of your applet, low level. $(APPLET_NAME).c is the main
16 dnl c file. 
17 APPLET_NAME="shermans_applet"
18
19 dnl The version of your applet
20 APPLET_VERSION="3.0.1"
21
22 dnl The display name in the gnome 2 menu and for the About box.
23 APPLET_NICE_NAME="Sherman's aquarium"
24
25 dnl Your name and email for the "Written by " field in the about box
26 APPLET_AUTHOR="Jonas Aaberg, <cja@gmx.net> 2002-2005. Graphics by Jim Toomey."
27
28 dnl Change the group. (This is just for gnome)
29 dnl Valid groups are: 
30 dnl "Accessories", "Amusements", "Internet", "Multimedia" and "Utility"
31 APPLET_GROUP="Amusements"
32
33 dnl The name file of the icon for the menu.
34 APPLET_NAME_ICON="shermans_icon.png"
35
36 dnl Images to install.
37 APPLET_IMAGES="aquarium/*"
38
39 dnl A one line description for the gnome menu.
40 APPLET_DESCRIPTION_SHORT="Bringer of life."
41
42 dnl This is the text displayed in the about box.
43 APPLET_DESCRIPTION="Sherman's aquarium is an applet with the\ncreatures from Jim Toomey's\nwonderful comic, Sherman's Lagoon\n(www.slagoon.com)."
44
45 dnl This is for the license line in the about box.
46 APPLET_LICENSE="Program released under GNU GPL.\nMost graphics Copyrighted by Jim Toomey and is NOT under GNU GPL."
47
48 dnl Version of GAI that is required
49 APPLET_REQUIRES_GAI_VERSION="0.5.3"
50
51 dnl Require XMMS (yes or no or checkfor)
52 APPLET_XMMS=checkfor
53
54 dnl ****************************************************************************
55
56 with_sdl=yes
57 AC_MSG_CHECKING(whether to try to include Screensaver support)
58 AC_ARG_ENABLE(sdl, [  --disable-sdl               Compile Sherman's aquarium without Screensaver support],[
59                      if test x$withval = xyes; then
60                         with_sdl=yes
61                      else
62                         with_sdl=no
63                      fi
64 ])
65 if test x$with_sdl = xno; then
66    AC_MSG_RESULT(no)
67 else
68    AC_MSG_RESULT(yes)
69 fi
70
71
72 with_gai=yes
73 AC_MSG_CHECKING(whether to try to compile applet support )
74 AC_ARG_ENABLE(gai, [  --disable-gai               Compile Sherman's aquarium without applet support],[
75                      if test x$withval = xyes; then
76                         with_gai=yes
77                      else
78                         with_gai=no
79                      fi
80 ])
81 if test x$with_gai = xno; then
82    AC_MSG_RESULT(no)
83 else
84    AC_MSG_RESULT(yes)
85 fi
86
87
88 AC_PROG_CC
89 AC_SUBST(APPLET_NAME)
90 AC_SUBST(APPLET_VERSION)
91 AC_SUBST(APPLET_NICE_NAME)
92 AC_SUBST(APPLET_AUTHOR)
93 AC_SUBST(APPLET_GROUP)
94 AC_SUBST(APPLET_NAME_ICON)
95 AC_SUBST(APPLET_IMAGES)
96 AC_SUBST(APPLET_DESCRIPTION_SHORT)
97 AC_SUBST(APPLET_DESCRIPTION)
98 AC_SUBST(APPLET_LICENSE)
99
100 dnl OS check
101
102 AC_MSG_CHECKING(operating system)
103 OSTYPE=`uname -s`
104 AC_MSG_RESULT($OSTYPE)
105 HOST="UNKNOWN"
106 STATUS=
107 SYSTEM_SPECIFIC_LIBS=
108 case $OSTYPE in
109
110      Linux)
111         HOST="LINUX"
112         MINOR=`uname -r | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'`
113         if test x$MINOR = x4 ; then
114                 STATUS="status_linux24.o"
115         else
116                 STATUS="status_linux26.o"
117         fi
118         ;;
119      Darwin)
120         HOST="DARWIN"
121         STATUS="status_drawin.o"
122         ;;
123      FreeBSD)
124         HOST="FREEBSD"
125         STATUS="status_freebsd.o"
126         SYSTEM_SPECIFIC_LIBS="-lkvm"
127         ;;
128      OpenBSD)
129         HOST="OPENBSD"
130         ;;
131      NetBSD)
132         HOST="NETBSD"
133         ;;
134      SunOS)
135         HOST="SUNOS"
136         ;;
137 esac
138 AC_SUBST(HOST)
139 AC_SUBST(SYSTEM_SPECIFIC_LIBS)
140 AC_SUBST(STATUS)
141
142 INSTALL_APPLET=
143 GAI=no
144 APPLET=
145 DGAI=
146 FOUND_GAI_LIBS=no
147
148 INSTALL_GNOME=
149 GNOME=no
150
151
152 dnl gai
153 if test x$with_gai = xyes ; then
154 AC_CHECK_PROG(PKGCONF, pkg-config, true, false)
155
156 if $PKGCONF ; then
157     AC_MSG_CHECKING(for gai)
158     if `pkg-config --exists gai`  ; then
159         AC_MSG_RESULT(yes)
160         GAI_CFLAGS=`pkg-config --cflags gai`
161         GAI_LIBS=`pkg-config --libs gai`
162         FOUND_GAI_LIBS=yes
163     else
164        AC_MSG_RESULT(no,
165 GAI is needed for applet support! Please visit http://gai.sf.net)
166     fi
167 else
168     AC_MSG_ERROR("can't find pkg-config!")
169 fi
170
171 dnl gai version
172 if test x$FOUND_GAI_LIBS = xyes ; then
173
174    AC_MSG_CHECKING(for gai version >= $APPLET_REQUIRES_GAI_VERSION)
175    if `pkg-config gai --atleast-version $APPLET_REQUIRES_GAI_VERSION` ; then
176       AC_MSG_RESULT(yes)
177       DGAI=-DGAI
178       GAI=yes
179       APPLET=shermans_applet
180       INSTALL_APPLET=install_applet
181    else
182       AC_MSG_RESULT(no,
183       a newer version of GAI is needed! Please visit http://gai.sf.net)
184       GAI=no
185    fi
186
187
188
189 dnl Gnome support
190 if test x$GAI = xyes ; then
191 AC_MSG_CHECKING(if gai is compiled with gnome support)
192
193 INSTALL_GNOME=
194 GNOME_SERVER=
195
196 if test `pkg-config gai --variable=gnome` = yes; then
197     AC_MSG_RESULT(yes)
198     GNOME=yes
199     AC_MSG_CHECKING([for gnome prefix])
200     with_gnome_prefix=`(pkg-config --variable=prefix libpanelapplet-2.0) 2>/dev/null`
201     if test $? -ne 0; then
202        with_gnome_prefix='${prefix}'
203     fi
204     AC_MSG_RESULT([$with_gnome_prefix])
205
206     GNOMEDIR=$with_gnome_prefix
207     INSTALL_GNOME=install-gnome
208     INSTALL_PATH='$(GNOMEDIR)'
209     
210     GNOMESERVER=`echo -n GNOME_$APPLET_NAME;echo -n "Applet.server"`
211     cat >$GNOMESERVER.in << EOF
212 <oaf_info>
213         <oaf_server iid="OAFIID:GNOME_@APPLET_NAME@Applet_Factory" type="exe" location="@GNOMEDIR@/bin/@APPLET_NAME@">
214                 <oaf_attribute name="repo_ids" type="stringv">
215                         <item value="IDL:Bonobo/GenericFactory:1.0"/>
216                         <item value="IDL:Bonobo/Unknown:1.0"/>
217                 </oaf_attribute>
218                 <oaf_attribute name="name" type="string" value="@APPLET_NAME@ applet Factory"/>
219                 <oaf_attribute name="description" type="string" value="Factory for @APPLET_NAME@ applet"/>
220         </oaf_server>
221
222         <oaf_server iid="OAFIID:GNOME_@APPLET_NAME@Applet" type="factory" location="OAFIID:GNOME_@APPLET_NAME@Applet_Factory">
223                 <oaf_attribute name="repo_ids" type="stringv">
224                         <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
225                         <item value="IDL:Bonobo/Control:1.0"/>
226                         <item value="IDL:Bonobo/Unknown:1.0"/>
227                 </oaf_attribute>
228                 <oaf_attribute name="name" type="string" value="@APPLET_NICE_NAME@"/>
229                 <oaf_attribute name="description" type="string" value="@APPLET_DESCRIPTION_SHORT@"/>
230                 <oaf_attribute name="panel:category" type="string" value="@APPLET_GROUP@"/>
231                 <oaf_attribute name="panel:icon" type="string" value="@APPLET_NAME_ICON@"/>
232         </oaf_server>
233 </oaf_info>
234 EOF
235
236
237 else
238     AC_MSG_RESULT(no)
239     GNOME=no
240     if test x$prefix = xNONE ; then
241         GNOMEDIR=/usr/local/
242         INSTALL_PATH=/usr/local/
243     else
244         GNOMEDIR=$prefix
245         INSTALL_PATH=$prefix
246     fi
247 fi 
248
249
250 fi
251
252 AC_SUBST(GNOMEDIR)
253
254
255 ROX_APPRUN=
256 ROX_APPINFO=
257 INSTALL_ROX=
258 ROX_PATH=
259 dnl ROX
260 AC_MSG_CHECKING(if gai knows about the ROX panel)
261 if test `pkg-config gai --variable=rox` = yes; then
262     AC_MSG_RESULT(yes)
263     ROX_APPRUN=AppRun
264
265     cat >AppRun.in << EOF
266 #!/bin/sh
267 # Slightly modified by Jonas Aaberg <cja@gmx.net> to suit GAI applets.
268
269 PROG=@APPLET_NAME@
270
271 APP_DIR=\`dirname "\$0"\`
272 APP_DIR=\`cd "\$APP_DIR";pwd\`; export APP_DIR
273
274 BIN="\$APP_DIR/\$PROG"
275
276 exec "\$BIN" --gai-rox "\$@"
277 EOF
278
279     ROX_APPINFO=AppInfo.xml
280
281     cat >AppInfo.xml.in << EOF
282 <?xml version="1.0"?>
283 <AppInfo>
284   <Summary>@APPLET_DESCRIPTION_SHORT@</Summary>
285 </AppInfo>
286
287 EOF
288
289
290     INSTALL_ROX=install-rox
291     ROX_PATH=`pkg-config gai --variable=roxpath`
292     AC_MSG_CHECKING(for ROX path)
293     AC_MSG_RESULT($ROX_PATH)
294 else
295     AC_MSG_RESULT(no)
296 fi
297
298
299 dnl endif gai lib not found
300 fi
301
302 dnl endif with gai 
303 fi
304
305
306 if test x$GAI = xno ; then
307     if test x$prefix = xNONE ; then
308         GNOMEDIR=/usr/local/
309         INSTALL_PATH=/usr/local/
310     else
311         GNOMEDIR=$prefix
312         INSTALL_PATH=$prefix
313     fi
314 fi 
315
316
317 AC_SUBST(DGAI)
318 AC_SUBST(GAI_CFLAGS)
319 AC_SUBST(GAI_LIBS)
320 AC_SUBST(APPLET)
321 AC_SUBST(INSTALL_APPLET)
322 AC_SUBST(INSTALL_GNOME)
323 AC_SUBST(INSTALL_PATH)
324
325
326
327 AC_SUBST(INSTALL_ROX)
328 AC_SUBST(ROX_PATH)
329
330
331
332 dnl images
333 if test x$APPLET_IMAGES = x; then
334    INSTALL_IMAGES=
335 else
336    INSTALL_IMAGES=install-images
337 fi
338 AC_SUBST(INSTALL_IMAGES)
339
340 dnl Setup image path and icon
341 if test x$GNOME = xyes ; then
342    APPLET_IMAGE_PATH=$GNOMEDIR/share/pixmaps/shermans
343    APPLET_ICON=$GNOMEDIR/share/pixmaps/$APPLET_NAME_ICON
344 else
345    if test x$prefix = xNONE ; then
346       APPLET_IMAGE_PATH=/usr/local/share/pixmaps/shermans
347       APPLET_ICON=/usr/local/share/pixmaps/$APPLET_NAME_ICON
348    else
349       APPLET_IMAGE_PATH=$prefix/share/pixmaps/shermans
350       APPLET_ICON=$prefix/share/pixmaps/$APPLET_NAME_ICON
351    fi
352 fi
353
354 AC_SUBST(APPLET_IMAGE_PATH)
355 AC_SUBST(APPLET_ICON)
356
357
358 dnl SDL
359 SDL=no
360 SCREENSAVER=
361 SDL_CFLAGS=
362 SDL_LIBS=
363 INSTALL_SCREENSAVER=
364
365 if test x$with_sdl = xyes ; then
366    AC_CHECK_PROG(SDLCONF, sdl-config, true, false)
367
368    if $SDLCONF ; then
369       sdl_version=`sdl-config --version`
370       AC_MSG_CHECKING([for SDL version ($sdl_version) >= 1.2.0])
371       dnl copied from yawmppp that copied it from gtk+'s aclocal.m4. These guys must love sed
372       SDL_MAJOR=`sdl-config --version | \
373                  sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
374       SDL_MINOR=`sdl-config --version | \
375                  sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
376       SDL_MICRO=`sdl-config --version | \
377                  sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
378       SDL=yes
379
380       if test $SDL_MAJOR -eq 1 ; then
381          if test $SDL_MINOR -eq 2 ; then
382              SDL=yes;
383          else
384              SDL=no;
385          fi      
386       else
387          SDL=no
388       fi   
389
390       if test x$SDL = xyes ; then
391          SDL_CFLAGS=`sdl-config --cflags`
392          SDL_LIBS=`sdl-config --libs`
393          SCREENSAVER=shermans
394          INSTALL_SCREENSAVER=install_screensaver
395          AC_MSG_RESULT(yes)
396          dnl gtk+ v2.2.x
397          AC_MSG_CHECKING(for gtk+ version >= 2.2.0)
398          if `pkg-config gtk+-2.0 --atleast-version 2.2.0` ; then
399             AC_MSG_RESULT(yes)
400             GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
401             GTK_LIBS=`pkg-config --libs gtk+-2.0`
402             AC_SUBST(GTK_LIBS)
403             AC_SUBST(GTK_CFLAGS)
404          else
405             AC_MSG_RESULT(no)
406             AC_MSG_ERROR(GTK+ v2.2.0 or later is needed for Sherman's aquarium!)
407          fi
408       else
409          AC_MSG_RESULT(no)
410       fi
411   fi
412
413 fi
414
415 AC_SUBST(GAI_CFLAGS)
416 AC_SUBST(GAI_LIBS)
417 AC_SUBST(APPLET)
418 AC_SUBST(INSTALL_SCREENSAVER)
419
420 AC_SUBST(SDL_CFLAGS)
421 AC_SUBST(SDL_LIBS)
422 AC_SUBST(SCREENSAVER)
423
424 dnl XMMS
425 XMMS=
426 XMMS_CFLAGS=
427 XMMS_LIBS=
428 XMMS_OBJ=
429 if test x$FOUND_GAI_LIBS = xyes ; then
430 if test x$with_gai = xyes ; then
431 if test x$APPLET_XMMS = xyes ; then
432    AC_CHECK_PROG(XMMS_CONFIG, xmms-config, true, false)
433
434    if $XMMS_CONFIG ; then
435       XMMS_CFLAGS=`xmms-config --cflags`
436       XMMS_LIBS=`xmms-config --libs`
437       XMMS="#define XMMS"
438    else
439       AC_MSG_ERROR("can't find xmms-config! XMMS installed?")
440    fi
441 fi
442 if test x$APPLET_XMMS = xcheckfor ; then
443    AC_CHECK_PROG(XMMS_CONFIG, xmms-config, true, false)
444
445    if $XMMS_CONFIG ; then
446       XMMS_CFLAGS=`xmms-config --cflags`
447       XMMS_LIBS=`xmms-config --libs`
448       XMMS="#define XMMS"
449       XMMS_OBJ="xmms_sn.o"
450    fi
451 fi
452 fi
453 fi
454
455 AC_SUBST(XMMS_OBJ)
456 AC_SUBST(XMMS_CFLAGS)
457 AC_SUBST(XMMS_LIBS)
458 AC_SUBST(XMMS)
459
460 REMARK="This file is autogenerated by the configure script."
461 REMARK2="So don't add things you want permanent here."
462 AC_SUBST(REMARK)
463 AC_SUBST(REMARK2)
464
465
466 AC_OUTPUT($GNOMESERVER $ROX_APPRUN $ROX_APPINFO Makefile config.h shermans/Makefile)
467
468 echo
469 echo " Sherman's aquarium v$APPLET_VERSION"
470 echo "==========================="
471 echo " - Compile Sherman's aquarium - dockapp/wmapplet:       $GAI"
472 echo " - Compile Sherman's aquarium - Gnome 2 Panel applet:   $GNOME"
473 echo " - Compile Sherman's aquarium - Screensaver:            $SDL"