summaryrefslogtreecommitdiff
path: root/configure.in
blob: d94af7277b6b04b6b4048ffaf67aaf7be78ad678 (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
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
#
#  configure.in - hplip autoconf input file
# 
#  (c) 2004-2007 Copyright Hewlett-Packard Development Company, LP
# 
# exit status:
#   0 = ok
#   1 = error
#   2 = no libusb
#   3 = no cups-devel
#   4 = no libnetsnmp
#   5 = no netsnmp-devel
#   6 = no python-devel
#   7 = no pthread-devel
#   8 = no ppdev-devel
#   9 = no libcups
#   10 = no libm
#   11 = no libusb-devel
#   12 = no sane-backends-devel
#   13 = no libdbus-1 support
#   14 = no dbus-devel support
#   15 = fax requries dbus support
#
#   102 = no libjpeg
#   103 = no jpeg-devel
#   104 = no libdl

AC_PREREQ(2.59)
AC_INIT([HP Linux Imaging and Printing], [2.8.7], [2.8.7.3], [hplip])
AM_INIT_AUTOMAKE([1.9 foreign])
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL

# Checks for required libraries, don't set global -lpthread, -lm, -ljpeg, ... here, set in Makefile.
AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libpthread support], 7)])
AC_CHECK_LIB([m], [pow], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libm math support], 10)])
AC_CHECK_LIB([jpeg], [jpeg_set_defaults],[LIBS="$LIBS"], [AC_MSG_ERROR(["cannot find libjpeg support"], 102)])
AC_CHECK_LIB([dl], [dlopen], [LIBS="$LIBS" AC_DEFINE([HAVE_LIBDL])], [AC_MSG_ERROR(["cannot find libdl support"], 104)])

# Checks for required header files.
AC_CHECK_HEADERS(pthread.h,, [AC_MSG_ERROR([cannot find pthread-devel support], 7)])
AC_CHECK_HEADERS(jpeglib.h,, [AC_MSG_ERROR([cannot find libjpeg-devel support], 103)])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN(,[APDK_ENDIAN_FLAG="-DAPDK_LITTLE_ENDIAN"])

# Autoconf-style header tests for APDK
cat >prnt/hpijs/auto-include.h <<EOFH
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_MACHINE_TYPES_H
#include <machine/types.h>
#endif
EOFH
AC_CHECK_TYPES([uint32_t], [APDK_AUTO_INCLUDE_FLAG="-DAPDK_AUTO_INCLUDE"],, [#include "prnt/hpijs/auto-include.h"])

AC_MSG_CHECKING("for platform-dependencies")
darwin_build="no"
case "$host" in
   *-darwin*)
      AC_MSG_RESULT("using Mac OS X platform.h")
      cat >prnt/hpijs/platform.h <<EOF
#include <stdlib.h>
#include <sys/types.h>
#include <sys/malloc.h>
#include <memory.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
EOF
      darwin_build="yes"
      ;;

     *)
      AC_MSG_RESULT("using Default platform.h")
      cat >prnt/hpijs/platform.h <<EOF
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
EOF
      ;;
esac
AM_CONDITIONAL(DARWIN_BUILD, test x$darwin_build = xyes)

AC_MSG_CHECKING([for documentation build])
AC_ARG_ENABLE(doc_build,
  [  --enable-doc-build     enable documentation build (default=yes)],
  doc_build=$enableval, doc_build=yes)
if test "$doc_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(DOC_BUILD, test x$doc_build = xyes)

AC_MSG_CHECKING([for hpijs only build])
AC_ARG_ENABLE(hpijs_only_build,
  [  --enable-hpijs-only-build     enable hpijs only build (default=no)],
  hpijs_only_build=$enableval, hpijs_only_build=no)
if test "$hpijs_only_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
   AC_DEFINE(HAVE_LIBHPIP) 
fi
AM_CONDITIONAL(HPLIP_BUILD, test x$hpijs_only_build = xno)

