File: configure.in

package info (click to toggle)
gnuplot 4.0.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,396 kB
  • ctags: 6,623
  • sloc: ansic: 63,562; lisp: 5,011; cpp: 970; sh: 900; makefile: 756; objc: 647; asm: 539; csh: 297; awk: 235; pascal: 192; perl: 44
file content (986 lines) | stat: -rwxr-xr-x 29,925 bytes parent folder | download | duplicates (2)
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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
dnl Process this file with autoconf to produce a configure script.
dnl configure.in for gnuplot on Unix.
dnl
dnl $Id: configure.in,v 1.142 2004/03/31 15:42:51 broeker Exp $
dnl
AC_INIT(src/graphics.c)
AM_CONFIG_HEADER(config.h:config.hin)
AC_PREREQ(2.52)

dnl this is actually major.minor ...
dnl note that for a non-beta release, we need to
dnl remove the letter from VERSION
PKG_MAJOR="`cat $srcdir/VERSION`"
PATCHLEVEL="`cat $srcdir/PATCHLEVEL`"
AM_INIT_AUTOMAKE(gnuplot, $PKG_MAJOR.$PATCHLEVEL)

dnl Additional command line options

dnl configure.in body

dnl Compiler characteristics
dnl Check for ANSI C prototypes, the const and inline keywords,
dnl and ANSI style stringification
AC_PROG_CC
AM_C_PROTOTYPES
AC_PROG_CPP
AC_C_CONST
AC_C_INLINE
AC_C_STRINGIZE

dnl Various programs
dnl X/Emacs for building lisp packages and creating .texi version of docs
AC_CHECK_PROGS(EMACS, emacs xemacs, no)
AC_CHECK_PROGS(PLAINTEX, tex, no)
AC_CHECK_PROGS(LATEX, latex latex2e, no)
AC_CHECK_PROGS(PDFLATEX, pdflatex, no)
AC_CHECK_PROGS(DVIPS, dvips, no)
AC_CHECK_PROGS(TROFF, troff, no)

dnl X Window System files.
AC_SUBST(LIBRARIES_FOR_X)
AC_PATH_XTRA

dnl Needed for LynxOS until AC_PATH_XTRA is fixed
if test "$ac_cv_func_gethostbyname" = no; then
  if test "$ac_cv_lib_nsl_gethostbyname" = no; then
    AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd")
  fi
fi

if test "$no_x" != yes; then
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  LIBRARIES_FOR_X="$X_LIBS -lX11 $X_EXTRA_LIBS"
  GNUPLOT_X11='gnuplot_x11${EXEEXT}'
  AC_DEFINE(X11,1,[ Define if you are using the X11 window system. ])
else
  GNUPLOT_X11=
fi

AC_SUBST(GNUPLOT_X11)

dnl Operating systems.
dnl FIXME AC_DEFINE(ISC22)
dnl FIXME AC_DEFINE(KSR)
dnl Check for MSDOS and djgpp, NeXT, Apple MacOsX (NeXT like), BeOS
GP_MSDOS
GP_NEXT
GP_APPLE
GP_BEOS
AM_CONDITIONAL(BUILD_SRC_BEOS_SUBDIR, test x$build_beos_subdir = xyes)

dnl Apparently, -lNeXT_s is needed on NeXT
dnl _instead_ of -lm ...
AC_CHECK_FUNC(sin,,[AC_CHECK_LIB(m,sin)])

dnl Header files. ANSI first
dnl We prefer that the absense of a macro is the norm, so in syscfg.h
dnl configure's HAVE_XXXX defines are translated into NO_XXXX for ANSI
dnl headers and functions
AC_HEADER_STDC

dnl Header files
dnl ANSI/ISO C, POSIX, others
AC_CHECK_HEADERS(dirent.h errno.h float.h limits.h locale.h math.h stdlib.h \
  string.h time.h sys/time.h sys/types.h \
  sys/bsdtypes.h sys/ioctl.h sys/param.h sys/select.h sys/socket.h \
  sys/stat.h sys/systeminfo.h sys/timeb.h sys/utsname.h \
  libc.h malloc.h poll.h sgtty.h termios.h values.h
)

AC_HEADER_STDBOOL

