summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 3bbb89f62584d492ca9fd308a2d58975d5c7a3b4 (plain)
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.61])
AC_INIT(foomatic-rip, [4.0.8])
AM_INIT_AUTOMAKE([no-define])
AC_CONFIG_SRCDIR([options.c])

AC_DEFINE_UNQUOTED(VERSION, "`cat VERSION.full 2> /dev/null`", [Foomatic version])


# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

# Allows per-target compilation flags
AM_PROG_CC_C_O

# Checks for libraries.
AC_CHECK_LIB(m, roundf)

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h memory.h stddef.h stdlib.h string.h strings.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([dup2 getcwd gethostname regcomp setenv strcasecmp strchr strcspn strdup strncasecmp strndup strrchr strstr strcasestr strtol])


ETCSEARCHPATH=${prefix}/etc:/usr/etc:/usr/local/etc
LIBSEARCHPATH=${libdir}:/usr/lib:/usr/lib64:/usr/local/lib:${prefix}/libexec:/usr/libexec:/usr/local/libexec

uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test x$uname = xIRIX64; then
  uname="IRIX"
fi

if test x$uname = xIRIX; then
  ETCSEARCHPATH="/usr/freeware/etc:$ETCSEARCHPATH"
  LIBSEARCHPATH="/usr/freeware/lib32:/usr/freeware/lib:$LIBSEARCHPATH"
fi

# Check for Perl
AC_PATH_PROG(PERL,perl)

if test -z "$PERL"; then
	AC_MSG_ERROR([Perl 5 is required to build and run]);
fi

# Check for /etc/printcap
FM_PATH_DIR(PRINTCAP,printcap,/etc/printcap,$ETCSEARCHPATH)

# Check for cups-config
AC_PATH_PROG(CUPS_CONFIG,cups-config)

# Use cups-config to find CUPS directories
if test -n "$CUPS_CONFIG" && test -z "$CUPS_SERVERBIN"; then
	CUPS_SERVERBIN=`cups-config --serverbin 2>/dev/null`
fi
if test -n "$CUPS_SERVERBIN"; then
   	CUPS=$CUPS_SERVERBIN
	CUPS_FILTERS="$CUPS_SERVERBIN/filter"
	CUPS_BACKENDS="$CUPS_SERVERBIN/backend"
	AC_SUBST(CUPS)
	AC_SUBST(CUPS_FILTERS)
	AC_SUBST(CUPS_BACKENDS)
else
	# Check for /usr/lib/cups
	FM_PATH_DIR(CUPS,cups,/usr/lib/cups,$SERVERBIB$LIBSEARCHPATH)

	# Check for /usr/lib/cups/filter
	FM_PATH_DIR(CUPS_FILTERS,cups/filter,/usr/lib/cups/filter,$FILTERS$LIBSEARCHPATH)

	# Check for /usr/lib/cups/backend
	FM_PATH_DIR(CUPS_BACKENDS,cups/backend,/usr/lib/cups/backend,$BACKENDS$LIBSEARCHPATH)
fi

# Check for /usr/lib/ppr
FM_PATH_DIR(PPR,ppr,/usr/lib/ppr,$LIBSEARCHPATH)

# Check for /usr/lib/ppr/interfaces
FM_PATH_DIR(PPR_INTERFACES,ppr/interfaces,/usr/lib/ppr/interfaces,$LIBSEARCHPATH)

# Check for /usr/lib/ppr/lib
FM_PATH_DIR(PPR_LIB,ppr/lib,/usr/lib/ppr/lib,$LIBSEARCHPATH)

AC_ARG_ENABLE(file-converter-check, [  --enable-file-converter-check  check whether a file converter is installed [default=yes]],
[if eval "test x${enableval} = xno"; then
  NOCONVERTERCHECK=1
  AC_MSG_WARN([Absence of a file converter is ignored, package will be built anyway])
fi])

# Check for a2ps, enscript, mpage
AC_PATH_PROG(A2PS,a2ps)
AC_PATH_PROG(ENSCRIPT,enscript)
AC_PATH_PROG(MPAGE,mpage)
AC_PATH_PROG(TEXTTOPS,texttops,,$CUPS_FILTERS)

AC_ARG_WITH(file-converter,[  --with-file-converter=[a2ps|enscript|mpage]
			Default: auto],
	FILECONVERTER="$withval",
	FILECONVERTER="")
AC_MSG_RESULT([file-converter: $FILECONVERTER])
AC_SUBST(FILECONVERTER)

# Use DBUS
AC_ARG_ENABLE(dbus, AS_HELP_STRING([--enable-dbus],[enable DBus CMS code]),
	      enable_dbus=$enableval,enable_dbus=yes)
AM_CONDITIONAL(BUILD_DBUS, test x$enable_dbus = xyes)
if test x$enable_dbus = xyes; then
	PKG_CHECK_MODULES(DBUS, dbus-1)
fi

if test "${NOCONVERTERCHECK}" = "" -a "${A2PS}" = "" -a "${ENSCRIPT}" = "" -a "${MPAGE}" = "" -a "${TEXTTOPS}" = "" ; then
	AC_MSG_ERROR([cannot find a2ps, enscript, mpage, or CUPS' texttops.  You need to have at least one installed]);
fi

AC_ARG_WITH(echo,[  --with-echo=(path to GNU compatible echo command)
			Default: echo],
	ECHO="$withval",
	ECHO="echo")
AC_MSG_RESULT([GNU Compatible Echo: $ECHO])
AC_SUBST(ECHO)

AC_ARG_WITH(execpath,[  --with-execpath=(path to various filters)
			Default: ${prefix}/bin:/usr/local/bin:/usr/bin:/bin],
	EXECPATH="$withval",
	EXECPATH="${prefix}/bin:/usr/local/bin:/usr/bin:/bin")
AC_MSG_RESULT([Execpath: $EXECPATH])
AC_SUBST(EXECPATH)

AC_CONFIG_FILES([Makefile beh foomatic-rip.1])
AC_CONFIG_HEADER(config.h)
AC_OUTPUT

# Finished
cat <<EOF
Finished configuring.
Type 'make' to build the package
Type 'make install' to install the base foomatic bits and links appropriate for
				CUPS and PPR to use foomatic
Type 'make install-main' to install the base foomatic bits.
Type 'make install-{cups|ppr}' to install the base foomatic bits and links
				appropriate for CUPS or PPR to use foomatic
Type 'make tests' to run some basic sanity tests (in place)
EOF