File: configure.ac

package info (click to toggle)
gutenprint 5.2.10-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 36,892 kB
  • ctags: 9,634
  • sloc: xml: 104,514; ansic: 98,821; sh: 13,283; perl: 3,816; makefile: 1,448; yacc: 934; lex: 212; sed: 16
file content (1193 lines) | stat: -rw-r--r-- 42,121 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
dnl $Id: configure.ac,v 1.261 2014/05/17 21:48:06 rlk Exp $
dnl Copyright (C) 2001-2004 Roger Leigh
dnl 
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl 
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl 
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

dnl Process this file with autoconf to produce a configure script.

dnl MAKING RELEASES (a step-by-step guide!)
dnl ===============
dnl
dnl Since the last release:
dnl 1. if only source code (not the interface) has changed, set
dnl      GUTENPRINT_MICRO_VERSION += 1;
dnl 2. if any interfaces have been added or changed *compatibly*
dnl      GUTENPRINT_CURRENT_INTERFACE (GCI) += 1;
dnl      GUTENPRINT_BINARY_AGE (GBA) += 1;
dnl 3. if interfaces have been deleted or changed *incompatibly*, set
dnl    	 GCI = GBA + 1;
dnl      GBA = 0;
dnl
dnl (Note that "added", "changed", and "deleted" refer to *external*
dnl interfaces, that is, interfaces that start with stp_ and are in any
dnl of the header files in include/gutenprint.  Internal interfaces
dnl that are prefixed with stpi_ and are only listed in internal headers
dnl in src/main do not need to be considered, since no external program
dnl should rely on them.  "Change" refers to more than just function
dnl signature; things like changes to enumerated types or changes in
dnl behavior with the same function arguments are also considered changes)
dnl
dnl The .soname version is (GCI - GBA).GBA
dnl Example: if GCI is 3 and GBA is 1, the version is 2.1.  To get 2.2,
dnl GCI would be incremented to 4 and GBA to 2.
dnl 
dnl *NOTE*: due to an error preparing 5.2.8, we must skip over major version of
dnl 3 (that is, GCI - GBA) and go directly from 2 to 4.
dnl
dnl For example:
dnl 	 GCI=3, GBA=1 => .soname = libgutenprint.so.2.1
dnl 	 GCI=4, GBA=2 => .soname = libgutenprint.so.2.2 (5.2.9)
dnl 	 GCI=5, GBA=3 => .soname = libgutenprint.so.2.3 (5.2.10)
dnl          (and so on for 5.2 releases, which must remain compatible)
dnl 	 GCI=4, GBA=0 => .soname = libgutenprint.so.4.0
dnl 	 GCI=5, GBA=1 => .soname = libgutenprint.so.4.1
dnl 	 GCI=6, GBA=2 => .soname = libgutenprint.so.4.2
dnl          (for Gutenprint 5.3 or 5.4 or 6.0 or whatever)
dnl 	 GCI=5, GBA=0 => .soname = libgutenprint.so.5.0
dnl 	 GCI=6, GBA=1 => .soname = libgutenprint.so.5.1
dnl 	 GCI=7, GBA=2 => .soname = libgutenprint.so.5.2
dnl          (for the next major/minor release beyond that)
dnl
dnl Typically, programs will require a certain major number to be matched
dnl and a minimum minor number.  Causing the major number to be incremented
dnl will result in programs linked against libgutenprint.so.2 to be treated
dnl as incompatible with libgutenprint.so.3.
dnl
dnl .soname versions can have a third component, which is set from
dnl GUTENPRINT_INTERFACE_AGE.  This resulted in problems on OS X and
dnl we have elected to use only two components in the .soname.
dnl
dnl Similar principles apply to libgutenprintui2, but that interface is
dnl still at 1.0.
dnl
dnl For more detailed information, see the libtool info documentation.
dnl
pushdef([GUTENPRINT_NAME],              [gutenprint])
pushdef([GUTENPRINT_MAJOR_VERSION],     [5])
pushdef([GUTENPRINT_MINOR_VERSION],     [2])
pushdef([GUTENPRINT_MICRO_VERSION],     [10])
pushdef([GUTENPRINT_EXTRA_VERSION],     [])
pushdef([GUTENPRINT_CURRENT_INTERFACE], [5])
pushdef([GUTENPRINT_BINARY_AGE],        [3])
pushdef([GUTENPRINTUI2_CURRENT_INTERFACE], [1])
pushdef([GUTENPRINTUI2_BINARY_AGE],        [0])
pushdef([GUTENPRINT_VERSION], GUTENPRINT_MAJOR_VERSION.GUTENPRINT_MINOR_VERSION.GUTENPRINT_MICRO_VERSION[]GUTENPRINT_EXTRA_VERSION)