if test "$ac_cv_header_math_h" = yes ; then
  AC_MSG_CHECKING([for struct exception in math.h])
  AC_TRY_LINK([#include <math.h>],
    [struct exception *x; x->type; x->name;],
    [AC_MSG_RESULT(yes)
     AC_DEFINE(HAVE_STRUCT_EXCEPTION_IN_MATH_H,1,
               [ Define if math.h declares struct exception for matherr(). ])],
    AC_MSG_RESULT(no))
fi

if test "$ac_cv_header_sys_stat_h" = yes; then
  AC_HEADER_STAT
fi

dnl check if unistd actually declares anything. On NeXT 3.2 unistd is
dnl conditionalized for _POSIX_SOURCE
AC_MSG_CHECKING(for unistd.h)
AC_EGREP_HEADER(execv, unistd.h,
  [AC_DEFINE(HAVE_UNISTD_H) AC_MSG_RESULT(yes)],
   AC_MSG_RESULT(no))

dnl check if errno.h header declares errno
AC_MSG_CHECKING(if errno variable is declared)
AC_TRY_COMPILE(
[#include <stdio.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif],
  errno=0,AC_MSG_RESULT(yes),
  [AC_DEFINE(EXTERN_ERRNO,1,[ Define if <errno.h> declares errno. ])
   AC_MSG_RESULT(no)])


dnl Types.
AC_TYPE_SIZE_T
AC_MSG_CHECKING(for time_t in time.h)
AC_EGREP_HEADER(time_t,time.h,
  [AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_TIME_T_IN_TIME_H,1,
             [ Define if time_t is declared in time.h. ])])
AC_TYPE_SIGNAL
 

dnl Functions. Standard first, then others

dnl ANSI/ISO and their predecessors
dnl sunos 4 has on_exit() in place of atexit()
dnl gamma is called lgamma on apollos and linux
dnl we prefer lgamma over gamma, see specfun.c
dnl math lib is already available, see operating systems part
AC_CHECK_FUNCS(atexit memcpy memmove memset \
  on_exit bcopy bzero \
  setvbuf strerror strchr strrchr strstr \
  index rindex \
  erf erfc gamma lgamma \
  getcwd poll pclose popen select sleep snprintf stpcpy \
  strcspn strdup strcasecmp stricmp strncasecmp strnicmp \
  sysinfo tcgetattr vfprintf doprnt usleep
)

dnl HBB 20030624: see if signgam is declared by math.h
AC_CHECK_DECLS([signgam],,,
[#if HAVE_MATH_H
#include <math.h>
#endif
])

dnl check, if we have sigsetjmp and siglongjmp.
dnl a trivial AC_CHECK_FUNCS(sigsetjmp) won't do
dnl because sigsetjmp() might be a macro declared
dnl in <setjmp.h>. (joze)
AC_MSG_CHECKING(for sigsetjmp)
AC_TRY_LINK([#include <setjmp.h>], [jmp_buf env; sigsetjmp(env, 1);],
  [AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_SIGSETJMP,1,
             [ Define if we have sigsetjmp(). ])],
  AC_MSG_RESULT(no))

if test "$ac_cv_func_pclose" = yes -a "$ac_cv_func_popen" = yes ; then
  AC_DEFINE(PIPES,1,[ Define if you do have the popen and pclose functions. ])
fi

dnl Argument types of select()
AC_FUNC_SELECT_ARGTYPES

dnl On SVR3.
dnl FIXME AC_DEFINE(CRIPPLED_SELECT)

dnl Install the lasergnu printer script
LASERGNU=lasergnu-noinstall
AC_ARG_WITH(lasergnu,dnl
[  --with-lasergnu         install lasergnu printer script],
  test "$withval" = yes && LASERGNU=lasergnu-install)

dnl .gih help file location
eval gp_datadir=$datadir
if test "$gp_datadir" = NONE/share; then
  datadir="/usr/local/share"
fi
pkgdatadir="$datadir/$PACKAGE"
AC_ARG_WITH(gihdir,dnl
[  --with-gihdir=DIR       location of .gih file
                          (default PREFIX/share/PACKAGE/VERSION)],
  GIHDIR="$withval",
  GIHDIR="$pkgdatadir/$PKG_MAJOR")

dnl The Linux console driver
AC_ARG_WITH(linux-vga,dnl
[  --with-linux-vga        use the Linux SVGA console driver
                          (requires /usr/lib/libvga)],,
  test -z "$with_linux_vga" && with_linux_vga=no)

dnl check for installed linux vgalib
if test "$with_linux_vga" = yes; then
  AC_MSG_CHECKING(for linux vga library)
  AC_CHECK_LIB(vga, vga_init,
    [AC_DEFINE(LINUXVGA,1,
               [ Define if this is a Linux system with SuperVGA library. ])
     LINUXSUID='chown root $(bindir)/gnuplot; chmod u+s $(bindir)/gnuplot'
     TERMLIBS="-lvga $TERMLIBS"],
    with_linux_vga=no)
fi

dnl TODO: simplify, get rid of GGI_SUPPORT
dnl new ggi driver
GGI_SUPPORT=no
AC_ARG_WITH(ggi,dnl
[  --with-ggi[=DIR]        enable the ggi driver (EXPERIMENTAL)],
  [if test "$withval" != no; then
     if test -d $withval/include; then
       CPPFLAGS="$CPPFLAGS -I$withval/include"
     fi
     if test -d $withval/lib; then
       LDFLAGS="$LDFLAGS -L$withval/lib"
     fi
     AC_CHECK_LIB(ggi,ggiInit,
       [TERMLIBS="-lggi $TERMLIBS"
        AC_DEFINE(USE_GGI_DRIVER,1,
                  [ Define if you want to use the experimental ggi driver. ])
        GGI_SUPPORT=yes
        dnl check if libggiwmh and ggi/wmh.h are found
        AC_CHECK_LIB(ggiwmh,ggiWmhInit,
          [TERMLIBS="-lggiwmh $TERMLIBS"
           AC_CHECK_HEADERS(ggi/wmh.h,,
             AC_MSG_WARN([found ggiwmh library but not ggi/wmh.h
please add path to ggi/wmh.h to CPPFLAGS in Makefile]))
          ])])
   fi])

AC_ARG_WITH(xmi,dnl
[  --with-xmi[=DIR]        ggi's xmi support for pm3d (EXPERIMENTAL)],
  [if test "$withval" != no -a "$GGI_SUPPORT" = yes; then
     if test -d $withval/include; then
       CPPFLAGS="$CPPFLAGS -I$withval/include"
     fi
     if test -d $withval/lib; then
       LDFLAGS="$LDFLAGS -L$withval/lib"
     fi
     AC_CHECK_LIB(xmi,xmiInit,
       [TERMLIBS="-lxmi $TERMLIBS"
        AC_CHECK_HEADERS(ggi/xmi.h)])
   fi])

dnl Use builtin readline or GNU readline
AC_ARG_WITH(readline,dnl
[  --with-readline         use the builtin minimal readline function (default)
  --without-readline      do not use the builtin readline function
  --with-readline=gnu     use the GNU readline library (4.2 or newer required)
  --with-readline=DIR     Specify the location of GNU readline],,
  test -z "$with_readline" && with_readline=yes)

dnl Gnuplot history, needs GNU readline
AC_ARG_ENABLE(history-file,dnl
[  --enable-history-file   use history file (requires GNU readline)],,
  test -z "$enable_history_file" && enable_history_file=no)

dnl GNU readline and the required terminal library
if test "$with_readline" != no; then
  if test "$with_readline" != yes; then
    dnl check for terminal library
    dnl this is a very cool solution from octave's configure.in
    gp_tcap=""
    for termlib in ncurses curses termcap terminfo termlib; do
      AC_CHECK_LIB(${termlib}, tputs, [gp_tcap="$gp_tcap -l$termlib"])
      case "$gp_tcap" in
        *-l${termlib}*)
          break
        ;;
      esac
    done

    if test "$with_readline" = gnu; then
      AC_CHECK_LIB(readline, readline,
        [TERMLIBS="-lreadline $gp_tcap $TERMLIBS"],, [${gp_tcap}])
    else
      if test -d $with_readline/include; then
        CPPFLAGS="$CPPFLAGS -I$with_readline/include"
      fi
      if test -d $with_readline/lib; then
        LDFLAGS="$LDFLAGS -L$with_readline/lib"
      fi

      AC_CHECK_LIB(readline,readline,
        [TERMLIBS="-lreadline $gp_tcap $TERMLIBS"],,[${gp_tcap}])

    fi

    if test "$ac_cv_lib_readline_readline" = no; then
      AC_MSG_WARN([GNU readline not found - falling back to builtin readline])
      with_readline=yes
    else
      AC_DEFINE(HAVE_LIBREADLINE,1,
                [ Define if you are using the GNU readline library. ])
      AC_CHECK_HEADERS(readline/readline.h,,
        AC_MSG_WARN([found GNU readline library but not readline.h
please add path to readline.h to CPPFLAGS in Makefile]))
      AC_CHECK_HEADERS(readline/history.h,,
        AC_MSG_WARN([found GNU readline library but not history.h
please add path to history.h to CPPFLAGS in Makefile]))

      if test "$enable_history_file" = yes; then
        AC_CHECK_HEADERS(readline/tilde.h,
          AC_DEFINE(GNUPLOT_HISTORY,1,
                    [ Define if you want to use a gnuplot history file with GNU readline. ]))
      fi

    fi # ! ac_cv_lib_readline_readline = no

  fi # ! with_readline != yes

  if test "$with_readline" = yes; then
    AC_DEFINE(READLINE,1,
              [ Define if you want to use the included readline function. ])
  fi

fi
dnl end readline

dnl If no DIR argument given, use the Unix plot library
dnl Else use either GNU libplot from plotutils,
dnl or ancient GNU graphics libplot
AC_ARG_WITH(plot,dnl
[  --with-plot[=DIR]       use the Unix plot library],
  [if test "$withval" = yes; then
     dnl Unix plot library
     AC_CHECK_LIB(plot,openpl,
       [AC_DEFINE(UNIXPLOT,1,
                  [ Define if you want to use the standard Unix plot library. ])
        TERMLIBS="-lplot $TERMLIBS"],
       with_plot=no)
   elif test "$withval" != no; then
     dnl GNU plotutils 2.2 or better
     if test -d $withval/include; then
       CPPFLAGS="$CPPFLAGS -I$withval/include"
     fi
     if test -d $withval/lib; then
       LDFLAGS="$LDFLAGS -L$withval/lib"
     fi
     TERMXLIBS="$X_LIBS -lXaw -lXmu -lXt -lXext -lX11"
     AC_CHECK_LIB(plot,pl_textangle,
       [TERMLIBS="-lplot $TERMLIBS"
        AC_DEFINE(GNUGRAPH,1,
                  [ Define if you want to use the GNU version of the Unix plot library. ])],
       [AC_MSG_WARN([GNU plotutils v2.2 or newer required -- disabling gnugraph terminal])
        TERMXLIBS=
        with_plot=no],
       [$TERMXLIBS])
   fi])
dnl end libplot

dnl check presence of z library
dnl TODO: path to zlib includes; -lz -lm specified multiple times
dnl       we don't do anything about missing png/gd includes either
AC_CHECK_LIB(z,deflate,
  [TERMLIBS="$TERMLIBS -lz"
   AC_DEFINE(HAVE_LIBZ,1,[ Define if you have zlib. ])
   AC_CHECK_HEADER(zlib.h,,
     [AC_MSG_WARN([found z library but not zlib.h
please add path to zlib.h to CPPFLAGS in Makefile])])],
  AC_MSG_WARN([zlib is required - see http://www.gzip.org/zlib/]))

dnl check presence of png library
AC_ARG_WITH(png,dnl
[  --with-png[=DIR]        where to find the png library],,
  with_png=yes)

if test "$with_png" != no; then
  AC_PATH_PROG([LIBPNG_CONFIG], [libpng-config])
  if test -n "$LIBPNG_CONFIG"; then
    libpng_CPPFLAGS=`libpng-config --cflags`
    # should be --ldopts, but it's currently broken
    libpng_LDFLAGS=`libpng-config --ldflags | sed 's/ -l[[^ ]][[^ ]]*//g'`
  elif test -d "$with_png"; then
    libpng_CPPFLAGS="-I$with_png/include"
    libpng_LDFLAGS="-L$with_png/lib"
  fi

  _cppflags="$CPPFLAGS"
  _ldflags="$LDFLAGS"
  CPPFLAGS="$CPPFLAGS $libpng_CPPFLAGS"
  LDFLAGS="$LDFLAGS $libpng_LDFLAGS"

  AC_CHECK_LIB(png,png_create_write_struct,
    AC_DEFINE(HAVE_LIBPNG,1,[ Define if you have the png library. ]),,[-lz -lm])

  AC_CHECK_HEADERS(png.h,,
    [AC_CHECK_HEADERS(libpng/png.h,
       [libpng_CPPFLAGS="$libpng_CPPFLAGS/libpng"])])

  if test "$ac_cv_lib_png_png_create_write_struct" = yes ; then
    AC_EGREP_CPP([You lose],[#include "png.h"
#if PNG_LIBPNG_VER < 89
You lose.
#endif
      ],[AC_MSG_WARN([- libpng too old - not including png support])
         with_png=no])
  else
    with_png=no
  fi

  dnl we'll use the png-specific flags later
  CPPFLAGS="$_cppflags"
  LDFLAGS="$_ldflags"

fi
dnl end png

dnl check presence of gd library
dnl we don't check for libfreetype and libjpeg locations - if gd requires
dnl them, the gdlib-config scipt contains all the required information
AC_ARG_WITH(gd,dnl
[  --with-gd[=DIR]         where to find Tom Boutell's gd library],,
  with_gd=yes)

if test "$with_gd" != no; then
  AC_PATH_PROG([GDLIB_CONFIG], [gdlib-config])
  if test -n "$GDLIB_CONFIG"; then
    libgd_CPPFLAGS=`gdlib-config --cflags`
    libgd_LDFLAGS=`gdlib-config --ldflags`
  elif test -d "$with_gd"; then
    libgd_CPPFLAGS="-I$with_gd/include"
    libgd_LDFLAGS="-L$with_gd/lib"
  fi

  _cppflags="$CPPFLAGS"
  _ldflags="$LDFLAGS"
  CPPFLAGS="$CPPFLAGS $libgd_CPPFLAGS"
  LDFLAGS="$LDFLAGS $libgd_LDFLAGS"

  AC_CHECK_LIB(gd,gdImageCreate,
    [dnl found gd library
     AC_DEFINE(HAVE_LIBGD,1,[ Define if you have gd library. ])
     AC_CHECK_HEADERS(gd.h)

     dnl gif support in libgd
     AC_CHECK_LIB(gd,gdImageGif,
       [AC_DEFINE(HAVE_GD_GIF,1,[ Define if libgd supports gif. ])])

     _libs="$LIBS"
     LIBS="$LIBS -ljpeg"
     dnl jpeg support in libgd
     AC_CHECK_LIB(gd,gdImageJpeg,
       [AC_DEFINE(HAVE_GD_JPEG,1,[ Define if libgd supports jpeg. ])
        libgd_LIBS="$libgd_LIBS -ljpeg"])

     LIBS="$_libs $libgd_LIBS -lfreetype"
     dnl freetype support in libgd
     AC_CHECK_LIB(gd,gdImageStringFT,
       [have_ttf=yes],
       [AC_CHECK_LIB(gd,gdImageStringTTF,
         [AC_DEFINE(gdImageStringFT,gdImageStringTTF,
                    [ libgd versions < 1.8.4 need gdImageStringTTF rather than gdImageStringFT ])
          have_ttf=yes])])

     if test "$have_ttf" = yes; then
       AC_DEFINE(HAVE_GD_TTF,1,
                 [ Define if libgd supports TrueType fonts through libfreetype. ])
       libgd_LIBS="$libgd_LIBS -lfreetype"
     fi

     LIBS="$_libs $libgd_LIBS -lpng"
     dnl png support in libgd
     AC_CHECK_LIB(gd,gdImagePng,
       [AC_DEFINE(HAVE_GD_PNG,1,[ Define if libgd supports png. ])
        libgd_LIBS="$libgd_LIBS -lpng"
        have_gd_png=yes])
     LIBS="$_libs"

    ],[dnl gd library not found
       with_gd=no
    ])

  if test -n "$GDLIB_CONFIG"; then
    libgd_LIBS=`gdlib-config --libs`
  fi

  dnl piece it all together
  if test "$with_gd" = no; then
    CPPFLAGS="$_cppflags"
    LDFLAGS="$_ldflags"
  else
    TERMLIBS="$TERMLIBS -lgd $libgd_LIBS"
  fi

fi
dnl end gd

dnl found png, but no png support in gd -> old png driver
if test "$with_png" != no -a "$have_gd_png" != yes; then
  CPPFLAGS="$CPPFLAGS $libpng_CPPFLAGS"
  LDFLAGS="$LDFLAGS $libpng_LDFLAGS"
  TERMLIBS="$TERMLIBS -lpng"
fi

dnl gif terminal support emulated using Tom Boutell's new gd library
AC_ARG_WITH(gif,dnl
[  --with-gif=png          'set term gif' produces png images instead
                          (libgd version >= 1.8) ],
  [if test "$withval" = png -a "$have_gd_png" = yes; then
     AC_DEFINE(PNG_FOR_GIF,1,
               [ Define to have 'set term gif' produce PNG images instead ])
   fi])

dnl The Portable Document Format (PDF) terminal
AC_ARG_WITH(pdf,dnl
[  --with-pdf[=DIR]        enable pdf terminal 
                          (requires PDFLib)],,
  with_pdf=yes)

if test "$with_pdf" != no; then
  AC_PATH_PROG([PDFLIB_CONFIG], [pdflib-config])
  if test -n "$PDFLIB_CONFIG"; then
    libpdf_CPPFLAGS=`pdflib-config --cflags`
    # D'oh - libraries don't belong here
    libpdf_LDFLAGS=`pdflib-config --ldflags |sed 's/ -l[[^ ]][[^ ]]*//g'`
  elif test -d "$with_pdf"; then
    libpdf_CPPFLAGS="-I$with_pdf/include"
    libpdf_LDFLAGS="-L$with_pdf/lib"
  fi

  _cppflags="$CPPFLAGS"
  _ldflags="$LDFLAGS"
  _libs="$LIBS"
  CPPFLAGS="$CPPFLAGS $libpdf_CPPFLAGS"
  LDFLAGS="$LDFLAGS $libpdf_LDFLAGS"

  AC_CHECK_LIB(pdf,PDF_get_majorversion,
    [AC_DEFINE(HAVE_LIBPDF,1,[ Define if you have the pdf library. ])
     AC_CHECK_HEADERS(pdflib.h,,
       AC_MSG_WARN([please add path to pdflib.h to CPPFLAGS in Makefile]))
    ],
    with_pdf=no)

  if test "$with_pdf" != no; then
    AC_CHECK_LIB(pdf,PDF_begin_pattern, ,
      [AC_DEFINE(HAVE_OLD_LIBPDF,1,[ Define if your pdf library is too old to support patterns. ])
      AC_MSG_WARN([your version of libpdf is too old!])
      ])
  fi

  LIBS="$_libs"
  if test "$with_pdf" = no; then
    CPPFLAGS="$_cppflags"
    LDFLAGS="$_ldflags"
  else
    TERMLIBS="$TERMLIBS -lpdf"
  fi

fi
dnl end pdf

dnl How do we detect the Ultrix X libraries?
dnl Or is it really a server (run-time) problem?
dnl FIXME AC_DEFINE(ULTRIX_KLUDGE)

dnl Removed enable options for these
dnl Just autodetect

dnl SCO cgi
AC_EGREP_CPP(yes,
[#ifdef SCO
yes
#endif
],AC_CHECK_LIB(ccgi, v_opnwk,
    [AC_DEFINE(CGI,1,[ Define if you want to use the CGI terminal under SCO. ])
     TERMLIBS="-lccgi $TERMLIBS"]))

dnl Sun sunview
AC_EGREP_CPP(yes,
[#ifdef sun
yes
#endif
],[AC_CHECK_LIB(suntool, window_create,
     [AC_CHECK_HEADER(suntool/sunview.h,
        [AC_DEFINE(SUN,1,
                   [ Define if you want to use the sunview terminal (sun). ])
         TERMLIBS="-lsuntool -lsunwindow -lpixrect $TERMLIBS"])],,
    [-lsunwindow -lpixrect])])

dnl Process rest of with and enable options

dnl Use .gnuplot file in current directory
AC_ARG_WITH(cwdrc,dnl
[  --with-cwdrc            check current directory for .gnuplot file,
                          normally disabled for security reasons],,
  [if test "$withval" = yes; then
     AC_DEFINE(NOCWDRC,1,
               [ Define if you do not want to read .gnuplot in the current directory. ])
   fi])

dnl Wether we want to build the lisp files
dnl Does nothing here, is passed on to the lisp subdir
AC_ARG_WITH(lisp-files,dnl
[  --without-lisp-files    do not build emacs lisp files])

dnl Sort help/subtopic tables by row or column
AC_ARG_WITH(row-help,dnl
[  --with-row-help         format help and subtopic tables by row (default)
  --without-row-help      format help and subtopic tables by column],
  [if test "$with_row_help" = no; then
     AC_DEFINE(COLUMN_HELP,1,
               [ Define if you want online help and subtopic tables sorted by column. ])
   fi])

dnl Wether we want to create the LaTeX tutorial
TUTORIAL=tutorial
AC_ARG_WITH(tutorial,dnl
[  --without-tutorial      do not build LaTeX tutorial])
dnl only if latex/2e is found
if test "$LATEX" = no -o "$with_tutorial" = no ; then
  TUTORIAL=notutorial
  with_tutorial=no
fi

dnl use mouse for x11 interface
AC_ARG_ENABLE(mouse,dnl
[  --disable-mouse         disable mouse for the x11 terminal],,
  test -z "$enable_mouse" && enable_mouse=yes)

if test "$enable_mouse" = yes; then
  AC_DEFINE(USE_MOUSE,1,
            [ Define if you want to have mouse support for the x11 terminal. ])
  AC_DEFINE(PIPE_IPC,1,
            [ Unix-type of Interprocess Communication is required for mouse support. ])
fi

dnl pm3d
AC_ARG_ENABLE(pm3d,dnl
[  --disable-pm3d          disable pm3d],,
  test -z "$enable_pm3d" && enable_pm3d=yes)

if test "$enable_pm3d" = yes; then
  AC_DEFINE(PM3D,1,[ Define if you want to have Petr Mikulik's fancy pm3d. ])
fi

dnl check for installed linux vgagl lib if
dnl both pm3d and linux_vga are defined.
if test "$with_linux_vga" = yes -a "$enable_pm3d" = yes; then
  _LIBS="$LIBS"
  dnl make sure LIBS contains -lvga
  LIBS="$TERMLIBS $LIBS"
  AC_MSG_CHECKING(for the vgagl library)
  AC_CHECK_LIB(vgagl, gl_hline,
    [LIBS="-lvgagl $LIBS"
     AC_CHECK_HEADERS(vgagl.h,
      [AC_DEFINE(VGAGL,1,[ Define if the vgagl libray is present. ])
       dnl yup, we've the libvgagl.
       dnl check now, if lib3dkit is found.
       AC_CHECK_LIB(3dkit, gl_striangle,
         [AC_CHECK_HEADERS(3dkit.h,
            [dnl success! If we're here, all checks for
             dnl the vgagl terminal driver succeeded.
             AC_DEFINE(THREEDKIT,1,[ Define if the 3dkit libray is present. ])
             AC_DEFINE(EXTENDED_COLOR_SPECS,1,
                       [ Define if color information should be passed for each vertex. ])
             VGAGLLIB="-l3dkit -lvgagl"
             with_vgagl=yes
            ],dnl <-- 3dkit.h found
            [with_vgagl=no
             AC_MSG_RESULT([unable to find 3dkit.h])
            ]dnl <-- 3dkit.h not found
          )
         ],dnl <-- 3dkit is present
         [
          with_vgagl=no
          AC_MSG_RESULT([unable to find lib3dkit])
         ]dnl <-- 3dkit is not present
       )
      ],dnl <-- vgagl.h is present
      [
       with_vgagl=no
       AC_MSG_RESULT([unable to find vgagl.h])
      ]dnl <-- vgagl.h is not present
     )
    ],dnl <-- libvgagl was found
    [with_vgagl=no
     AC_MSG_RESULT([unable to find libvgagl])
    ]dnl <-- libvgagl was not found
  )
  dnl restore LIBS
  LIBS="$_LIBS"
else
  with_vgagl=no
fi

TERMLIBS="$VGAGLLIB $TERMLIBS"

dnl filledboxes
AC_ARG_ENABLE(filledboxes,dnl
[  --disable-filledboxes   disable filledboxes style],,
  test -z "$enable_filledboxes" && enable_filledboxes=yes)

if test "$enable_filledboxes" = yes; then
  AC_DEFINE(USE_ULIG_FILLEDBOXES,1,
            [ Define if you want to have Uli Gruenebaum's filledboxes style. ])
fi

dnl relative boxwidth
AC_ARG_ENABLE(relative-boxwidth,dnl
[  --disable-relative-boxwidth   disable relative_boxwidths],,
  test -z "$enable_relative_boxwidth" && enable_relative_boxwidth=yes)

if test "$enable_relative_boxwidth" = yes; then
  AC_DEFINE(USE_ULIG_RELATIVE_BOXWIDTH,1,
            [ Define if you want to have Uli Gruenebaum's relative boxwidth. ])
fi

dnl isvar function patch
AC_ARG_ENABLE(isvar,dnl
[  --disable-defined-var         disable defined(var) function ],,
  test -z "$enable_defined_var" && enable_defined_var=yes)

if test "$enable_defined_var" = yes; then
     AC_DEFINE(GP_ISVAR, 1,
               [ Define to enable defined(variable) test. ])
fi

dnl thin plate splines patch
AC_ARG_ENABLE(thin-splines,dnl
[  --enable-thin-splines   enable thin plate splines],
  [if test "$enableval" = yes; then
     AC_DEFINE(THIN_PLATE_SPLINES_GRID,1,
               [ Define to use thin plate spines. ])
   fi])

dnl IRIS terminal on IRIS4D series computer
AC_ARG_ENABLE(iris,dnl
[  --enable-iris           enable IRIS terminal (IRIS4D only)],
  [if test "$enableval" = yes; then
     AC_CHECK_LIB(gl_s,winopen,
       [AC_DEFINE(IRIS,1,
                  [ Define if you want to use the IRIS terminal on IRIS4D series computers. ])
        TERMLIBS="-lgl_s $TERMLIBS"],
       enable_iris=no)
   fi])

dnl MGR Window system
AC_ARG_ENABLE(mgr,dnl
[  --enable-mgr            enable MGR terminal],
  [if test "$enableval" = yes; then
     AC_CHECK_LIB(mgr,m_getinfo,
       [AC_DEFINE(MGR,1,[ Define if you want to use the MGR Window system. ])
        TERMLIBS="-lmgr -lpixrect $TERMLIBS"],
       enable_mgr=no,
       [-lpixrect])
   fi])

dnl fitting error variables
AC_ARG_ENABLE(fiterrvars,dnl
[  --disable-fiterrvars    enable fitting error variables],,
  [test -z "${enable_fiterrvars}" && enable_fiterrvars=yes])
if test "$enable_fiterrvars" = yes; then
  AC_DEFINE(GP_FIT_ERRVARS, 1,
            [ Define to allow 'fit' to create parameter error variables. ])
fi

dnl Redwood Graphics Interface Protocol
AC_ARG_ENABLE(rgip,dnl
[  --enable-rgip           enable Redwood Graphics Interface Protocol],
  [if test "$enableval" = yes; then
     AC_DEFINE(RGIP,1,
               [ Define if you want to use the Redwood Graphics Interface Protocol. ])
   fi])

dnl hidden3d compile-time options...
dnl NOTE: have to check that they're not both turned on --- the code
dnl doesn't allow that choice.
AC_ARG_ENABLE(h3d-quadtree,dnl
[  --enable-h3d-quadtree   enable quadtree optimization in hidden3d code],
  [if test "$enableval" = yes; then
     AC_DEFINE(HIDDEN3D_QUADTREE,1,
	       [ Define to enable quadtree optimization in hidden3d code.])
   fi])
AC_ARG_ENABLE(h3d-gridbox,dnl
[  --enable-h3d-gridbox    enable gridbox optimization in hidden3d code],
  [if test "$enable_h3d_quadtree" = yes; then
     AC_MSG_ERROR(dnl
[Only one of the hidden3d options quadtree and gridbox may be enabled.])
   fi
   if test "$enableval" = yes; then
     AC_DEFINE(HIDDEN3D_GRIDBOX,1,
               [ Define to enable gridbox optimization in hidden3d code.])
   fi])

dnl
if test ! -f src/graphics.c ; then
  AC_MSG_RESULT([Compiling outside source directory - copying needed files])
  mkdir tutorial >/dev/null 2>&1
  cp ${srcdir}/tutorial/eg3.dat tutorial
fi

dnl build lisp files
AC_CONFIG_SUBDIRS(lisp)

dnl Substitute variables
AC_SUBST(PACKAGE)
AC_SUBST(PKG_MAJOR)
AC_SUBST(VERSION)
AC_SUBST(GIHDIR)
AC_SUBST(LASERGNU)
AC_SUBST(LINUXSUID)
AC_SUBST(TERMLIBS)
AC_SUBST(TERMXLIBS)
AC_SUBST(TUTORIAL)

dnl Write Makefiles and configuration header
AC_OUTPUT([Makefile
           config/Makefile
           demo/Makefile
           docs/Makefile
           m4/Makefile
           man/Makefile
           src/Makefile
           term/Makefile
           tutorial/Makefile],
          [test -z "$CONFIG_HEADERS" || echo timestamp >stamp-h])

dnl Report configuration
AC_MSG_RESULT([
** Configuration summary for $PACKAGE $VERSION:

  Where is the help file?           $GIHDIR/gnuplot.gih
])

if test "$with_lasergnu" = yes; then
  AC_MSG_RESULT([  Install lasergnu printer script])
fi

if test "$with_linux_vga" = yes; then
  AC_MSG_RESULT([  Use the Linux SVGA console driver
    SECURITY NOTICE: SVGAlib requires that gnuplot is installed suid root!])

  if test "$with_vgagl" = yes; then
    AC_MSG_RESULT([  Enable vgagl terminal with mouse and pm3d support])
  fi
fi

if test "$GGI_SUPPORT" = yes; then
  AC_MSG_RESULT([  Enable ggi terminal (EXPERIMENTAL)])
fi

if test "$ac_cv_header_ggi_xmi_h" = yes; then
  AC_MSG_RESULT([  Enable ggi's xmi support for pm3d (EXPERIMENTAL)])
fi

if test "$with_readline" != no; then
  if test "$with_readline" != yes; then
    AC_MSG_RESULT([  Use GNU readline library])

    if test -n "$gp_tcap"; then
      AC_MSG_RESULT([    with $gp_tcap])
    fi
    if test "$enable_history_file" = yes; then
        AC_MSG_RESULT([    enable history file])
    fi

    AC_MSG_WARN([Please see INSTALL for a required readline bugfix.])

  else
    AC_MSG_RESULT([  Use builtin minimal readline])
  fi
fi

if test x"$with_plot" != x; then
  if test "$with_plot" = yes; then
    AC_MSG_RESULT([  Use the Unix plot library])
  elif test "$with_plot" != no; then
    AC_MSG_RESULT([  Use the GNU plot library])
  fi
fi

if test "$ac_cv_lib_gd_gdImageJpeg" = yes; then
  AC_MSG_RESULT([  Enable generation of JPEG files])
fi

if test "$ac_cv_lib_gd_gdImageGif" = yes; then
  AC_MSG_RESULT([  Enable generation of GIF files])
fi

if test "$with_png" != no; then
  AC_MSG_RESULT([  Enable generation of PNG files])
fi

if test "$have_gd_png" = yes; then
  AC_MSG_RESULT([    using gd driver])
else
  AC_MSG_RESULT([    using old driver])
fi

if test "$have_ttf" = yes; then
  AC_MSG_RESULT([  Enable TTF fonts with gd driver])
fi

if test "$with_gif" = png; then
  AC_MSG_RESULT([  Set term gif will produce PNG images instead ])
fi

if test "$ac_cv_header_pdflib_h" = yes; then
  AC_MSG_RESULT([  Enable generation of PDF files])
  if test "$ac_cv_lib_pdf_PDF_begin_pattern" != yes; then
    AC_MSG_RESULT([    but no support for pattern-fill])
  fi
fi

if test "$with_cwdrc" = yes; then
  AC_MSG_RESULT([  Check current directory for .gnuplot file])
fi

if test "$with_lisp_files" != no; then
  AC_MSG_RESULT([  Build gnuplot-mode for X/Emacs])
fi

if test "$with_row_help" = no; then
  AC_MSG_RESULT([  Sort help/subtopic tables by column])
fi

if test "$TUTORIAL" = tutorial; then
  AC_MSG_RESULT([  Build LaTeX tutorial])
fi

if test "$no_x" != yes; then
  AC_MSG_RESULT([  Use the X Window System ])
  if test "$enable_mouse" = yes; then
    AC_MSG_RESULT([  Enable mouse for X11])
  fi
fi

if test "$enable_pm3d" = yes; then
  AC_MSG_RESULT([  Enable pm3d])
fi

if test "$enable_filledboxes" = yes; then
  AC_MSG_RESULT([  Enable filledboxes])
fi

if test "$enable_relative_boxwidth" = yes; then
  AC_MSG_RESULT([  Enable relative boxwidths])
fi

if test "$enable_defined_var" = yes; then
  AC_MSG_RESULT([  Enable defined(variable) test])
fi

if test "$enable_thin_splines" = yes; then
  AC_MSG_RESULT([  Enable thin plate splines])
fi

if test "$enable_iris" = yes; then
  AC_MSG_RESULT([  Enable IRIS terminal])
fi

if test "$enable_mgr" = yes; then
  AC_MSG_RESULT([  Enable MGR terminal])
fi

if test "$enable_fiterrvars" = yes; then
  AC_MSG_RESULT([  Enable fitting error variables])
fi

if test "$enable_rgip" = yes ; then
  AC_MSG_RESULT([  Enable RGIP terminal])
fi

if test "$enable_h3d_quadtree" = yes; then
  AC_MSG_RESULT([  Enable hidden3d quadtree optimization])
fi

if test "$enable_h3d_gridbox" = yes; then
  AC_MSG_RESULT([  Enable hidden3d gridbox optimization])
fi

dnl end config report

dnl end configure.in