File: aclocal.m4

package info (click to toggle)
xplanet 0.94-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,624 kB
  • ctags: 1,191
  • sloc: cpp: 9,466; ansic: 6,375; sh: 2,065; makefile: 380; perl: 55
file content (486 lines) | stat: -rw-r--r-- 13,901 bytes parent folder | download
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
AC_DEFUN(AC_FIND_FREETYPE,
[

AC_ARG_WITH(freetype, [  --with-freetype         Enable Freetype support for TrueType fonts [yes]])

if test "$with_freetype" != 'no'; then
  AC_PATH_X_PROG(FREETYPE_CONFIG, freetype-config, no)
  if test "$FREETYPE_CONFIG" = no; then
    AC_MSG_WARN(*** Xplanet will be built without freetype support ***)
    with_freetype='no'
  else
    FREETYPE_CFLAGS="-I`$FREETYPE_CONFIG --prefix`/include `$FREETYPE_CONFIG --cflags`"
    FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
    AC_SUBST(FREETYPE_CFLAGS)
    AC_SUBST(FREETYPE_LIBS)
    AC_DEFINE(HAVE_LIBFREETYPE)
  fi
fi

])

dnl Autoconf stuff to check for graphics libraries is adapted from 
dnl imagemagick's configure.in

AC_DEFUN(AC_FIND_GRAPHICS_LIBS,

[

GRAPHICS_SOURCE=""
GRAPHICS_LIBS=""

#
# Check for GIF
#
AC_ARG_WITH(gif, [  --with-gif              Enable GIF support [yes]])

have_gif='no'
if test "$with_gif" != 'no'; then
    have_gif_header='no'
    AC_CHECK_X_HEADER(gif_lib.h,have_gif_header='yes',have_gif_header='no')
    if test "$have_gif_header" != 'no'; then
        have_libgif='no'
        AC_CHECK_X_LIB(gif, DGifOpenFileName,have_libgif='yes',have_libgif='no',$X_LIBS)

	if test "$have_libgif" != 'no'; then
	    GRAPHICS_SOURCE="$GRAPHICS_SOURCE gif.c"
            GRAPHICS_LIBS="$GRAPHICS_LIBS -lgif $X_LIBS"
	    AC_DEFINE(HAVE_LIBGIF,,Define if you have GIF library)
	    have_gif='yes'
	else
            AC_CHECK_X_LIB(ungif, DGifOpenFileName,have_libgif='yes',have_libgif='no',$X_LIBS)
            if test "$have_libgif" != 'no'; then
	        GRAPHICS_SOURCE="$GRAPHICS_SOURCE gif.c"
                GRAPHICS_LIBS="$GRAPHICS_LIBS -lungif"
                AC_DEFINE(HAVE_LIBGIF,,Define if you have GIF library)
	        have_gif='yes'
	    fi
	fi

    fi
    if test "$have_gif" != 'yes'; then
	AC_MSG_WARN(*** Native GIF support will not be included ***)
    fi
fi

#
# Check for JPEG
#
AC_ARG_WITH(jpeg, [  --with-jpeg             Enable JPEG support [yes]])

have_jpeg='no'
if test "$with_jpeg" != 'no'; then
    have_jpeg_header='no'
    AC_CHECK_X_HEADER(jpeglib.h,have_jpeg_header='yes',have_jpeg_header='no')
    if test "$have_jpeg_header" != 'no'; then
	have_libjpeg='no'
        AC_CHECK_X_LIB(jpeg,jpeg_read_header,have_libjpeg='yes',have_libjpeg='no',)
	if test "$have_libjpeg" != 'no'; then
	    GRAPHICS_SOURCE="$GRAPHICS_SOURCE jpeg.c"
	    GRAPHICS_LIBS="$GRAPHICS_LIBS -ljpeg"
	    AC_DEFINE(HAVE_LIBJPEG,,Define if you have JPEG library)
            have_jpeg='yes'
  	fi
    fi
    if test "$have_jpeg" != 'yes'; then
	AC_MSG_WARN(*** Native JPEG support will not be included ***)
    fi
fi

#
# Check for PNG
#
AC_ARG_WITH(png, [  --with-png              Enable PNG support [yes]])

have_png='no'
if test "$with_png" != 'no'; then
    have_png_header='no'
    AC_CHECK_X_HEADER(png.h,have_png_header='yes',have_png_header='no')
    AC_CHECK_X_HEADER(pngconf.h,have_png_header='yes',have_png_header='no')
    if test "$have_png_header" != 'no'; then
	have_libpng='no'
	AC_CHECK_X_LIB(png,png_create_read_struct,have_libpng='yes',have_libpng='no',-lm -lz)
	if test "$have_libpng" != 'no'; then
	    GRAPHICS_SOURCE="$GRAPHICS_SOURCE png.c"
	    GRAPHICS_LIBS="$GRAPHICS_LIBS -lpng -lm -lz"
	    AC_DEFINE(HAVE_LIBPNG,,Define if you have PNG library)
            have_png='yes'
  	fi
    fi
    if test "$have_png" != 'yes'; then
	AC_MSG_WARN(*** Native PNG support will not be included ***)
    fi
fi

#
# Check for PNM
#
AC_ARG_WITH(pnm, [  --with-pnm              Enable PNM support [yes]])

have_pnm='no'
if test "$with_pnm" != 'no'; then
    have_pnm_header='no'
    AC_CHECK_X_HEADER(pnm.h,have_pnm_header='yes',have_pnm_header='no')
    if test "$have_pnm_header" != 'no'; then
	have_libpnm='no'
        AC_CHECK_X_LIB(netpbm,pnm_init,have_libpnm='yes',have_libpnm='no',)
	if test "$have_libpnm" != 'no'; then
	    GRAPHICS_SOURCE="$GRAPHICS_SOURCE pnm.c"
	    GRAPHICS_LIBS="$GRAPHICS_LIBS -lnetpbm"
	    AC_DEFINE(HAVE_LIBPNM,,Define if you have PNM library)
            have_pnm='yes'
	else
            AC_CHECK_X_LIB(pnm,pnm_init,have_libpnm='yes',have_libpnm='no',)
	    if test "$have_libpnm" != 'no'; then
	        GRAPHICS_SOURCE="$GRAPHICS_SOURCE pnm.c"
	        GRAPHICS_LIBS="$GRAPHICS_LIBS -lpnm"
	        AC_DEFINE(HAVE_LIBPNM,,Define if you have PNM library)
                have_pnm='yes'
	    fi
  	fi
    fi
    if test "$have_pnm" != 'yes'; then
	AC_MSG_WARN(*** Native PNM support will not be included ***)
    fi
fi

#
# Check for TIFF
#
AC_ARG_WITH(tiff, [  --with-tiff             Enable TIFF support [yes]])

have_tiff='no'
if test "$with_tiff" != 'no'; then
    have_tiff_header='no'
    AC_CHECK_X_HEADER(tiff.h,have_tiff_header='yes',have_tiff_header='no')
    AC_CHECK_X_HEADER(tiffio.h,have_tiff_header='yes',have_tiff_header='no')
    if test "$have_tiff_header" != 'no'; then
	have_libtiff='no'
        AC_CHECK_X_LIB(tiff,TIFFOpen,have_libtiff='yes',have_libtiff='no',-lm)
	if test "$have_libtiff" != 'no'; then
	    GRAPHICS_SOURCE="$GRAPHICS_SOURCE tiff.c"
	    GRAPHICS_LIBS="$GRAPHICS_LIBS -ltiff -lm"
	    AC_DEFINE(HAVE_LIBTIFF,,Define if you have TIFF library)
            have_tiff='yes'
  	fi
    fi
    if test "$have_tiff" != 'yes'; then
	AC_MSG_WARN(*** Native TIFF support will not be included ***)
    fi
fi

AC_SUBST(GRAPHICS_SOURCE)
AC_SUBST(GRAPHICS_LIBS)

])