AC_INIT(GUTENPRINT_NAME, GUTENPRINT_VERSION, [gimp-print-devel@lists.sourceforge.net])
AC_PREREQ(2.53)
AC_REVISION($Revision: 1.261 $)
AC_CONFIG_SRCDIR(src/main/print-vars.c)
AC_CONFIG_AUX_DIR(scripts)
STP_INIT
AC_COPYRIGHT(
[
Parts of this configure script come from the 'configure.ac' file, and
are not based on freely-redistributable m4 macros; you can redistribute
them and/or modify them under the terms of the GNU General Public
as published by the Free Software Foundation; either version 2, or (at
your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
])

[GUTENPRINT_MAJOR_VERSION]=GUTENPRINT_MAJOR_VERSION
[GUTENPRINT_MINOR_VERSION]=GUTENPRINT_MINOR_VERSION
[GUTENPRINT_MICRO_VERSION]=GUTENPRINT_MICRO_VERSION
[GUTENPRINT_EXTRA_VERSION]=GUTENPRINT_EXTRA_VERSION
[GUTENPRINT_CURRENT_INTERFACE]=GUTENPRINT_CURRENT_INTERFACE
[GUTENPRINT_INTERFACE_AGE]=0
[GUTENPRINT_BINARY_AGE]=GUTENPRINT_BINARY_AGE
[GUTENPRINT_VERSION]=GUTENPRINT_VERSION
[GUTENPRINTUI2_CURRENT_INTERFACE]=GUTENPRINTUI2_CURRENT_INTERFACE
[GUTENPRINTUI2_INTERFACE_AGE]=0
[GUTENPRINTUI2_BINARY_AGE]=GUTENPRINTUI2_BINARY_AGE
popdef([GUTENPRINT_MAJOR_VERSION])
popdef([GUTENPRINT_MINOR_VERSION])
popdef([GUTENPRINT_MICRO_VERSION])
popdef([GUTENPRINT_EXTRA_VERSION])
popdef([GUTENPRINT_CURRENT_INTERFACE])
popdef([GUTENPRINT_BINARY_AGE])
popdef([GUTENPRINTUI2_CURRENT_INTERFACE])
popdef([GUTENPRINTUI2_BINARY_AGE])

AC_SUBST([GUTENPRINT_MAJOR_VERSION])
AC_SUBST([GUTENPRINT_MINOR_VERSION])
AC_SUBST([GUTENPRINT_MICRO_VERSION])
AC_SUBST([GUTENPRINT_CURRENT_INTERFACE])
AC_SUBST([GUTENPRINT_INTERFACE_AGE])
AC_SUBST([GUTENPRINT_BINARY_AGE])
AC_SUBST([GUTENPRINT_VERSION])
AC_SUBST([GUTENPRINTUI2_CURRENT_INTERFACE])
AC_SUBST([GUTENPRINTUI2_INTERFACE_AGE])
AC_SUBST([GUTENPRINTUI2_BINARY_AGE])

dnl Make sure we inherit common compiler options from the environment...
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
LIBS="${LIBS:=}"

dnl Initialize automake stuff.
AM_INIT_AUTOMAKE(1.9 dist-bzip2 no-dist-gzip tar-ustar check-news gnu)
popdef([GUTENPRINT_NAME])
popdef([GUTENPRINT_VERSION])


dnl In the following script, there are a the following variants
dnl of cflags and variables
dnl
dnl *_CFLAGS:   cflags for compiling libraries and example progs
dnl *_LIBS:     libraries for linking programs. ONLY to be used
dnl             to generate ${gutenprint_libs}
dnl *_LIBDEPS:  libraries for linking libraries against
dnl *_libdeps:  library dependencies for pkg-config
dnl *_cflags:   cflags for pkg-config
dnl *_libs:     libs for pkg-config

GUTENPRINT_LIBS="-lgutenprint"
GUTENPRINTUI2_LIBS="-lgutenprintui2"
gutenprint_version=${GUTENPRINT_VERSION}
gutenprintui2_version=${GUTENPRINT_VERSION}

GUTENPRINTUI2_LIBDEPS="${GUTENPRINTUI2_LIBDEPS} \$(GUTENPRINT_LIBS)"

dnl Specify a configuration file.
AM_CONFIG_HEADER([config.h])

dnl Available languages (translations)
ALL_LINGUAS="ca cs da de el en_GB es fi fr gl hu it ja nb nl pl pt ru sk sl sv tr uk vi zh_CN zh_TW"
AC_SUBST(ALL_LINGUAS)

dnl Set up libtool scripts.
dnl Disable static library building to speed up the build
AC_LIBTOOL_DLOPEN
# We need static libraries for CUPS genppd program for now, for bug 865265
# --rlk 20031223
AC_ENABLE_STATIC(yes)
#AC_DISABLE_SHARED
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
dnl define HAVE_GNU_LD if GNU ld is present
if test "$ac_cv_prog_gnu_ld" = "yes" ; then
  AC_DEFINE(HAVE_GNU_LD,, [Define if GNU ld is present.])
fi

dnl Set up maintainer mode
AM_MAINTAINER_MODE
if test x${USE_MAINTAINER_MODE} = xyes ; then
  MAINTAINER_MODE="true"
  BUILD_TEST="yes"
  BUILD_DOC="yes"
  AC_DEFINE(HAVE_MAINTAINER_MODE,, [Define if maintainer-mode is to be used.])
fi

dnl Check canonical system/host (a kludge: replace me with something better).
if test x${host_os} = xlinux-gnu ; then
  OSTYPE="linux"
elif test "`echo ${host_os} | sed 's/^\(linux\).*$/\1/'`" = "linux" ; then
  OSTYPE="linux"
elif test "`echo ${host_os} | sed 's/^\(irix\).*$/\1/'`" = "irix" ; then
  OSTYPE="irix"
else
  OSTYPE="${host_os}"
fi
AC_DEFINE_UNQUOTED(OSTYPE, ["${OSTYPE}"], [The operating system to build for])


dnl Command line options.
AC_PATH_PROG(CUPS_CONFIG, cups-config)
if test -z "${CUPS_CONFIG}" ; then
  BUILD_CUPS="no"
else
  BUILD_CUPS="yes"
fi
STP_ARG_WITH_DETAILED(
  [cups],
  [=PREFIX],
  [whether to build CUPS driver],
  [(default PREFIX=/usr)],
  [BUILD_CUPS],
  [(automatic)],
  [
    yes) [BUILD_CUPS]="yes" ; AC_MSG_RESULT([yes]) ; cups_prefix="/usr" ;;
    no) [BUILD_CUPS]="no" ; AC_MSG_RESULT([no]) ; cups_prefix="/usr" ;;
    *) if test -d ${withval} ; then
         [BUILD_CUPS]="yes"
	 AC_MSG_RESULT([yes (using specified prefix)])
         cups_prefix="${withval}"
       else
         AC_MSG_RESULT([unknown])
         AC_MSG_ERROR([${withval}: no such directory for --with-cups])
       fi ;;
  ],[
     cups_prefix="${prefix}"
  ])

dnl GNU gettext checks.
AM_GNU_GETTEXT_VERSION([0.16])
AM_GNU_GETTEXT([external])

AM_CONDITIONAL(USE_NLS, test x${USE_NLS} = xyes)

STP_ARG_ENABLE([nls-macosx],
               [build CUPS PPD files],
               [USE_NLS_OSX],
               [(automatic)])

USE_LEVEL3_PS=no
BUILD_CUPS_PPDS="${BUILD_CUPS}"
BUILD_TRANSLATED_CUPS_PPDS=no
BUILD_CUPS_1_2="no"
if test -n "${CUPS_CONFIG}" -a "${BUILD_CUPS}" = "yes" ; then
  cups_version=`${CUPS_CONFIG} --version | sed -e '1,$s/svn$/.0/'`
dnl Quote to protect sed regexes
dnl Some relases may be 1.xrc1 or 1.xsvn. Grab only what is needed.
  [cups_major=`echo $cups_version | sed -e 's/\([0-9][0-9]*\).*/\1/'`]
  [cups_minor=`echo $cups_version | sed -e 's/\([0-9][0-9]*\).\([0-9][0-9]*\).*/\2/'`]
  [cups_point=`echo $cups_version | sed -e 's/\([0-9][0-9]*\).\([0-9][0-9]*\).\([0-9][0-9]*\).*/\3/'`]
dnl There was no CUPS 1.0.15 or the like
  if test "$cups_major" -gt 1 -o "$cups_minor" -gt 1 -o "$cups_point" -gt 14 ; then
    USE_LEVEL3_PS=yes
  fi
  if test "$cups_major" -gt 1 -o "$cups_minor" -gt 1 ; then
    BUILD_CUPS_PPDS="no"
    BUILD_CUPS_1_2="yes"
  fi
fi

STP_ARG_ENABLE([cups-ppds],
               [build CUPS PPD files],
               [BUILD_CUPS_PPDS],
               [(automatic)])

STP_ARG_ENABLE([cups-1_2-enhancements],
               [build CUPS 1.2 enhancements],
               [BUILD_CUPS_1_2],
               [(automatic)])

