Ready for testing
[enscript.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([GNU Enscript],[1.6.6],[bug-enscript@gnu.org])
3 AC_PREREQ([2.61])
4 AC_CONFIG_SRCDIR([src/gsint.h])
5 AC_CONFIG_HEADERS([config.h])
6
7 AM_INIT_AUTOMAKE
8
9 AC_PROG_INSTALL
10
11 AC_PROG_CC
12
13 AC_USE_SYSTEM_EXTENSIONS
14
15 AC_C_CONST
16 AC_FUNC_ALLOCA
17 dnl its save to say that in 2023 all compilers support prototypes
18 AC_DEFINE([PROTOTYPES], [1], [Define to 1 if your compiler supports function prototypes.])
19
20 AC_HEADER_STDC
21 AC_CHECK_HEADERS([string.h stdlib.h unistd.h stdarg.h math.h pwd.h])
22 AC_CHECK_HEADERS([sys/types.h sys/stat.h])
23
24 dnl Check some functions.
25 AC_CHECK_FUNCS(strchr getcwd)
26 AC_REPLACE_FUNCS(strerror memmove memcpy strtoul)
27 AC_FUNC_VPRINTF
28
29 dnl -lsun is needed on IRIX-4.0 to get the user passwd entry through
30 dnl the yellow pages / NIS.
31 AC_CHECK_LIB(sun, main)
32
33 dnl Find out where the gethostname() is.
34 AC_CHECK_FUNC(gethostname, , [
35   AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl", [
36     AC_CHECK_LIB(socket, gethostname)
37   ])
38 ])
39
40 AC_PROG_RANLIB
41 AC_PROG_YACC
42 AM_PROG_LEX
43
44 AC_ARG_ENABLE(debug,
45 [  --enable-debug         enable debugging], [
46   echo enabling debugging
47   if test -n "$GCC"; then
48     CFLAGS="$CFLAGS -Wall"
49   fi
50 ])
51
52 dnl Define the default output media.
53
54 AC_ARG_WITH(media,
55 [  --with-media(=MEDIA)   use output media Letter (MEDIA), default is A4],
56   if test "X$withval" != "Xno"; then
57     if test "X$withval" = "Xyes"; then
58       ac_cv_value_media='Letter'
59     else
60       ac_cv_value_media=$withval
61     fi
62   else
63     ac_cv_value_media=${MEDIA-A4}
64   fi,
65   ac_cv_value_media=${MEDIA-A4}
66 )
67 MEDIA=$ac_cv_value_media
68 AC_SUBST(MEDIA)
69
70 dnl Define the default input encoding.
71 AC_ARG_WITH(encoding,
72 [  --with-encoding(=ENCODING) use input encoding (ENCODING), default is latin1],
73   if test "X$withval" != "Xno"; then
74     if test "X$withval" = "Xyes"; then
75       ac_cv_value_encoding='latin1'
76     else
77       ac_cv_value_encoding=$withval
78     fi
79   else
80     ac_cv_value_encoding=${ENCODING-latin1}
81   fi,
82   ac_cv_value_encoding=${ENCODING-latin1}
83 )
84 ENCODING=$ac_cv_value_encoding
85 AC_SUBST(ENCODING)
86
87 dnl Find the printer spooler command.
88
89 AC_CHECK_PROG(SPOOLER, lpr, lpr)
90 AC_CHECK_PROG(SPOOLER, lp, lp)
91
92 dnl user can overwrite this
93 AC_ARG_WITH(spooler,
94 [  --with-spooler=SPOOLER  set the printer spooler command],
95   if test "X$withval" != "Xno"; then
96     SPOOLER=$withval
97   fi
98 )
99
100 dnl If SPOOLER is still empty, set it to `lpr'.  After this, we should
101 dnl be able to compile enscript on HURD.
102 if test "X$SPOOLER" = "X"; then
103   SPOOLER=lpr
104 fi
105
106 dnl The PostScript language level.
107 PSLEVEL="2"
108 AC_ARG_WITH(ps-level,
109 [  --with-ps-level=LEVEL   set the PostScript language level to LEVEL],
110   if test "X$withval" != "Xno"; then
111     PSLEVEL=$withval
112   fi
113 )
114 AC_SUBST(PSLEVEL)
115
116 dnl Internationalization.
117 AM_GNU_GETTEXT([external])
118 AM_GNU_GETTEXT_VERSION([0.21.1])
119
120 dnl Path separator character.
121 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], [':'],
122   [Character used to separate path components.])
123 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], [":"],
124   [Character used to separate path components, as string.])
125
126 dnl
127 dnl Scripts
128 dnl
129
130 dnl diffpp
131
132 AC_PATH_PROG(PERL, perl)
133
134 dnl substitutions
135
136 AC_SUBST(CFLAGS)
137 AC_SUBST(LDFLAGS)
138
139 AC_CONFIG_FILES([Makefile      po/Makefile.in\
140         compat/Makefile \
141         afm/Makefile \
142         afmlib/Makefile \
143         src/Makefile \
144         src/tests/Makefile \
145         lib/Makefile \
146         scripts/Makefile \
147         states/Makefile \
148         states/hl/Makefile \
149         states/tests/Makefile \
150         docs/Makefile \
151         w32/Makefile])
152
153 AC_OUTPUT
154
155 echo ""
156
157 echo "Enscript is now configured to your system with the following"
158 echo "user-definable options.  Please, check that they are correct and"
159 echo "match to your system's properties."
160 echo ""
161 echo "Option     Change with configure's option   Current value"
162 echo "---------------------------------------------------------"
163 echo "Media      --with-media=MEDIA               $MEDIA"
164 echo "Encoding   --with-encoding=ENCODING         $ENCODING"
165 echo "Spooler    --with-spooler=SPOOLER           $SPOOLER"
166 echo "PS level   --with-ps-level=LEVEL            $PSLEVEL"
167 echo ""