AC_MSG_CHECKING([for network build])
AC_ARG_ENABLE(network_build,
  [  --enable-network-build    enable network build (default=yes)],
  network_build=$enableval, network_build=yes)
if test "$network_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(NETWORK_BUILD, test x$network_build = xyes)

AC_MSG_CHECKING([for parallel port build])
AC_ARG_ENABLE(pp_build,
  [  --enable-pp-build    enable parallel port build (default=yes)],
  pp_build=$enableval, pp_build=yes)
if test "$pp_build" = "yes"; then
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_PPORT) 
else
   AC_MSG_RESULT(no)
fi
   
AC_MSG_CHECKING([for scanner build])
AC_ARG_ENABLE(scan_build,
  [  --enable-scan-build    enable scanner build (default=yes)],
  scan_build=$enableval, scan_build=yes)
if test "$scan_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(SCAN_BUILD, test x$scan_build = xyes)

AC_MSG_CHECKING([for gui build])
AC_ARG_ENABLE(gui_build,
  [  --enable-gui-build    enable gui build (default=yes)],
  gui_build=$enableval, gui_build=yes)
if test "$gui_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(GUI_BUILD, test x$gui_build = xyes)

AC_MSG_CHECKING([for fax build])
AC_ARG_ENABLE(fax_build,
  [  --enable-fax-build    enable fax build (default=yes)],
  fax_build=$enableval, fax_build=yes)
if test "$fax_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(FAX_BUILD, test x$fax_build = xyes)

AC_MSG_CHECKING([for dbus build])
AC_ARG_ENABLE(dbus_build,
  [  --enable-dbus-build    enable dbus build (default=yes)],
  dbus_build=$enableval, dbus_build=yes)
if test "$dbus_build" = "yes"; then
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_DBUS) 
else
   AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING([for cups 1.1.x build])
AC_ARG_ENABLE(cups11_build,
  [  --enable-cups11-build    enable cups 1.1.x build (default=no)],
  cups11_build=$enableval, cups11_build=no)
if test "$cups11_build" = "yes"; then
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_CUPS11) 
else
   AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING([for shadow build])
AC_ARG_ENABLE(shadow_build,
  [  --enable-shadow-build    enable shadow build (default=no)],
  shadow_build=$enableval, shadow_build=no)
if test "$shadow_build" = "yes"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(SHADOW_BUILD, test x$shadow_build = xyes)

AC_ARG_WITH(cupsbackenddir, AC_HELP_STRING([--with-cupsbackenddir=DIR], [set cups backend install directory [default=/usr/lib/cups/backend]]),
   cupsbackenddir=$withval, cupsbackenddir="/usr/lib/cups/backend")

AC_ARG_WITH(cupsfilterdir, AC_HELP_STRING([--with-cupsfilterdir=DIR], [set cups filter install directory [default=/usr/lib/cups/filter]]),
   cupsfilterdir=$withval, cupsfilterdir="/usr/lib/cups/filter")

AC_ARG_WITH(icondir, AC_HELP_STRING([--with-icondir=DIR], [set hplip.desktop install directory [default=/usr/share/applications]]),
   icondir=$withval, icondir="/usr/share/applications")

AC_ARG_WITH(systraydir, AC_HELP_STRING([--with-systraydir=DIR], [set hplip-systray.desktop install directory [default=/etc/xdg/autostart]]),
   systraydir=$withval, systraydir="/etc/xdg/autostart")

AC_ARG_WITH(hpppddir, AC_HELP_STRING([--with-hpppddir=DIR], [set hp ppd install directory [default=datadir/ppd/HP]]),
   hpppddir=$withval, hpppddir="$datadir/ppd/HP")

AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=DIR], [set hplip documentation directory [default=datadir/doc]]),
   hpdocdir=$withval, hpdocdir="$datadir/doc/hplip-$VERSION")