if test "$USE_NLS" != no -a "$BUILD_CUPS_PPDS" = yes ; then
   BUILD_TRANSLATED_CUPS_PPDS="yes"
fi

STP_ARG_ENABLE([translated-cups-ppds],
               [build translated CUPS PPD files],
               [BUILD_TRANSLATED_CUPS_PPDS],
               [(automatic)])

if test "$BUILD_CUPS_1_2" = yes -a "$BUILD_TRANSLATED_CUPS_PPDS" = yes ; then
   BUILD_GLOBALIZED_CUPS_PPDS=yes
else
   BUILD_GLOBALIZED_CUPS_PPDS=no
fi

STP_ARG_ENABLE([globalized-cups-ppds],
               [build globalized CUPS PPD files],
               [BUILD_GLOBALIZED_CUPS_PPDS],
               [(automatic)])

STP_ARG_ENABLE_DETAILED([simplified-cups-ppds],
			[],
			[build simplified CUPS PPD files],
			[(options: yes, no, only)],
			[BUILD_SIMPLIFIED_CUPS_PPDS],
			[no],
			[
    yes) [WHICH_PPDS]="-a"; BUILD_SIMPLIFIED_CUPS_PPDS=yes; AC_MSG_RESULT([yes]) ;;
    no) [WHICH_PPDS]=""; BUILD_SIMPLIFIED_CUPS_PPDS=no; AC_MSG_RESULT([no]) ;;
    only) [WHICH_PPDS]="-s"; BUILD_SIMPLIFIED_CUPS_PPDS=only; AC_MSG_RESULT([only]) ;;
    *) AC_MSG_ERROR([${enableval}: not a valid option ('yes', 'no', or 'only')]) ;;
				   ])

STP_ARG_ENABLE([cups-ppds-at-top-level],
	       [place CUPS PPD files at top level],
	       [CUPS_PPDS_AT_TOP_LEVEL],
	       [no])

STP_ARG_ENABLE([cups-level3-ppds],
               [generate PostScript level 3 PPD files],
               [USE_LEVEL3_PS],
               [(automatic)])

STATIC_GENPPD="$enable_static"
STP_ARG_ENABLE([static-genppd],
               [build a statically-linked cups-genppd and rastertogutenprint.  WARNING: Please read the README and NEWS (release notes) CAREFULLY before using --disable-static-genppd!],
	       [STATIC_GENPPD],
	       [(automatic)])

AC_PATH_PROG(FOOMATIC_CONFIGURE, foomatic-configure)
if test -z "${FOOMATIC_CONFIGURE}" ; then
  BUILD_FOOMATIC="no"
else
  BUILD_FOOMATIC="yes"
fi
STP_ARG_WITH([foomatic],
             [build foomatic data files],
             [BUILD_FOOMATIC],
             [(automatic)])


AC_PATH_PROG(FOOMATIC_PPDFILE, foomatic-ppdfile)
if test -z "${FOOMATIC_PPDFILE}" ; then
  BUILD_FOOMATIC_3="no"
else
  BUILD_FOOMATIC_3="yes"
fi
STP_ARG_WITH([foomatic3],
             [make use of foomatic 3 extra features],
             [BUILD_FOOMATIC_3],
             [(automatic)])

AC_PATH_PROG(IJS_CONFIG, ijs-config)

if test -z "${IJS_CONFIG}"  ; then
  BUILD_GHOSTSCRIPT="no"
else
  BUILD_GHOSTSCRIPT="yes"
fi
STP_ARG_WITH([ghostscript],
             [build Ghostscript driver],
             [BUILD_GHOSTSCRIPT],
             [(automatic)])

STP_ARG_WITH_DETAILED([modules],
                      [],
                      [enable loadable modules],
	              [(options: ltdl, dlopen, static)],
	              [WITH_MODULES],
	              [(automatic)],[
    yes) [WITH_MODULES]="yes";  AC_MSG_RESULT([yes]) ;;
    no) [WITH_MODULES]="no";  AC_MSG_RESULT([no]) ;;
    ltdl) [WITH_MODULES]="ltdl";  AC_MSG_RESULT([ltdl]) ;;
    dlopen) [WITH_MODULES]="dlopen";  AC_MSG_RESULT([dlopen]) ;;
    static) [WITH_MODULES]="static";  AC_MSG_RESULT([static]) ;;
    *) AC_MSG_ERROR([${withval}: not a valid module loader]) ;;
                      ],[
    # if static libraries are enabled, modules must be static
    if test x$enable_static = xyes; then
      [WITH_MODULES]="static"
    else
      [WITH_MODULES]="yes"]
    fi)

# Abort if a broken configuration was required
if test x$enable_static = xyes; then
  if test $WITH_MODULES = no; then
    :
  elif test $WITH_MODULES = static; then
    :
  else
    AC_MSG_ERROR([--disable-static must be used with --with-modules])
  fi
fi 

STP_ARG_ENABLE([debug],
               [turn on debugging in build],
               [ENABLE_DEBUG],
               [no])

STP_ARG_ENABLE([profile],
               [turn on profiling in build],
               [ENABLE_PROFILE],
               [no])

STP_ARG_WITH_DETAILED([readline], ,
                      [use readline],
                      [(default tries -lncurses, -lcurses, -ltermcap)],
                      [USE_READLINE],
                      [yes],[
    yes) [USE_READLINE]="yes" ; AC_MSG_RESULT([yes]) ;;
    no) [USE_READLINE]="no" ; AC_MSG_RESULT([no]) ;;
    only) [USE_READLINE]="yes"
          [EXTRA_LIBREADLINE_DEPS]=" "
          AC_MSG_RESULT([yes (using only readline)]) ;;
    *) [USE_READLINE]="yes"
       [EXTRA_LIBREADLINE_DEPS]="${withval}"
       AC_MSG_RESULT([yes (using extra libraries ${withval})]) ;;
             ])
dnl if test -z "${[EXTRA_LIBREADLINE_DEPS]}" ; then
dnl   [EXTRA_LIBREADLINE_DEPS]=""
dnl fi

# libusb-1.0 (For CUPS backends)
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],
                  [HAVE_LIBUSB=yes
                   BUILD_LIBUSB_BACKENDS=yes],
                  [HAVE_LIBUSB=no
	           BUILD_LIBUSB_BACKENDS=no])

AC_PATH_PROGS([GIMPTOOL2_CHECK], [gimptool-2.0 gimptool])
if test -z "${GIMPTOOL2_CHECK}" ; then
  BUILD_GIMP2="no"
else
  # Check we have version 2.0
  gimptool_check_version=`${GIMPTOOL2_CHECK} --version`
