-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1366 lines (1189 loc) · 39.9 KB
/
configure.ac
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
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl Process this file with autoconf to produce a configure script.
AC_INIT([pcb], [1.99z])
AC_CONFIG_SRCDIR([src/draw.c])
AC_PREREQ([2.60])
AM_INIT_AUTOMAKE([1.9])
AC_GNU_SOURCE
AC_CONFIG_HEADERS([config.h])
##########################################################################
#
# Try to figure out if we are building from git sources.
# If we are then unless building of the documentation has
# been disabled then just require the user have all the right
# tools. Users building from a tarball won't need latex, makeinfo,
# etc. but if you're already downloading development sources, then
# it is not unreasonable to require development tools. What motivated
# this is that using maintainer mode proved to cause regular confusion.
pcb_sources="tarball"
AC_MSG_CHECKING([if you are building from a git checkout])
pcb_git_version=no
if test -f $srcdir/.gitignore ; then
pcb_git_version=yes
AC_MSG_RESULT([yes])
pcb_sources="GIT"
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(GIT_VERSION, test x$pcb_git_version = xyes)
AC_MSG_CHECKING([if you are building from a anoncvs checkout])
pcb_cvs_version=no
if test -f $srcdir/CVS/Root ; then
pcb_cvs_version=yes
AC_MSG_RESULT([yes])
pcb_sources="CVS"
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(CVS_VERSION, test x$pcb_cvs_version = xyes)
AM_CONDITIONAL(GIT_OR_CVS_VERSION, test x$pcb_git_version = xyes -o x$pcb_cvs_version = xyes)
##########################################################################
#
# See if we are supposed to build the docs
#
docs_yesno=yes
AC_MSG_CHECKING([if the documentation should be built])
AC_ARG_ENABLE([doc],
[ --enable-doc Build and install the documentation [[default=yes]]],
[
if test "X$enable_doc" = "Xno" ; then
DOC=""
AC_MSG_RESULT([no])
docs_yesno=no
else
DOC=doc
AC_MSG_RESULT([yes])
docs_yesno=yes
fi
],
[
DOC=doc
AC_MSG_RESULT([yes])
docs_yesno=yes
])
AC_SUBST(DOC)
AC_MSG_CHECKING([if maintainer mode is required])
if test "$docs_yesno" = "yes" -a "$pcb_git_version" = "yes" ; then
AC_MSG_RESULT([yes -- the documentation build is enabled and your sources are from git])
enable_maintainer_mode=yes
else
AC_MSG_RESULT([no])
fi
AM_MAINTAINER_MODE
dnl determine host type
AC_CANONICAL_HOST
AC_MSG_CHECKING(for windows)
PCB_PATH_DELIMETER=":"
PCB_DIR_SEPARATOR_S="/"
PCB_DIR_SEPARATOR_C='/'
case $host in
*-*-mingw* )
WIN32=yes
CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS}"
;;
* )
WIN32=no
;;
esac
AC_MSG_RESULT($WIN32)
AC_SUBST(WIN32)
AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
if test "x$WIN32" = "xyes" ; then
PCB_PATH_DELIMETER=";"
PCB_DIR_SEPARATOR_S="\\\\"
PCB_DIR_SEPARATOR_C='\\'
fi
AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
if test "x$WIN32" = "xyes" ; then
AC_CHECK_TOOL(WINDRES, windres, [no])
if test "$WINDRES" = "no" ; then
AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
fi
fi
# i18n
GETTEXT_PACKAGE=$PACKAGE
AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
AC_SUBST(GETTEXT_PACKAGE)
AM_GNU_GETTEXT_VERSION([0.14])
AM_GNU_GETTEXT
IT_PROG_INTLTOOL([0.35.0])
AC_C_INLINE
AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_MKDIR_P
AM_PROG_LEX
AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
if test "$LEX_PATH" = "notfound" ; then
AC_MSG_ERROR([Couldn't find a usable lex program.
Please install flex which is available from
ftp://ftp.gnu.org/pub/non-gnu/flex/
])
fi
AC_PROG_YACC
AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
if test "$YACC_PATH" = "notfound" ; then
AC_MSG_ERROR([Couldn't find a usable yacc program.
Please install bison which is available from
ftp://ftp.gnu.org/pub/gnu/bison/
])
fi
AC_PROG_INSTALL
AC_PROG_RANLIB
#
# Used for building the icons
#
AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
AC_PATH_PROG(CONVERT, convert, notfound)
##########################################################################
#
#
if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
AC_PATH_PROG(MKINFO, makeinfo, no)
if test "X$MKINFO" != "Xno"; then
AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
v=`$MKINFO --version | grep "GNU texinfo"`
if test $? -ne 0; then
AC_MSG_RESULT([non-GNU])
MKINFO="no"
fi
fi
if test "X$MKINFO" != "Xno"; then
vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
AC_MSG_RESULT([$vmajor.$vminor])
if test "$vmajor" -lt 4 \
|| (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
MKINFO=no
fi
fi
if test "X$MKINFO" = "Xno"; then
AC_MSG_ERROR([You have requested a build
of the documentation. For this to work, you must have version 4.6 or newer of
the GNU texinfo package. You seem to have
$v
Please update to a newer version of texinfo or disable building of
the documentation with --disable-doc
])
fi
AC_PATH_PROG(TEXI2DVI, texi2dvi, no)
if test "X$TEXI2DVI" = "Xno"; then
AC_MSG_ERROR([You have requested a build
of the documentation. For this to work, you must have the texi2dvi program
installed. Alternatively, you can disable building the documentation with
--disable-doc.])
fi
AC_PATH_PROG(PERL, perl, notfound)
if test "X$PERL" = "Xnotfound"; then
AC_MSG_ERROR([You have requested a build
of the documentation. For this to work, you must have perl installed.
Alternatively, you can disable building the documentation with
--disable-doc.
])
fi
AC_PATH_PROG([KPSEWHICH], [kpsewhich], [no])
if test "X$KPSEWHICH" = "Xno"; then
AC_MSG_ERROR([You have requested a build
of the documentation. For this to work, you must have a functional install of
TeX and LaTeX. kpsewhich is part of TeX.
Alternatively, you can disable building the documentation with
--disable-doc.])
fi
AC_MSG_CHECKING([If your TeX installation contains epsf.tex])
f=`$KPSEWHICH epsf.tex`
if test $? -eq 0 ; then
AC_MSG_RESULT([yes ($f)])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([You have requested a build
of the documentation. For this to work, you must have a functional install of
TeX and LaTeX that includes epsf.tex. On some linux distributions this is
part of the texlive-generic-recommended package.
Alternatively, you can disable building the documentation with
--disable-doc.])
fi
fi
##########################################################################
#
#
# FIXME: for now, only try to add -rdynamic if we're using gcc. We really
# need to figure out what the correct test is here. In the mean time, this
# should let things build with SunPRO again.
if test "x$GCC" = "xyes"; then
AC_MSG_CHECKING([If the compiler accepts -rdynamic])
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
[AC_MSG_RESULT([yes])],
[LDFLAGS="$old_LDFLAGS"
AC_MSG_RESULT([no])
])
fi
# ------------- HID config -------------------
hid_guis=""
hid_printers=""
hid_exporters=""
hid_always=""
for hid in `cd $srcdir/src/hid; echo *`; do
F=$srcdir/src/hid/$hid/hid.conf
if test -f $F
then
echo checking $F
. $F
case $type in
gui ) hid_guis="$hid_guis $hid" ;;
printer ) hid_printers="$hid_printers $hid" ;;
export ) hid_exporters="$hid_exporters $hid" ;;
always ) hid_always="$hid_always $hid" ;;
esac
fi
done
AC_MSG_CHECKING([for which gui to use])
AC_ARG_WITH([gui],
[ --with-gui= Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
[],
[with_gui=gtk]
)
AC_MSG_RESULT([$with_gui])
case " $hid_guis no none " in
*\ $with_gui\ * ) HIDLIST="$with_gui" ;;
* ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
esac
if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
then
HIDLIST=
fi
AC_MSG_CHECKING([whether to enable toporouter])
AC_ARG_ENABLE([toporouter],
[AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
)
AS_CASE(["x$enable_toporouter"],[xyes | xno],,
[enable_toporouter=yes
]
)
AC_MSG_RESULT([$enable_toporouter])
AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
AC_MSG_CHECKING([whether to enable toporouter output])
AC_ARG_ENABLE([toporouter-output],
[AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
)
AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
[enable_toporouter_output=no]
)
AC_MSG_RESULT([$enable_toporouter_output])
AS_CASE([$enable_toporouter_output],[yes],
[
topo_output_enabled=1
],
[
topo_output_enabled=0
]
)
AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
[Define to 1 to enable toporouter graphical output]
)
PKG_PROG_PKG_CONFIG()
if test "x$enable_toporouter_output" = "xyes"; then
PKG_CHECK_MODULES(CAIRO, cairo,,
[AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
Please review the following errors:
$CAIRO_PKG_ERRORS])]
)
fi
AC_MSG_CHECKING([for whether to use DBUS])
AC_ARG_ENABLE([dbus],
[ --enable-dbus Enable DBUS IPC],
[],[
case " $with_gui " in
*\ gtk\ *) enable_dbus=yes ;;
*\ lesstif\ *) enable_dbus=yes ;;
* ) enable_dbus=no ;;
esac
])
AC_MSG_RESULT([$enable_dbus])
AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
if test "x$enable_dbus" = "xyes"; then
case " $with_gui " in
*\ gtk\ *) ;;
*\ lesstif\ *) ;;
* ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
esac
PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
[saved_LIBS="$LIBS"
LIBS="$LIBS $DBUS_LIBS"
AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
LIBS="$saved_LIBS" ],
[AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
Please review the following errors:
$DBUS_PKG_ERRORS])]
)
DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
AC_DEFINE([HAVE_DBUS], 1,
[Define to 1 if DBUS IPC is to be compiled in])
fi
AC_MSG_CHECKING([for whether to use GL drawing])
AC_ARG_ENABLE([gl],
[ --enable-gl Enable GL drawing (with GTK HID)],
[],[
case " $with_gui " in
*\ gtk\ *) enable_gl=yes;;
* ) enable_gl=no;;
esac
])
AC_MSG_RESULT([$enable_gl])
AM_CONDITIONAL(USE_GL, test x$enable_gl = xyes)
if test "x$enable_gl" = "xyes"; then
case " $with_gui " in
*\ gtk\ *) ;;
* ) AC_MSG_ERROR([GL drawing enabled but only works with the GTK HID.
Either do not use --enable-gl or enable the gtk HID.])
;;
esac
AX_CHECK_GL
AS_IF([test X$no_gl = Xyes],
[AC_MSG_FAILURE([OpenGL is required.])])
AX_CHECK_GLU
AS_IF([test X$no_glu = Xyes],
[AC_MSG_FAILURE([The OpenGL GLU library is required.])])
AC_DEFINE([ENABLE_GL], 1,
[Define to 1 if GL support is to be compiled in])
fi
AC_MSG_CHECKING([for which printer to use])
AC_ARG_WITH([printer],
[ --with-printer= Specify the printer: lpr [[default=lpr]]],
[],[with_printer=lpr])
AC_MSG_RESULT([$with_printer])
case " $hid_printers " in
*\ $with_printer\ * )
HIDLIST="$HIDLIST $with_printer"
;;
* ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
esac
AC_MSG_CHECKING([for which exporters to use])
AC_ARG_WITH([exporters],
[ --with-exporters= Enable export devices: bom gerber gcode nelma png ps [[default=bom gerber gcode nelma png ps]]],
[],[with_exporters=$hid_exporters])
AC_MSG_RESULT([$with_exporters])
for e in `echo $with_exporters | sed 's/,/ /g'`; do
case " $hid_exporters " in
*\ $e\ * )
HIDLIST="$HIDLIST $e"
;;
* ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
esac
done
if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
case " ${HIDLIST} " in
*\ png\ *)
AC_MSG_ERROR([you have requested the png HID but turned off all output
formats! If you do not want gif/jpeg/png output, use --with-exporters to list
which exporters you want and do not list png there.])
;;
*)
;;
esac
fi
for hid in $HIDLIST; do
F=$srcdir/src/hid/$hid/hid.conf
if test -f $F ; then
echo checking $hid dependencies
deps=
. $F
for dep in $deps; do
if test "X`echo $HIDLIST | grep $dep`" = "X"; then
AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
fi
done
fi
done
for e in $HIDLIST; do
HIDLIBS="$HIDLIBS lib$e.a"
done
AC_SUBST(HIDLIST)
AC_SUBST(HIDLIBS)
# ------------- end HID config -------------------
######################################################################
#
# desktop integration
#
AC_PATH_PROG(SETENV, env, [])
AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
# Change default location for XDG files (MIME and Icons)
AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the theme icons
and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
# Change default location for KDE data files (KDE MIME registrations)
AC_ARG_WITH(kdedatadir, [ --with-kdedatadir=path Change where the KDE mime reg
istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
if test x$opt_xdgdatadir = x; then
# path was not specified with --with-xdgdatadir
XDGDATADIR='${datadir}'
else
# path WAS specified with --with-xdgdatadir
XDGDATADIR="$opt_xdgdatadir"
fi
AC_SUBST(XDGDATADIR)
if test x$opt_kdedatadir = x; then
# path was not specified with --with-kdedatadir
KDEDATADIR='${datadir}'
else
# path WAS specified with --with-kdedatadir
KDEDATADIR="$opt_kdedatadir"
fi
AC_SUBST(KDEDATADIR)
AC_ARG_ENABLE(update-desktop-database,
AC_HELP_STRING([--disable-update-desktop-database],
[do not update desktop database after installation]),,
enable_update_desktop_database=yes)
AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
if test x$enable_update_desktop_database = xyes ; then
AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
if test $UPDATE_DESKTOP_DATABASE = no; then
AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
fi
fi
AC_ARG_ENABLE(update-mime-database,
AC_HELP_STRING([--disable-update-mime-database],
[do not update mime database after installation]),,
enable_update_mime_database=yes)
AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
if test x$enable_update_mime_database = xyes ; then
AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
if test $UPDATE_MIME_DATABASE = no; then
AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
fi
fi
#
######################################################################
AC_PATH_PROGS(M4, gm4 m4, [none])
if test "X$M4" = "Xnone" ; then
AC_MSG_ERROR([Did not find a m4 executible. You need to make sure
that m4 is installed on your system and that m4 is in your path])
fi
AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
pcb_m4_r=`echo "eval(-2/2)" | $M4`
if test "$pcb_m4_r" != "-1" ; then
AC_MSG_RESULT([yes])
AC_MSG_ERROR([It appears that $M4 has a bug involving division
with negative numbers. In particular it just returned the result that
-2/2 = $pcb_m4_r instead of -1. This is a known bug in GNU m4-1.4.9. Please
install a non-broken m4.])
else
AC_MSG_RESULT([no])
fi
AC_PATH_PROGS(WISH, wish wish85 wish8.5 wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
if test "X$WISH" = "Xnone" ; then
AC_MSG_ERROR([Did not find the wish executible. You need to make sure
that tcl is installed on your system and that wish is in your path])
fi
AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
GNUM4=$M4
AC_SUBST(GNUM4)
AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
AC_PATH_PROG(PDFLATEX, pdflatex, notfound)
AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
AC_PATH_PROG(TEXI2DVI, texi2dvi, notfound)
AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
AC_PATH_PROG(PS2PDF, ps2pdf, notfound)
AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
# used to build some of the getting started guide
AC_PATH_PROG(GSCHEM, gschem, notfound)
AM_CONDITIONAL(MISSING_GSCHEM, test x$GSCHEM = xnotfound)
if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
if test "$PDFLATEX" = "notfound" -o "$TEXI2DVI" = "notfound" -o "$PS2PDF" = "notfound" ; then
AC_MSG_ERROR([It appears that you are building from a source tree obtained
via git but you do not have the required tools installed to build the documentation. Here
is a list of tools and the detected values:
PDFLATEX: $PDFLATEX
TEXI2DVI: $TEXI2DVI
PS2PDF: $PS2PDF
GSCHEM: $GSCHEM
Either make sure these tools are installed or disable building and installing the documentation
by using the --disable-doc configure option.
])
fi
fi
############################################################################
#
# These checks are for tools used by the testsuite. It will not be fatal
# if these are missing because this is primarily for developer use. It is
# possible that we might add some --enable flag in the future that forces
# full tools for development work.
# Check for ImageMagick tools used by the testsuite
AC_PATH_PROG(IM_ANIMATE, animate, notfound)
AC_PATH_PROG(IM_COMPARE, compare, notfound)
AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
AC_PATH_PROG(IM_CONVERT, convert, notfound)
AC_PATH_PROG(IM_DISPLAY, display, notfound)
AC_PATH_PROG(IM_MONTAGE, montage, notfound)
missing_magick=""
test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
if test "X${missing_magick}" != "X" ; then
AC_MSG_RESULT([no. The testsuite will be disabled because the following
tools from the ImageMagick suite were not found:
${missing_magick}
No loss in pcb functionality should be experienced, you just will not
be able to run the full regression testsuite.
])
have_magick=no
else
AC_MSG_RESULT([yes])
have_magick=yes
fi
have_test_tools=yes
test $have_magick = yes || have_test_tools=no
# the RS274-X export HID is partially checked by looking at the result with
# gerbv
AC_PATH_PROG(GERBV, gerbv, notfound)
test $GERBV != notfound || have_test_tools=no
AM_CONDITIONAL(HAVE_TEST_TOOLS, test x$have_test_tools = xyes)
AC_MSG_CHECKING([if all the requried testsuite tools were found])
if test x$have_test_tools = xyes ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no -- the testsuite will be disabled])
fi
#
############################################################################
dnl Checks for libraries.
AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(xnet, gethostbyname)
AC_CHECK_LIB(fl, yywrap)
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNCS(regcomp re_comp)
AC_CHECK_FUNCS(logf expf rint)
AC_CHECK_FUNCS(vsnprintf)
AC_CHECK_FUNCS(getpwuid getcwd)
AC_CHECK_FUNCS(rand random)
AC_CHECK_FUNCS(stat)
AC_CHECK_FUNCS(mkdtemp)
# normally used for all file i/o
AC_CHECK_FUNCS(popen)
# for lrealpath.c
AC_CHECK_FUNCS(realpath canonicalize_file_name)
libiberty_NEED_DECLARATION(canonicalize_file_name)
# for pcb_spawnvp in action.c on Windows
AC_CHECK_FUNCS(_spawnvp)
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
AC_CHECK_HEADERS(dlfcn.h)
if test "x${WIN32}" = "xyes" ; then
AC_CHECK_HEADERS(windows.h)
fi
# Search for glib
PKG_CHECK_MODULES(GLIB, glib-2.0, ,
[AC_MSG_RESULT([Note: cannot find glib-2.0.
You may want to review the following errors:
$GLIB_PKG_ERRORS])]
)
need_gdlib=no
with_gif=no
with_png=no
with_jpeg=no
for e in $HIDLIST; do
case $e in
lesstif )
AC_PATH_XTRA
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$X_CFLAGS"
AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
AC_CHECK_LIB(ICE, main, , , $X_LIBS)
AC_CHECK_LIB(SM, main, , , $X_LIBS)
AC_CHECK_LIB(Xext, main, , , $X_LIBS)
AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
CPPFLAGS="$save_CPPFLAGS"
case $ac_cv_lib_Xm_XmCreateMainWindow in
no )
AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
;;
* ) ;;
esac
AC_CHECK_HEADERS(Xm/Xm.h)
case $ac_cv_header_Xm_Xm_h in
no )
AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
;;
* ) ;;
esac
;;
gtk )
# Check for pkg-config
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "$PKG_CONFIG" = "no"; then
AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
fi
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, ,
[AC_MSG_ERROR([Cannot find gtk+ >= 2.18.0, install it and rerun ./configure
Please review the following errors:
$GTK_PKG_ERRORS])]
)
GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
if test "x$enable_gl" = "xyes"; then
# Check for GtkGLExt
PKG_CHECK_MODULES(GTKGLEXT, gtkglext-1.0 >= 1.0.0, , [AC_MSG_ERROR([
*** Required version of gtkglext is not installed - please install first ***
Please review the following errors:
$GTKGLEXT_PKG_ERRORS])]
)
GTKGLEXT_VER=`$PKG_CONFIG gtkglext-1.0 --modversion`
fi
;;
png)
need_gdlib=yes
AC_MSG_CHECKING([if GIF output from the png HID is desired])
AC_ARG_ENABLE([gif],
[ --disable-gif Disable support for gif output when the png HID is used [[default=include gif support]]],
[
if test "X$enable_gif" != "Xno" ; then
AC_MSG_RESULT([yes])
with_gif=yes
else
AC_MSG_RESULT([no])
fi
],
[
AC_MSG_RESULT([yes])
with_gif=yes
])
AC_MSG_CHECKING([if JPEG output from the png HID is desired])
AC_ARG_ENABLE([jpeg],
[ --disable-jpeg Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
[
if test "X$enable_jpeg" != "Xno" ; then
AC_MSG_RESULT([yes])
with_jpeg=yes
else
AC_MSG_RESULT([no])
fi
],
[
AC_MSG_RESULT([yes])
with_jpeg=yes
])
AC_MSG_CHECKING([if PNG output from the png HID is desired])
AC_ARG_ENABLE([png],
[ --disable-png Disable support for PNG output when the png HID is used [[default=include PNG support]]],
[
if test "X$enable_png" != "Xno" ; then
AC_MSG_RESULT([yes])
with_png=yes
else
AC_MSG_RESULT([no])
fi
],
[
AC_MSG_RESULT([yes])
with_png=yes
])
;;
gcode|nelma)
need_gdlib=yes
with_png=yes
;;
esac
done
if test "$need_gdlib" = "yes"; then
# Check for gdlib-config for gd (www.boutell.com/gd)
AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
if test "$GDLIB_CONFIG" = "no"; then
AC_MSG_RESULT([Cannot find gdlib-config.
Make sure it is installed and in your PATH.
gdlib-config is part of the GD library available from www.boutell.com/gd.
This is needed for the png HID. I will look for libgd anyway and maybe
you will get lucky.
])
if test "$WIN32" != "yes" ; then
AC_CHECK_LIB(gd,main,,
AC_MSG_ERROR([[You have requested gcode, nelma, or png HIDs but -lgd could not be found]]))
else
AC_CHECK_LIB(bgd,main,,
AC_MSG_ERROR([[You have requested gcode, nelma, or png HIDs but -lbgd could not be found]]))
fi
else
if test "$WIN32" = "yes" ; then
GD=bgd
else
GD=gd
fi
AC_MSG_CHECKING([for libgd cflags])
GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
AC_MSG_RESULT([$GD_CFLAGS])
AC_MSG_CHECKING([for libgd libs])
GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
AC_MSG_RESULT([$GD_LIBS])
fi
# since some linux systems evidently install gdlib-config but fail to
# install the headers (nice), check for the header too and fail if it
# is not there.
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
AC_CHECK_HEADERS(gd.h)
CPPFLASS="$save_CPPFLAGS"
case $ac_cv_header_gd_h in
no )
AC_MSG_ERROR([
You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
This is needed for the nelma and/or png HID.
])
;;
* ) ;;
esac
# Some versions of gd (prior to the expiration of the
# patent related to gif compression) do not support
# gif output. Check for that here.
save_LIBS="$LIBS"
LIBS="$save_LIBS $GD_LIBS $X_LIBS"
if test "X$with_gif" = "Xyes" ; then
AC_CHECK_FUNCS(gdImageGif)
if test "$ac_cv_func_gdImageGif" != "yes"; then
AC_MSG_ERROR([Your gd installation does not appear to include gif support.
You may need to update your installation of gd or disable
gif export with --disable-gif])
fi
fi
if test "X$with_jpeg" = "Xyes" ; then
AC_CHECK_FUNCS(gdImageJpeg)
if test "$ac_cv_func_gdImageJpeg" != "yes"; then
AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
You may need to update your installation of gd or disable
JPEG export with --disable-jpeg])
fi
fi
if test "X$with_png" = "Xyes" ; then
AC_CHECK_FUNCS(gdImagePng)
if test "$ac_cv_func_gdImagePng" != "yes"; then
AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
You may need to update your installation of gd or disable
PNG export with --disable-png])
fi
fi
LIBS="$save_LIBS"
fi
AM_CONDITIONAL(PNG, test x$with_png = xyes)
AM_CONDITIONAL(GIF, test x$with_gif = xyes)
# ------------- check if png previews should be built for pcblib-newlib
AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
AC_ARG_ENABLE(
[m4lib-png],
[ --enable-m4lib-png Enable creating png previews for the m4 library],
[],[enable_m4lib_png=no])
AC_MSG_RESULT([$enable_m4lib_png])
AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
# Run away.... more ugly stuff here. By default we don't actually build
# pcblib-newlib from pcblib unless we are building from cvs or git sources.
# The reason is it takes a while and requires the png HID. The problem is,
# what if someone wants to use --enable-m4lib-png but the tarball was built
# without the previews. Or, what if someone does not want the PNG previews
# but the person building the tarball included them. Ugh! So what the following
# code attempts to do is detect that mismatch situation. Note that we only
# want to kick this code in when *not* building from git or cvs sources.
build_pcblib_newlib=no
if test "$pcb_sources" = "tarball" ; then
AC_MSG_CHECKING([If pcblib-newlib was built with png previews])
stamp=$srcdir/lib/pcblib-newlib.stamp
if test ! -f ${stamp} ; then
AC_MSG_RESULT([unknown, missing ${stamp}])
build_pcblib_newlib=yes
else
if test "`cat ${stamp}`" = "png-preview=yes" ; then
AC_MSG_RESULT([yes])
# lib exists and built with preview.
# if we don't want the preview, than rebuild
if test x$enable_m4lib_png != xyes ; then
build_pcblib_newlib=yes
fi
else
AC_MSG_RESULT([no])
# lib exists and built without preview.
# if we want the preview, than rebuild
if test x$enable_m4lib_png = xyes ; then
build_pcblib_newlib=yes
fi
fi
fi
else
build_pcblib_newlib=yes
fi
AC_MSG_CHECKING([If pcblib-newlib needs to be rebuilt])
AC_MSG_RESULT([$build_pcblib_newlib])
AM_CONDITIONAL(BUILD_PCBLIB_NEWLIB, test x$build_pcblib_newlib = xyes)
if test "X$cross_compiling" = "Xyes" ; then
# we are cross compiling so we will need a build host binary for pcb
AC_PATH_PROG(PCB, [pcb], [notfound])
else
PCB="\${top_builddir}/src/pcb"
fi
AC_SUBST(PCB)
# now make see how essential it was that we have a pcb executable for the build
# host
if test "X$pcb_git_version" = "Xyes" ; then
if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
if test "$PCB" = "notfound" ; then
AC_MSG_ERROR([You have selected a build with m4lib png
previews enabled and/or with building the documentation enabled but you also
appear to be cross-compiling. For this to work, you must have a pcb installed that
can run on this machine (the build machine) because it is needed for generating
library footprint png previews as well as some of the figures in the documentation.
If you wish to skip building the documentation and the footprint previews then add
--disable-doc --disable-m4lib-png
This will allow your cross build to work.])
fi
fi
fi
# ------------- Xrender -------------------
have_xrender=no
AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
AC_ARG_ENABLE([xrender],
[ --disable-xrender Compile and link with Xrender [default=yes]])
case "$have_xrender:$enable_xrender" in
no:* ) ;;
*:no ) ;;
* )
X_LIBS="-lXrender $X_LIBS"
AC_DEFINE([HAVE_XRENDER], 1,
[Define to 1 if Xrender is available])
;;
esac