# Macros to search for OpenGL/Mesa are adapted from the
# xscreensaver-3.14 package

###############################################################################
#
#       Some utility functions to make checking for X things easier.
#
###############################################################################

# Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
#
AC_DEFUN(AC_CHECK_X_HEADER, [
  ac_save_CPPFLAGS="$CPPFLAGS"
  if test \! -z "$prefix" ; then 
    CPPFLAGS="$CPPFLAGS -I$prefix/include"
  fi
  if test \! -z "$includedir" ; then 
    CPPFLAGS="$CPPFLAGS -I$includedir"
  fi
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_CHECK_HEADER([$1], [$2], [$3])
  CPPFLAGS="$ac_save_CPPFLAGS"])

AC_DEFUN(AC_CHECK_X_LIB, [
  ac_save_LDFLAGS="$LDFLAGS"
  if test "$prefix" != "NONE"; then 
    LDFLAGS="$LDFLAGS -L$prefix/lib"
  fi
  if test \! -z "$libdir" ; then 
    LDFLAGS="$LDFLAGS -L$libdir"
  fi
  AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
  LDFLAGS="$ac_save_LDFLAGS"
]
)

# Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
#
AC_DEFUN(AC_EGREP_X_HEADER, [
  ac_save_CPPFLAGS="$CPPFLAGS"
  if test \! -z "$prefix" ; then 
    CPPFLAGS="$CPPFLAGS -I$prefix/include"
  fi
  if test \! -z "$includedir" ; then 
    CPPFLAGS="$CPPFLAGS -I$includedir"
  fi
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_EGREP_HEADER([$1], [$2], [$3], [$4])
  CPPFLAGS="$ac_save_CPPFLAGS"])