dnl Quote to protect sed regexes
  [gimptool_check_major=`echo "$gimptool_check_version" | sed -e 's/\([0-9][0-9]*\).\([0-9][0-9]*\).\([0-9][0-9]*\).*/\1/'`]
  [gimptool_check_minor=`echo "$gimptool_check_version" | sed -e 's/\([0-9][0-9]*\).\([0-9][0-9]*\).\([0-9][0-9]*\).*/\2/'`]
  if test "$gimptool_check_major" -eq 2; then
    BUILD_GIMP2="yes"
    if test "$gimptool_check_minor" -ge 4 ; then
      BUILD_GIMP2_AS_GUTENPRINT="yes"
    else
      BUILD_GIMP2_AS_GUTENPRINT="no"
    fi
  else
    BUILD_GIMP2="no"
    BUILD_GIMP2_AS_GUTENPRINT="no"
  fi
fi

PKG_CHECK_MODULES([GTK2], [gtk+-2.0],
                  [HAVE_GTK2=yes
                   BUILD_LIBGUTENPRINTUI2=yes
                   GUTENPRINTUI2_LIBDEPS="${GUTENPRINTUI2_LIBDEPS} ${GTK2_LIBS}"],
                  [HAVE_GTK2=no
	           BUILD_LIBGUTENPRINTUI2=no])
# Require both gimptool and pkg-config to succeed
if test x$BUILD_GIMP2 = xyes; then
  PKG_CHECK_MODULES([GIMP2], [gimpui-2.0], [BUILD_GIMP2=yes], [BUILD_GIMP2=no])
fi

STP_ARG_WITH([gimp2],
             [build GIMP 2.x Print plugin],
             [BUILD_GIMP2],
             [(automatic)])

STP_ARG_WITH([gimp2-as-gutenprint],
             [name GIMP 2.x Print plugin gutenprint (requires GIMP 2.2; normally used with GIMP 2.4 or above)],
             [BUILD_GIMP2_AS_GUTENPRINT],
             [(automatic)])

STP_ARG_ENABLE([libgutenprintui2],
               [build Gutenprint GTK+-2.0 user interface library],
               [BUILD_LIBGUTENPRINTUI2],
               [(automatic)])

STP_ARG_ENABLE([samples],
               [install sample images],
               [INSTALL_SAMPLES],
               [yes])

STP_ARG_ENABLE([escputil],
               [build escputil],
               [BUILD_ESCPUTIL],
               [yes])

STP_ARG_ENABLE([test],
               [build test programs],
               [BUILD_TEST],
               [yes])

STP_ARG_WITH([doc],
	     [build Gutenprint documentation],
	     [BUILD_DOC],
	     [yes])

if test "$BUILD_TEST" = "yes" ; then
  BUILD_TESTPATTERN="yes"
else
  BUILD_TESTPATTERN="no"
fi

STP_ARG_ENABLE([testpattern],
               [build testpattern generator],
               [BUILD_TESTPATTERN],
               [(automatic)])

STP_ARG_ENABLE([user-install],
               [install GIMP plugin in home directory],
               [USER_INSTALL],
               [no])
if test x$USER_INSTALL = xyes ; then
  PLUG_IN_PATH="bin"
else
  PLUG_IN_PATH="admin-bin"
fi

dnl aclocal flags.
dnl AM_ACLOCAL_INCLUDE(m4 m4local)

dnl Checks for programs.
AM_ICONV_LINK
AC_ISC_POSIX
AC_PROG_AWK
AC_PROG_CC
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LEX
AC_PROG_YACC
AC_PATH_PROG([TEST], [test])
AC_PATH_PROG([TRUE], [true])
AC_PATH_PROG([FIND], [find])
AC_PATH_PROG([PERL], [perl])
AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
AC_PATH_PROG([CONVERT], [convert])
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${CONVERT} = x ; then
    AC_MSG_WARN([PostScript developer's guide cannot be regenerated!])
  fi
fi
AC_PATH_PROG(TEXI2HTML, texi2html)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${TEXI2HTML} = x ; then
    AC_MSG_WARN([HTML documentation cannot be regenerated!])
  fi
fi
AC_PATH_PROG(DVIPS, dvips)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${DVIPS} = x ; then
    AC_MSG_WARN([PostScript documentation cannot be regenerated!])
  fi
fi
AC_PATH_PROG(DB2PDF, db2pdf)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${DB2PDF} = x ; then
    AC_MSG_WARN([PDF developer's guide cannot be regenerated!])
  fi
fi
AC_PATH_PROGS(DVIPDF, dvipdf dvipdfm)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${DVIPDF} = x ; then
    AC_MSG_WARN([PDF documentation cannot be regenerated!])
  fi
fi
AC_PATH_PROG(DB2PS, db2ps)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${DB2PS} = x ; then
    AC_MSG_WARN([PostScript developer's guide cannot be regenerated!])
  fi
fi
AC_PATH_PROG(DB2HTML, db2html)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${DB2HTML} = x ; then
    AC_MSG_WARN([HTML developer's guide cannot be regenerated!])
  fi
fi
AC_PATH_PROG(DOXYGEN, doxygen)
if test x${USE_MAINTAINER_MODE} = xyes ; then
  if test x${DOXYGEN} = x ; then
    AC_MSG_WARN([HTML developer's guide cannot be regenerated!])
  fi
fi

dnl CUPS checks
STP_CUPS_PROGS

dnl foomatic checks
if test x${BUILD_FOOMATIC} = xyes ; then
  PATH_SBIN=$PATH:/usr/sbin:/usr/local/sbin
  AC_PATH_PROG(FOOMATIC_KITLOAD, foomatic-kitload, , [$PATH_SBIN])
  if test -z "$FOOMATIC_KITLOAD" ; then
    AC_MSG_WARN(Cannot find foomatic-kitload; attempt to install foomatic will fail)
  fi
fi

dnl ijs checks
if test x${BUILD_GHOSTSCRIPT} = xyes ; then
  if test -z "$IJS_CONFIG" ; then
    AC_MSG_ERROR(Cannot find ijs-config; please ensure Ghostscript 6.53 or above is installed);
  fi
  IJS_CFLAGS=`$IJS_CONFIG --cflags`
  IJS_LIBS=`$IJS_CONFIG --libs`
fi

GUTENPRINT_RELEASE_VERSION=${GUTENPRINT_MAJOR_VERSION}.${GUTENPRINT_MINOR_VERSION}
AH_TEMPLATE(GUTENPRINT_RELEASE_VERSION,, [Gutenprint release version])
AC_DEFINE_UNQUOTED(GUTENPRINT_RELEASE_VERSION, "${GUTENPRINT_RELEASE_VERSION}")
GUTENPRINT_BASE_VERSION=${GUTENPRINT_MAJOR_VERSION}.${GUTENPRINT_MINOR_VERSION}.${GUTENPRINT_MICRO_VERSION}
AH_TEMPLATE(GUTENPRINT_BASE_VERSION,, [Gutenprint base version])
AC_DEFINE_UNQUOTED(GUTENPRINT_BASE_VERSION, "${GUTENPRINT_BASE_VERSION}")

dnl Set PACKAGE_LOCALE_DIR in config.h
AH_TEMPLATE(PACKAGE_LOCALE_DIR,, [Package locale directory])
if test "x${prefix}" = "xNONE"; then
  AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, ["${ac_default_prefix}/share/locale"])
else
  AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, ["${prefix}/share/locale"])
fi

dnl Set PACKAGE_DATA_DIR in config.h.
AH_TEMPLATE(PACKAGE_DATA_DIR,, [Package data directory])
if test "x${datadir}" = 'x${prefix}/share'; then
  if test "x${prefix}" = "xNONE"; then
    PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}"
  else
    PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}"
  fi
elif test "x${datadir}" = 'x${datarootdir}'; then
  if test "x${datarootdir}" = 'x${prefix}/share'; then
    if test "x${prefix}" = "xNONE"; then
      PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}"
    else
      PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}"
    fi
  else
    PACKAGE_DATA_DIR="${datarootdir}/${PACKAGE}"
  fi
else
  PACKAGE_DATA_DIR="${datadir}/${PACKAGE}"
fi

AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${PACKAGE_DATA_DIR}")

dnl Set PACKAGE_LIB_DIR in config.h.
AH_TEMPLATE(PACKAGE_LIB_DIR,, [Package lib directory])
if test "x${libdir}" = 'x${exec_prefix}/lib'; then
  if test "x${exec_prefix}" = "xNONE"; then
    if test "x${prefix}" = "xNONE"; then
      PACKAGE_LIB_DIR="${ac_default_prefix}/lib/${PACKAGE}"
    else
      PACKAGE_LIB_DIR="${prefix}/lib/${PACKAGE}"
    fi
  else
    PACKAGE_LIB_DIR="${exec_prefix}/lib/${PACKAGE}"
  fi
else
  PACKAGE_LIB_DIR="${libdir}/${PACKAGE}"
fi

AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, ["${PACKAGE_LIB_DIR}"])

AH_TEMPLATE(PKGXMLDATADIR,, [Package XML data directory])
PKGXMLDATADIR="${PACKAGE_DATA_DIR}/${GUTENPRINT_RELEASE_VERSION}/xml"
AC_DEFINE_UNQUOTED(PKGXMLDATADIR, ["$PKGXMLDATADIR"], )

AH_TEMPLATE(PKGMODULEDIR,, [Package module directory])
PKGMODULEDIR="${PACKAGE_LIB_DIR}/${GUTENPRINT_RELEASE_VERSION}/modules"
AC_DEFINE_UNQUOTED(PKGMODULEDIR, ["$PKGMODULEDIR"])

dnl Compiler flags
if test x$ac_compiler_gnu = "xyes"; then
  STP_ADD_COMPILER_ARGS([-Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wwrite-strings -Werror-implicit-function-declaration -Winline -Wformat=2 -finline-limit=131072],, [GNUCFLAGS])
  if test x${USE_MAINTAINER_MODE} = xyes ; then
    STP_ADD_COMPILER_ARGS([-pedantic -Waggregate-return -Wcast-qual -Wshadow -Wredundant-decls],, [GNUCFLAGS])
  fi
  if test x$ENABLE_DEBUG = xyes ; then
    STP_ADD_COMPILER_ARG([-g])
  else
    STP_ADD_FIRST_COMPILER_ARG([-O6 -O3 -O2 -O1 -O])
  fi
else
  if test x$ENABLE_DEBUG = xyes ; then
    STP_ADD_COMPILER_ARG([-g])
  else
    STP_ADD_FIRST_COMPILER_ARG([-O])
  fi
fi
if test x$ENABLE_PROFILE = xyes ; then
  STP_ADD_COMPILER_ARG([-pg])
fi
AC_SUBST(GNUCFLAGS)

AH_TEMPLATE([HAVE_GCC_ATTRIBUTES],
            [Define to 1 if GCC special attributes are supported])
AC_MSG_CHECKING([if $CC supports __attribute__ syntax])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef struct __attribute__((__packed__)) {
   unsigned char foo;
   char bar;
   long baz;
} test_struct_t;],
                                   [test_struct_t mystruct;])],
                  [AC_MSG_RESULT([yes])]
                   AC_DEFINE([HAVE_GCC_ATTRIBUTES], 1),
                  [AC_MSG_RESULT([no])])

