dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT(libgphoto2/gphoto2.h) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(libgphoto2, 2.1.3dev6) AM_MAINTAINER_MODE AC_LIBTOOL_DLOPEN dnl --------------------------------------------------------------------------- dnl Versioning: dnl - AGE (Micro): Increment if any interfaces have been added; set to 0 dnl if any interfaces have been removed. Removal has dnl precedence over adding, so set to 0 if both happened. dnl - REVISION (Minor): Increment any time the source changes; set to dnl 0 if you incremented CURRENT. dnl - CURRENT (Major): Increment if the interface has additions, changes, dnl removals. dnl --------------------------------------------------------------------------- LIBGPHOTO2_AGE=3 LIBGPHOTO2_REVISION=0 LIBGPHOTO2_CURRENT=2 AC_SUBST(LIBGPHOTO2_AGE) AC_SUBST(LIBGPHOTO2_REVISION) AC_SUBST(LIBGPHOTO2_CURRENT) LIBGPHOTO2_VERSION_INFO=`expr $LIBGPHOTO2_CURRENT + $LIBGPHOTO2_REVISION`:$LIBGPHOTO2_AGE:$LIBGPHOTO2_REVISION AC_SUBST(LIBGPHOTO2_VERSION_INFO) dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_DEFINE_UNQUOTED(HAVE_CC,"$CC",[The C compiler we're using]) dnl --------------------------------------------------------------------------- dnl Reference definitions dnl required before we do the Makevars hack! dnl --------------------------------------------------------------------------- GP_REFERENCES()dnl dnl --------------------------------------------------------------------------- dnl i18n support (including some hacks) dnl --------------------------------------------------------------------------- dnl The following is a hack to get gphoto2 to build on gettext-0.10.35 dnl systems - BUILD_INCLUDED_LIBINTL is set only in gettext-0.10.37 which is dnl the gettext version provided with gphoto2. BUILD_INCLUDED_LIBINTL=no AC_SUBST(BUILD_INCLUDED_LIBINTL) dnl USE_INCLUDED_LIBINTL=no dnl AC_SUBST(USE_INCLUDED_LIBINTL) ALL_LINGUAS="da de es fr hu it ja no ru sl sv uk zh_CN" # EVIL HACKS AC_MSG_CHECKING([for po/Makevars requiring evil hack]) GETTEXT_PACKAGE="${PACKAGE}-${LIBGPHOTO2_CURRENT}" AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The gettext domain we're using]) AC_SUBST(GETTEXT_PACKAGE) if test -f po/Makevars.template then sed \ -e "s/^DOMAIN.*/DOMAIN = ${GETTEXT_PACKAGE}/" \ -e "s/^MSGID_BUGS_ADDRESS.*/MSGID_BUGS_ADDRESS = ${MAIL_GPHOTO_TRANSLATION}/" \ < po/Makevars.template > po/Makevars AC_MSG_RESULT([yes. done.]) else AC_MSG_RESULT([no]) fi AM_GNU_GETTEXT AC_CHECK_FUNC(gettext, gettext_without_libintl=true) # same trick as with libdl: # if gettext() doesn't require linking against libintl, # we don't have to check for gettext in libintl. Otherwise # we may even require libintl. dnl AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"]) if test "$gettext_without_libintl" != "true" -a "$USE_NLS" = "yes"; then AC_CHECK_LIB(intl, gettext, [INTLLIBS="$INTLLIBS -lintl"]) fi dnl --------------------------------------------------------------------------- dnl Turn on debugging and all warnings when using gcc dnl --------------------------------------------------------------------------- if test "$ac_cv_prog_gcc" = "yes"; then CFLAGS="$CFLAGS -g -Wall -Wmissing-declarations -Wmissing-prototypes" LDFLAGS="$LDFLAGS -g -Wall" fi dnl Replace `main' with a function in -libs: AC_CHECK_LIB(ibs, main) LIBJPEG="" libjpeg_msg="no" AC_SUBST(LIBJPEG) AC_CHECK_LIB(jpeg,jpeg_start_decompress,[ AC_CHECK_HEADER(jpeglib.h,[ AC_DEFINE(HAVE_LIBJPEG,1,[define if we found LIBJPEG and its headers]) LIBJPEG="-ljpeg" libjpeg_msg="yes" ]) ]) dnl --------------------------------------------------------------------------- dnl Checks for header files. dnl --------------------------------------------------------------------------- AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(getopt.h unistd.h mcheck.h) AC_INLINE AC_CONST dnl --------------------------------------------------------------------------- dnl Check for libtool: lt_dlforeachfile has been introduced in dnl libtool-1.4. However, there are still systems out dnl there running libtool-1.3. For those, we will need dnl dlopen. Note that on some systems (e.g. FreeBSD) dnl -ldl isn't needed. dnl --------------------------------------------------------------------------- AC_PROG_LIBTOOL have_ltdl=false ltdl_msg="no" try_ltdl=false AC_ARG_WITH(ltdl, [ --with-ltdl Use ltdl],[ if test x$withval = xyes; then try_ltdl=true fi]) if $try_ltdl; then AC_CHECK_LIB(ltdl, lt_dlforeachfile,[ AC_CHECK_HEADER(ltdl.h,[ AC_DEFINE(HAVE_LTDL,1,[whether we use libltdl]) LTDL_LIBS="-lltdl" ltdl_msg="yes" have_ltdl=true])]) fi if ! $have_ltdl; then AC_CHECK_FUNC(dlopen,,[ AC_CHECK_LIB(dl, dlopen,[LTDL_LIBS="-ldl"],[AC_ERROR([ *** Could not determine how to handle *** shared libraries!])])]) fi AC_SUBST(LTDL_LIBS) dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T dnl Checks for library functions. AC_CHECK_FUNCS([getopt getopt_long mkdir strdup strncpy strcpy snprintf sprintf vsnprintf]) dnl Find out how to get struct tm AC_STRUCT_TM dnl Check for tm_gmtoff in struct tm AC_MSG_CHECKING([for tm_gmtoff in struct tm]) AC_TRY_COMPILE([ #include #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;], AC_DEFINE(HAVE_TM_GMTOFF,1,[whether struct tm has tm_gmtoff field]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ) dnl Create a stdint.h-like file containing size-specific integer definitions dnl that will always be available AC_NEED_STDINT_H(libgphoto2/_stdint.h) dnl Create a header file containing NetBSD-style byte swapping macros AC_NEED_BYTEORDER_H(libgphoto2/gphoto2-endian.h) dnl Solaris hack for grep and tr [ if test -n "`echo $host_os | grep '[sS]olaris'`"; then TR=/usr/xpg4/bin/tr GREP=/usr/xpg4/bin/grep else TR=tr GREP=grep fi ] dnl --------------------------------------------------------------------------- dnl camlib directory dnl --------------------------------------------------------------------------- AC_MSG_CHECKING(where to install camlibs) AC_ARG_WITH(camlibdir, [ --with-camlibdir= install camlibs in directory ], camlibdir="$withval", camlibdir='${libdir}/gphoto2/${VERSION}') AC_MSG_RESULT("$camlibdir") AC_SUBST(camlibdir) dnl --------------------------------------------------------------------------- dnl Camera drivers dnl --------------------------------------------------------------------------- camlibs='agfa-cl20 barbie canon casio digita dimera directory fuji gsmart300 jamcam jd11 kodak konica largan minolta mustek panasonic pccam300 pccam600 polaroid ptp2 ricoh samsung sierra sipix smal sonydscf1 sonydscf55 soundvision spca50x sq905 stv0674 stv0680 sx330z toshiba' AC_SUBST(SUBDIRS_CAMLIBS) for i in $camlibs; do d=`echo $i | $TR a-z- A-Z_` eval "CONFIG_DRIVER_$d=n" done AC_MSG_CHECKING(which drivers to compile) AC_ARG_WITH(drivers, [ --with-drivers= compile drivers in ; ] [ drivers may be separated with commas; ] [ 'all' compiles all drivers; ] [ possible drivers are: ] [ agfa-cl20, barbie, canon, casio, digita, dimera,] [ directory, fuji, gsmart300, jamcam,] [ jd11, kodak, konica, mustek, largan,] [ minolta, panasonic, pccam300, pccam600,] [ polaroid, ptp2, ricoh, samsung, smal,] [ sierra, sipix, sonydscf1, sonydscf55,] [ soundvision, spca50x, sq905, stv0680, sx330z ], drivers="$withval", drivers="all") if test "$drivers" = "all"; then for i in $camlibs; do SUBDIRS_CAMLIBS="$SUBDIRS_CAMLIBS $i" done AC_MSG_RESULT(all) else drivers=`echo $drivers | sed 's/,/ /g'` for driver in $drivers; do if test -n "`echo $camlibs | $GREP -E \"(^| )$driver( |\$)\"`"; then SUBDIRS_CAMLIBS="$SUBDIRS_CAMLIBS $driver" else AC_ERROR(Unknown driver $driver!) fi done AC_MSG_RESULT($drivers) fi dnl ************************************************************ dnl find out where to install documentation files dnl ************************************************************ GP_CHECK_DOC_DIR()dnl dnl ******** dnl build docs? dnl ******** GP_BUILD_DOCS()dnl dnl ************************************************************ dnl initialize packaging dnl ************************************************************ GPKG_CHECK_RPM()dnl Check wether to package for a system using RPM GPKG_CHECK_LINUX()dnl Check wether to package for a linux system dnl --------------------------------------------------------------------------- dnl pkg-config: pkg-config is a tool to simplify checks for libraries and dnl versions. I really think this is a good thing and therefore dnl use it here. However, if pkg-config is not installed, dnl we offer alternative checks, too. dnl --------------------------------------------------------------------------- pkgconfig_msg="no (http://www.freedesktop.org/software/pkgconfig)" try_pkgconfig=true have_pkgconfig=false AC_ARG_WITH(pkgconfig, [ --without-pkgconfig Don't use pkg-config],[ if test x$withval = xno; then try_pkgconfig=false pkgconfig_msg="no (not requested)" fi]) if $try_pkgconfig; then AC_PATH_PROG(PKG_CONFIG,pkg-config) if test -n "${PKG_CONFIG}"; then have_pkgconfig=true pkgconfig_msg="yes" fi fi # guessing directory to install *.pc into pkgconfigdir='${libdir}/pkgconfig' AC_SUBST(pkgconfigdir) dnl --------------------------------------------------------------------------- dnl libexif: The CameraFilesystem can use libexif for extracting thumbnails dnl out of EXIF data. Similarly, it can extract the mtime of dnl a file. dnl libexif is available from dnl http://www.sourceforge.net/projects/libexif dnl --------------------------------------------------------------------------- exif_msg="no (http://www.sourceforge.net/projects/libexif)" try_exif=true have_exif=false AC_ARG_WITH(exif, [ --without-exif Don't use libexif],[ if test x$withval = xno; then try_exif=false exif_msg="no (not requested)" fi]) if test "x$prefix" = xNONE; then exif_prefix=$ac_default_prefix else exif_prefix=$prefix fi AC_ARG_WITH(exif-prefix, [ --with-exif-prefix=PREFIX Location of libexif],[ exif_prefix="$withval"]) if $try_exif; then if $have_pkgconfig; then AC_MSG_CHECKING([for libexif using pkg-config]) if ${PKG_CONFIG} --exists libexif > /dev/null 2>&1; then EXIF_CFLAGS=`$PKG_CONFIG --cflags libexif` EXIF_LIBS=`$PKG_CONFIG --libs libexif` have_exif=true libexif_version=`${PKG_CONFIG} --modversion libexif` libexif_prefix=`${PKG_CONFIG} --variable=prefix libexif` exif_msg="yes (version ${libexif_version} from ${libexif_prefix})" AC_DEFINE(HAVE_EXIF,1,[whether we use libexif]) fi AC_MSG_RESULT($exif_msg) else CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="-I$exif_prefix/include/libexif -I$exif_prefix/include $CPPFLAGS" AC_CHECK_HEADER(exif-data.h, [ EXIF_CFLAGS="-I$exif_prefix/include -I$exif_prefix/include/libexif" EXIF_LIBS="-L$exif_prefix/lib -lexif" have_exif=true exif_msg="yes (unknown version from standard location)" AC_DEFINE(HAVE_EXIF,1,[whether we use libexif])]) fi if $have_exif; then CPPFLAGS_save="$CPPFLAGS" CPPFLAGS=$EXIF_CFLAGS AC_CHECK_HEADER([exif-ifd.h], [ exif_msg="${exif_msg}, (>= 0.5.4)" AC_DEFINE(HAVE_EXIF_0_5_4,1,[whether we use a version of libexif greater than 0.5.3])]) CPPFLAGS="$CPPFLAGS_save" fi fi AM_CONDITIONAL(HAVE_EXIF, $have_exif) AC_SUBST(EXIF_CFLAGS) AC_SUBST(EXIF_LIBS) dnl Check libusb AC_PATH_PROG(LIBUSB_CONFIG,libusb-config) if test -n "${LIBUSB_CONFIG}"; then AM_CONDITIONAL(HAVE_LIBUSB,true) else AM_CONDITIONAL(HAVE_LIBUSB,false) fi dnl --------------------------------------------------------------------------- dnl /proc/meminfo: If the meminfo /proc entry is available, we use it dnl to limit the libgphoto2 filesystem cache size. dnl --------------------------------------------------------------------------- if test "$cross_compiling" != yes; then AC_CHECK_FILE(/proc/meminfo, [ proc_meminfo_msg="available"; proc_meminfo=true; AC_DEFINE(HAVE_PROCMEMINFO,1,[whether we get memory info from /proc/meminfo]) ], [ proc_meminfo_msg="not available"; proc_meminfo=false; ]) else proc_meminfo_msg="state not known, cross-compilation"; proc_meminfo=false; fi dnl Check for sysctl() AC_MSG_CHECKING([for sysctl on BSD]) AC_TRY_COMPILE([ #ifdef __FreeBSD__ # include #elif (__NetBSD__ || __OpenBSD__) # include #endif #include #include ], [int mib[2] = { CTL_HW, HW_PHYSMEM }; int value; size_t valuelen = sizeof(value); sysctl(mib, 2 , &value, &valuelen, NULL, 0)], AC_DEFINE(HAVE_SYSCTL,1,[whether we may use sysctl]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ) dnl --------------------------------------------------------------------------- dnl Configure libgphoto2-port dnl --------------------------------------------------------------------------- AC_CONFIG_SUBDIRS(libgphoto2_port) AC_OUTPUT([ README Makefile camlibs/Makefile camlibs/agfa-cl20/Makefile camlibs/barbie/Makefile camlibs/canon/Makefile camlibs/canon/doc/Makefile camlibs/casio/Makefile camlibs/digita/Makefile camlibs/dimera/Makefile camlibs/directory/Makefile camlibs/fuji/Makefile camlibs/gsmart300/Makefile camlibs/jamcam/Makefile camlibs/jd11/Makefile camlibs/kodak/Makefile camlibs/kodak/dc120/Makefile camlibs/kodak/dc210/Makefile camlibs/kodak/dc240/Makefile camlibs/kodak/dc3200/Makefile camlibs/konica/Makefile camlibs/konica/localization/Makefile camlibs/largan/Makefile camlibs/largan/lmini/Makefile camlibs/minolta/Makefile camlibs/minolta/dimagev/Makefile camlibs/mustek/Makefile camlibs/panasonic/Makefile camlibs/panasonic/l859/Makefile camlibs/panasonic/coolshot/Makefile camlibs/pccam300/Makefile camlibs/pccam600/Makefile camlibs/polaroid/Makefile camlibs/ptp2/Makefile camlibs/ricoh/Makefile camlibs/samsung/Makefile camlibs/sierra/Makefile camlibs/sipix/Makefile camlibs/smal/Makefile camlibs/sonydscf1/Makefile camlibs/sonydscf55/Makefile camlibs/soundvision/Makefile camlibs/spca50x/Makefile camlibs/sq905/Makefile camlibs/stv0674/Makefile camlibs/stv0680/Makefile camlibs/sx330z/Makefile camlibs/toshiba/Makefile camlibs/toshiba/pdrm11/Makefile tests/Makefile libgphoto2/Makefile libgphoto2/libgphoto2.pc gphoto2-config packaging/Makefile packaging/linux-hotplug/Makefile packaging/rpm/Makefile packaging/rpm/package.spec doc/Makefile doc/api/Makefile ]) if test "x$CDPATH" != "x" then echo echo "***********************************************************" echo "* You have CDPATH set. You may have to run \"unset CDPATH\" *" echo "* before running \"make dist\" or \"make rpm\". *" echo "***********************************************************" fi echo " Configuration (libgphoto2): Source code location: ${srcdir} Version: ${VERSION} Compiler: ${CC} Build API documentation: $gtkdoc_msg pkg-config: $pkgconfig_msg EXIF support: $exif_msg JPEG mangling support: $libjpeg_msg Use ltdl.h: $ltdl_msg /proc/meminfo: $proc_meminfo_msg " # Build User's Manual: $manual_msg echo " Please check whether the configuration I detected matches what you would like to have. E.g. make sure that USB support is there if you intend to use USB cameras with $PACKAGE. Please also check that PKG_CONFIG_PATH contains ${pkgconfigdir} before compiling any libgphoto2 frontend. "