-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.in
516 lines (431 loc) · 16.7 KB
/
configure.in
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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
AC_INIT([vis5d+], [1.3.2], [[email protected]], [vis5d+])
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([src/v5d.c])
AM_INIT_AUTOMAKE(1.6)
AM_CONFIG_HEADER(config.h src/api-config.h)
AM_MAINTAINER_MODE
##########################################################################
AC_ARG_ENABLE(debug, [ --enable-debug compile for debugging], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
CFLAGS="-g"
# should we define DEBUG too?
enable_shared=no
fi
# should we build shared libraries by default?
AM_ENABLE_SHARED(yes)
# This is the version info according to the libtool versioning system.
# It does *not* correspond to the release number, and has a technical
# meaning (CURRENT:REVISION:AGE) that indicates the compatibility of
# different library versions (see the libtool manual):
SHARED_VERSION_INFO="2:0:0"
AC_SUBST(SHARED_VERSION_INFO)
##########################################################################
# Checks for programs.
AC_PROG_CC
# c++ is needed for src/decimate.C
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AM_PROG_LIBTOOL
# Use -Wall if we have gcc.
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall"
fi
AC_CHECK_PROG(DB2HTML, db2html, db2html, $srcdir/missing db2html)
AC_CHECK_PROG(DB2DVI, db2dvi, db2dvi, $srcdir/missing db2dvi)
AC_CHECK_PROG(DB2PS, db2ps, db2ps, $srcdir/missing db2ps)
AC_CHECK_PROG(DB2PDF, db2pdf, db2pdf, $srcdir/missing db2pdf)
AC_CHECK_PROG(DB2RTF, db2rtf, db2rtf, $srcdir/missing db2rtf)
# check for ImageMagick convert program
AC_PATH_PROG(IMCONVERT, convert)
if test -z "$IMCONVERT"; then
AC_MSG_WARN(ImageMagick convert program not found in path. Convert can be used
to save vis5d pictures to a variety of output formats.)
else
AC_DEFINE_UNQUOTED(IMCONVERT,"$IMCONVERT",[path to Image Magick convert program] )
fi
AC_ARG_ENABLE(fortran, [ --disable-fortran don't use any Fortran], enable_fortran=$enableval, enable_fortran=yes)
if test "$enable_fortran" = "yes"; then
AC_CHECK_PROGS(F77, f77 xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90)
AC_PROG_F77
if test -n "$F77"; then
AC_F77_LIBRARY_LDFLAGS
# Call AC_F77_DUMMY_MAIN explicitly, since it otherwise
# will cause configure to fail if C-F77 linking fails.
AC_F77_DUMMY_MAIN([], skip_f77=yes)
if test "x$skip_f77" != xyes; then
AC_F77_WRAPPERS
# enable Fortran packages in util/ subdirectory:
OPT_UTILS="$OPT_UTILS \$(FPROGS)"
fi
else
AC_MSG_WARN([didn't find any Fortran compiler])
fi
fi
# Try to determine "good" native compiler flags if none specified via CFLAGS.
# We don't try too hard since it probably doesn't matter too much. For
# fancier tests for compiler flags, see the AX_CC_MAXOPT macro in the
# autoconf macro repository.
if test "$ac_test_CFLAGS" != "set"; then
AX_CHECK_COMPILER_FLAGS(-O3, [CFLAGS="-O3"])
fi
##########################################################################
# more optional arguments to the configure script:
AC_ARG_ENABLE(threads, [ --enable-threads use parallel threads], enable_threads=$enableval, enable_threads=no)
AC_ARG_WITH(mesa, [ --with-mesa force the use of Mesa instead of other graphics libs], with_mesa=$withval, with_mesa=maybe)
AC_ARG_WITH(netcdf, [ --with-netcdf=<lib> specify NetCDF library file], with_netcdf=$withval, with_netcdf=yes)
AC_ARG_WITH(mcidas, [ --with-mcidas=<lib> specify McIDAS library file], with_mcidas=$withval, with_mcidas=yes)
AC_ARG_WITH(mixkit, [ --with-mixkit=<lib> specify mixkit library file], with_mixkit=$withval, with_mixkit=yes)
AC_ARG_WITH(memory, [ --with-memory=<MB> max. memory to use, 0 for no maximum [default: 0]], VIS5D_MAX_MEM=$withval, VIS5D_MAX_MEM=0)
AC_DEFINE_UNQUOTED(VIS5D_MAX_MEM, $VIS5D_MAX_MEM, [max. memory to use (MB), 0 for no maximum])
##########################################################################
# hardware characteristics:
AC_CHECK_SIZEOF(float, 0)
AC_CHECK_SIZEOF(int, 0)
AC_CHECK_SIZEOF(signed char, 0)
AC_C_BIGENDIAN
##########################################################################
# Checks for libraries.
AC_CHECK_LIB(m, sqrt)
AC_CHECK_HEADER(zlib.h,AC_CHECK_LIB(z, deflate))
if test "$ac_cv_lib_z_deflate" = "yes"; then
AC_CHECK_HEADER(png.h,AC_CHECK_LIB(png, png_write_image))
fi
AC_CHECK_FUNCS(strcasecmp strncasecmp strdup)
# Find X11 libs and flags:
AC_PATH_X
AC_PATH_XTRA
CFLAGS="$CFLAGS $X_CFLAGS"
XLIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
AC_SUBST(XLIBS)
##########################################################################
# Find 3D graphics libs:
GLLIBS=""
# First, look for OpenGL or Mesa:
if test "$with_mesa" != "yes"; then
AC_CHECK_LIB(GL, glBegin,
AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
:, -lGL $XLIBS), :, $XLIBS)
fi
if test -z "$GLLIBS" -a "$with_mesa" != "no"; then
AC_CHECK_LIB(MesaGL, glBegin,
AC_CHECK_LIB(MesaGLU, gluProject, GLLIBS="-lMesaGLU -lMesaGL",
:, -lMesaGL $XLIBS), :, $XLIBS)
fi
if test "$with_mesa" = "yes"; then
AC_CHECK_LIB(GL, glBegin,
AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
:, -lGL $XLIBS), :, $XLIBS)
fi
if test -n "$GLLIBS"; then
AC_DEFINE(HAVE_OPENGL,1,[Define if we have OpenGL libraries.])
AC_CHECK_HEADERS(GL/gl.h,[],
[AC_MSG_ERROR([Couldn't include header file <GL/gl.h>; you may need to specify the path to OpenGL include files in CPPFLAGS.])])
else
echo "couldn't find OpenGL libraries!"
if test "$with_mesa" = "yes"; then
AC_MSG_ERROR([couldn't find Mesa library])
fi
fi
# Next, look for SGI IrisGL:
if test -z "$GLLIBS"; then
AC_CHECK_LIB(gl_s, bgnqstrip, ok=yes,ok=no, $XLIBS)
if test "$ok" = "yes"; then
AC_CHECK_LIB(fm, fminit, GLLIBS="-lfm -lgl_s",:,-lgl_s $XLIBS)
if test -z "$GLLIBS"; then
AC_CHECK_LIB(fm_s, fminit,
GLLIBS="-lfm_s -lgl_s",:,-lgl_s $XLIBS)
fi
fi
if test -n "$GLLIBS"; then
AC_DEFINE(HAVE_SGI_GL,1,[Define if we have SGI GL libraries.])
OPT_UTILS="$OPT_UTILS listfonts"
fi
fi
if test -z "$GLLIBS"; then
echo "****************************************************"
echo "You need to install a 3D graphics library, preferably"
echo "the free OpenGL replacement, Mesa. You can download"
echo "Mesa from the Mesa home page:"
echo " http://www.mesa3d.org/"
echo "and install it by running:"
echo " ./configure && make && su -c 'make install'"
echo "in the Mesa directory."
if test -r /sbin/ldconfig; then
echo "You may also need to run /sbin/ldconfig as root"
echo "to update the system after installing Mesa."
if test -r /etc/ld.so.conf; then
if test -z "`grep /usr/local/lib /etc/ld.so.conf`"; then
echo "(First, add '/usr/local/lib' to /etc/ld.so.conf if"
echo "you installed Mesa under /usr/local, the default.)"
fi
fi
fi
echo "****************************************************"
AC_MSG_ERROR([couldn't find 3D graphics library])
fi
AC_SUBST(GLLIBS)
# Check for any particular functions in the GL libs:
save_LIBS="$LIBS"
LIBS="$GLLIBS $XLIBS $LIBS"
AC_CHECK_FUNCS(XMesaGetBackBuffer)
LIBS="$save_LIBS"
##########################################################################
V5D_LIBS_AUX="" # any extra libs we need to link Vis5d
AC_CHECK_PROGS(TCLSH, tclsh, cat)
if test "x$TCLSH" = xcat; then
TCL_VERSION=""
else
TCL_VERSION=`echo 'puts $tcl_version' | $TCLSH -`
fi
# Find Tcl (Linux systems need -ldl as well):
AC_CHECK_LIB(dl, dlopen, V5D_LIBS_AUX="-ldl $V5D_LIBS_AUX")
have_libtcl=no
AC_CHECK_LIB(tcl$TCL_VERSION, Tcl_Eval,
[V5D_LIBS_AUX="-ltcl$TCL_VERSION $V5D_LIBS_AUX"; have_libtcl=yes],
[AC_CHECK_LIB(tcl, Tcl_Eval, [V5D_LIBS_AUX="-ltcl $V5D_LIBS_AUX"
have_libtcl=yes],
[:], $V5D_LIBS_AUX)],
$V5D_LIBS_AUX)
if test $have_libtcl = yes; then
AC_DEFINE(HAVE_LIBTCL,1,[Have Tcl library?])
TCL_HEADER=no
for header in tcl$TCL_VERSION/tcl.h tcl.h tcl/tcl.h; do
AC_CHECK_HEADER($header, [TCL_HEADER=$header; break])
done
if test "x$TCL_HEADER" != xno; then
AC_DEFINE(HAVE_TCL_H,1,[Have tcl.h header file?])
AC_SUBST(TCL_HEADER)
fi
fi
# check if we have setrlimit function:
AC_CHECK_FUNCS(setrlimit)
# check if we have the Fortran (sigh) idate function:
if test -n "$F77"; then
AC_LANG_PUSH(Fortran 77)dnl
AC_MSG_CHECKING([for Fortran idate function])
AC_TRY_LINK([],[ idate(imon,iday,iyear)],
[AC_DEFINE(HAVE_IDATE,1,[Do we have Fortran idate function?])
AC_MSG_RESULT(yes)],AC_MSG_RESULT(no))
AC_LANG_POP(Fortran 77)dnl
fi
AC_CHECK_LIB(image, iopen, OPT_UTILS="$OPT_UTILS fromxwd")
##########################################################################
# Find NetCDF
if test "$with_netcdf" != "no"; then
# first, check a couple common locations for the netcdf libs:
if test "$with_netcdf" != "yes"; then
netcdf_dir=`dirname $with_netcdf`
case $netcdf_dir in
/*) ;; # already an absolute path
*) netcdf_dir="`pwd`/$netcdf_dir" ;;
esac
LDFLAGS="-L$netcdf_dir $LDFLAGS"
elif test -r $srcdir/libnetcdf.a; then
LDFLAGS="-L`pwd`/$srcdir $LDFLAGS"
elif test -r $srcdir/src/libnetcdf.a; then
LDFLAGS="-L`pwd`/$srcdir/src $LDFLAGS"
elif test -d /usr/netcdf/lib; then
LDFLAGS="-L/usr/netcdf/lib $LDFLAGS"
if test -d /usr/netcdf/include; then
CPPFLAGS="-I/usr/netcdf/include $CPPFLAGS"
fi
elif test -d /usr/local/netcdf/lib; then
LDFLAGS="-L/usr/local/netcdf/lib $LDFLAGS"
if test -d /usr/local/netcdf/include; then
CPPFLAGS="-I/usr/local/netcdf/include $CPPFLAGS"
fi
fi
# now, look for the actual library:
AC_CHECK_LIB(netcdf, nc_inq_dimlen,
[AC_DEFINE(HAVE_LIBNETCDF,1,[Do we have NetCDF library?])
V5D_LIBS_AUX="-lnetcdf $V5D_LIBS_AUX"],:, $V5D_LIBS_AUX)
case $V5D_LIBS_AUX in
*netcdf*)
# Look for the header;
AC_CHECK_HEADERS(netcdf.h)
;;
*)
echo "****************************************************"
echo "Didn't find the NetCDF library; irregular data features"
echo "will be disabled. You can download the NetCDF source"
echo "code from the NetCDF home page:"
echo " http://www.unidata.ucar.edu/packages/netcdf/"
echo "and/or use --with-netcdf=<lib> to specify the location"
echo "of libnetcdf.a."
echo "****************************************************"
;;
esac
fi
##########################################################################
# Find mixkit
if test "$with_mixkit" != "no"; then
# first, check a couple common locations for mixkit lib:
if test "$with_mixkit" != "yes"; then
mixkit_dir=`dirname $with_mixkit`
case $mixkit_dir in
/*) ;; # already an absolute path
*) mixkit_dir="`pwd`/$mixkit_dir" ;;
esac
MIXLIBS="-L$mixkit_dir -lmix"
elif test -r $srcdir/libmix.a; then
MIXLIBS="-L`pwd`/$srcdir -lmix"
elif test -r $srcdir/src/libmix.a; then
MIXLIBS="-L`pwd`/$srcdir/src -lmix"
elif test -d /usr/mixkit/lib; then
MIXLIBS="-L/usr/mixkit/lib -lmix"
if test -d /usr/mixkit/include; then
CPPFLAGS="-I/usr/mixkit/include $CPPFLAGS"
fi
elif test -d /usr/local/mixkit/lib; then
MIXLIBS="-L/usr/local/mixkit/lib -lmix"
if test -d /usr/local/mixkit/include; then
CPPFLAGS="-I/usr/local/mixkit/include $CPPFLAGS"
fi
fi
if test -n "$MIXLIBS"; then
# Look for the header;
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(mixkit/mixio.h,
[AC_DEFINE(HAVE_MIXKIT,1,[Do we have mixkit library?])])
AC_LANG_POP(C++)
LIBS="$MIXLIBS $LIBS"
else
echo "****************************************************"
echo "Didn't find the mixkit library;"
echo "You can download the Mixkit source"
echo "code from the Qslim home page:"
echo " http://graphics.cs.uiuc.edu/~garland/software/qslim.html"
echo "and/or use --with-mixkit=<lib> to specify the location"
echo "of libmix.a."
echo "****************************************************"
fi
fi
AM_CONDITIONAL(MIXKIT,test "x$ac_cv_header_mixkit_mixio_h" = "xyes")
##########################################################################
# Find MCIDAS
MCIDAS_LIBS=""
if test "$with_mcidas" != "no" -a -n "$F77"; then
mcidas_lib=mcidas5
using_included_mcidas=no
# first, check a couple common locations for the mcidas libs:
if test "$with_mcidas" != "yes"; then
mcidas_dir=`dirname $with_mcidas`
mcidas_lib=`basename $with_mcidas | sed 's/\.a$//;s/^lib//'`
case $mcidas_dir in
/*) ;; # already an absolute path
*) mcidas_dir="`pwd`/$mcidas_dir" ;;
esac
MCIDAS_LDFLAGS="-L$mcidas_dir"
elif test -r $srcdir/libmcidas5.a; then
MCIDAS_LDFLAGS="-L`pwd`/$srcdir"
elif test -r $srcdir/src/libmcidas5.a; then
MCIDAS_LDFLAGS="-L`pwd`/$srcdir/src"
using_included_mcidas=yes
fi
MCIDAS_LIBS="$MCIDAS_LDFLAGS -l$mcidas_lib $FLIBS"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $MCIDAS_LDFLAGS"
AC_F77_FUNC(readd)
AC_CHECK_LIB(mcidas_lib, $readd, [], [MCIDAS_LIBS=""], $FLIBS)
LDFLAGS="$save_LDFLAGS"
if test -n "$MCIDAS_LIBS"; then
MCIDAS_LIBS="kltwin.o $MCIDAS_LIBS"
AC_DEFINE(HAVE_MCIDAS,1,[Do we have McIDAS library?])
if test "$using_included_mcidas" = "no"; then
AC_DEFINE(MCIDAS_SIDECAR,1,[Have McIDAS sidecar?])
fi
fi
fi
AC_SUBST(MCIDAS_LIBS)
AM_CONDITIONAL(MCIDAS, test -n "$MCIDAS_LIBS")
##########################################################################
# Checks for header files.
AC_CHECK_HEADERS(X11/Xm/MwmUtil.h sys/types.h sys/prctl.h sys/sysmp.h sysmp.h sys/lock.h sys/stat.h fcntl.h)
# Checks for typedefs, structures, and compiler characteristics.
##########################################################################
# Check for POSIX threads library.
# (based on FFTW configure.in, www.fftw.org)
# Eventually, we should also check for the other threads models that
# Vis5d supports.
THREADLIBS=""
if test "$enable_threads" = "yes"; then
# Check for POSIX threads:
if test -z "$THREADLIBS"; then
ACX_PTHREAD([THREADLIBS=" $PTHREAD_LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
AC_DEFINE(HAVE_PTHREADS,1,[Have POSIX threads?])])
fi
# First, check for SGI sproc fork variant:
# (we prefer POSIX threads to this, right?)
if test -z "$THREADLIBS"; then
AC_CHECK_FUNC(sproc, [THREADLIBS=" "
AC_DEFINE(HAVE_SGI_SPROC,1,[Have SGI sproc?])])
fi
# Solaris threads:
# (we prefer the more-standard POSIX threads, right?)
if test -z "$THREADLIBS"; then
AC_CHECK_LIB(thread, thr_create,
[THREADLIBS="-lthread"
AC_DEFINE(HAVE_SUNOS_THREADS,1,[Have SunOS threads?])])
fi
if test -z "$THREADLIBS"; then
echo "no threads libraries found...compiling as single-threaded"
fi
fi # if enable_threads = yes
if test -z "$THREADLIBS"; then
AC_DEFINE(SINGLE_TASK,1,[Define to disable multi-threading.])
fi
AC_SUBST(THREADLIBS)
##########################################################################
dnl Set PACKAGE_DATA_DIR in config.h.
if test "x${datadir}" = 'x${prefix}/share' -o "x${datadir}" = 'x${datarootdir}'; then
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", [Location of package data files])
else
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
fi
else
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
fi
# Set PACKAGE_SOURCE_DIR in config.h.
packagesrcdir=`cd $srcdir && pwd`
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}",[where the source was built])
##########################################################################
# experimental GTK stuff
AC_ARG_ENABLE(gtk, [ --enable-gtk compile gtk user interface (NEW)], enable_gtk=$enableval, enable_gtk=no)
AC_CHECK_PROG(GLADE, glade, glade, $srcdir/missing glade)
if test "x$enable_gtk" = xyes; then
AM_PATH_GTK(1.2.0, ,
AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))
AM_PATH_GTKGL
fi
AM_CONDITIONAL(ENABLE_GTK, test "x$enable_gtk" = xyes)
# FIXME: get gettext support working again
dnl ALL_LINGUAS="pt_BR es"
#
# we need libintl.h to use NLS
#
dnl AC_CHECK_HEADERS(libintl.h,[], enable_nls="no")
dnl AM_GNU_GETTEXT(use-libtool, need-ngettext)
dnl GTK_DIRS=
dnl if test "$usegtk" = "yes"; then
dnl AM_PATH_GTK(1.2.9, GTK_DIRS="gtk ",
dnl [AC_MSG_ERROR([Cannot find GTK: Is gtk-config in path?])])
dnl AM_PATH_GTKGL
dnl fi
dnl AC_SUBST(GTK_DIRS)
# Set VIS5D_LOCALE_DIR in config.h.
dnl if test "x${prefix}" = "xNONE"; then
dnl AC_DEFINE_UNQUOTED(VIS5D_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale",[directory containing message catalogs])
dnl else
dnl AC_DEFINE_UNQUOTED(VIS5D_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale")
dnl fi
##########################################################################
AC_SUBST(V5D_LIBS_AUX)
AC_SUBST(OPT_UTILS)
# additional files for GTK: gtk/vis5dgtk.pc gtk/gradients/Makefile gtk/Makefile intl/Makefile po/Makefile.in
AC_CONFIG_FILES([vis5d+.pc Makefile src/Makefile doc/Makefile lui5/Makefile util/Makefile src/tclheader.h gtk/Makefile gtk/vis5dgtk.pc gtk/gradients/Makefile])
AC_OUTPUT