Switched to FFTW-3.
[grace.git] / ac-tools / configure.in
blobb854cf7b8e7af8755feffa72fe99ce48d67cb975
1 dnl **** Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.57)
5 AC_INIT(src/main.c)
6 AC_CONFIG_AUX_DIR(ac-tools)
8 AC_CONFIG_HEADER(include/config.h:ac-tools/config.h.in)
10 AC_PREFIX_DEFAULT("/usr/local")
12 builtin(include, ac-tools/aclocal.m4)
14 AC_SUBST(EXEEXT)
15 AC_SUBST(OBJEXT)
16 AC_SUBST(BATEXT)
18 AC_SUBST(MKINSTALLDIRS)
20 AC_SUBST(GRACE)
21 AC_SUBST(GRACE_HOME)
22 AC_SUBST(GUI_FLAGS)
23 AC_SUBST(FC)
24 AC_SUBST(GUI_LIBS)
25 AC_SUBST(NOGUI_LIBS)
26 AC_SUBST(WINDOWS_LIBS)
27 AC_SUBST(NETCDF_LIBS)
28 AC_SUBST(XDR_LIB)
29 AC_SUBST(DL_LIB)
30 AC_SUBST(T1_LIB)
31 AC_SUBST(T1_INC)
32 AC_SUBST(EXPAT_LIB)
33 AC_SUBST(EXPAT_INC)
34 AC_SUBST(FFTW_LIB)
35 AC_SUBST(Z_LIB)
36 AC_SUBST(JPEG_LIB)
37 AC_SUBST(PNG_LIB)
38 AC_SUBST(PDF_LIB)
39 AC_SUBST(HARU_LIB)
40 AC_SUBST(UNDO_LIB)
41 AC_SUBST(XBAE_INC)
42 AC_SUBST(GSL_LIBS)
43 AC_SUBST(GSL_CFLAGS)
44 AC_SUBST(CUPS_LIBS)
45 AC_SUBST(CUPS_CFLAGS)
46 AC_SUBST(SUBDIRS)
48 AC_SUBST(PAPERSIZE)
50 AC_SUBST(GRACE_EDITOR)
51 AC_SUBST(GRACE_HELPVIEWER)
52 AC_SUBST(PRINT_CMD)
54 AC_SUBST(MAJOR_REV)
55 AC_SUBST(MINOR_REV)
56 AC_SUBST(PATCHLEVEL)
57 AC_SUBST(BETA_VER)
58 AC_SUBST(PROG_SUFFIX)
60 dnl **** Those are for T1lib
62 AC_SUBST(T1_AA_TYPE16)
63 AC_SUBST(T1_AA_TYPE32)
64 AC_SUBST(T1_AA_TYPE64)
66 dnl **** Grace version numbers
67 MAJOR_REV=5
68 MINOR_REV=99
69 PATCHLEVEL=1
70 BETA_VER="dev5"
72 VERSTRING=${MAJOR_REV}.${MINOR_REV}.${PATCHLEVEL}
73 if test "x${program_suffix}" = "xNONE"
74 then
75     PROG_SUFFIX="-$VERSTRING"
76 else
77     PROG_SUFFIX=${program_suffix}
80 dnl **** define home dir of Grace
81 if test "x${prefix}" = "xNONE"
82 then
83   GRACE_HOME=${ac_default_prefix}/grace-$VERSTRING
84 else
85   GRACE_HOME=${prefix}/grace
87 AC_ARG_ENABLE(grace-home,
88 [  --enable-grace-home=DIR      define Grace home dir [[PREFIX/grace-x.y.z]]],
89 [GRACE_HOME="${enableval}"])
92 dnl **** option to define config file overriding autodetect
93 AC_ARG_ENABLE(config,
94 [  --enable-config=FILE         define configuration FILE to override
95                                autodetection (not recommended!)],
96                              [CONF_FILE="${enableval}"])
98 dnl **** define C compiler
99 CC=${CC-gcc}
100 AC_ARG_WITH(cc,
101 [  --with-cc=PROG               use PROG as C compiler [${CC-gcc}]],
102 [CC="${withval}"])
104 dnl **** define Fortran compiler
105 FC=${FC-f77}
106 AC_ARG_WITH(f77,
107 [  --with-f77=PROG              use PROG as Fortran compiler [${FC-f77}]],
108 [FC="${withval}"])
110 dnl Chance to add include path
111 AC_ARG_WITH(extra-incpath,
112 [  --with-extra-incpath=PATH    define extra include path (dir1:dir2:...) [[none]]],
113 [CPPFLAGS="${CPPFLAGS} -I`echo ${withval}|sed 's/:/\ -I/g'`"])
115 dnl ... and ld path
116 AC_ARG_WITH(extra-ldpath,
117 [  --with-extra-ldpath=PATH     define extra ld path (dir1:dir2:...) [[none]]],
118 [LDFLAGS="-L`echo ${withval}|sed 's/:/\ -L/g'` ${LDFLAGS}";
119   case "${host}" in
120     sparc-sun-solaris*) LDFLAGS="-R:${withval} ${LDFLAGS}";;
121   esac
124 dnl **** use bundled T1lib  
125 AC_ARG_WITH(bundled_t1lib,
126 [  --with-bundled-t1lib         use bundled T1lib [[no]]],
127 [case "${withval}" in
128   yes) bundled_t1lib=true ;;
129   no)  bundled_t1lib=false;;
130   *) AC_MSG_ERROR(bad value ${withval} for --with-bundled-t1lib) ;;
131 esac],[bundled_t1lib=false])
133 dnl **** use bundled Expat  
134 AC_ARG_WITH(bundled_expat,
135 [  --with-bundled-expat         use bundled Expat [[no]]],
136 [case "${withval}" in
137   yes) bundled_expat=true ;;
138   no)  bundled_expat=false;;
139   *) AC_MSG_ERROR(bad value ${withval} for --with-bundled-expat) ;;
140 esac],[bundled_expat=false])
142 dnl **** use bundled Xbae  
143 AC_ARG_WITH(bundled_xbae,
144 [  --with-bundled-xbae          use bundled Xbae [[yes]]],
145 [case "${withval}" in
146   yes) bundled_xbae=true ;;
147   no)  bundled_xbae=false;;
148   *) AC_MSG_ERROR(bad value ${withval} for --with-bundled-xbae) ;;
149 esac],[bundled_xbae=true])
151 dnl **** use libundo  
152 AC_ARG_ENABLE(undo,
153 [  --enable-undo                enable undo/redo functionality [[yes]]],
154 [case "${enableval}" in
155   yes) undo=true ;;
156   no)  undo=false;;
157   *) AC_MSG_ERROR(bad value ${enableval} for --enable-undo) ;;
158 esac],[undo=true])
160 dnl **** use netcdf  
161 #AC_ARG_ENABLE(netcdf,
162 #[  --enable-netcdf              enable support for netCDF [[yes]]],
163 #[case "${enableval}" in
164 #  yes) netcdf=true ;;
165 #  no)  netcdf=false;;
166 #  *) AC_MSG_ERROR(bad value ${enableval} for --enable-netcdf) ;;
167 #esac],[netcdf=true])
168 netcdf=false
170 dnl **** use FFTW
171 AC_ARG_ENABLE(fftw,
172 [  --enable-fftw                use FFTW library for Fourier transforms [[yes]]],
173 [case "${enableval}" in
174   yes) fftw=true ;;
175   no)  fftw=false;;
176   *) AC_MSG_ERROR(bad value ${enableval} for --enable-fftw) ;;
177 esac],[fftw=true])
179 dnl **** whether to build JPEG driver
180 AC_ARG_ENABLE(jpegdrv,
181 [  --enable-jpegdrv             build JPEG driver [[yes]]],
182 [case "${enableval}" in
183   yes) jpegdrv=true ;;
184   no)  jpegdrv=false;;
185   *) AC_MSG_ERROR(bad value ${enableval} for --enable-jpegdrv) ;;
186 esac],[jpegdrv=true])
188 dnl **** whether to build PNG driver
189 AC_ARG_ENABLE(pngdrv,
190 [  --enable-pngdrv              build PNG driver [[yes]]],
191 [case "${enableval}" in
192   yes) pngdrv=true ;;
193   no)  pngdrv=false;;
194   *) AC_MSG_ERROR(bad value ${enableval} for --enable-pngdrv) ;;
195 esac],[pngdrv=true])
197 dnl **** whether to build PDF driver
198 AC_ARG_ENABLE(pdfdrv,
199 [  --enable-pdfdrv              build PDF driver (PDFlib-based) [[yes]]],
200 [case "${enableval}" in
201   yes) pdfdrv=true ;;
202   no)  pdfdrv=false;;
203   *) AC_MSG_ERROR(bad value ${enableval} for --enable-pdfdrv) ;;
204 esac],[pdfdrv=true])
206 dnl **** whether to build hPDF driver
207 AC_ARG_ENABLE(hpdfdrv,
208 [  --enable-hpdfdrv             build PDF driver (libHaru-based) [[yes]]],
209 [case "${enableval}" in
210   yes) hpdfdrv=true ;;
211   no)  hpdfdrv=false;;
212   *) AC_MSG_ERROR(bad value ${enableval} for --enable-hpdfdrv) ;;
213 esac],[hpdfdrv=true])
215 dnl **** use editres  
216 AC_ARG_ENABLE(editres,
217 [  --enable-editres             enable editres support [[yes]]],
218 [case "${enableval}" in
219   yes) editres=true ;;
220   no)  editres=false;;
221   *) AC_MSG_ERROR(bad value ${enableval} for --enable-editres) ;;
222 esac],[editres=true])
224 dnl **** use XmHTML
225 AC_ARG_ENABLE(xmhtml,
226 [  --enable-xmhtml              use XmHTML widget for on-line help [[yes]]],
227 [case "${enableval}" in
228   yes) xmhtml=true ;;
229   no)  xmhtml=false;;
230   *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmhtml) ;;
231 esac],[xmhtml=true])
233 dnl **** use Qt gui
234 AC_ARG_ENABLE(qt-gui,
235 [  --enable-qt-gui              use Qt gui [[no]]],
236 [case "${enableval}" in
237   yes) qt_gui=true ;;
238   no)  qt_gui=false;;
239   *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt-gui) ;;
240 esac],[qt_gui=false])
242 dnl **** define editor
243 GRACE_EDITOR="'xterm -e vi'"
244 AC_ARG_WITH(editor,
245 [  --with-editor=COMMAND        define editor [["xterm -e vi"]]],
246 [GRACE_EDITOR="'${withval}'"])
248 dnl **** define help viewer
249 GRACE_HELPVIEWER="'mozilla %s'"
250 AC_ARG_WITH(helpviewer,
251 [  --with-helpviewer=COMMAND    define help viewer command [["mozilla %s"]]],
252 [GRACE_HELPVIEWER="'${withval}'"])
254 dnl **** use GSL
255 AC_ARG_ENABLE(gsl,
256 [  --enable-gsl                 use GSL library for advanced math [[yes]]],
257 [case "${enableval}" in
258   yes) gsl=true ;;
259   no)  gsl=false;;
260   *) AC_MSG_ERROR(bad value ${enableval} for --enable-gsl) ;;
261 esac],[gsl=true])
263 dnl **** use CUPS
264 AC_ARG_ENABLE(cups,
265 [  --enable-cups                enable support for CUPS [[yes]]],
266 [case "${enableval}" in
267   yes) cups=true ;;
268   no)  cups=false;;
269   *) AC_MSG_ERROR(bad value ${enableval} for --enable-cups) ;;
270 esac],[cups=true])
273 dnl **** define print command
274 AC_ARG_WITH(printcmd,
275 [  --with-printcmd=PROG         use PROG for printing],
276 [if test "x${withval}" != "x"; then
277     PRINT_CMD="'${withval}'"
278  else
279     PRINT_CMD=NONE
280  fi],
281 [PRINT_CMD=NONE]
284 dnl **** default papersize  
285 AC_ARG_ENABLE(papersize,
286 [  --enable-papersize=PAPER     select paper size for docs (a4 or letter) [[a4]]],
287 [case "${enableval}" in
288   a4)     PAPERSIZE=a4    ;;
289   letter) PAPERSIZE=letter;;
290   *) AC_MSG_ERROR(bad value ${enableval} for --enable-papersize) ;;
291 esac],[PAPERSIZE=a4])
293 dnl **** check if user wants to compile with debugging support
294 AC_ARG_ENABLE(debug,
295 [  --enable-debug               turn on support for debugging [[no]]],
296 [case "${enableval}" in
297   yes) debug=true ;;
298   no)  debug=false ;;
299   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
300 esac],[debug=false])
302 dnl **** maintainer mode
303 AC_ARG_ENABLE(maintainer,
304 [  --enable-maintainer          enable maintainer's mode [[no]]],
305 [case "${enableval}" in
306   yes) maintainer=true; debug=true ;;
307   no)  maintainer=false ;;
308   *) AC_MSG_ERROR(bad value ${enableval} for --enable-maintainer) ;;
309 esac],[maintainer=false])
312 dnl **** Possibility to override defaults
313 if test "x$CONF_FILE" != "x"
314 then
315   if test -r $CONF_FILE
316   then
317     AC_MSG_RESULT(--> using \`$CONF_FILE' as config file)
318     . $CONF_FILE
319   else
320     AC_MSG_ERROR(--> Can't open file \`$CONF_FILE' for reading!)
321     exit 1
322   fi
323 else
324   dnl **** Define CFLAGS etc empty to prevent configure from setting them
325   CFLAGS=${CFLAGS-""}
326   FFLAGS=${FFLAGS-""}
327   LDFLAGS=${LDFLAGS-""}
328   OPTIMIZE=${OPTIMIZE-""}
329   DEBUG=${DEBUG-""}
332 dnl **** Check for host type
333 AC_CANONICAL_HOST
335 dnl Checks for C compiler
336 AC_PROG_CC
338 if test "x${CFLAGS}" = "x"
339 then
340   if test "x${GCC}" = "xyes"
341   then
342     dnl **** default settings for gcc
343     DEBUG="-g -O2"
344     OPTIMIZE="-O2"
345     CFLAGS="-fno-common -Wall -pedantic -Wpointer-arith -Wnested-externs"
347     dnl **** check for strength-reduce bug
348     ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce")
350     CFLAGS="$CPU_FLAGS $CFLAGS"
351   else
352     case "${host}" in
353       alpha*-dec-osf4.*)
354         CFLAGS="-std1 -w0"
355         OPTIMIZE="-O2"
356         DEBUG="-g3 -O2"
357         ;;
358       hppa*-hp-hpux*)
359         CFLAGS="-Aa -D_HPUX_SOURCE"
360         OPTIMIZE="-O"
361         DEBUG="-g -O"
362         ;;
363       mips-sgi-irix6.[[4-9]]*)
364         CFLAGS="-w"
365         OPTIMIZE="-O2 -OPT:Olimit=0"
366         DEBUG="-g3 -O2 -OPT:Olimit=0"
367         ;;
368       mips-sgi-irix*)
369         CFLAGS="-fullwarn -woff 835"
370         OPTIMIZE="-O2 -Olimit 3500"
371         ;;
372       rs6000-ibm-aix*)
373         CFLAGS="-D_ALL_SOURCE"
374         OPTIMIZE="-O2"
375         DEBUG="-g -O2"
376         ;;
377       *)
378         CFLAGS=""
379         OPTIMIZE="-O"
380         DEBUG="-g"
381         ;;
382     esac
383   fi
386 case $debug in
387   true)
388     CFLAGS="$DEBUG $CFLAGS";;
389   *)
390     CFLAGS="$OPTIMIZE $CFLAGS"
391     WINDOWS_LIBS="-mwindows"
392     ;;
393 esac
395 case $FC in
396   /*|../*|./*)
397      if test ! -x $FC; then
398        FC=no
399      fi
400      ;;
401   *) AC_CHECK_PROG(fc, $FC, $FC, no)
402      FC=$ac_cv_prog_fc
403      ;;
404 esac
406 if test "${FC}" = "no"
407 then
408   AC_MSG_RESULT(--> Fortran tests won't be compiled)
409   FC=:
412 dnl **** Check for some compiler/system characteristics
413 AC_C_CHAR_UNSIGNED
414 AC_CHECK_SIZEOF(char,0)
415 AC_CHECK_SIZEOF(short,0)
416 AC_CHECK_SIZEOF(int,0)
417 AC_CHECK_SIZEOF(long,0)
418 AC_CHECK_SIZEOF(long long,0)
419 AC_CHECK_SIZEOF(float,0)
420 AC_CHECK_SIZEOF(double,0)
421 AC_CHECK_SIZEOF(long double,0)
422 AC_CHECK_SIZEOF(void *,0)
424 dnl **** Check for endianess
425 AC_C_BIGENDIAN
427 dnl **** Checks for FPU arithmetics
428 ACX_CHECK_FPU
430 dnl **** .exe/.obj file extensions
431 AC_EXEEXT
432 AC_OBJEXT
434 OBJEXT=".$OBJEXT"
436 AC_PROG_MAKE_SET
438 dnl **** Checks for programs.
439 AC_CHECK_PROG(AR, ar, ar, NONE)
440 if test "$AR" = "NONE"; then
441   AC_MSG_ERROR(--> Can't find \`ar'!)
442   AC_CACHE_SAVE
443   exit 1
446 AC_PROG_RANLIB
447 AC_PROG_LN_S
448 AC_PROG_YACC
450 AC_PROG_INSTALL
451 case "x$INSTALL" in
452    x/*) ;;
453    *) INSTALL=`pwd`/ac-tools/"shtool install -c" ;
454 esac
456 MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f"
458 if test "x$PRINT_CMD" = "xNONE"; then
459   AC_CHECK_PROG(LP_CMD, lp, 'lp -c', "NONE")
460   if test "${ac_cv_prog_LP_CMD}" = "NONE"; then
461     AC_CHECK_PROG(LPR_CMD, lpr, 'lpr', "NONE")
462     if test "${ac_cv_prog_LPR_CMD}" = "NONE"; then
463       PRINT_CMD=
464     else
465       PRINT_CMD="${ac_cv_prog_LPR_CMD}"
466     fi
467   else
468     PRINT_CMD="${ac_cv_prog_LP_CMD}"
469   fi
472 AC_MSG_RESULT(--> Using \"$PRINT_CMD\" to print)
474 dnl **** Checks for header files.
475 AC_HEADER_STDC
476 AC_HEADER_SYS_WAIT
477 AC_CHECK_HEADERS(unistd.h fcntl.h)
478 AC_CHECK_HEADERS(sys/param.h sys/time.h sys/select.h)
479 AC_HEADER_TIME
480 dnl **** math.h and related
481 AC_CHECK_HEADERS(math.h float.h ieeefp.h)
483 dnl **** Checks for typedefs, structures, and compiler characteristics.
484 AC_C_CONST
485 AC_TYPE_PID_T
486 AC_TYPE_SIZE_T
487 AC_STRUCT_TM
489 dnl **** Checks for library functions.
490 AC_TYPE_SIGNAL
491 AC_FUNC_ALLOCA
492 AC_CHECK_FUNCS(getcwd)
494 case "$host_os" in
495   *cygwin* | *mingw*)
496     AC_CACHE_CHECK([for gethostname], ac_cv_gethostname,
497       gethostname_save_LIBS="$LIBS"
498       LIBS="$LIBS -lws2_32"
499       AC_TRY_LINK([#include <windows.h>],
500         [gethostname(NULL, 0);],
501         ac_cv_gethostname="yes",
502         ac_cv_gethostname="no") 
503       LIBS="$gethostname_save_LIBS")
504     if test "$ac_cv_gethostname" = "yes"; then
505       AC_DEFINE(HAVE_GETHOSTNAME)
506     fi
507   ;;
508   *)
509     AC_CHECK_FUNCS(gethostname)
510   ;;
511 esac
513 AC_CHECK_FUNCS(strstr)
514 AC_CHECK_FUNCS(memcpy memmove bcopy)
515 AC_CHECK_FUNCS(fcntl)
516 AC_CHECK_FUNCS(popen)
517 AC_CHECK_FUNCS(fdopen)
518 AC_CHECK_FUNCS(mkstemp)
519 AC_CHECK_FUNCS(gettimeofday)
520 AC_CHECK_FUNCS(getlogin)
521 AC_CHECK_FUNCS(fnmatch)
522 AC_CHECK_FUNCS(vsnprintf)
523 AC_CHECK_FUNCS(on_exit)
524 AC_CHECK_FUNCS(select)
525 AC_CHECK_FUNCS(uname)
526 AC_CHECK_FUNCS(strerror)
527 if test "$ac_cv_func_strerror" = no; then
528   AC_CACHE_CHECK([for sys_errlist declaration in stdio.h], ac_cv_sys_errlist_decl,
529       AC_EGREP_HEADER(sys_errlist, stdio.h, ac_cv_sys_errlist_decl="yes",
530       ac_cv_sys_errlist_decl="no"))
531   if test "$ac_cv_sys_errlist_decl" = yes; then
532     AC_DEFINE(HAVE_SYS_ERRLIST_DECL)
533   fi
536 ICE_CHECK_DECL(drand48, stdlib.h)
538 dnl **** Check for locale
539 AC_CHECK_FUNCS(setlocale)
541 dnl **** Check for buggy realloc()
542 ACX_CHECK_REALLOC(AC_DEFINE(REALLOC_IS_BUGGY))
544 dnl **** Checks for libm
545 AC_CHECK_LIB(m, sin)
547 dnl **** Those functions are usually found in libm but...
548 ICE_CHECK_DECL(hypot, math.h)
549 ICE_CHECK_DECL(rint, math.h)
550 ICE_CHECK_DECL(cbrt, math.h)
551 ICE_CHECK_DECL(log2, math.h)
552 ICE_CHECK_DECL(asinh, math.h)
553 ICE_CHECK_DECL(acosh, math.h)
554 ICE_CHECK_DECL(atanh, math.h)
555 ICE_CHECK_DECL(lgamma, math.h)
557 dnl **** The machten4 (unix for mac) system does have signgam in libm
558 dnl **** but it is not declared in <math.h>
559 if test "$ac_cv_func_lgamma" = yes; then
560   AC_CACHE_CHECK([for signgam declaration in math.h], ac_cv_signgam_decl,
561       AC_EGREP_HEADER(signgam, math.h, ac_cv_signgam_decl="yes",
562       ac_cv_signgam_decl="no"))
563   if test "$ac_cv_signgam_decl" = yes; then
564     AC_DEFINE(HAVE_SIGNGAM_DECL)
565   fi
568 ICE_CHECK_DECL(erf, math.h)
569 ICE_CHECK_DECL(erfc, math.h)
570 ICE_CHECK_DECL(j0, math.h)
571 ICE_CHECK_DECL(j1, math.h)
572 ICE_CHECK_DECL(jn, math.h)
573 ICE_CHECK_DECL(y0, math.h)
574 ICE_CHECK_DECL(y1, math.h)
575 ICE_CHECK_DECL(yn, math.h)
576 ICE_CHECK_DECL(finite, math.h)
577 dnl **** C9X-compatible isfinite() may be a good replacement for finite()
578 if test "$ac_cv_lib_m_finite" != yes; then
579   ICE_CHECK_DECL(isfinite, math.h)
581 ICE_CHECK_DECL(isnan, math.h)
583 dnl **** Check for T1lib installed
584 if test $bundled_t1lib = false
585 then
586   ACX_CHECK_T1LIB(5.0.2, AC_DEFINE(HAVE_LIBT1), bundled_t1lib=true)
589 if test $bundled_t1lib = true
590 then
591   dnl **** Use the bundled T1lib
593   AC_MSG_RESULT(--> Bundled version of T1lib will be used)
595   T1_LIB='$(TOP)/T1lib/libt1.a'
596   T1_INC='-I$(TOP)/T1lib/t1lib'
597   t1lib_dir="T1lib"
599   dnl **** Check ANSI types
600   ACX_ANSI_TYPES
601 else
602   AC_MSG_RESULT(--> Good. Seems you have compatible version of T1lib installed)
605 dnl **** Check for Expat installed
606 if test $bundled_expat = false
607 then
608   ACX_CHECK_EXPAT(1.95.7, AC_DEFINE(HAVE_EXPAT), bundled_expat=true)
611 if test $bundled_expat = true
612 then
613   dnl **** Use the bundled Expat
615   AC_MSG_RESULT(--> Bundled version of Expat will be used)
617   EXPAT_LIB='$(TOP)/expat/libexpat.a'
618   EXPAT_INC='-I$(TOP)/expat'
619   expat_dir="expat"
620 else
621   AC_MSG_RESULT(--> Good. Seems you have compatible version of Expat installed)
624 dnl **** Check for dlopen() interface
625 dnl           (Linux, SunOS-[4,5], OSF, IRIX, AIX-4, UnixWare, ...)
626 mdw_CHECK_MANYLIBS(dlopen, dl, [DL_LIB=$mdw_cv_lib_dlopen; AC_DEFINE(HAVE_DLOPEN)], DL_LIB="NONE")
628 if test "${DL_LIB}" != "NONE"; then
629   dnl **** Old implementations of dlopen() don't have RTLD_NOW
630   AC_CACHE_CHECK([whether RTLD_NOW is defined in dlfcn.h], ac_cv_rtld_now_in_dlfcn_h,  
631     AC_EGREP_CPP(yes,
632         [#include <dlfcn.h>
633          #ifdef RTLD_NOW
634             yes
635          #endif
636         ], ac_cv_rtld_now_in_dlfcn_h="yes"; AC_DEFINE(HAVE_RTLD_NOW),
637            ac_cv_rtld_now_in_dlfcn_h="no")
638   )
639 else
640   dnl **** Check for shl_load() interface (HP/UX)
641   mdw_CHECK_MANYLIBS(shl_load, dld, [DL_LIB=$mdw_cv_lib_shl_load; AC_DEFINE(HAVE_SHL_LOAD)], DL_LIB="NONE")
644 if test "${DL_LIB}" = "NONE"; then
645   AC_MSG_RESULT(--> Support for dll modules will not be compiled)
646   DL_LIB=""
649 if test $undo = true
650 then
651   ACX_CHECK_LIBUNDO(0.8.2, AC_DEFINE(HAVE_LIBUNDO),
652                    AC_MSG_RESULT(--> undo/redo functionality is disabled))
655 if test $netcdf = true
656 then
657   ACX_CHECK_NETCDF(3.0, AC_DEFINE(HAVE_NETCDF),
658                    AC_MSG_RESULT(--> support for netCDF is disabled))
661 if test $gsl = true
662 then
663   ACX_CHECK_GSL(AC_DEFINE(HAVE_GSL),
664     AC_MSG_RESULT(--> support for GSL is disabled))
668 if test $fftw = true
669 then
670   ACX_CHECK_FFTW(3.0.0, AC_DEFINE(HAVE_FFTW),
671                  AC_MSG_RESULT(--> using legacy unoptimized FFT code))
674 dnl **** check for libz - needed for PDF and PNG drivers and XmHTML
675 if test $pngdrv = true || test $pdfdrv = true || test $hpdfdrv = true || test $xmhtml = true
676 then
677   ACX_CHECK_ZLIB(1.0.3)
680 dnl **** check for libxmi - needed for all raster drivers
681 ACX_CHECK_XMI(1.2, , jpegdrv=false;pngdrv=false;
682     AC_MSG_RESULT(--> all raster drivers are disabled))
684 dnl **** check for IJG's libjpeg - also, for PDF driver and XmHTML
685 if test $jpegdrv = true || test $pdfdrv = true || test $xmhtml = true
686 then
687   ACX_CHECK_JPEG(61, AC_DEFINE(HAVE_LIBJPEG),
688                      AC_MSG_RESULT(--> JPEG backend is disabled))
691 dnl **** check for libpng - needed for PDF and PNG drivers and XmHTML
692 if test $pngdrv = true || test $pdfdrv = true || test $hpdfdrv = true || test $xmhtml = true
693 then
694   ACX_CHECK_PNG(0.9.6, AC_DEFINE(HAVE_LIBPNG),
695                        AC_MSG_RESULT(--> PNG backend is disabled))
698 dnl **** check for PDFlib
699 if test $pdfdrv = true
700 then
701   ACX_CHECK_PDFLIB(6.0.0, AC_DEFINE(HAVE_LIBPDF), pdfdrv=false)
703 if test $pdfdrv != true; then
704   AC_MSG_RESULT(--> PDF driver is disabled)
707 dnl **** check for libHaru
708 if test $hpdfdrv = true
709 then
710   ACX_CHECK_HARU(2.2.1, AC_DEFINE(HAVE_HARU), hpdfdrv=false)
712 if test $hpdfdrv != true; then
713   AC_MSG_RESULT(--> hPDF driver is disabled)
716 if test $cups = true
717 then
718   ACX_CHECK_CUPS(AC_DEFINE(HAVE_CUPS),
719     AC_MSG_RESULT(--> support for CUPS is disabled))
722 dnl **** TODO: undefine unneeded libraries
724 NOGUI_LIBS="$LIBS"
726 dnl **** Choose a GUI *****
728 dnl **** default is gui-less
729 GRACE=grace
731 AC_PATH_XTRA
732 if test "$no_x" = yes; then
733   if test "$qt_gui" = false; then
734     GUI="NONE_GUI"
735   fi
736 else
737   if test "$qt_gui" = false; then
738   dnl **** Check for Motif
739     GUI_LIBS="-lXt -lXext -lX11 $X_PRE_LIBS $X_EXTRA_LIBS"
741     ACX_SAVE_STATE
742     
743     LIBS="$GUI_LIBS"
744     CFLAGS="$X_CFLAGS $CFLAGS"
745     CPPFLAGS="$X_CFLAGS $CPPFLAGS"
746     LDFLAGS="$X_LIBS $LDFLAGS"
747     
748     dnl **** use editres  
749     case $editres in
750       true) AC_CHECK_LIB(Xmu,_XEditResCheckMessages,GUI_LIBS="-lXmu $GUI_LIBS"; AC_DEFINE(WITH_EDITRES));;
751       *) ;;
752     esac
753     
754     if test "$ac_cv_lib_Xmu__XEditResCheckMessages" != yes; then
755       AC_MSG_RESULT(--> support for EditRes protocol is disabled)
756     fi
758     dnl **** some Motif-2.1 variants need the -lXp library
759     AC_CHECK_LIB(Xp,main,GUI_LIBS="-lXp $GUI_LIBS")
761     ACX_RESTORE_STATE
763     dnl **** check for Xpm lib
764     ACX_CHECK_XPM(30411, GUI_LIBS="$XPM_LIB $GUI_LIBS"; AC_DEFINE(HAVE_XPM),AC_MSG_ERROR(Xpm lib has not been found))
766     ACX_CHECK_MOTIF(1002)
767     if test "$acx_cv_motif" = "no"; then
768       dnl **** only Motif GUI is supported by now:
769       GUI="NONE_GUI"
770       GUI_FLAGS=""
771       GUI_LIBS=""
772       AC_MSG_ERROR(M*tif has not been found)
773     else
774       GUI_LIBS="$MOTIF_LIB $GUI_LIBS"
775       GUI="MOTIF_GUI"
776       GUI_FLAGS="$X_CFLAGS"
777       GRACE=xmgrace
779       dnl **** Special Motif checks
780       xsave_CPPFLAGS="$CPPFLAGS"
781       xsave_LIBS="$LIBS"
782       CPPFLAGS="$CPPFLAGS $GUI_FLAGS"
783       LIBS="$X_LIBS $GUI_LIBS $LIBS"
785       dnl **** Check for Xbae widget
786       if test $bundled_xbae = false
787       then
788         AC_CHECK_LIB(Xbae, XbaeCreateMatrix, XBAE_LIB="-lXbae";AC_DEFINE(HAVE_LIBXBAE))
789       fi
790       if test -z "$XBAE_LIB"
791       then
792         dnl **** Use the bundled Xbae library
793         AC_MSG_RESULT(--> Bundled version of Xbae library will be used)
794         XBAE_LIB='$(TOP)/Xbae/Xbae/libXbae.a'
795         XBAE_INC='-I$(TOP)/Xbae'
796         xbae_dir="Xbae/Xbae"
797       else
798         AC_MSG_RESULT(--> Good. Seems you have compatible version of Xbae installed)
799       fi
801       dnl **** Check for XmHTML widget
802       if test $xmhtml = true
803       then
804         ACX_CHECK_XMHTML(1105, AC_DEFINE(WITH_XMHTML), xmhtml=false)
805       fi
807       GUI_LIBS="$XMHTML_LIB $XBAE_LIB $GUI_LIBS"
809       CPPFLAGS="$xsave_CPPFLAGS"
810       LIBS="$xsave_LIBS"
811       
812     fi
813   fi
816 if test "$qt_gui" = true
817 then
818   AC_PROG_CXX
819   AC_DEFINE(QT_GUI)
820   GRACE=qtgrace
821   case "$host_os" in
822       *cygwin* | *mingw*)
823       LDFLAGS="$LDFLAGS -L$QTDIR/lib -lQtGui4 -lQtCore4"
824       WINDOWS_LIBS="$WINDOWS_LIBS -lws2_32"
825       ;;
826       *)
827       LDFLAGS="$LDFLAGS -L$QTDIR/lib -lQtGui -lQtCore -lpthread"
828       ;;
829   esac
830   qtgui_dir="src/qtgui"
833 dnl **** Final list of subdirs
834 SUBDIRS="${t1lib_dir} ${expat_dir} ${xbae_dir} ${qtgui_dir} lib/base lib/canvas lib/core lib/plot lib/graal lib/grace src fonts templates doc examples auxiliary tests"
836 dnl **** Create Make.conf
837 AC_OUTPUT(Make.conf:ac-tools/Make.conf.in)