AH_VERBATIM([HAVE_GCC_ATTRIBUTES_BOILERPLATE],
[#if !defined(HAVE_GCC_ATTRIBUTES) && !defined(__attribute__)
/* This should really be a C99 anonymous variadic macro. */
#define __attribute__(attr)
#endif])

dnl Checks for libraries.
dnl When checking readline, check using extra libraries first.
dnl We want to protect against the link somehow succeeding, but only
dnl failing at runtime, as seems to happen on some BSD systems.
AH_TEMPLATE(HAVE_LIBREADLINE, [Is libreadline present?])
if test "$USE_READLINE" = yes ; then
  if test "$EXTRA_LIBREADLINE_DEPS" = "" ; then
    unset ac_cv_lib_readline_readline
    AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
		 HAVE_LIBREADLINE=false, -lncurses)
    if test x${HAVE_LIBREADLINE} = xtrue ; then
      echo "  Using -lreadline -lncurses"
      EXTRA_LIBREADLINE_DEPS=-lncurses
      AC_DEFINE(HAVE_LIBREADLINE, [1])
    else
      unset ac_cv_lib_readline_readline
      AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
		   HAVE_LIBREADLINE=false, -lcurses)
      if test x${HAVE_LIBREADLINE} = xtrue ; then
	echo "  Using -lreadline -lcurses"
	EXTRA_LIBREADLINE_DEPS=-lcurses
	AC_DEFINE(HAVE_LIBREADLINE, [1])
      else
	unset ac_cv_lib_readline_readline
	AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
		     HAVE_LIBREADLINE=false, -ltermcap)
	if test x${HAVE_LIBREADLINE} = xtrue ; then
	  echo "  Using -lreadline -ltermcap"
	  EXTRA_LIBREADLINE_DEPS=-ltermcap
	  AC_DEFINE(HAVE_LIBREADLINE, [1])
	else
	  unset ac_cv_lib_readline_readline
	  AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
		       HAVE_LIBREADLINE=false)
	  if test x${HAVE_LIBREADLINE} = xtrue ; then
	    AC_DEFINE(HAVE_LIBREADLINE, [1])
	  else
	    AC_DEFINE(HAVE_LIBREADLINE, [0])
	  fi
	fi
      fi
    fi
  else
    unset ac_cv_lib_readline_readline
    AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
		 HAVE_LIBREADLINE=false, ${EXTRA_LIBREADLINE_DEPS})
    if test x${HAVE_LIBREADLINE} = xtrue ; then
      echo "  Using -lreadline ${EXTRA_LIBREADLINE_DEPS}"
      AC_DEFINE(HAVE_LIBREADLINE, [1])
    else
      AC_DEFINE(HAVE_LIBREADLINE, [0])
    fi
  fi
else
  HAVE_LIBREADLINE=false
  AC_DEFINE(HAVE_LIBREADLINE, [0])
fi

dnl libltdl, used for dynamic module loading
AC_CHECK_LIB(ltdl, lt_dlopen, [LTDL_LIBS="-lltdl"])