AC_MSG_CHECKING([for foomatic ppd install])
AC_ARG_ENABLE(foomatic_ppd_install,
  [  --enable-foomatic-ppd-install    enable foomatic static ppd install (default=no), uses hpppddir],
  foomatic_ppd_install=$enableval, foomatic_ppd_install=no)
if test $foomatic_ppd_install = yes; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi

AC_ARG_WITH(drvdir, AC_HELP_STRING([--with-drvdir=DIR], [set cups drv install directory [default=datadir/cups/drv/hp]]),
   drvdir=$withval, drvdir="$datadir/cups/drv/hp")

AC_MSG_CHECKING([for foomatic drv install])
AC_ARG_ENABLE(foomatic_drv_install,
  [  --enable-foomatic-drv-install    enable foomatic dynamic ppd install (default=yes), uses drvdir and hpppddir],
  foomatic_drv_install=$enableval, foomatic_drv_install=yes)
if test $foomatic_drv_install = yes; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING([for foomatic-rip-hplip install])
AC_ARG_ENABLE(foomatic_rip_hplip_install,
  [  --enable-foomatic-rip-hplip-install    enable foomatic-rip-hplip install (default=yes), uses cupsfilterdir],
  foomatic_rip_hplip_install=$enableval, foomatic_rip_hplip_install=yes)
if test "$foomatic_rip_hplip_install" = "yes"; then
   AC_MSG_RESULT(yes)
   foomatic_filter="foomatic-rip-hplip"
else
   AC_MSG_RESULT(no)
   foomatic_filter="foomatic-rip"
fi
AM_CONDITIONAL(RIP_INSTALL, test x$foomatic_rip_hplip_install = xyes)

AC_MSG_CHECKING(for restricted build)
grep -q BB_BUILD bb_build.inc
if test $? -eq 0; then
  bb_build="yes"
  hpaio_version=libsane-hpaio.so.1.0.1
else
  bb_build="no"
  hpaio_version=libsane-hpaio.so.1.0.0
fi
AC_MSG_RESULT($bb_build)

# Check conditional packages.

if test "$hpijs_only_build" = "no" && test "$network_build" = "yes"; then
   AC_CHECK_LIB([crypto], [CRYPTO_free],, [AC_MSG_ERROR([cannot find net-snmp support (or --disable-network-build)], 4)])
   AC_CHECK_LIB([netsnmp], [snmp_timeout], [LIBS="$LIBS" AC_DEFINE([HAVE_LIBNETSNMP])], [AC_MSG_ERROR([cannot find net-snmp support (or --disable-network-build)], 4)])
   AC_CHECK_HEADERS(net-snmp/net-snmp-config.h,, [AC_MSG_ERROR([cannot find net-snmp-devel support (or --disable-network-build)], 5)])
fi

if test "$hpijs_only_build" = "no" && test "$pp_build" = "yes"; then
   AC_CHECK_HEADERS(linux/ppdev.h, ,[AC_MSG_ERROR([cannot find ppdev-devel support (or --disable-pp-build)], 8)])
fi

if test "$hpijs_only_build" = "no"; then
   AC_CHECK_LIB([cups], [cupsDoFileRequest], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libcups support], 9)])
   AC_CHECK_HEADERS(cups/cups.h, ,[AC_MSG_ERROR([cannot find cups-devel support], 3)])
   AC_CHECK_LIB([usb], [usb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb support], 2)])
   AC_CHECK_HEADERS(usb.h, ,[AC_MSG_ERROR([cannot find libusb-devel support], 11)])
   AC_ARG_VAR([PYTHON], [Python interpreter/compiler command])
   AM_PATH_PYTHON([2.2])
   AC_MSG_CHECKING([for path to Python.h])
   PYTHONINCLUDEDIR=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print get_python_inc();"`
   AC_MSG_RESULT("using $PYTHONINCLUDEDIR")
   AC_ARG_VAR(PYTHONINCLUDEDIR, [path to Python.h C header file])
   AC_CHECK_HEADERS(python$PYTHON_VERSION/Python.h, ,[AC_MSG_ERROR([cannot find python-devel support], 6)])
