1dnl **** Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.57)
4
5AC_INIT(src/main.c)
6AC_CONFIG_AUX_DIR(ac-tools)
7
8AC_CONFIG_HEADER(config.h:ac-tools/config.h.in)
9
10AC_PREFIX_DEFAULT("/usr/local")
11
12builtin(include, ac-tools/aclocal.m4)
13
14AC_SUBST(EXEEXT)
15AC_SUBST(OBJEXT)
16AC_SUBST(BATEXT)
17
18AC_SUBST(MKINSTALLDIRS)
19
20AC_SUBST(GRACE)
21AC_SUBST(GRACE_HOME)
22AC_SUBST(GUI_FLAGS)
23AC_SUBST(FC)
24AC_SUBST(GUI_LIBS)
25AC_SUBST(NOGUI_LIBS)
26AC_SUBST(NETCDF_LIBS)
27AC_SUBST(XDR_LIB)
28AC_SUBST(DL_LIB)
29AC_SUBST(T1_LIB)
30AC_SUBST(T1_INC)
31AC_SUBST(FFTW_LIB)
32AC_SUBST(Z_LIB)
33AC_SUBST(JPEG_LIB)
34AC_SUBST(PNG_LIB)
35AC_SUBST(PDF_LIB)
36AC_SUBST(XBAE_INC)
37AC_SUBST(SUBDIRS)
38
39AC_SUBST(GRACE_EDITOR)
40AC_SUBST(GRACE_HELPVIEWER)
41AC_SUBST(PRINT_CMD)
42
43dnl **** Those are for T1lib
44
45AC_SUBST(T1_AA_TYPE16)
46AC_SUBST(T1_AA_TYPE32)
47AC_SUBST(T1_AA_TYPE64)
48
49dnl **** define home dir of Grace
50if test "x${prefix}" = "xNONE"
51then
52  GRACE_HOME=${ac_default_prefix}/grace
53else
54  GRACE_HOME=${prefix}/grace
55fi
56AC_ARG_ENABLE(grace-home,
57[  --enable-grace-home=DIR      define Grace home dir [[PREFIX/grace]]],
58[GRACE_HOME="${enableval}"])
59
60
61dnl **** option to define config file overriding autodetect
62AC_ARG_ENABLE(config,
63[  --enable-config=FILE         define configuration FILE to override
64                               autodetection (not recommended!)],
65                             [CONF_FILE="${enableval}"])
66
67dnl **** define C compiler
68CC=${CC-gcc}
69AC_ARG_WITH(cc,
70[  --with-cc=PROG               use PROG as C compiler [[${CC-gcc}]]],
71[CC="${withval}"])
72
73dnl **** define Fortran compiler
74FC=${FC-f77}
75AC_ARG_WITH(f77,
76[  --with-f77=PROG              use PROG as Fortran compiler [[${FC-f77}]]],
77[FC="${withval}"])
78
79dnl Chance to add include path
80AC_ARG_WITH(extra-incpath,
81[  --with-extra-incpath=PATH    define extra include path (dir1:dir2:...) [[none]]],
82[CPPFLAGS="${CPPFLAGS} -I`echo ${withval}|sed 's/:/\ -I/g'`"])
83
84dnl ... and ld path
85AC_ARG_WITH(extra-ldpath,
86[  --with-extra-ldpath=PATH     define extra ld path (dir1:dir2:...) [[none]]],
87[LDFLAGS="-L`echo ${withval}|sed 's/:/\ -L/g'` ${LDFLAGS}";
88  case "${host}" in
89    sparc-sun-solaris*) LDFLAGS="-R:${withval} ${LDFLAGS}";;
90  esac
91])
92
93dnl **** use bundled T1lib
94AC_ARG_WITH(bundled_t1lib,
95[  --with-bundled-t1lib         use bundled T1lib [[no]]],
96[case "${withval}" in
97  yes) bundled_t1lib=true ;;
98  no)  bundled_t1lib=false;;
99  *) AC_MSG_ERROR(bad value ${withval} for --with-bundled-t1lib) ;;
100esac],[bundled_t1lib=false])
101
102dnl **** use bundled Xbae
103AC_ARG_WITH(bundled_xbae,
104[  --with-bundled-xbae          use bundled Xbae [[yes]]],
105[case "${withval}" in
106  yes) bundled_xbae=true ;;
107  no)  bundled_xbae=false;;
108  *) AC_MSG_ERROR(bad value ${withval} for --with-bundled-xbae) ;;
109esac],[bundled_xbae=true])
110
111dnl **** use netcdf
112AC_ARG_ENABLE(netcdf,
113[  --enable-netcdf              enable support for netCDF [[yes]]],
114[case "${enableval}" in
115  yes) netcdf=true ;;
116  no)  netcdf=false;;
117  *) AC_MSG_ERROR(bad value ${enableval} for --enable-netcdf) ;;
118esac],[netcdf=true])
119
120dnl **** use FFTW
121AC_ARG_WITH(fftw,
122[  --with-fftw                  use FFTW library for Fourier transforms [[yes]]],
123[case "${withval}" in
124  yes) fftw=true ;;
125  no)  fftw=false;;
126  *) AC_MSG_ERROR(bad value ${withval} for --with-fftw) ;;
127esac],[fftw=true])
128
129dnl **** whether to build JPEG driver
130AC_ARG_ENABLE(jpegdrv,
131[  --enable-jpegdrv             build JPEG driver [[yes]]],
132[case "${enableval}" in
133  yes) jpegdrv=true ;;
134  no)  jpegdrv=false;;
135  *) AC_MSG_ERROR(bad value ${enableval} for --enable-jpegdrv) ;;
136esac],[jpegdrv=true])
137
138dnl **** whether to build PNG driver
139AC_ARG_ENABLE(pngdrv,
140[  --enable-pngdrv              build PNG driver [[yes]]],
141[case "${enableval}" in
142  yes) pngdrv=true ;;
143  no)  pngdrv=false;;
144  *) AC_MSG_ERROR(bad value ${enableval} for --enable-pngdrv) ;;
145esac],[pngdrv=true])
146
147dnl **** whether to build PDF driver
148AC_ARG_ENABLE(pdfdrv,
149[  --enable-pdfdrv              build PDF driver [[yes]]],
150[case "${enableval}" in
151  yes) pdfdrv=true ;;
152  no)  pdfdrv=false;;
153  *) AC_MSG_ERROR(bad value ${enableval} for --enable-pdfdrv) ;;
154esac],[pdfdrv=true])
155
156dnl **** check if user wants to compile grace_np lib with support for Fortran
157AC_ARG_ENABLE(f77_wrapper,
158[  --enable-f77-wrapper         include Fortran wrapper for libgrace_np [[yes]]],
159[case "${enableval}" in
160  yes) f77_wrapper=true ;;
161  no)  f77_wrapper=false;;
162  *) AC_MSG_ERROR(bad value ${enableval} for --enable-f77-wrapper) ;;
163esac],[f77_wrapper=true])
164
165dnl **** use editres
166AC_ARG_ENABLE(editres,
167[  --enable-editres             enable editres support [[yes]]],
168[case "${enableval}" in
169  yes) editres=true ;;
170  no)  editres=false;;
171  *) AC_MSG_ERROR(bad value ${enableval} for --enable-editres) ;;
172esac],[editres=true])
173
174dnl **** use libhelp
175AC_ARG_ENABLE(libhelp,
176[  --enable-libhelp             use libhelp [[no]]],
177[case "${enableval}" in
178  yes) libhelp=true ;;
179  no)  libhelp=false;;
180  *) AC_MSG_ERROR(bad value ${enableval} for --enable-libhelp) ;;
181esac],[libhelp=false])
182
183dnl **** use XmHTML
184AC_ARG_ENABLE(xmhtml,
185[  --enable-xmhtml              use XmHTML widget for on-line help [[yes]]],
186[case "${enableval}" in
187  yes) xmhtml=true ;;
188  no)  xmhtml=false;;
189  *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmhtml) ;;
190esac],[xmhtml=true])
191
192if test $xmhtml = true && test $libhelp = true
193then
194  AC_MSG_ERROR(can't use both libhelp and XmHTML)
195fi
196
197dnl **** define editor
198GRACE_EDITOR="'xterm -e vi'"
199AC_ARG_WITH(editor,
200[  --with-editor=COMMAND        define editor [["xterm -e vi"]]],
201[GRACE_EDITOR="'${withval}'"])
202
203dnl **** define help viewer
204GRACE_HELPVIEWER="'mozilla %s'"
205AC_ARG_WITH(helpviewer,
206[  --with-helpviewer=COMMAND    define help viewer command [["mozilla %s"]]],
207[GRACE_HELPVIEWER="'${withval}'"])
208
209dnl **** define print command
210AC_ARG_WITH(printcmd,
211[  --with-printcmd=PROG         use PROG for printing],
212[if test "x${withval}" != "x"; then
213    PRINT_CMD="'${withval}'"
214 else
215    PRINT_CMD=NONE
216 fi],
217[PRINT_CMD=NONE]
218)
219
220dnl **** check if user wants to compile with debugging support
221AC_ARG_ENABLE(debug,
222[  --enable-debug               turn on debugging [[no]]],
223[case "${enableval}" in
224  yes) debug=true ;;
225  no)  debug=false ;;
226  *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
227esac],[debug=false])
228
229dnl **** maintainer mode
230AC_ARG_ENABLE(maintainer,
231[  --enable-maintainer          enable maintainer's mode [[no]]],
232[case "${enableval}" in
233  yes) maintainer=true; debug=true ;;
234  no)  maintainer=false ;;
235  *) AC_MSG_ERROR(bad value ${enableval} for --enable-maintainer) ;;
236esac],[maintainer=false])
237
238if test $maintainer = true
239then
240  AC_DEFINE(WITH_DEBUG)
241fi
242
243dnl Support for Fortran wrapper
244if test $f77_wrapper = true; then
245  AC_DEFINE(WITH_F77_WRAPPER)
246fi
247
248
249dnl **** Possibility to override defaults
250if test "x$CONF_FILE" != "x"
251then
252  if test -r $CONF_FILE
253  then
254    AC_MSG_RESULT(--> using \`$CONF_FILE' as config file)
255    . $CONF_FILE
256  else
257    AC_MSG_ERROR(--> Can't open file \`$CONF_FILE' for reading!)
258    exit 1
259  fi
260else
261  dnl **** Define CFLAGS etc empty to prevent configure from setting them
262  CFLAGS=${CFLAGS-""}
263  FFLAGS=${FFLAGS-""}
264  LDFLAGS=${LDFLAGS-""}
265  OPTIMIZE=${OPTIMIZE-""}
266  DEBUG=${DEBUG-""}
267fi
268
269dnl **** Check for host type
270AC_CANONICAL_HOST
271
272dnl Checks for C compiler
273AC_PROG_CC
274
275AC_ISC_POSIX
276AC_AIX
277AC_MINIX
278
279if test "x${CFLAGS}" = "x"
280then
281  if test "x${GCC}" = "xyes"
282  then
283    dnl **** default settings for gcc
284    DEBUG="-g -O2"
285    OPTIMIZE="-O2"
286    CFLAGS="-fno-common -Wall -Wpointer-arith -Wnested-externs"
287
288    dnl **** check for strength-reduce bug
289    ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce")
290
291    CFLAGS="$CPU_FLAGS $CFLAGS"
292  else
293    case "${host}" in
294      alpha*-dec-osf4.*)
295        CFLAGS="-std1 -w0"
296        OPTIMIZE="-O2"
297        DEBUG="-g3 -O2"
298        ;;
299      hppa*-hp-hpux*)
300        CFLAGS="-Aa -D_HPUX_SOURCE"
301        OPTIMIZE="-O"
302        DEBUG="-g -O"
303        ;;
304      mips-sgi-irix6.[[4-9]]*)
305        CFLAGS="-w"
306        OPTIMIZE="-O2 -OPT:Olimit=0"
307        DEBUG="-g3 -O2 -OPT:Olimit=0"
308        ;;
309      mips-sgi-irix*)
310        CFLAGS="-fullwarn -woff 835"
311        OPTIMIZE="-O2 -Olimit 3500"
312        ;;
313      rs6000-ibm-aix*)
314        CFLAGS="-D_ALL_SOURCE"
315        OPTIMIZE="-O2"
316        DEBUG="-g -O2"
317        ;;
318      *)
319        CFLAGS=""
320        OPTIMIZE="-O"
321        DEBUG="-g"
322        ;;
323    esac
324  fi
325fi
326
327case $debug in
328  true) CFLAGS="$DEBUG $CFLAGS";;
329  *) CFLAGS="$OPTIMIZE $CFLAGS";;
330esac
331
332case $FC in
333  /*|../*|./*)
334     if test ! -x $FC; then
335       FC=no
336     fi
337     ;;
338  *) AC_CHECK_PROG(fc, $FC, $FC, no)
339     FC=$ac_cv_prog_fc
340     ;;
341esac
342
343if test "${FC}" = "no"
344then
345  AC_MSG_RESULT(--> Fortran tests won't be compiled)
346  FC=:
347fi
348
349dnl **** Check for some compiler/system characteristics
350AC_C_CHAR_UNSIGNED
351AC_CHECK_SIZEOF(char,0)
352AC_CHECK_SIZEOF(short,0)
353AC_CHECK_SIZEOF(int,0)
354AC_CHECK_SIZEOF(long,0)
355AC_CHECK_SIZEOF(long long,0)
356AC_CHECK_SIZEOF(float,0)
357AC_CHECK_SIZEOF(double,0)
358AC_CHECK_SIZEOF(long double,0)
359AC_CHECK_SIZEOF(void *,0)
360
361dnl **** Check for endianess
362AC_C_BIGENDIAN
363
364dnl **** Checks for FPU arithmetics
365ACX_CHECK_FPU
366
367dnl **** .exe/.obj file extensions
368AC_EXEEXT
369AC_OBJEXT
370
371OBJEXT=".$OBJEXT"
372
373AC_PROG_MAKE_SET
374
375dnl **** Checks for programs.
376AC_CHECK_PROG(AR, ar, ar, NONE)
377if test "$AR" = "NONE"; then
378  AC_MSG_ERROR(--> Can't find \`ar'!)
379  AC_CACHE_SAVE
380  exit 1
381fi
382
383AC_PROG_RANLIB
384AC_PROG_LN_S
385AC_PROG_YACC
386
387AC_PROG_INSTALL
388case "x$INSTALL" in
389   x/*) ;;
390   *) INSTALL=`pwd`/ac-tools/"shtool install -c" ;
391esac
392
393MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f"
394
395if test "x$PRINT_CMD" = "xNONE"; then
396  AC_CHECK_PROG(LP_CMD, lp, 'lp -c', "NONE")
397  if test "${ac_cv_prog_LP_CMD}" = "NONE"; then
398    AC_CHECK_PROG(LPR_CMD, lpr, 'lpr', "NONE")
399    if test "${ac_cv_prog_LPR_CMD}" = "NONE"; then
400      PRINT_CMD=
401    else
402      PRINT_CMD="${ac_cv_prog_LPR_CMD}"
403    fi
404  else
405    PRINT_CMD="${ac_cv_prog_LP_CMD}"
406  fi
407fi
408
409AC_MSG_RESULT(--> Using \"$PRINT_CMD\" to print)
410
411dnl **** Checks for header files.
412AC_HEADER_STDC
413AC_HEADER_SYS_WAIT
414AC_CHECK_HEADERS(unistd.h fcntl.h)
415AC_CHECK_HEADERS(sys/param.h sys/time.h sys/select.h)
416AC_HEADER_TIME
417dnl **** math.h and related
418AC_CHECK_HEADERS(math.h float.h ieeefp.h)
419
420dnl **** Checks for typedefs, structures, and compiler characteristics.
421AC_C_CONST
422AC_TYPE_PID_T
423AC_TYPE_SIZE_T
424AC_STRUCT_TM
425
426dnl **** Checks for library functions.
427AC_TYPE_SIGNAL
428AC_FUNC_ALLOCA
429AC_CHECK_FUNCS(getcwd gethostname)
430AC_CHECK_FUNCS(strstr)
431AC_CHECK_FUNCS(memcpy memmove)
432AC_CHECK_FUNCS(unlink fcntl)
433AC_CHECK_FUNCS(popen)
434AC_CHECK_FUNCS(gettimeofday)
435AC_CHECK_FUNCS(fnmatch)
436AC_CHECK_FUNCS(vsnprintf)
437AC_CHECK_FUNCS(on_exit)
438AC_CHECK_FUNCS(strerror)
439if test "$ac_cv_func_strerror" = no; then
440  AC_CACHE_CHECK([for sys_errlist declaration in stdio.h], ac_cv_sys_errlist_decl,
441      AC_EGREP_HEADER(sys_errlist, stdio.h, ac_cv_sys_errlist_decl="yes",
442      ac_cv_sys_errlist_decl="no"))
443  if test "$ac_cv_sys_errlist_decl" = yes; then
444    AC_DEFINE(HAVE_SYS_ERRLIST_DECL)
445  fi
446fi
447
448ICE_CHECK_DECL(drand48, stdlib.h)
449
450dnl **** Check for locale
451AC_CHECK_FUNCS(setlocale)
452
453dnl **** Check for buggy realloc()
454ACX_CHECK_REALLOC(AC_DEFINE(REALLOC_IS_BUGGY))
455
456dnl **** Checks for libm
457AC_CHECK_LIB(m, sin)
458
459dnl **** Those functions are usually found in libm but...
460ICE_CHECK_DECL(hypot, math.h)
461ICE_CHECK_DECL(rint, math.h)
462ICE_CHECK_DECL(cbrt, math.h)
463ICE_CHECK_DECL(log2, math.h)
464ICE_CHECK_DECL(asinh, math.h)
465ICE_CHECK_DECL(acosh, math.h)
466ICE_CHECK_DECL(atanh, math.h)
467ICE_CHECK_DECL(lgamma, math.h)
468
469dnl **** The machten4 (unix for mac) system does have signgam in libm
470dnl **** but it is not declared in <math.h>
471if test "$ac_cv_func_lgamma" = yes; then
472  AC_CACHE_CHECK([for signgam declaration in math.h], ac_cv_signgam_decl,
473      AC_EGREP_HEADER(signgam, math.h, ac_cv_signgam_decl="yes",
474      ac_cv_signgam_decl="no"))
475  if test "$ac_cv_signgam_decl" = yes; then
476    AC_DEFINE(HAVE_SIGNGAM_DECL)
477  fi
478fi
479
480ICE_CHECK_DECL(erf, math.h)
481ICE_CHECK_DECL(erfc, math.h)
482ICE_CHECK_DECL(j0, math.h)
483ICE_CHECK_DECL(j1, math.h)
484ICE_CHECK_DECL(jn, math.h)
485ICE_CHECK_DECL(y0, math.h)
486ICE_CHECK_DECL(y1, math.h)
487ICE_CHECK_DECL(yn, math.h)
488ICE_CHECK_DECL(finite, math.h)
489dnl **** C9X-compatible isfinite() may be a good replacement for finite()
490if test "$ac_cv_lib_m_finite" != yes; then
491  ICE_CHECK_DECL(isfinite, math.h)
492fi
493ICE_CHECK_DECL(isnan, math.h)
494
495dnl **** Check for T1lib installed
496if test $bundled_t1lib = false
497then
498  ACX_CHECK_T1LIB(1.3.1, AC_DEFINE(HAVE_LIBT1), bundled_t1lib=true)
499fi
500
501if test $bundled_t1lib = true
502then
503  dnl **** Use the bundled T1lib
504
505  AC_MSG_RESULT(--> Bundled version of T1lib will be used)
506
507  T1_LIB='$(TOP)/T1lib/libt1.a'
508  T1_INC='-I$(TOP)/T1lib/t1lib'
509  t1lib_dir="T1lib"
510
511  dnl **** Check ANSI types
512  ACX_ANSI_TYPES
513else
514  AC_MSG_RESULT(--> Good. Seems you have compatible version of T1lib installed)
515fi
516
517dnl **** Check for XDR
518AC_SEARCH_LIBS(xdrstdio_create, nsl rpc xdr rpclib, XDR_LIB=$mdw_cv_lib_xdrstdio_create, XDR_LIB="NONE")
519
520if test "${XDR_LIB}" = "NONE"; then
521  XDR_LIB=
522  AC_MSG_RESULT(--> No XDR library found; grconvert will not be built)
523else
524  grconvert_dir="grconvert"
525fi
526
527dnl **** Check for dlopen() interface
528dnl           (Linux, SunOS-[4,5], OSF, IRIX, AIX-4, UnixWare, ...)
529AC_SEARCH_LIBS(dlopen, dl, [DL_LIB=$mdw_cv_lib_dlopen; AC_DEFINE(HAVE_DLOPEN)], DL_LIB="NONE")
530
531if test "${DL_LIB}" != "NONE"; then
532  dnl **** Old implementations of dlopen() don't have RTLD_NOW
533  AC_CACHE_CHECK([whether RTLD_NOW is defined in dlfcn.h], ac_cv_rtld_now_in_dlfcn_h,
534    AC_EGREP_CPP(yes,
535        [#include <dlfcn.h>
536         #ifdef RTLD_NOW
537            yes
538         #endif
539        ], ac_cv_rtld_now_in_dlfcn_h="yes"; AC_DEFINE(HAVE_RTLD_NOW),
540           ac_cv_rtld_now_in_dlfcn_h="no")
541  )
542fi
543
544if test "${DL_LIB}" = "NONE"; then
545  AC_MSG_RESULT(--> Support for dll modules will not be compiled)
546  DL_LIB=""
547fi
548
549if test $netcdf = true
550then
551  ACX_CHECK_NETCDF(3.0, AC_DEFINE(HAVE_NETCDF),
552                   AC_MSG_RESULT(--> support for netCDF is disabled))
553fi
554
555if test $fftw = true
556then
557  ACX_CHECK_FFTW(2.1.3, AC_DEFINE(HAVE_FFTW),
558                 AC_MSG_RESULT(--> using legacy unoptimized FFT code))
559fi
560
561dnl **** check for libz - needed for PDF and PNG drivers and XmHTML
562if test $pngdrv = true || test $pdfdrv = true || test $xmhtml = true
563then
564  ACX_CHECK_ZLIB(1.0.3)
565fi
566
567dnl **** check for IJG's libjpeg - also, for PDF driver and XmHTML
568if test $jpegdrv = true || test $pdfdrv = true || test $xmhtml = true
569then
570  ACX_CHECK_JPEG(61, AC_DEFINE(HAVE_LIBJPEG),
571                     AC_MSG_RESULT(--> JPEG backend is disabled))
572fi
573
574dnl **** check for libpng - needed for PDF and PNG drivers and XmHTML
575if test $pngdrv = true || test $pdfdrv = true || test $xmhtml = true
576then
577  ACX_CHECK_PNG(0.9.6, AC_DEFINE(HAVE_LIBPNG),
578                       AC_MSG_RESULT(--> PNG backend is disabled))
579fi
580
581dnl **** check for PDFlib
582if test $pdfdrv = true
583then
584  ACX_CHECK_PDFLIB(5.0.0, AC_DEFINE(HAVE_LIBPDF), pdfdrv=false)
585fi
586if test $pdfdrv != true; then
587  AC_MSG_RESULT(--> PDF driver is disabled)
588fi
589
590dnl **** TODO: undefine unneeded libraries
591
592NOGUI_LIBS="$LIBS"
593
594dnl **** Choose a GUI *****
595
596dnl **** default is gui-less
597GRACE=grace
598
599AC_PATH_XTRA
600if test "$no_x" = yes; then
601  GUI="NONE_GUI"
602else
603dnl **** Check for Motif
604  GUI_LIBS="-lXt -lXext -lX11 $X_PRE_LIBS $X_EXTRA_LIBS"
605
606  ACX_SAVE_STATE
607
608  LIBS="$GUI_LIBS"
609  CFLAGS="$X_CFLAGS $CFLAGS"
610  CPPFLAGS="$X_CFLAGS $CPPFLAGS"
611  LDFLAGS="$X_LIBS $LDFLAGS"
612
613  dnl **** use editres
614  case $editres in
615    true) AC_CHECK_LIB(Xmu,_XEditResCheckMessages,GUI_LIBS="-lXmu $GUI_LIBS"; AC_DEFINE(WITH_EDITRES));;
616    *) ;;
617  esac
618
619  if test "$ac_cv_lib_Xmu__XEditResCheckMessages" != yes; then
620    AC_MSG_RESULT(--> support for EditRes protocol is disabled)
621  fi
622
623  dnl **** some Motif-2.1 variants need the -lXp library
624  AC_CHECK_LIB(Xp,main,GUI_LIBS="-lXp $GUI_LIBS")
625
626  dnl **** and some - Xpm lib
627  AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,GUI_LIBS="-lXpm $GUI_LIBS"; AC_DEFINE(HAVE_XPM))
628
629  if test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = yes; then
630    AC_CHECK_HEADERS(xpm.h X11/xpm.h)
631  fi
632
633  ACX_RESTORE_STATE
634
635  ACX_CHECK_MOTIF(1002)
636  if test "$acx_cv_motif" = "no"; then
637    dnl **** only Motif GUI is supported by now:
638    GUI="NONE_GUI"
639    GUI_FLAGS=""
640    GUI_LIBS=""
641    AC_MSG_ERROR(M*tif has not been found)
642  else
643    GUI_LIBS="$MOTIF_LIB $GUI_LIBS"
644    GUI="MOTIF_GUI"
645    GUI_FLAGS="$X_CFLAGS"
646    GRACE=xmgrace
647
648    dnl **** Special Motif checks
649    xsave_CPPFLAGS="$CPPFLAGS"
650    xsave_LIBS="$LIBS"
651    CPPFLAGS="$CPPFLAGS $GUI_FLAGS"
652    LIBS="$X_LIBS $GUI_LIBS $LIBS"
653
654    dnl **** Check for Xbae widget
655    if test $bundled_xbae = false
656    then
657      AC_CHECK_LIB(Xbae, XbaeCreateMatrix, XBAE_LIB="-lXbae";AC_DEFINE(HAVE_LIBXBAE))
658    fi
659    if test -z "$XBAE_LIB"
660    then
661      dnl **** Use the bundled Xbae library
662      AC_MSG_RESULT(--> Bundled version of Xbae library will be used)
663      XBAE_LIB='$(TOP)/Xbae/Xbae/libXbae.a'
664      XBAE_INC='-I$(TOP)/Xbae'
665      xbae_dir="Xbae/Xbae"
666    else
667      AC_MSG_RESULT(--> Good. Seems you have compatible version of Xbae installed)
668    fi
669
670    dnl **** Check for libhelp
671    case $libhelp in
672      true) AC_CHECK_LIB(hlpclient,get_help,LIBHELP_LIB="-lhlpclient"; AC_DEFINE(WITH_LIBHELP));;
673      *)  ;;
674    esac
675
676    dnl **** Check for XmHTML widget
677    if test $xmhtml = true
678    then
679      ACX_CHECK_XMHTML(1105, AC_DEFINE(WITH_XMHTML), xmhtml=false)
680    fi
681
682    GUI_LIBS="$LIBHELP_LIB $XMHTML_LIB $XBAE_LIB $GUI_LIBS"
683
684    CPPFLAGS="$xsave_CPPFLAGS"
685    LIBS="$xsave_LIBS"
686
687  fi
688fi
689
690dnl **** Final list of subdirs
691SUBDIRS="cephes ${t1lib_dir} ${xbae_dir} src ${grconvert_dir} grace_np fonts templates doc examples auxiliary"
692
693dnl **** Create Make.conf
694AC_OUTPUT(Make.conf:ac-tools/Make.conf.in)
695