AC_CHECK_LIB(dl, dlopen, [DLOPEN_LIBS="-ldl"])

AC_CHECK_LIB(m,pow,
             GUTENPRINT_LIBDEPS="${GUTENPRINT_LIBDEPS} -lm"
             gutenprint_libdeps="${gutenprint_libdeps} -lm"
             GUTENPRINTUI2_LIBDEPS="${GUTENPRINTUI2_LIBDEPS} -lm"
             gutenprintui2_libdeps="${gutenprintui2_libdeps} -lm"
	     LIBM=-lm
)

STP_CUPS_LIBS

STP_GIMP2_LIBS

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADER(readline/readline.h,
  HAVE_READLINE_READLINE_H=true,
  HAVE_READLINE_READLINE_H=false)
if test x${HAVE_READLINE_READLINE_H} = xtrue ; then
  AC_DEFINE(HAVE_READLINE_READLINE_H,, [Define if libreadline header is present.])
  if test x${HAVE_LIBREADLINE} = xtrue ; then
    LIBREADLINE_DEPS="-lreadline $EXTRA_LIBREADLINE_DEPS"
  fi
fi
AC_CHECK_HEADERS(dlfcn.h, [HAVE_DLFCN_H=true])
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(ltdl.h, [HAVE_LTDL_H=true])
AC_CHECK_HEADERS(stdarg.h stdlib.h string.h)
AC_CHECK_HEADERS(sys/time.h sys/types.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL

dnl Checks for library functions.
AC_CHECK_FUNCS([nanosleep poll usleep])
AC_CHECK_FUNCS([getopt_long])

dnl finite() is non-standard, isfinite() is ISO-standard, figure out
dnl which to use...
AC_SEARCH_LIBS(finite, m, CFLAGS="-Disfinite=finite $CFLAGS")

dnl Define what has to be built
AM_CONDITIONAL(BUILD_FOOMATIC, test x${BUILD_FOOMATIC} = xyes)

AM_CONDITIONAL(BUILD_FOOMATIC_3, test x${BUILD_FOOMATIC_3} = xyes)

AM_CONDITIONAL(BUILD_GHOSTSCRIPT, test x${BUILD_GHOSTSCRIPT} = xyes)

AM_CONDITIONAL(BUILD_CUPS, test x${BUILD_CUPS} = xyes)

AM_CONDITIONAL(BUILD_CUPS_1_2, test x${BUILD_CUPS_1_2} = xyes)

AM_CONDITIONAL(BUILD_CUPS_PPDS, test x${BUILD_CUPS_PPDS} = xyes)

AM_CONDITIONAL(CUPS_PPDS_AT_TOP_LEVEL, test x${CUPS_PPDS_AT_TOP_LEVEL} = xyes)

AM_CONDITIONAL(BUILD_TRANSLATED_CUPS_PPDS, test x${BUILD_TRANSLATED_CUPS_PPDS} = xyes )

AM_CONDITIONAL(BUILD_GLOBALIZED_CUPS_PPDS, test x${BUILD_GLOBALIZED_CUPS_PPDS} = xyes )

AM_CONDITIONAL(BUILD_SIMPLIFIED_CUPS_PPDS, test x${BUILD_SIMPLIFIED_CUPS_PPDS} = xyes)

if test x${USE_LEVEL3_PS} = xno ; then
  CUPS_PPD_PS_LEVEL=2
else
  CUPS_PPD_PS_LEVEL=3
fi

AM_CONDITIONAL(USE_LEVEL3_PS, test x${USE_LEVEL3_PS} = xyes)

AM_CONDITIONAL(BUILD_ESCPUTIL, test x${BUILD_ESCPUTIL} = xyes)

AM_CONDITIONAL(BUILD_TEST, test x${BUILD_TEST} = xyes)

AM_CONDITIONAL(BUILD_TESTPATTERN, test x${BUILD_TESTPATTERN} = xyes)

AM_CONDITIONAL(BUILD_LIBGUTENPRINTUI2, test x${BUILD_LIBGUTENPRINTUI2} = xyes)

AM_CONDITIONAL(BUILD_GIMP2, test x${BUILD_GIMP2} = xyes)

AM_CONDITIONAL(BUILD_DOC, test x${BUILD_DOC} = xyes)

AM_CONDITIONAL(BUILD_GIMP2_AS_GUTENPRINT, test x${BUILD_GIMP2_AS_GUTENPRINT} = xyes)

AM_CONDITIONAL(INSTALL_SAMPLES, test x${INSTALL_SAMPLES} = xyes)

AM_CONDITIONAL(INSTALL_USER_GUIDE, test x${INSTALL_USER_GUIDE} = xyes)

AM_CONDITIONAL(BUILD_LIBUSB_BACKENDS, test x${BUILD_LIBUSB_BACKENDS} = xyes)

STP_CUPS_PATH

# loadable modules
# portable sh has no AND test...
if test -n "$HAVE_LTDL_H"; then
  if test -n "$LTDL_LIBS"; then
    LTDL_POSSIBLE="true"
  fi
fi
if test -n "$HAVE_DLFCN_H"; then
  if test -n "$DLOPEN_LIBS"; then
    DLOPEN_POSSIBLE="true"
  fi
fi
# define what the user chose to build, if possible.
# Prefer dlopen over ltdl.
if test x$WITH_MODULES = xyes; then
  if test x$DLOPEN_POSSIBLE = xtrue; then
    USE_DLOPEN="true"
  elif test x$LDTL_POSSIBLE = xtrue; then
    USE_LTDL="true"
  fi
elif test x$WITH_MODULES = xltdl; then
  if test x$LTDL_POSSIBLE = xtrue; then
    USE_LTDL="true"
  fi
elif test x$WITH_MODULES = xdlopen; then
  if test x$DLOPEN_POSSIBLE = xtrue; then
    USE_DLOPEN="true"
  fi
fi
# define what module system is to be used
AC_MSG_CHECKING([which module system will be used])
if test x$USE_LTDL = xtrue; then
  MODULE="true"
  AC_DEFINE(MODULE, "1", [Build a modular libgutenprint])
  AC_DEFINE(USE_LTDL, "1", [Use GNU libltdl as module loader])
  GUTENPRINT_LIBDEPS="${GUTENPRINT_LIBDEPS} ${LTDL_LIBS}"
  gutenprint_libdeps="${gutenprint_libdeps} ${LTDL_LIBS}"
  AC_MSG_RESULT([ltdl])
elif test x$USE_DLOPEN = xtrue; then
  MODULE="true"
  AC_DEFINE(MODULE, "1", [Build a modular libgutenprint])
  AC_DEFINE(USE_DLOPEN, "1", [Use libdl/dlopen as module loader])
  GUTENPRINT_LIBDEPS="${GUTENPRINT_LIBDEPS} ${DLOPEN_LIBS}"
  gutenprint_libdeps="${gutenprint_libdeps} ${DLOPEN_LIBS}"
  AC_MSG_RESULT([dlopen])
else
  MODULE="false"
  AC_MSG_RESULT([static])
fi
AM_CONDITIONAL(BUILD_MODULES, test x$MODULE = xtrue)

AM_CONDITIONAL(BUILD_GENPPD_STATIC, test x"$STATIC_GENPPD" = xyes)

dnl Define LTLIBOBJS
AC_CONFIG_COMMANDS_PRE(
[LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's/\.o/.lo/g'`
AC_SUBST(LTLIBOBJS)
LTALLOCA=`echo "$ALLOCA" | sed 's/\.o/.lo/g'`
AC_SUBST(LTALLOCA)])

dnl Definitions
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "${cups_conf_datadir}", [CUPS data directory.])

AH_TEMPLATE(CUPS_MODELDIR,, [CUPS PPD file directory])
if test "${CUPS_PPDS_AT_TOP_LEVEL}" = yes ; then
  AC_DEFINE_UNQUOTED(CUPS_MODELDIR, "${cups_conf_datadir}/model/")
else
  AC_DEFINE_UNQUOTED(CUPS_MODELDIR, "${cups_conf_datadir}/model/${PACKAGE}/${GUTENPRINT_RELEASE_VERSION}/")
fi

AC_ARG_WITH(cups_nickname, [  --with-cups-nickname="nickname suffix"
                          Suffix to add to PPD NickName, default=" - CUPS+Gutenprint v"],
  CUPS_PPD_NICKNAME_STRING="$withval",
  CUPS_PPD_NICKNAME_STRING=" - CUPS+Gutenprint v")

AH_TEMPLATE(CUPS_PPD_NICKNAME_STRING,, [CUPS PPD Nickname string])
AC_DEFINE_UNQUOTED(CUPS_PPD_NICKNAME_STRING, "$CUPS_PPD_NICKNAME_STRING")


AC_DEFINE_UNQUOTED(CUPS_PPD_PS_LEVEL, ${CUPS_PPD_PS_LEVEL}, [CUPS PPD PostScript level])
STP_RELEASE_DATE

dnl Some versions of make get very grouchy about $(RM)
RM='rm'

dnl Substitutions
AC_SUBST(prefix)
AC_SUBST(exec_prefix)
AC_SUBST(cups_prefix)
AC_SUBST(cups_exec_prefix)
AC_SUBST(cups_bindir)
AC_SUBST(cups_sbindir)
AC_SUBST(cups_conf_datadir)
AC_SUBST(cups_conf_serverbin)
AC_SUBST(cups_conf_serverroot)
AC_SUBST(CUPS_CFLAGS)
AC_SUBST(CUPS_LIBS)
AC_SUBST(CUPS_PPD_PS_LEVEL)
AC_SUBST(FOOMATIC_KITLOAD)
AC_SUBST(GENPPD_LIBS)
AC_SUBST(IJS_CFLAGS)
AC_SUBST(IJS_LIBS)
AC_SUBST(RM)
AC_SUBST(GIMP2_CFLAGS)
AC_SUBST(GIMP2_LIBS)
AC_SUBST(gimp2_plug_indir)
AC_SUBST(GUTENPRINT_CFLAGS)
AC_SUBST(GUTENPRINT_LIBS)
AC_SUBST(GUTENPRINT_LIBDEPS)
AC_SUBST(GUTENPRINT_VERSION)
AC_SUBST(GUTENPRINTUI2_CFLAGS)
AC_SUBST(GUTENPRINTUI2_LIBS)
AC_SUBST(GUTENPRINTUI2_LIBDEPS)
AC_SUBST(GUTENPRINTUI2_VERSION)
AC_SUBST(gutenprint_cflags)
gutenprint_libs="${GUTENPRINT_LIBS} ${gutenprint_libdeps}"
AC_SUBST(gutenprint_libs)
AC_SUBST(gutenprint_libdeps)
AC_SUBST(gutenprintui2_cflags)
gutenprintui2_libs="${GUTENPRINTUI2_LIBS} ${gutenprintui2_libdeps}"
AC_SUBST(gutenprintui2_libs)
AC_SUBST(gutenprintui2_libdeps)
AC_SUBST(LIBM)
AC_SUBST(LIBREADLINE_DEPS)
AC_SUBST(MAINTAINER_CFLAGS)
AC_SUBST(PLUG_IN_PATH)
AC_SUBST(WHICH_PPDS)
AC_SUBST(BUILD_CUPS_PPDS)
AC_SUBST(GUTENPRINT_BASE_VERSION)
AC_SUBST(GUTENPRINT_RELEASE_VERSION)

dnl Optional architecture options to be applied after all autoconf tests
dnl are done...
AC_ARG_WITH(archflags, [  --with-archflags="..."  additional options for CFLAGS and LDFLAGS],
    CFLAGS="$CFLAGS $withval"
    LDFLAGS="$LDFLAGS $withval")

dnl Output files

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([doc/gutenprint.dox])
AC_CONFIG_FILES([doc/gutenprintui2.dox])
AC_CONFIG_FILES([doc/developer/Makefile])
AC_CONFIG_FILES([include/Makefile])
AC_CONFIG_FILES([include/gutenprint/Makefile])
AC_CONFIG_FILES([include/gutenprintui2/Makefile])
AC_CONFIG_FILES([include/gutenprint/gutenprint-version.h])
AC_CONFIG_FILES([man/Makefile])
AC_CONFIG_FILES([man/cups-calibrate.8])
AC_CONFIG_FILES([man/cups-genppd.8])
AC_CONFIG_FILES([man/cups-genppdupdate.8])
AC_CONFIG_FILES([man/escputil.1])
AC_CONFIG_FILES([man/ijsgutenprint.1])
AC_CONFIG_FILES([po/Makefile.in])
AC_CONFIG_FILES([samples/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/cups/Makefile])
AC_CONFIG_FILES([src/cups/Info.plist])
AC_CONFIG_FILES([src/cups/cups-genppdupdate],
                [chmod +x src/cups/cups-genppdupdate])
AC_CONFIG_FILES([src/escputil/Makefile])
AC_CONFIG_FILES([src/foomatic/Makefile])
AC_CONFIG_FILES([src/foomatic/foomatic-generator],
                [chmod +x src/foomatic/foomatic-generator])
AC_CONFIG_FILES([src/foomatic/mk_printerlist],
                [chmod +x src/foomatic/mk_printerlist])
AC_CONFIG_FILES([src/testpattern/run-testpattern-2],
                [chmod +x src/testpattern/run-testpattern-2])
AC_CONFIG_FILES([src/cups/test-rastertogutenprint],
                [chmod +x src/cups/test-rastertogutenprint])
AC_CONFIG_FILES([src/ghost/Makefile])
AC_CONFIG_FILES([src/testpattern/Makefile])
AC_CONFIG_FILES([src/gimp2/Makefile])
AC_CONFIG_FILES([src/main/Makefile])
AC_CONFIG_FILES([src/main/gutenprint.pc])
AC_CONFIG_FILES([src/xml/Makefile])
AC_CONFIG_FILES([src/xml/escp2/Makefile])
AC_CONFIG_FILES([src/xml/escp2/media/Makefile])
AC_CONFIG_FILES([src/xml/escp2/mediasizes/Makefile])
AC_CONFIG_FILES([src/xml/escp2/model/Makefile])
AC_CONFIG_FILES([src/xml/escp2/inputslots/Makefile])
AC_CONFIG_FILES([src/xml/escp2/inks/Makefile])
AC_CONFIG_FILES([src/xml/escp2/weaves/Makefile])
AC_CONFIG_FILES([src/xml/escp2/qualitypresets/Makefile])
AC_CONFIG_FILES([src/gutenprintui2/Makefile])
AC_CONFIG_FILES([src/gutenprintui2/gutenprintui2.pc])
AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([scripts/Makefile])
AC_CONFIG_COMMANDS([default], [
echo
],
[GUTENPRINT_RELEASE_VERSION=${GUTENPRINT_RELEASE_VERSION}]
[GUTENPRINT_BASE_VERSION=${GUTENPRINT_BASE_VERSION}]
)

AC_OUTPUT

warnings_emitted=0
echo
echo "Configuration Summary:"
echo "------------- --------"
echo
echo "If you have any problems, please report the information below to"
echo "$PACKAGE_BUGREPORT"
echo
echo "================================================================"
echo "  Release: $PACKAGE_STRING generated on $RELEASE_DATE"
echo
echo "  Features:"
if test "$BUILD_CUPS" != "no" ; then
    echo "    Build CUPS:                                 $BUILD_CUPS, installing in $cups_prefix"
    echo "        Build CUPS 1.2 enhancements:            $BUILD_CUPS_1_2"
    echo "        Build CUPS PPD files:                   $BUILD_CUPS_PPDS"
    if test "$BUILD_CUPS_PPDS" != "no" ; then
	echo "            Build translated CUPS PPD files:    $BUILD_TRANSLATED_CUPS_PPDS"
	echo "                Build global CUPS PPD files:    $BUILD_GLOBALIZED_CUPS_PPDS"
	echo "            Build simplified CUPS PPD files:    $BUILD_SIMPLIFIED_CUPS_PPDS"
	echo "            Install CUPS PPDs at top level:     $CUPS_PPDS_AT_TOP_LEVEL"
    fi
    if test "$BUILD_CUPS_PPDS" != "no" -o "$BUILD_CUPS_1_2" != "no" ; then
        echo "        Generate PS level 3 CUPS PPD files:     $USE_LEVEL3_PS"
    fi
    echo "        Build genppd statically:                $STATIC_GENPPD"

    if test "$STATIC_GENPPD" = "no" ; then
        echo "            ***WARNING: Use of --disable-static-genppd or --disable-static"
	echo "                        when building CUPS is very dangerous.  The build may"
	echo "                        fail when building the PPD files, or may *SILENTLY*"
	echo "                        build incorrect PPD files or cause other problems."
	echo "                        Please review the README and release notes carefully!"
	warnings_emitted=1
    fi
    echo "        Build CUPS dyesub USB backend:          $BUILD_LIBUSB_BACKENDS"
else
    echo "    Build CUPS:                                 $BUILD_CUPS"
fi
echo "    Build EPSON inkjet utility:                 $BUILD_ESCPUTIL"
if test "$BUILD_GIMP2" != "no" ; then
    echo "    Build enhanced Print plugin for GIMP:       yes"
    if test "$BUILD_GIMP2_AS_GUTENPRINT" != "no" ; then
	echo "        GIMP plugin will be named:              gutenprint"
    else
	echo "        GIMP plugin will be named:              print"
    fi
    echo "        Install plugin(s) in home directory:    $USER_INSTALL"
else
    echo "    Build enhanced Print plugin for GIMP:       no"
fi
echo "    Build Ghostscript IJS driver:               $BUILD_GHOSTSCRIPT"
echo "    Build Foomatic data:                        $BUILD_FOOMATIC"
if test "$BUILD_FOOMATIC" != "no" ; then
    echo "        Build Foomatic 3.x data:                $BUILD_FOOMATIC_3"
fi
echo "    Build test programs:                        $BUILD_TEST"
echo "    Build testpattern generator:                $BUILD_TESTPATTERN"
echo
echo "  Installation summary:"
echo "    Installation prefix:                        $prefix"
# Configure intentionally does not expand exec_prefix to allow make
# to do so.
echo "    Exec prefix:                                `eval eval echo $exec_prefix` ($exec_prefix)";
echo "    Data directory:                             $PACKAGE_DATA_DIR"
echo "    Library directory:                          `eval eval echo $PACKAGE_LIB_DIR` ($PACKAGE_LIB_DIR)"
echo "    XML data directory:                         $PKGXMLDATADIR"
echo "    Module directory:                           `eval eval echo $PKGMODULEDIR` ($PKGMODULEDIR)"
echo "    Install sample images:                      $INSTALL_SAMPLES"
echo
echo "  General configuration:"
if test x$ac_compiler_gnu = "xyes"; then
    echo "    Compiler options:                           $CFLAGS $GNUCFLAGS"
else
    echo "    Compiler options:                           $CFLAGS"
fi
echo "    Build static libraries:                     $enable_static"
echo "    Build shared libraries:                     $enable_shared"
echo "    Maintainer mode:                            $USE_MAINTAINER_MODE"
echo "    Use i18n:                                   $USE_NLS"
echo "    Generate profiling information:             $ENABLE_PROFILE"
echo "    Generate debugging symbols:                 $ENABLE_DEBUG"
echo "    Use modules:                                $WITH_MODULES"
if test -n "$EXTRA_LIBREADLINE_DEPS" ; then
    echo "    Use readline libraries:                     $USE_READLINE, extra arguments: $EXTRA_LIBREADLINE_DEPS"
else
    echo "    Use readline libraries:                     $USE_READLINE"
fi
echo "    uname -a output:                            `uname -a`"
echo "================================================================"
if test $warnings_emitted -ne 0 ; then
    echo
    echo '*** WARNING: Please review the warnings shown above carefully!'
fi
echo
if test "$BUILD_GIMP2" = "no" -o "$BUILD_CUPS" = "no" ; then
    echo "VERY IMPORTANT:"
    echo "If you expect to build the CUPS driver or the enhanced Print plugin for"
    echo "GIMP, but the output above indicates that that component will not be built,"
    echo "it almost certainly indicates that development packages required to build"
    echo "that component are not installed on your system.  Please read the README"
    echo "file and install the necessary development packages before reporting any"
    echo "error to the development team.  Depending upon your operating system version,"
    echo "you may have to install packages from the installation medium or over"
    echo "the network."
    echo
fi
echo "Finished configuring.  Please review CAREFULLY the configuration summary above."
echo "Type 'make clean' followed by 'make' to build the package"
echo "then 'make install' to install it."