1#
2#  configure.in - hplip autoconf input file
3#
4#  (c) 2004-2007 Copyright HP Development Company, LP
5#
6# exit status:
7#   0 = ok
8#   1 = error
9#   2 = no libusb
10#   3 = no cups-devel
11#   4 = no libnetsnmp
12#   5 = no netsnmp-devel
13#   6 = no python-devel
14#   7 = no pthread-devel
15#   8 = no ppdev-devel
16#   9 = no libcups
17#   10 = no libm
18#   11 = no libusb-devel
19#   12 = no sane-backends-devel
20#   13 = no libdbus-1 support
21#   14 = no dbus-devel support
22#   15 = fax requries dbus support
23#
24#   102 = no libjpeg
25#   103 = no jpeg-devel
26#   104 = no libdl
27
28#AC_PREREQ(2.59)
29AC_INIT([HP Linux Imaging and Printing], [3.20.6], [3.20.6], [hplip])
30#AM_INIT_AUTOMAKE([1.9 foreign])
31AM_INIT_AUTOMAKE
32AC_DISABLE_STATIC
33
34# Checks for programs.
35AC_PROG_CXX
36AC_PROG_CC
37AC_PROG_INSTALL
38AC_PROG_LIBTOOL
39
40# Checks for required libraries, don't set global -lpthread, -lm, -ljpeg, ... here, set in Makefile.
41AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libpthread support], 7)])
42AC_CHECK_LIB([m], [pow], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libm math support], 10)])
43AC_CHECK_LIB([jpeg], [jpeg_set_defaults],[LIBS="$LIBS"], [AC_MSG_ERROR(["cannot find libjpeg support"], 102)])
44AC_CHECK_LIB([dl], [dlopen], [LIBS="$LIBS" AC_DEFINE([HAVE_LIBDL])], [AC_MSG_ERROR(["cannot find libdl support"], 104)])
45
46# Checks for required header files.
47AC_CHECK_HEADERS(pthread.h,, [AC_MSG_ERROR([cannot find pthread-devel support], 7)])
48AC_CHECK_HEADERS(jpeglib.h,, [AC_MSG_ERROR([cannot find libjpeg-devel support], 103)])
49
50# Checks for typedefs, structures, and compiler characteristics.
51AC_C_BIGENDIAN(,[APDK_ENDIAN_FLAG="-DAPDK_LITTLE_ENDIAN"])
52
53# Autoconf-style header tests for APDK
54cat >prnt/hpijs/auto-include.h <<EOFH
55#ifdef HAVE_INTTYPES_H
56#include <inttypes.h>
57#endif
58#ifdef HAVE_STDINT_H
59#include <stdint.h>
60#endif
61#ifdef HAVE_MACHINE_TYPES_H
62#include <machine/types.h>
63#endif
64EOFH
65AC_CHECK_TYPES([uint32_t], [APDK_AUTO_INCLUDE_FLAG="-DAPDK_AUTO_INCLUDE"],, [#include "prnt/hpijs/auto-include.h"])
66
67AC_MSG_CHECKING("for platform-dependencies")
68darwin_build="no"
69case "$host" in
70   *-darwin*)
71      AC_MSG_RESULT("using Mac OS X platform.h")
72      cat >prnt/hpijs/platform.h <<EOF
73#include <stdlib.h>
74#include <sys/types.h>
75#include <sys/malloc.h>
76#include <memory.h>
77#include <string.h>
78#include <stdio.h>
79#include <math.h>
80EOF
81      darwin_build="yes"
82      ;;
83
84     *)
85      AC_MSG_RESULT("using Default platform.h")
86      cat >prnt/hpijs/platform.h <<EOF
87#include <stdlib.h>
88#include <memory.h>
89#include <string.h>
90#include <stdio.h>
91#include <math.h>
92EOF
93      ;;
94esac
95AM_CONDITIONAL(DARWIN_BUILD, test x$darwin_build = xyes)
96AM_CONDITIONAL(GCC_GE_47, test `g++ -dumpversion | gawk '{print $1>=4.7?"1":"0"}'` = 1)
97
98AC_MSG_CHECKING([for documentation build])
99AC_ARG_ENABLE(doc_build,
100  [  --enable-doc-build     enable documentation build (default=yes)],
101  doc_build=$enableval, doc_build=yes)
102if test "$doc_build" = "yes"; then
103   AC_MSG_RESULT(yes)
104else
105   AC_MSG_RESULT(no)
106fi
107AM_CONDITIONAL(DOC_BUILD, test x$doc_build = xyes)
108
109AC_MSG_CHECKING([for hpijs only build])
110AC_ARG_ENABLE(hpijs_only_build,
111  [  --enable-hpijs-only-build     enable hpijs only build (default=yes)(Deprecated)],
112  hpijs_only_build=$enableval, hpijs_only_build=no)
113if test "$hpijs_only_build" = "yes"; then
114   AC_MSG_RESULT(yes)
115   epm_full=\#
116   epm_lite=\#
117   epm_hpcups_only=\#
118   epm_print_only_exclude=\#
119   epm_hpijs_only=
120   AC_MSG_WARN(HPIJS build is deprecated. Feature can be used as is. Fixes or updates will not be provided)
121else
122   AC_MSG_RESULT(no)
123   epm_hpijs_only=\#
124   AC_DEFINE(HAVE_LIBHPIP)
125fi
126AM_CONDITIONAL(HPIJS_ONLY_BUILD, test x$hpijs_only_build = xyes)
127
128AC_MSG_CHECKING([for lite build])
129AC_ARG_ENABLE(lite_build,
130  [  --enable-lite-build     enable lite build, print & scan only (default=no)],
131  lite_build=$enableval, lite_build=no)
132if test "$lite_build" = "yes"; then
133   AC_MSG_RESULT(yes)
134   epm_full=\#
135   epm_hpcups_only=\#
136   epm_print_only_exclude=
137   epm_lite=
138else
139   AC_MSG_RESULT(no)
140fi
141AM_CONDITIONAL(LITE_BUILD, test x$lite_build = xyes)
142
143AC_MSG_CHECKING([for hpcups only build])
144AC_ARG_ENABLE(hpcups_only_build,
145  [  --enable-hpcups-only-build     enable hpcups only build, print only (default=no)],
146  hpcups_only_build=$enableval, hpcups_only_build=no)
147if test "$hpcups_only_build" = "yes"; then
148   AC_MSG_RESULT(yes)
149   epm_full=\#
150   epm_lite=\#
151   epm_hpcups_only=
152   epm_print_only_exclude=\#
153else
154   AC_MSG_RESULT(no)
155fi
156AM_CONDITIONAL(HPCUPS_ONLY_BUILD, test x$hpcups_only_build = xyes)
157
158AM_CONDITIONAL(HPLIP_BUILD, test x$hpcups_only_build = xno && test x$hpijs_only_build = xno)
159if test "$hpijs_only_build" = "no" && test "$hpcups_only_build" = "no"; then
160   AC_DEFINE(HAVE_LIBHPIP)
161fi
162
163if test "$lite_build" = "no" && test "$hpcups_only_build" = "no" && test "$hpijs_only_build" = "no"; then
164   epm_full=
165   epm_lite=\#
166   epm_hpcups_only=\#
167   epm_print_only_exclude=
168fi
169AM_CONDITIONAL(FULL_BUILD, test x$hpcups_only_build = xno && test x$lite_build = xno && test x$hpijs_only_build = xno)
170
171AC_MSG_CHECKING([for hpijs install])
172AC_ARG_ENABLE(hpijs_install,
173  [  --enable-hpijs-install     enable hpijs install (default=no)(Deprecated)],
174  hpijs_install=$enableval, hpijs_install=no)
175if test "$hpijs_install" = "yes"; then
176   AC_MSG_RESULT(yes)
177   epm_hpijs_install=yes
178   AC_MSG_WARN(HPIJS is deprecated. Feature can be used as is. Fixes or updates will not be provided)
179else
180   AC_MSG_RESULT(no)
181fi
182AM_CONDITIONAL(HPIJS_INSTALL, test x$hpijs_install = xyes)
183
184AC_MSG_CHECKING([for hpcups install])
185AC_ARG_ENABLE(hpcups_install,
186  [  --enable-hpcups-install     enable hpcups install (default=yes)],
187  hpcups_install=$enableval, hpcups_install=yes)
188if test "$hpcups_install" = "yes" && test "$hpijs_only_build" = "no"; then
189   AC_MSG_RESULT(yes)
190   epm_hpcups_install=yes
191else
192   AC_MSG_RESULT(no)
193fi
194AM_CONDITIONAL(HPCUPS_INSTALL, test x$hpcups_install = xyes && test x$hpijs_only_build = xno)
195
196AC_MSG_CHECKING([for new hpcups install])
197AC_ARG_ENABLE(new_hpcups,
198  [  --enable-new-hpcups     enable new hpcups install (default=no)],
199  new_hpcups=$enableval, new_hpcups=no)
200if test "$new_hpcups" = "yes"; then
201   AC_MSG_RESULT(yes)
202else
203   AC_MSG_RESULT(no)
204fi
205AM_CONDITIONAL(NEW_HPCUPS, test x$new_hpcups = xyes)
206
207AC_MSG_CHECKING([for hpps install])
208AC_ARG_ENABLE(hpps_install,
209  [  --enable-hpps-install     enable hpps install (default=yes)],
210  hpps_install=$enableval, hpps_install=yes)
211if test "$hpps_install" = "yes" && test "$hpijs_only_build" = "no"; then
212   AC_MSG_RESULT(yes)
213   epm_hpps_install=yes
214else
215   AC_MSG_RESULT(no)
216fi
217AM_CONDITIONAL(HPPS_INSTALL, test x$hpps_install = xyes && test x$hpijs_only_build = xno)
218
219AC_MSG_CHECKING([for network build])
220AC_ARG_ENABLE(network_build,
221  [  --enable-network-build    enable network build (default=yes)],
222  network_build=$enableval, network_build=yes)
223if test "$network_build" = "yes"; then
224   AC_MSG_RESULT(yes)
225else
226   AC_MSG_RESULT(no)
227fi
228AM_CONDITIONAL(NETWORK_BUILD, test x$network_build = xyes)
229
230AC_MSG_CHECKING([for parallel port build])
231AC_ARG_ENABLE(pp_build,
232  [  --enable-pp-build    enable parallel port build (default=no)(Deprecated) ],
233  pp_build=$enableval, pp_build=no)
234if test "$pp_build" = "yes"; then
235   AC_MSG_RESULT(yes)
236   AC_MSG_WARN(Parallel Port support deprecated. Feature can be used as is. Fixes or updates will not be provided)
237   AC_DEFINE(HAVE_PPORT)
238else
239   AC_MSG_RESULT(no)
240fi
241
242AC_MSG_CHECKING([for class driver])
243AC_ARG_ENABLE(class_driver,
244  [  --enable-class-driver    enable class driver (default=no)],
245  class_driver=$enableval, class_driver=no)
246if test "$class_driver" = "yes"; then
247   AC_MSG_RESULT(yes)
248   epm_full=\#
249   epm_lite=\#
250   epm_hpcups_only=\#
251   epm_print_only_exclude=\#
252   epm_scan=\#
253   epm_class_driver=
254   epm_class_install=yes
255   test `sh ./createPPD.sh -f` == 0
256else
257   AC_MSG_RESULT(no)
258   test `sh ./createPPD.sh -q` == 0
259fi
260AM_CONDITIONAL(HPLIP_CLASS_DRIVER, test x$class_driver = xyes)
261
262
263AC_MSG_CHECKING([for scanner build])
264AC_ARG_ENABLE(scan_build,
265  [  --enable-scan-build    enable scanner build (default=yes)],
266  scan_build=$enableval, scan_build=yes)
267if test "$scan_build" = "yes"; then
268   AC_MSG_RESULT(yes)
269   epm_scan=
270else
271   AC_MSG_RESULT(no)
272   epm_scan=\#
273fi
274AM_CONDITIONAL(SCAN_BUILD, test x$scan_build = xyes)
275
276AC_MSG_CHECKING([for gui build])
277AC_ARG_ENABLE(gui_build,
278  [  --enable-gui-build    enable gui build (default=yes)],
279  gui_build=$enableval, gui_build=yes)
280if test "$gui_build" = "yes"; then
281   AC_MSG_RESULT(yes)
282else
283   AC_MSG_RESULT(no)
284fi
285AM_CONDITIONAL(GUI_BUILD, test x$gui_build = xyes)
286
287AC_MSG_CHECKING([for fax build])
288AC_ARG_ENABLE(fax_build,
289  [  --enable-fax-build    enable fax build (default=yes)],
290  fax_build=$enableval, fax_build=yes)
291if test "$fax_build" = "yes"; then
292   AC_MSG_RESULT(yes)
293else
294   AC_MSG_RESULT(no)
295fi
296AM_CONDITIONAL(FAX_BUILD, test x$fax_build = xyes && test x$class_driver = xno)
297
298#AppArmor Changes
299AC_MSG_CHECKING([for apparmor profile])
300AC_ARG_ENABLE(apparmor_build,
301  [  --enable-apparmor_build    enable apparmor build (default=no)],
302  apparmor_build=$enableval, apparmor_build=no)
303if test "$apparmor_build" = "yes"; then
304   if test -d /etc/apparmor.d/; then
305      AC_MSG_RESULT(yes)
306   else
307      AC_MSG_ERROR([cannot find apparmor support])
308   fi
309else
310   AC_MSG_RESULT(no)
311fi
312AM_CONDITIONAL(APPARMOR_BUILD, test x$apparmor_build = xyes)
313
314
315AC_MSG_CHECKING([for dbus build])
316AC_ARG_ENABLE(dbus_build,
317  [  --enable-dbus-build    enable dbus build (default=yes)],
318  dbus_build=$enableval, dbus_build=yes)
319if test "$dbus_build" = "yes"; then
320   AC_MSG_RESULT(yes)
321else
322   AC_MSG_RESULT(no)
323fi
324
325AC_MSG_CHECKING([for cups 1.1.x build])
326AC_ARG_ENABLE(cups11_build,
327  [  --enable-cups11-build    enable cups 1.1.x build (default=no)],
328  cups11_build=$enableval, cups11_build=no)
329if test "$cups11_build" = "yes"; then
330   AC_MSG_RESULT(yes)
331   AC_DEFINE(HAVE_CUPS11)
332else
333   AC_MSG_RESULT(no)
334fi
335
336AC_MSG_CHECKING([for udev sysfs enable rules])
337AC_ARG_ENABLE(udev_sysfs_rules,
338  [  --enable-udev_sysfs_rules    Use SYSFS attribute instead of ATTR/ATTRS attribute in udev rules(default=no)],
339  udev_sysfs_rules=$enableval, udev_sysfs_rules=no)
340if test "$udev_sysfs_rules" = "yes"; then
341   AC_MSG_RESULT(yes)
342else
343   AC_MSG_RESULT(no)
344fi
345AM_CONDITIONAL(UDEV_SYSFS_RULES, test x$udev_sysfs_rules = xyes)
346
347AC_MSG_CHECKING([for shadow build])
348AC_ARG_ENABLE(shadow_build,
349  [  --enable-shadow-build    enable shadow build (default=no)],
350  shadow_build=$enableval, shadow_build=no)
351if test "$shadow_build" = "yes"; then
352   AC_MSG_RESULT(yes)
353else
354   AC_MSG_RESULT(no)
355fi
356AM_CONDITIONAL(SHADOW_BUILD, test x$shadow_build = xyes)
357
358AC_MSG_CHECKING([for libusb-0.1 build])
359AC_ARG_ENABLE(libusb01_build,
360  [  --enable-libusb01_build    Use libusb-0.1 instead of libusb-1.0 (default=no. i.e. libusb-1.0)],
361  libusb01_build=$enableval, libusb01_build=no)
362if test "$libusb01_build" = "yes"; then
363   AC_MSG_RESULT(yes)
364   AC_DEFINE(HAVE_LIBUSB01)
365else
366   AC_MSG_RESULT(no)
367fi
368AM_CONDITIONAL(LIBUSB01_BUILD, test x$libusb01_build = xyes)
369
370AC_ARG_WITH(cupsbackenddir, AC_HELP_STRING([--with-cupsbackenddir=DIR], [set cups backend install directory [default=/usr/lib/cups/backend]]),
371   cupsbackenddir=$withval, cupsbackenddir="/usr/lib/cups/backend")
372
373AC_ARG_WITH(cupsfilterdir, AC_HELP_STRING([--with-cupsfilterdir=DIR], [set cups filter install directory [default=/usr/lib/cups/filter]]),
374   cupsfilterdir=$withval, cupsfilterdir="/usr/lib/cups/filter")
375
376AC_ARG_WITH(icondir, AC_HELP_STRING([--with-icondir=DIR], [set hplip.desktop install directory [default=/usr/share/applications]]),
377   icondir=$withval, icondir="/usr/share/applications")
378
379AC_ARG_WITH(icondir, AC_HELP_STRING([--with-icondir=DIR], [set hp-uiscan.desktop install directory [default=/usr/share/applications]]),
380   icondir=$withval, icondir="/usr/share/applications")
381
382AC_ARG_WITH(systraydir, AC_HELP_STRING([--with-systraydir=DIR], [set hplip-systray.desktop install directory [default=/etc/xdg/autostart]]),
383   systraydir=$withval, systraydir="/etc/xdg/autostart")
384
385AC_ARG_WITH(hpppddir, AC_HELP_STRING([--with-hpppddir=DIR], [set hp ppd install directory [default=datadir/ppd/HP]]),
386   hpppddir=$withval, hpppddir="$datadir/ppd/HP")
387
388# AppArmor Changes
389AC_ARG_WITH(apparmordir, AC_HELP_STRING([--with-apparmordir=DIR], [set apparmor profile install directory [default=/etc/apparmor.d]]),
390   apparmordir=$withval, apparmordir="/etc/apparmor.d")
391
392if test -f "/usr/share/cups/mime/mime.types"; then
393   abs_mimedir="/usr/share/cups/mime/"
394else
395   abs_mimedir="/etc/cups/"
396fi
397AC_ARG_WITH(mimedir, AC_HELP_STRING([--with-mimedir=DIR], [set cups mime.types location [default=abs_mimedir]]),
398   mimedir=$withval, mimedir="$abs_mimedir")
399
400AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=DIR], [set hplip documentation directory [default=datadir/doc]]),
401   hpdocdir=$withval, hpdocdir="$datadir/doc/hplip-$VERSION")
402
403AC_ARG_WITH(htmldir, AC_HELP_STRING([--with-htmldir=DIR], [set hplip html documentation directory [default=datadir/doc]]),
404   hphtmldir=$withval, hphtmldir="$datadir/doc/hplip-$VERSION")
405
406AC_MSG_CHECKING([for foomatic ppd install])
407AC_ARG_ENABLE(foomatic_ppd_install,
408  [  --enable-foomatic-ppd-install    enable foomatic static ppd install (default=no)(Deprecated), uses hpppddir],
409  foomatic_ppd_install=$enableval, foomatic_ppd_install=no)
410if test $foomatic_ppd_install = yes; then
411   AC_MSG_RESULT(yes)
412   epm_foomatic_ppd_install=yes
413   AC_MSG_WARN(foomatic static ppd install is deprecated. Feature can be used as is. Fixes or updates will not be provided)
414else
415   AC_MSG_RESULT(no)
416fi
417AM_CONDITIONAL(FOOMATIC_PPD_INSTALL, test x$foomatic_ppd_install = xyes)
418
419AC_ARG_WITH(drvdir, AC_HELP_STRING([--with-drvdir=DIR], [set cups drv install directory [default=datadir/cups/drv/hp]]),
420   drvdir=$withval, drvdir="$datadir/cups/drv/hp")
421
422AC_MSG_CHECKING([for foomatic drv install])
423AC_ARG_ENABLE(foomatic_drv_install,
424  [  --enable-foomatic-drv-install    enable foomatic dynamic ppd install (default=no)(Deprecated), uses drvdir and hpppddir],
425  foomatic_drv_install=$enableval, foomatic_drv_install=no)
426if test $foomatic_drv_install = yes; then
427   AC_MSG_RESULT(yes)
428   epm_foomatic_drv_install=yes
429   AC_MSG_WARN(foomatic dynamic ppd install is deprecated. Feature can be used as is. Fixes or updates will not be provided)
430else
431   AC_MSG_RESULT(no)
432fi
433AM_CONDITIONAL(FOOMATIC_DRV_INSTALL, test x$foomatic_drv_install = xyes)
434
435AC_MSG_CHECKING([for cups drv install])
436AC_ARG_ENABLE(cups_drv_install,
437  [  --enable-cups-drv-install    enable cups dynamic ppd install (default=yes), uses drvdir and hpppddir],
438  cups_drv_install=$enableval, cups_drv_install=yes)
439if test $cups_drv_install = yes && test $hpijs_only_build = no; then
440   AC_MSG_RESULT(yes)
441   epm_cups_drv_install=yes
442else
443   AC_MSG_RESULT(no)
444fi
445AM_CONDITIONAL(CUPS_DRV_INSTALL, test x$cups_drv_install = xyes && test x$hpijs_only_build = xno)
446
447AC_MSG_CHECKING([for cups ppd install])
448AC_ARG_ENABLE(cups_ppd_install,
449  [  --enable-cups-ppd-install    enable cups static ppd install (default=no), uses hpppddir],
450  cups_ppd_install=$enableval, cups_ppd_install=no)
451if test $cups_ppd_install = yes && test $hpijs_only_build = no; then
452   AC_MSG_RESULT(yes)
453   epm_cups_ppd_install=yes
454else
455   AC_MSG_RESULT(no)
456fi
457AM_CONDITIONAL(CUPS_PPD_INSTALL, test x$cups_ppd_install = xyes && test x$hpijs_only_build = xno)
458
459AC_MSG_CHECKING([for foomatic-rip-hplip install])
460AC_ARG_ENABLE(foomatic_rip_hplip_install,
461  [  --enable-foomatic-rip-hplip-install    enable foomatic-rip-hplip install (default=no)(Deprecated), uses cupsfilterdir],
462  foomatic_rip_hplip_install=$enableval, foomatic_rip_hplip_install=no)
463if test "$foomatic_rip_hplip_install" = "yes"; then
464   AC_MSG_RESULT(yes)
465   foomatic_filter="foomatic-rip-hplip"
466   epm_foomatic_rip_hplip_install=yes
467   AC_MSG_WARN(foomatic-rip-hplip install is deprecated. Feature can be used as is. Fixes or updates will not be provided)
468else
469   AC_MSG_RESULT(no)
470   foomatic_filter="foomatic-rip"
471fi
472AM_CONDITIONAL(RIP_INSTALL, test x$foomatic_rip_hplip_install = xyes)
473
474AC_MSG_CHECKING([for qt5])
475AC_ARG_ENABLE(qt5,
476  [  --enable-qt5    enable qt5 (default=no)],
477  qt5=$enableval, qt5=no)
478if test "$qt5" = "yes"; then
479   AC_MSG_RESULT(yes)
480else
481   AC_MSG_RESULT(no)
482fi
483AM_CONDITIONAL(QT5_INSTALL, test x$qt5 = xyes)
484
485
486AC_MSG_CHECKING([for qt4])
487AC_ARG_ENABLE(qt4,
488  [  --enable-qt4    enable qt4 (default=yes)],
489  qt4=$enableval, qt4=yes)
490if test "$qt4" = "yes" && test "$qt5" = "no"; then
491   AC_MSG_RESULT(yes)
492else
493   AC_MSG_RESULT(no)
494   qt4=no
495fi
496AM_CONDITIONAL(QT4_INSTALL, test x$qt4 = xyes)
497
498AC_MSG_CHECKING([for qt3])
499AC_ARG_ENABLE(qt3,
500  [  --enable-qt3    enable qt3 (default=no)],
501  qt3=$enableval, qt3=no)
502if test "$qt3" = "yes"; then
503   AC_MSG_RESULT(yes)
504   qt5=no
505   qt4=no
506else
507   AC_MSG_RESULT(no)
508fi
509AM_CONDITIONAL(QT3_INSTALL, test x$qt3 = xyes)
510
511if test "$gui_build" = "no"; then
512   qt3=no
513   qt4=no
514   qt5=no
515fi
516
517epm_qt3=\#
518epm_qt4=\#
519epm_qt5=\#
520if test "$hpcups_only_build" = "no" && test "$hpijs_only_build" = "no"; then
521if test "$qt3" = "yes" && test "$qt4" = "no" && test "$qt5" = "no"; then
522   ui_toolkit=qt3
523   epm_qt3=
524elif test "$qt4" = "yes" && test "$qt5" = "no"; then
525   ui_toolkit=qt4
526   epm_qt4=
527elif test "$qt5" = "yes"; then
528   ui_toolkit=qt5
529   epm_qt5=
530else
531   ui_toolkit=no
532fi
533fi
534
535AC_MSG_CHECKING([for policykit])
536AC_ARG_ENABLE(policykit,
537  [  --enable-policykit    enable PolicyKit (default=no)],
538  policykit=$enableval, policykit=no)
539if test "$policykit" = "yes"; then
540   AC_MSG_RESULT(yes)
541else
542   AC_MSG_RESULT(no)
543fi
544AM_CONDITIONAL(POLICYKIT_INSTALL, test x$policykit = xyes)
545
546# Determine where the PolicyKit policy file goes
547if test "$policykit" = "yes"; then
548   if test -d /usr/share/polkit-1; then
549      policykit_dir=/usr/share/polkit-1/actions
550   elif test -d /usr/share/PolicyKit; then
551      policykit_dir=/usr/share/PolicyKit/policy
552   else
553      policykit_dir=/usr/share/PolicyKit/policy
554   fi
555else
556   policykit_dir=
557fi
558
559AC_MSG_CHECKING(for host machine platform)
560machine=`uname -m`
561if test "$machine" = "x86_32" || test "$machine" = "i686"; then
562    platform="x86_32"
563elif test "$machine" = "x86_64"; then
564    platform="x86_64"
565elif test "$machine" = "ppc"; then
566    platform="ppc"
567else
568    platform="unsupport"
569fi
570AC_MSG_RESULT($platform)
571
572# Check conditional packages.
573
574if test "$hpijs_only_build" = "no" && test "$network_build" = "yes" && test "$hpcups_only_build" = "no"; then
575#   AC_CHECK_LIB([crypto], [CRYPTO_free], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find net-snmp support (or --disable-network-build)], 4)])
576#   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)])
577#   AC_CHECK_HEADERS(net-snmp/net-snmp-config.h,, [AC_MSG_ERROR([cannot find net-snmp-devel support (or --disable-network-build)], 5)])
578
579   old_LIBS="$LIBS"
580   AC_CHECK_LIB([crypto], [CRYPTO_free],, [AC_MSG_ERROR([cannot find net-snmp support (or --disable-network-build)], 4)])
581   AC_CHECK_LIB([netsnmp], [snmp_timeout], [LIBS="$old_LIBS" AC_DEFINE([HAVE_LIBNETSNMP]) SNMPLIB="netsnmp"], check_ucd=yes)
582if test "$check_ucd" = "yes"; then
583   AC_CHECK_LIB([snmp], [snmp_timeout], [LIBS="$old_LIBS" AC_DEFINE([HAVE_LIBNETSNMP]) AC_DEFINE([HAVE_UCDSNMP]) SNMPLIB="snmp"],
584          [AC_MSG_ERROR([cannot find net/ucd-snmp support (or --disable-network-build)], 4)])
585   AC_CHECK_HEADERS(ucd-snmp/ucd-snmp-config.h,, [AC_MSG_ERROR([cannot find ucd-snmp-devel support (or --disable-network-build)], 5)])
586else
587   AC_CHECK_HEADERS(net-snmp/net-snmp-config.h,, [AC_MSG_ERROR([cannot find net-snmp-devel support (or --disable-network-build)], 5)])
588fi
589fi
590
591if test "$hpijs_only_build" = "no" && test "$pp_build" = "yes" && test "$hpcups_only_build" = "no"; then
592   AC_CHECK_HEADERS(linux/ppdev.h, ,[AC_MSG_ERROR([cannot find ppdev-devel support (or --disable-pp-build)], 8)])
593fi
594
595if test "$class_driver" = "no" && test "$hpijs_only_build" = "no" && test "$hpcups_only_build" = "no"; then
596   AC_CHECK_LIB([cups], [cupsDoFileRequest], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libcups support], 9)])
597   AC_CHECK_HEADERS(cups/cups.h, ,[AC_MSG_ERROR([cannot find cups-devel support], 3)])
598   if test "$libusb01_build" = "yes"; then
599      AC_CHECK_LIB([usb], [usb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb support], 2)])
600      AC_CHECK_HEADERS(usb.h, ,[AC_MSG_ERROR([cannot find libusb-devel support], 11)])
601   else
602      AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb 1.0 support], 2)])
603      AC_CHECK_HEADERS(libusb-1.0/libusb.h, ,[AC_MSG_ERROR([cannot find libusb-1.0-devel support], 11)])
604   fi
605fi
606
607SAVE_CPPFLAGS="$CPPFLAGS"
608CFLAGS=`python-config --includes`
609if [ $? -eq 0 ]
610then
611   echo $FLAGS
612else
613CFLAGS=`python3-config --includes`
614   if [ $? -eq 0 ]
615   then
616   echo $FLAGS
617   fi
618fi
619
620#CFLAGS=`(python-config --includes)`
621if test "$class_driver" = "no" && test "$hpijs_only_build" = "no" && test "$lite_build" = "no" && test "$hpcups_only_build" = "no"; then
622   AC_ARG_VAR([PYTHON], [Python interpreter/compiler command])
623   AM_PATH_PYTHON([2.2])
624   AC_MSG_CHECKING([for path to Python.h])
625   PYTHONINCLUDEDIR=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print (get_python_inc());"`
626   AC_MSG_RESULT("using $PYTHONINCLUDEDIR ....  python${PYTHON_VERSION}/Python.h")
627   AC_ARG_VAR(PYTHONINCLUDEDIR, [path to Python.h C header file])
628   AC_CHECK_HEADERS([python${PYTHON_VERSION}/Python.h python${PYTHON_VERSION}mu/Python.h python${PYTHON_VERSION}m/Python.h ],
629          [FOUND_HEADER=yes; break;])
630   AS_IF([test "x$FOUND_HEADER" != "xyes"],
631          [AC_MSG_ERROR([cannot find python-devel support], 6)])
632fi
633CFLAGS="$save_CFLAGS"
634
635if test "$hpijs_only_build" = "no" && test "$scan_build" = "yes" && test "$hpcups_only_build" = "no"; then
636   AC_CHECK_LIB([sane], [sane_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find sane-backends-devel support (or --disable-scan-build)], 12)])
637fi
638
639# The PKG_CHECK_MODULES macro requires the pkgconfig package (pkg-config). Otherwise you get a strange shell script error
640# "syntax error near upexpected token: DBUS".
641if test "$hpijs_only_build" = "no" && test "$lite_build" = "no" && test "$hpcups_only_build" = "no" && test "$dbus_build" = "yes"; then
642#   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)])
643   PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.0.0],,[AC_MSG_ERROR([cannot find dbus-devel support: $DBUS_PKG_ERRORS], 14)])
644   AC_CHECK_LIB([dbus-1], [dbus_connection_open], [LIBS="$LIBS" AC_DEFINE([HAVE_DBUS])], [AC_MSG_ERROR([cannot find libdbus support], 13)])
645fi
646
647if test "$hpijs_only_build" = "no" && test "$lite_build" = "no" && test "$hpcups_only_build" = "no" && test "$fax_build" = "yes" && test "$dbus_build" = "no"; then
648   AC_MSG_ERROR([fax requires dbus support], 15)
649fi
650
651# AC_DEFINE_DIR([DATADIR], [datadir])
652# Copyright © 2006 Stepan Kasal  <kasal@ucw.cz>
653# Copyright © 2006 Andreas Schwab <schwab@suse.de>
654# Copyright © 2006 Guido U. Draheim <guidod@gmx.de>
655# Copyright © 2006 Alexandre Oliva
656# Copying and distribution of this file, with or without modification, are permitted in any medium without
657# royalty provided the copyright notice and this notice are preserved.
658AC_DEFUN([AC_DEFINE_DIR], [
659  prefix_NONE=
660  exec_prefix_NONE=
661  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
662  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
663dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
664dnl refers to ${prefix}.  Thus we have to use `eval' twice.
665  eval ac_define_dir="\"[$]$2\""
666  eval ac_define_dir="\"$ac_define_dir\""
667  $1="$ac_define_dir"
668  test "$prefix_NONE" && prefix=NONE
669  test "$exec_prefix_NONE" && exec_prefix=NONE
670])
671
672AC_DEFINE_DIR([abs_datadir], [datadir])
673AC_DEFINE_DIR([abs_sbindir], [sbindir])
674AC_DEFINE_DIR([abs_hpppddir], [hpppddir])
675AC_DEFINE_DIR([abs_docdir], [hpdocdir])
676AC_DEFINE_DIR([abs_htmldir], [hphtmldir])
677abs_ppddir=${abs_hpppddir%/*}
678AC_DEFINE_DIR([abs_drvdir], [drvdir])
679
680AC_SUBST(abs_datadir)
681AC_SUBST(abs_sbindir)
682AC_SUBST(abs_hpppddir)
683AC_SUBST(abs_docdir)
684AC_SUBST(abs_htmldir)
685AC_SUBST(abs_ppddir)
686AC_SUBST(abs_drvdir)
687AC_SUBST(abs_mimedir)
688
689# AppArmor Changes
690AC_SUBST(apparmordir)
691AC_SUBST(apparmor_build)
692AC_SUBST(mimedir)
693AC_SUBST(icondir)
694AC_SUBST(systraydir)
695AC_SUBST(cupsbackenddir)
696AC_SUBST(cupsfilterdir)
697AC_SUBST(hpppddir)
698AC_SUBST(hpdocdir)
699AC_SUBST(hphtmldir)
700AC_SUBST(drvdir)
701AC_SUBST(network_build)
702AC_SUBST(pp_build)
703AC_SUBST(gui_build)
704AC_SUBST(class_driver)
705AC_SUBST(scan_build)
706AC_SUBST(fax_build)
707AC_SUBST(dbus_build)
708AC_SUBST(cups11_build)
709AC_SUBST(foomatic_drv_install)
710AC_SUBST(foomatic_ppd_install)
711AC_SUBST(foomatic_rip_hplip_install)
712AC_SUBST(foomatic_filter)
713AC_SUBST(cups_ppd_install)
714AC_SUBST(cups_drv_install)
715AC_SUBST(hpijs_install)
716AC_SUBST(hpcups_install)
717AC_SUBST(hpps_install)
718AC_SUBST(doc_build)
719AC_SUBST(shadow_build)
720AC_SUBST(libusb01_build)
721AC_SUBST(APDK_ENDIAN_FLAG)
722AC_SUBST(APDK_AUTO_INCLUDE_FLAG)
723AC_SUBST(ui_toolkit)
724AC_SUBST(platform)
725AC_SUBST(qt3)
726AC_SUBST(qt4)
727AC_SUBST(qt5)
728AC_SUBST(epm_foomatic_rip_hplip_install)
729AC_SUBST(epm_foomatic_ppd_install)
730AC_SUBST(epm_cups_ppd_install)
731AC_SUBST(epm_foomatic_drv_install)
732AC_SUBST(epm_cups_drv_install)
733AC_SUBST(epm_hpijs_install)
734AC_SUBST(epm_hpcups_install)
735AC_SUBST(epm_hpps_install)
736AC_SUBST(epm_qt5)
737AC_SUBST(epm_qt4)
738AC_SUBST(epm_qt3)
739AC_SUBST(epm_full)
740AC_SUBST(epm_lite)
741AC_SUBST(epm_hpcups_only)
742AC_SUBST(epm_hpijs_only)
743AC_SUBST(epm_print_only_exclude)
744AC_SUBST(epm_scan)
745AC_SUBST(policykit)
746AC_SUBST(policykit_dir)
747AC_SUBST(hpijs_only_build)
748AC_SUBST(lite_build)
749AC_SUBST(hpcups_only_build)
750AC_SUBST(SNMPLIB)
751AC_SUBST(prefix)
752AC_SUBST(udev_sysfs_rules)
753AC_SUBST(epm_class_driver)
754AC_SUBST(epm_class_install)
755
756AC_CONFIG_FILES(Makefile hplip.conf hplip.desktop hp-uiscan.desktop hplip-systray.desktop prnt/drv/hpijs.drv prnt/drv/hpcups.drv hplip.list data/policykit/com.hp.hplip.service)
757AC_OUTPUT
758