3 dnl Redundancy free definition of libgphoto2 camlibs.
5 dnl Removes the redundany from the camlib lists, and executes
6 dnl additional consistency checks, e.g. to ensure that subdirectories
9 dnl You can mark camlibs as obsolete, i.e. they won't be listed
10 dnl explicitly but still be recognized.
14 dnl GP_CAMLIB([canon])
15 dnl GP_CAMLIB([casio])
17 dnl GP_CAMLIB([ptp],[obsolete])
20 dnl GP_CAMLIB([toshiba])
21 dnl GP_CAMLIBS_DEFINE([camlibs])
23 dnl The camlibs basedir parameter of GP_CAMLIBS_DEFINE is optional.
25 dnl ####################################################################
27 AC_DEFUN([GP_CAMLIBS_INIT],[dnl
28 AC_BEFORE([$0],[GP_CAMLIB])dnl
29 m4_define_default([gp_camlib_srcdir], [camlibs])dnl
30 m4_define_default([gp_camlibs], [])dnl
31 m4_define_default([gp_camlibs_obsolete], [])dnl
34 dnl ####################################################################
36 AC_DEFUN([GP_CAMLIB],[dnl
37 AC_REQUIRE([GP_CAMLIBS_INIT])dnl
38 AC_BEFORE([$0],[GP_CAMLIBS_DEFINE])dnl
39 m4_if([$2],[obsolete],[dnl
41 m4_append([gp_camlibs_obsolete], [$1], [ ])dnl
44 m4_append([gp_camlibs], [$1], [ ])dnl
46 m4_errprint(__file__:__line__:[ Error:
47 *** Illegal parameter 2 to $0: `$2'
48 *** Valid values are: undefined or [obsolete]
54 dnl ####################################################################
56 AC_DEFUN([GP_CAMLIBS_DEFINE],[dnl
57 AC_REQUIRE([GP_CAMLIBS_INIT])dnl
58 m4_pattern_allow([m4_strip])dnl
59 m4_ifval([$1],[m4_define([gp_camlib_srcdir],[$1])])dnl
60 dnl for camlib in m4_strip(gp_camlibs) m4_strip(gp_camlibs_obsolete)
62 dnl if test -d "$srcdir/m4_strip(gp_camlib_srcdir)/$camlib"; then :; else
65 dnl * Source subdirectory for camlib \`$camlib' not found in
66 dnl * directory \`$srcdir/m4_strip(gp_camlib_srcdir)/'
70 AC_MSG_CHECKING([which drivers to compile])
71 dnl Yes, that help output won't be all that pretty, but we at least
72 dnl do not have to edit it by hand.
73 AC_ARG_WITH([drivers],[AS_HELP_STRING(
74 [--with-drivers=<list>],
75 [Compile drivers in <list>. ]dnl
76 [Drivers may be separated with commas. ]dnl
77 ['all' is the default and compiles all drivers. ]dnl
78 [Possible drivers are: ]dnl
79 m4_strip(gp_camlibs))],
83 ALL_DEFINED_CAMLIBS="m4_strip(gp_camlibs) m4_strip(gp_camlibs_obsolete)"
84 ALL_CURRENT_CAMLIBS="m4_strip(gp_camlibs)"
85 BUILD_THESE_CAMLIBS_BASE=""
86 if test "$drivers" = "all"; then
87 BUILD_THESE_CAMLIBS_BASE="$ALL_CURRENT_CAMLIBS"
90 # drivers=$(echo $drivers | sed 's/,/ /g')
93 for driver in $drivers; do
96 for camlib in ${ALL_DEFINED_CAMLIBS}; do
97 if test "$driver" = "$camlib"; then
98 BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE $driver"
103 if $found; then :; else
104 AC_MSG_ERROR([Unknown driver $driver!])
107 if test "x$BUILD_THESE_CAMLIBS_BASE" = "x canon" ; then
108 # Gentoo mode... if user just said "canon", add "ptp2" ... should save support requests.
109 BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE ptp2"
110 camlibs="$camlibs ptp2"
112 You have just selected the old canon driver. However most current Canons
113 are supported by the PTP2 driver.
114 Autoselecting ptp2 driver too to avoid support requests.
118 AC_MSG_RESULT([$drivers])
120 BUILD_THESE_CAMLIBS=""
121 for f in $BUILD_THESE_CAMLIBS_BASE
123 BUILD_THESE_CAMLIBS="${BUILD_THESE_CAMLIBS}${BUILD_THESE_CAMLIBS+ }${f}.la"
125 AC_SUBST([BUILD_THESE_CAMLIBS])
126 AC_SUBST([ALL_DEFINED_CAMLIBS])
127 AC_SUBST([ALL_CURRENT_CAMLIBS])
130 dnl ####################################################################