# Usage: HANDLE_X_PATH_ARG([variable_name],
#                          [--command-line-option],
#                          [descriptive string])
#
# All of the --with options take three forms:
#
#   --with-foo (or --with-foo=yes)
#   --without-foo (or --with-foo=no)
#   --with-foo=/DIR
#
# This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
# a directory (string beginning with a slash) it checks to see whether
# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
# as appropriate.
#
AC_DEFUN(HANDLE_X_PATH_ARG, [

   case "$[$1]" in
    yes) ;;
    no)  ;;

    /*)
     AC_MSG_CHECKING([for existence of [$3] headers directory])
     d=$[$1]/include
     if test -d $d; then
       X_CFLAGS="-I$d $X_CFLAGS"
       AC_MSG_RESULT($d)
     else
       AC_MSG_RESULT(not found ($d: no such directory))
     fi

     AC_MSG_CHECKING([for existence of [$3] libs directory])
     d=$[$1]/lib
     if test -d $d; then
       X_LIBS="-L$d $X_LIBS"
       AC_MSG_RESULT($d)
     else
       AC_MSG_RESULT(not found ($d: no such directory))
     fi

     # replace the directory string with "yes".
     [$1]_req="yes"
     [$1]=$[$1]_req
     ;;

    *)
     echo ""
     echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
     echo "       If it is a directory, then \`DIR/include' will be added to"
     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
     exit 1
     ;;
   esac
  ])

AC_DEFUN(AC_PATH_X_PROG, [
  ac_save_PATH="$PATH"
  if test \! -z "$prefix" ; then 
    PATH="$PATH:${prefix}/bin"
  fi
  if test \! -z "$bindir" ; then 
    PATH="$PATH:${bindir}"
  fi
  AC_PATH_PROG([$1], [$2], [$3])
  PATH="$ac_save_PATH"
]
)

#
# Check for X11
#

AC_DEFUN(AC_FIND_X11,
[

have_libx11='no'
if test "$with_x" != 'no'; then

dnl Locate X include files and libraries
   AC_PATH_XTRA
   NEW_X_LIBS="$X_LIBS -lX11"

   AC_CHECK_LIB(X11, XOpenDisplay, have_libx11='yes',have_libx11='no',$X_LIBS)
   if test "$have_libx11" != 'no'; then
     AC_DEFINE(HAVE_LIBX11,,Define if you have X11 libraries)

     DISPLAYX11="DisplayX11Base.cc DisplayX11.cc"
     AC_SUBST(DISPLAYX11)

     X_LIBS="$NEW_X_LIBS"
   else
     AC_MSG_WARN(*** Xplanet will be built without X11 support ***)
   fi
fi

if test "$have_libx11" = 'no'; then
  XPARSEGEOMETRY="ParseGeom.o"
  AC_SUBST(XPARSEGEOMETRY)
fi

])

AC_DEFUN(AC_FIND_MAGICK,
[

AC_ARG_WITH(magick, [  --with-magick           Use ImageMagick libraries [no]],use_magick=yes,use_magick=no)

if test "$use_magick" = yes; then
  AC_PATH_X_PROG(MAGICK_CONFIG, Magick++-config, no)
  if test "$MAGICK_CONFIG" = no; then
    AC_MSG_WARN(*** Xplanet will be built without ImageMagick support ***)
    use_magick=no
  else
    AC_MSG_RESULT([ImageMagick version is `$MAGICK_CONFIG --version`])
    MAGICK_CFLAGS=`$MAGICK_CONFIG --cppflags`
    MAGICK_CFLAGS="$MAGICK_CFLAGS `$MAGICK_CONFIG --cxxflags`"
    MAGICK_LIBS=`$MAGICK_CONFIG --ldflags`
    MAGICK_LIBS="$MAGICK_LIBS `$MAGICK_CONFIG --libs`"
    AC_SUBST(MAGICK_CFLAGS)
    AC_SUBST(MAGICK_LIBS)
    AC_DEFINE(HAVE_LIBMAGICK)
    DISPLAYMAGICK="DisplayMagickpp.cc"
    DISPLAYMAGICKHEADER="DisplayMagickpp.h"
    AC_SUBST(DISPLAYMAGICK)
    AC_SUBST(DISPLAYMAGICKHEADER)
  fi
fi

])

AC_DEFUN(AC_USE_MACAQUA,
[
AC_ARG_WITH(aqua, [  --with-aqua             For Mac OS X Aqua [no]],use_aqua=yes,use_aqua=no)

if test "$use_aqua" = yes; then
  DISPLAYMACAQUA="DisplayMacAqua.cc"
  DISPLAYMACAQUAHEADER="DisplayMacAqua.h"

  AC_SUBST(DISPLAYMACAQUA)
  AC_SUBST(DISPLAYMACAQUAHEADER)

  AC_DEFINE(HAVE_AQUA)
  ADDITIONAL_LIBS="$ADDITIONAL_LIBS -framework ApplicationServices"
  AC_SUBST(ADDITIONAL_LIBS)
fi

])

AC_DEFUN(AC_FIND_GL,
[

AC_ARG_WITH(animation, [  --with-animation        Enable --animation option (OpenGL/Mesa 
                          must be installed in this case) [yes]])
if test "$with_animation" != no; then

if test "$use_aqua" = yes; then
  AC_CHECK_X_HEADER(GLUT/glut.h, have_glut='yes', have_glut='no')
  if test "$have_glut" != 'no'; then
    AC_DEFINE(HAVE_ANIMATION_LIB)
    GLUTFUNCS="glutfuncs.cc"
    AC_SUBST(GLUTFUNCS)
    OPENGL_LIBS="-framework GLUT -framework OpenGL -lobjc"
    AC_SUBST(OPENGL_LIBS)
  fi
else

AC_ARG_WITH(gl, [  --with-gl               Assume GL libraries exist [no]])
AC_ARG_WITH(glut, [  --with-glut             Assume GLUT libraries exist [no]])

AC_ARG_WITH(gl_dir,[  --with-gl-dir=DIR       Location of OpenGL/Mesa headers and libraries],
  [with_gl_dir="$withval"; with_gl_dir_req="$withval"],[with_gl_dir=yes])
AC_ARG_WITH(glut_dir,[  --with-glut-dir=DIR     Location of GLUT headers and libraries],
  [with_glut_dir="$withval"; with_glut_dir_req="$withval"],[with_glut_dir=no])

if test "$with_glut_dir" != no; then
  HANDLE_X_PATH_ARG(with_glut_dir, --with-glut-dir, GLUT)
fi

if test "$with_glut" = 'yes'; then
  echo "Not checking for glut; assuming it exists ..."
  have_glut='yes'
else
  have_glut='no'
  have_glut_header='no'
  AC_CHECK_X_HEADER(GL/glut.h, have_glut_header='yes', have_glut_header='no')
  if test "$have_glut_header" != 'no'; then
    have_libglut='no'
    if test "$have_cygwin" = yes; then
      have_libglut='yes'
    else
      AC_CHECK_LIB(glut,glutInit,have_libglut='yes',have_libglut='no',$X_LIBS -lGL -lGLU -lXmu -lX11 -lm)
    fi
    if test "$have_libglut" != 'no'; then
      have_glut='yes'
    fi
  fi
fi

###############################################################################
#
#       Check for -lGL or -lMesa.
#
###############################################################################

HANDLE_X_PATH_ARG(with_gl_dir, --with-gl-dir, GL)

if test "$with_gl" = yes; then
  echo "Not checking for OpenGL/Mesa; assuming it exists ..."
  have_gl='yes'
else
  have_gl='no'
  if test "$with_gl_dir" = yes; then
    AC_CHECK_X_HEADER(GL/gl.h, have_gl_header=yes, have_gl_header=no)
    if test "$have_gl_header" != 'no'; then
      have_libgl='no'
      if test "$have_cygwin" = yes; then
        have_libgl='yes'
      else
        AC_CHECK_LIB(GL,glBegin,have_libgl='yes',have_libgl='no',$X_LIBS)
      fi
      have_glu_header='no'
      if test "$have_libgl" != 'no'; then
        AC_CHECK_X_HEADER(GL/glu.h, have_glu_header=yes, have_glu_header=no)
        if test "$have_glu_header" != 'no'; then
          have_libglu='no'
          if test "$have_cygwin" = yes; then
            have_libglu='yes'
          else
            AC_CHECK_LIB(GLU,gluSphere,have_libglu='yes',have_libglu='no',$X_LIBS -lGL -lm)
          fi
          if test "$have_libglu" != 'no'; then
            have_gl='yes'
          fi
        fi
      fi
    fi
  elif test "$with_gl_dir" != no; then
    echo "error: must be yes or no: --with-gl-dir=$with_gl_dir"
    exit 1
  fi
fi

if test "$have_glut" = yes && test "$have_gl" = yes; then
  AC_DEFINE(HAVE_ANIMATION_LIB)
  GLUTFUNCS="glutfuncs.cc"
  AC_SUBST(GLUTFUNCS)
  if test "$have_cygwin" = yes; then
    OPENGL_LIBS="-lglut32 -lopengl32 -lglu32"
  else
    OPENGL_LIBS="-lXmu -lXi -lglut -lGL -lGLU"
  fi
  AC_SUBST(OPENGL_LIBS)
else
    AC_MSG_WARN(*** Xplanet will be built without the -animate option ***)
fi

fi

fi
])