1
dnl **** Process this file with autoconf to produce a configure script.
4
AC_CONFIG_AUX_DIR(ac-tools)
6
AC_CONFIG_HEADER(config.h:ac-tools/config.h.in)
8
AC_PREFIX_DEFAULT("/usr/local")
10
builtin(include, ac-tools/aclocal.m4)
16
AC_SUBST(MKINSTALLDIRS)
35
AC_SUBST(GRACE_EDITOR)
42
dnl **** Those are for T1lib
44
AC_SUBST(T1_AA_TYPE16)
45
AC_SUBST(T1_AA_TYPE32)
46
AC_SUBST(T1_AA_TYPE64)
48
dnl **** define home dir of Grace
49
if test "x${prefix}" = "xNONE"
51
GRACE_HOME=${ac_default_prefix}/grace
53
GRACE_HOME=${prefix}/grace
55
AC_ARG_ENABLE(grace-home,
56
[ --enable-grace-home=DIR define Grace home dir [PREFIX/grace]],
57
[GRACE_HOME="${enableval}"])
60
dnl **** option to define config file overriding autodetect
62
[ --enable-config=FILE define configuration FILE to override
63
autodetection (not recommended!)],
64
[CONF_FILE="${enableval}"])
66
dnl **** define C compiler
69
[ --with-cc=PROG use PROG as C compiler [${CC-gcc}]],
72
dnl **** define Fortran compiler
75
[ --with-f77=PROG use PROG as Fortran compiler [${FC-f77}]],
78
dnl Chance to add include path
79
AC_ARG_WITH(extra-incpath,
80
[ --with-extra-incpath=PATH define extra include path (dir1:dir2:...) [none]],
81
[CPPFLAGS="${CPPFLAGS} -I`echo ${withval}|sed 's/:/\ -I/g'`"])
84
AC_ARG_WITH(extra-ldpath,
85
[ --with-extra-ldpath=PATH define extra ld path (dir1:dir2:...) [none]],
86
[LDFLAGS="-L`echo ${withval}|sed 's/:/\ -L/g'` ${LDFLAGS}";
88
sparc-sun-solaris*) LDFLAGS="-R:${withval} ${LDFLAGS}";;
92
dnl **** use bundled T1lib
93
AC_ARG_WITH(bundled_t1lib,
94
[ --with-bundled-t1lib use bundled T1lib [no]],
96
yes) bundled_t1lib=true ;;
97
no) bundled_t1lib=false;;
98
*) AC_MSG_ERROR(bad value ${withval} for --with-bundled-t1lib) ;;
99
esac],[bundled_t1lib=false])
101
dnl **** use bundled Xbae
102
AC_ARG_WITH(bundled_xbae,
103
[ --with-bundled-xbae use bundled Xbae [yes]],
104
[case "${withval}" in
105
yes) bundled_xbae=true ;;
106
no) bundled_xbae=false;;
107
*) AC_MSG_ERROR(bad value ${withval} for --with-bundled-xbae) ;;
108
esac],[bundled_xbae=true])
111
AC_ARG_ENABLE(netcdf,
112
[ --enable-netcdf enable support for netCDF [yes]],
113
[case "${enableval}" in
116
*) AC_MSG_ERROR(bad value ${enableval} for --enable-netcdf) ;;
121
[ --with-fftw use FFTW library for Fourier transforms [yes]],
122
[case "${withval}" in
125
*) AC_MSG_ERROR(bad value ${withval} for --with-fftw) ;;
128
dnl **** whether to build JPEG driver
129
AC_ARG_ENABLE(jpegdrv,
130
[ --enable-jpegdrv build JPEG driver [yes]],
131
[case "${enableval}" in
134
*) AC_MSG_ERROR(bad value ${enableval} for --enable-jpegdrv) ;;
135
esac],[jpegdrv=true])
137
dnl **** whether to build PNG driver
138
AC_ARG_ENABLE(pngdrv,
139
[ --enable-pngdrv build PNG driver [yes]],
140
[case "${enableval}" in
143
*) AC_MSG_ERROR(bad value ${enableval} for --enable-pngdrv) ;;
146
dnl **** whether to build PDF driver
147
AC_ARG_ENABLE(pdfdrv,
148
[ --enable-pdfdrv build PDF driver [yes]],
149
[case "${enableval}" in
152
*) AC_MSG_ERROR(bad value ${enableval} for --enable-pdfdrv) ;;
155
dnl **** check if user wants to compile grace_np lib with support for Fortran
156
AC_ARG_ENABLE(f77_wrapper,
157
[ --enable-f77-wrapper include Fortran wrapper for libgrace_np [yes]],
158
[case "${enableval}" in
159
yes) f77_wrapper=true ;;
160
no) f77_wrapper=false;;
161
*) AC_MSG_ERROR(bad value ${enableval} for --enable-f77-wrapper) ;;
162
esac],[f77_wrapper=true])
165
AC_ARG_ENABLE(editres,
166
[ --enable-editres enable editres support [yes]],
167
[case "${enableval}" in
170
*) AC_MSG_ERROR(bad value ${enableval} for --enable-editres) ;;
171
esac],[editres=true])
174
AC_ARG_ENABLE(libhelp,
175
[ --enable-libhelp use libhelp [no]],
176
[case "${enableval}" in
179
*) AC_MSG_ERROR(bad value ${enableval} for --enable-libhelp) ;;
180
esac],[libhelp=false])
183
AC_ARG_ENABLE(xmhtml,
184
[ --enable-xmhtml use XmHTML widget for on-line help [yes]],
185
[case "${enableval}" in
188
*) AC_MSG_ERROR(bad value ${enableval} for --enable-xmhtml) ;;
191
if test $xmhtml = true && test $libhelp = true
193
AC_MSG_ERROR(can't use both libhelp and XmHTML)
196
dnl **** define editor
197
GRACE_EDITOR="'xterm -e vi'"
199
[ --with-editor=COMMAND define editor [\"xterm -e vi\"]],
200
[GRACE_EDITOR="'${withval}'"])
202
dnl **** define help viewer
203
AC_ARG_WITH(helpviewer,
204
[ --with-helpviewer=COMMAND define (alternative) help viewer command],
205
[HELPVIEWER="-DGRACE_HELPVIEWER=${withval}"])
207
dnl **** define print command
208
AC_ARG_WITH(printcmd,
209
[ --with-printcmd=PROG use PROG for printing],
210
[if test "x${withval}" != "x"; then
211
PRINT_CMD="'${withval}'"
218
dnl **** check if user wants to compile with debugging support
220
[ --enable-debug turn on debugging [no]],
221
[case "${enableval}" in
224
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
227
dnl **** maintainer mode
228
AC_ARG_ENABLE(maintainer,
229
[ --enable-maintainer enable maintainer's mode [no]],
230
[case "${enableval}" in
231
yes) maintainer=true; debug=true ;;
232
no) maintainer=false ;;
233
*) AC_MSG_ERROR(bad value ${enableval} for --enable-maintainer) ;;
234
esac],[maintainer=false])
236
if test $maintainer = true
238
AC_DEFINE(WITH_DEBUG)
241
dnl Support for Fortran wrapper
242
if test $f77_wrapper = true; then
243
AC_DEFINE(WITH_F77_WRAPPER)
247
dnl **** Possibility to override defaults
248
if test "x$CONF_FILE" != "x"
250
if test -r $CONF_FILE
252
AC_MSG_RESULT(--> using \`$CONF_FILE' as config file)
255
AC_MSG_ERROR(--> Can't open file \`$CONF_FILE' for reading!)
259
dnl **** Define CFLAGS etc empty to prevent configure from setting them
262
LDFLAGS=${LDFLAGS-""}
263
OPTIMIZE=${OPTIMIZE-""}
267
dnl **** Check for host type
270
dnl Checks for C compiler
277
if test "x${CFLAGS}" = "x"
279
if test "x${GCC}" = "xyes"
281
dnl **** default settings for gcc
284
CFLAGS="-fno-common -Wall -pedantic -Wpointer-arith -Wnested-externs"
286
dnl **** check for strength-reduce bug
287
ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce")
289
dnl **** some arch-specific optimizations/settings for gcc
291
i486-*) CPU_FLAGS="-m486";;
292
i586-*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium,
293
[CPU_FLAGS=-mcpu=pentium],
294
[ACX_CHECK_CC_FLAGS(-mpentium,pentium,
295
[CPU_FLAGS=-mpentium], [CPU_FLAGS=-m486])])
297
i686-*) ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
298
[CPU_FLAGS=-mcpu=pentiumpro],
299
[ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro,
300
[CPU_FLAGS=-mpentiumpro], [CPU_FLAGS=-m486])])
304
CFLAGS="$CPU_FLAGS $CFLAGS"
313
CFLAGS="-Aa -D_HPUX_SOURCE"
317
mips-sgi-irix6.[[4-9]]*)
319
OPTIMIZE="-O2 -OPT:Olimit=0"
320
DEBUG="-g3 -O2 -OPT:Olimit=0"
323
CFLAGS="-fullwarn -woff 835"
324
OPTIMIZE="-O2 -Olimit 3500"
327
CFLAGS="-D_ALL_SOURCE"
341
true) CFLAGS="$DEBUG $CFLAGS";;
342
*) CFLAGS="$OPTIMIZE $CFLAGS";;
345
AC_CHECK_PROG(fc, $FC, $FC, no)
346
if test "${ac_cv_prog_fc}" = "no"
348
AC_MSG_RESULT(--> Fortran tests won't be compiled)
352
dnl **** Check for some compiler/system characteristics
354
AC_CHECK_SIZEOF(char,0)
355
AC_CHECK_SIZEOF(short,0)
356
AC_CHECK_SIZEOF(int,0)
357
AC_CHECK_SIZEOF(long,0)
358
AC_CHECK_SIZEOF(long long,0)
359
AC_CHECK_SIZEOF(float,0)
360
AC_CHECK_SIZEOF(double,0)
361
AC_CHECK_SIZEOF(long double,0)
362
AC_CHECK_SIZEOF(void *,0)
364
dnl **** Check for endianess
367
dnl **** Checks for FPU arithmetics
370
dnl **** .exe/.obj file extensions
378
dnl **** Checks for programs.
379
AC_CHECK_PROG(AR, ar, ar, NONE)
380
if test "$AR" = "NONE"; then
381
AC_MSG_ERROR(--> Can't find \`ar'!)
393
*) INSTALL=`pwd`/ac-tools/"shtool install -c" ;
396
MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f"
398
if test "x$PRINT_CMD" = "xNONE"; then
399
AC_CHECK_PROG(LP_CMD, lp, 'lp -c', "NONE")
400
if test "${ac_cv_prog_LP_CMD}" = "NONE"; then
401
AC_CHECK_PROG(LPR_CMD, lpr, 'lpr', "NONE")
402
if test "${ac_cv_prog_LPR_CMD}" = "NONE"; then
405
PRINT_CMD="${ac_cv_prog_LPR_CMD}"
408
PRINT_CMD="${ac_cv_prog_LP_CMD}"
412
AC_MSG_RESULT(--> Using \"$PRINT_CMD\" to print)
414
dnl **** Checks for header files.
417
AC_CHECK_HEADERS(unistd.h fcntl.h)
418
AC_CHECK_HEADERS(sys/param.h sys/time.h sys/select.h)
420
dnl **** math.h and related
421
AC_CHECK_HEADERS(math.h float.h ieeefp.h)
423
dnl **** Checks for typedefs, structures, and compiler characteristics.
429
dnl **** Checks for library functions.
433
AC_CHECK_FUNCS(getcwd gethostname)
434
AC_CHECK_FUNCS(strstr)
435
AC_CHECK_FUNCS(memcpy memmove)
436
AC_CHECK_FUNCS(unlink fcntl)
437
AC_CHECK_FUNCS(popen)
438
AC_CHECK_FUNCS(gettimeofday)
439
AC_CHECK_FUNCS(fnmatch)
440
AC_CHECK_FUNCS(vsnprintf)
441
AC_CHECK_FUNCS(on_exit)
442
AC_CHECK_FUNCS(strerror)
443
if test "$ac_cv_func_strerror" = no; then
444
AC_CACHE_CHECK("for sys_errlist declaration in stdio.h", ac_cv_sys_errlist_decl,
445
AC_EGREP_HEADER(sys_errlist, stdio.h, ac_cv_sys_errlist_decl="yes",
446
ac_cv_sys_errlist_decl="no"))
447
if test "$ac_cv_sys_errlist_decl" = yes; then
448
AC_DEFINE(HAVE_SYS_ERRLIST_DECL)
452
ICE_CHECK_DECL(drand48, stdlib.h)
454
dnl **** Check for locale
455
AC_CHECK_FUNCS(setlocale)
457
dnl **** Check for buggy realloc()
458
ACX_CHECK_REALLOC(AC_DEFINE(REALLOC_IS_BUGGY))
460
dnl **** Checks for libm
463
dnl **** Those functions are usually found in libm but...
464
ICE_CHECK_DECL(hypot, math.h)
465
ICE_CHECK_DECL(rint, math.h)
466
ICE_CHECK_DECL(cbrt, math.h)
467
ICE_CHECK_DECL(log2, math.h)
468
ICE_CHECK_DECL(asinh, math.h)
469
ICE_CHECK_DECL(acosh, math.h)
470
ICE_CHECK_DECL(atanh, math.h)
471
ICE_CHECK_DECL(lgamma, math.h)
473
dnl **** The machten4 (unix for mac) system does have signgam in libm
474
dnl **** but it is not declared in <math.h>
475
if test "$ac_cv_func_lgamma" = yes; then
476
AC_CACHE_CHECK("for signgam declaration in math.h", ac_cv_signgam_decl,
477
AC_EGREP_HEADER(signgam, math.h, ac_cv_signgam_decl="yes",
478
ac_cv_signgam_decl="no"))
479
if test "$ac_cv_signgam_decl" = yes; then
480
AC_DEFINE(HAVE_SIGNGAM_DECL)
484
ICE_CHECK_DECL(erf, math.h)
485
ICE_CHECK_DECL(erfc, math.h)
486
ICE_CHECK_DECL(j0, math.h)
487
ICE_CHECK_DECL(j1, math.h)
488
ICE_CHECK_DECL(jn, math.h)
489
ICE_CHECK_DECL(y0, math.h)
490
ICE_CHECK_DECL(y1, math.h)
491
ICE_CHECK_DECL(yn, math.h)
492
ICE_CHECK_DECL(finite, math.h)
493
dnl **** C9X-compatible isfinite() may be a good replacement for finite()
494
if test "$ac_cv_lib_m_finite" != yes; then
495
ICE_CHECK_DECL(isfinite, math.h)
497
ICE_CHECK_DECL(isnan, math.h)
499
dnl **** Check for T1lib installed
500
if test $bundled_t1lib = false
502
ACX_CHECK_T1LIB(1.3.1, AC_DEFINE(HAVE_LIBT1), bundled_t1lib=true)
505
if test $bundled_t1lib = true
507
dnl **** Use the bundled T1lib
509
AC_MSG_RESULT(--> Bundled version of T1lib will be used)
511
T1_LIB='$(TOP)/T1lib/libt1.a'
512
T1_INC='-I$(TOP)/T1lib/t1lib'
515
dnl **** Check ANSI types
518
AC_MSG_RESULT(--> Good. Seems you have compatible version of T1lib installed)
521
dnl **** Check for XDR
522
mdw_CHECK_MANYLIBS(xdrstdio_create, nsl rpc xdr rpclib, XDR_LIB=$mdw_cv_lib_xdrstdio_create, XDR_LIB="NONE")
524
if test "${XDR_LIB}" = "NONE"; then
526
AC_MSG_RESULT(--> No XDR library found; grconvert will not be built)
528
grconvert_dir="grconvert"
531
dnl **** Check for dlopen() interface
532
dnl (Linux, SunOS-[4,5], OSF, IRIX, AIX-4, UnixWare, ...)
533
mdw_CHECK_MANYLIBS(dlopen, dl, [DL_LIB=$mdw_cv_lib_dlopen; AC_DEFINE(HAVE_DLOPEN)], DL_LIB="NONE")
535
if test "${DL_LIB}" != "NONE"; then
536
dnl **** Old implementations of dlopen() don't have RTLD_NOW
537
AC_CACHE_CHECK("whether RTLD_NOW is defined in dlfcn.h", ac_rtld_now_in_dlfcn_h,
543
], ac_rtld_now_in_dlfcn_h="yes"; AC_DEFINE(HAVE_RTLD_NOW),
544
ac_rtld_now_in_dlfcn_h="no")
547
dnl **** Check for shl_load() interface (HP/UX)
548
mdw_CHECK_MANYLIBS(shl_load, dld, [DL_LIB=$mdw_cv_lib_shl_load; AC_DEFINE(HAVE_SHL_LOAD)], DL_LIB="NONE")
551
if test "${DL_LIB}" = "NONE"; then
552
AC_MSG_RESULT(--> Support for dll modules will not be compiled)
556
if test $netcdf = true
558
ACX_CHECK_NETCDF(3.0, AC_DEFINE(HAVE_NETCDF),
559
AC_MSG_RESULT(--> support for netCDF is disabled))
564
ACX_CHECK_FFTW(2.1.3, AC_DEFINE(HAVE_FFTW),
565
AC_MSG_RESULT(--> using legacy unoptimized FFT code))
568
dnl **** check for libz - needed for PDF and PNG drivers and XmHTML
569
if test $pngdrv = true || test $pdfdrv = true || test $xmhtml = true
571
ACX_CHECK_ZLIB(1.0.3)
574
dnl **** check for IJG's libjpeg - also, for PDF driver and XmHTML
575
if test $jpegdrv = true || test $pdfdrv = true || test $xmhtml = true
577
ACX_CHECK_JPEG(61, AC_DEFINE(HAVE_LIBJPEG),
578
AC_MSG_RESULT(--> JPEG backend is disabled))
581
dnl **** check for libpng - needed for PDF and PNG drivers and XmHTML
582
if test $pngdrv = true || test $pdfdrv = true || test $xmhtml = true
584
ACX_CHECK_PNG(0.9.6, AC_DEFINE(HAVE_LIBPNG),
585
AC_MSG_RESULT(--> PNG backend is disabled))
588
dnl **** check for libtiff - may be needed for PDF driver
589
if test $pdfdrv = true
591
ACX_CHECK_TIFF(19960307)
594
dnl **** check for PDFlib
595
if test $pdfdrv = true
597
ACX_CHECK_PDFLIB(3.02, AC_DEFINE(HAVE_LIBPDF), pdfdrv=false)
599
if test $pdfdrv != true; then
600
AC_MSG_RESULT(--> PDF driver is disabled)
603
dnl **** TODO: undefine unneeded libraries
607
dnl **** Choose a GUI *****
609
dnl **** default is gui-less
613
if test "$no_x" = yes; then
616
dnl **** Check for Motif
617
GUI_LIBS="-lXt -lXext -lX11 $X_PRE_LIBS $X_EXTRA_LIBS"
622
CFLAGS="$X_CFLAGS $CFLAGS"
623
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
624
LDFLAGS="$X_LIBS $LDFLAGS"
628
true) AC_CHECK_LIB(Xmu,_XEditResCheckMessages,GUI_LIBS="-lXmu $GUI_LIBS"; AC_DEFINE(WITH_EDITRES));;
632
if test $ac_cv_lib_Xmu__XEditResCheckMessages != yes; then
633
AC_MSG_RESULT(--> support for EditRes protocol is disabled)
636
dnl **** some Motif-2.1 variants need the -lXp library
637
AC_CHECK_LIB(Xp,main,GUI_LIBS="-lXp $GUI_LIBS")
639
dnl **** and some - Xpm lib
640
AC_CHECK_LIB(Xpm,main,GUI_LIBS="-lXpm $GUI_LIBS"; AC_DEFINE(HAVE_XPM)
641
AC_CHECK_HEADERS(xpm.h X11/xpm.h))
645
ACX_CHECK_MOTIF(1002)
646
if test "$acx_cv_motif" = "no"; then
647
dnl **** only Motif GUI is supported by now:
651
AC_MSG_WARN(M*tif has not been found; building a GUI-less version)
653
GUI_LIBS="$MOTIF_LIB $GUI_LIBS"
655
GUI_FLAGS="$X_CFLAGS"
658
dnl **** Special Motif checks
659
xsave_CPPFLAGS="$CPPFLAGS"
661
CPPFLAGS="$CPPFLAGS $GUI_FLAGS"
662
LIBS="$X_LIBS $GUI_LIBS $LIBS"
664
dnl **** Check for Xbae widget
665
if test $bundled_xbae = false
667
AC_CHECK_LIB(Xbae, XbaeCreateMatrix, XBAE_LIB="-lXbae";AC_DEFINE(HAVE_LIBXBAE))
669
if test -z "$XBAE_LIB"
671
dnl **** Use the bundled Xbae library
672
AC_MSG_RESULT(--> Bundled version of Xbae library will be used)
673
XBAE_LIB='$(TOP)/Xbae/Xbae/libXbae.a'
674
XBAE_INC='-I$(TOP)/Xbae'
677
AC_MSG_RESULT(--> Good. Seems you have compatible version of Xbae installed)
680
dnl **** Check for libhelp
682
true) AC_CHECK_LIB(hlpclient,get_help,LIBHELP_LIB="-lhlpclient"; AC_DEFINE(WITH_LIBHELP));;
686
dnl **** Check for XmHTML widget
687
if test $xmhtml = true
689
ACX_CHECK_XMHTML(1105, AC_DEFINE(WITH_XMHTML), xmhtml=false)
692
GUI_LIBS="$LIBHELP_LIB $XMHTML_LIB $XBAE_LIB $GUI_LIBS"
694
CPPFLAGS="$xsave_CPPFLAGS"
700
dnl **** Final list of subdirs
701
SUBDIRS="cephes ${t1lib_dir} ${xbae_dir} src ${grconvert_dir} grace_np fonts templates doc examples auxiliary"
703
dnl **** Create Make.conf
704
AC_OUTPUT(Make.conf:ac-tools/Make.conf.in)