fi

if test "$hpijs_only_build" = "no" && test "$scan_build" = "yes"; then
   AC_CHECK_LIB([sane], [sane_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find sane-backends-devel support (or --disable-scan-build)], 12)])
fi

if test "$hpijs_only_build" = "no" && test "$dbus_build" = "yes"; then
#   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0.0, dbus-glib-1 >= 0.61],,[AC_MSG_ERROR([cannot find dbus-devel support: $DBUS_PKG_ERRORS], 14)])
   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0.0],,[AC_MSG_ERROR([cannot find dbus-devel support: $DBUS_PKG_ERRORS], 14)])
   AC_CHECK_LIB([dbus-1], [dbus_connection_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libdbus support], 13)])
fi

if test "$hpijs_only_build" = "no" && test "$fax_build" = "yes" && test "$dbus_build" = "no"; then
   AC_MSG_ERROR([fax requires dbus support], 15)
fi

# AC_DEFINE_DIR([DATADIR], [datadir])
# Copyright © 2006 Stepan Kasal  <kasal@ucw.cz>
# Copyright © 2006 Andreas Schwab <schwab@suse.de>
# Copyright © 2006 Guido U. Draheim <guidod@gmx.de>
# Copyright © 2006 Alexandre Oliva
# Copying and distribution of this file, with or without modification, are permitted in any medium without
# royalty provided the copyright notice and this notice are preserved.
AC_DEFUN([AC_DEFINE_DIR], [
  prefix_NONE=
  exec_prefix_NONE=
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
  eval ac_define_dir="\"[$]$2\""
  eval ac_define_dir="\"$ac_define_dir\""
  $1="$ac_define_dir"
  test "$prefix_NONE" && prefix=NONE
  test "$exec_prefix_NONE" && exec_prefix=NONE
])

AC_DEFINE_DIR([abs_datadir], [datadir])
AC_DEFINE_DIR([abs_sbindir], [sbindir])
AC_DEFINE_DIR([abs_hpppddir], [hpppddir])
AC_DEFINE_DIR([abs_docdir], [hpdocdir])
abs_ppddir=${abs_hpppddir%/*}
AC_DEFINE_DIR([abs_drvdir], [drvdir])

AC_SUBST(abs_datadir) 
AC_SUBST(abs_sbindir) 
AC_SUBST(abs_hpppddir) 
AC_SUBST(abs_docdir) 
AC_SUBST(abs_ppddir) 
AC_SUBST(abs_drvdir) 
AC_SUBST(icondir)
AC_SUBST(systraydir)
AC_SUBST(cupsbackenddir)
AC_SUBST(cupsfilterdir)
AC_SUBST(hpppddir)
AC_SUBST(hpdocdir)
AC_SUBST(drvdir)
AC_SUBST(network_build)
AC_SUBST(pp_build)
AC_SUBST(gui_build)
AC_SUBST(scan_build)
AC_SUBST(fax_build)
AC_SUBST(dbus_build)
AC_SUBST(cups11_build)
AC_SUBST(foomatic_drv_install)
AC_SUBST(foomatic_ppd_install)
AC_SUBST(foomatic_rip_hplip_install)
AC_SUBST(foomatic_filter)
AC_SUBST(doc_build)
AC_SUBST(shadow_build)
AC_SUBST(APDK_ENDIAN_FLAG)
AC_SUBST(APDK_AUTO_INCLUDE_FLAG)
AC_SUBST(hpaio_version)
AC_SUBST(bb_build)

AC_CONFIG_FILES(Makefile hplip.conf hplip.desktop hplip-systray.desktop prnt/drv/hpijs.drv hplip.list)
AC_OUTPUT