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