From 898ff8fe4b241da50a8b3dcbca80acf99e445694 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Thu, 14 Apr 2005 18:14:09 +0000 Subject: [PATCH] first part of new build system git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@7829 67ed7778-7388-44ab-90cf-0a291f65f57c --- Makefile.am | 2 +- autogen.sh | 578 ++++++++++++++------ configure.in | 2 +- libgphoto2/Makefile.am | 33 +- libgphoto2_port/Makefile.am | 2 +- libgphoto2_port/configure.in | 326 +++++------ libgphoto2_port/libgphoto2_port/Makefile.am | 30 +- 7 files changed, 600 insertions(+), 373 deletions(-) diff --git a/Makefile.am b/Makefile.am index f10f5d8a5..f35fbd9af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ bin_SCRIPTS = gphoto2-config EXTRA_DIST = HACKING MAINTAINERS makefile.os2 os2mak.inc TESTERS CHANGES -SUBDIRS = libgphoto2_port libgphoto2 camlibs tests po packaging doc +SUBDIRS = @subdirs@ libgphoto2 camlibs tests po packaging doc doc_DATA = AUTHORS COPYING README CHANGES NEWS diff --git a/autogen.sh b/autogen.sh index 521bc7a47..1f7547abc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,192 +1,428 @@ #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# This was lifted from the Gimp, and adapted slightly by -# Raph Levien. -# Since then, it has been rewritten quite a lot by misc. people. +# autogen.sh - initialize and clean automake&co based build trees +# +# For more detailed info, run "autogen.sh --help" or scroll down to the +# print_help() function. -# Call this file with AUTOCONF_SUFFIX and AUTOMAKE_SUFFIX set -# if you want us to call a specific version of autoconf or automake. -# E.g. if you want us to call automake-1.6 instead of automake (which -# seems to be quite advisable if your automake is not already version -# 1.6) then call this file with AUTOMAKE_SUFFIX set to "-1.6". -# Cases which are known to work: -# 2002-07-14: Debian GNU/Linux unstable with: -# autoconf 2.53 -# automake 1.4-p5 and 1.6 (both) -# gettext 0.10.40 -# libtool 1.4.2a -# 2002-07-14: Redhat Linux 7.3 with: -# autoconf 2.53 -# automake 1.5 (not 1.4-p5) -# gettext 0.11.1 -# libtool 1.4.2 - -DIE=0 -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. -test "$srcdir" = "." && srcdir=`pwd` - -PROJECT=libgphoto2 - -# failure subroutine. -# syntax: do-something || fail -fail() { - status=$? - echo "Last command failed with status $status in directory $(pwd)." - echo "Aborting." - exit $status -} - -(autoconf${AUTOCONF_SUFFIX} --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile $PROJECT." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/gnu/autoconf/" - DIE=1 -} - -(libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to compile $PROJECT." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/gnu/libtool/" - DIE=1 -} - -(automake${AUTOMAKE_SUFFIX} --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have automake installed to compile $PROJECT." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/gnu/automake/" - DIE=1 -} - -(gettextize --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have gettext installed to compile $PROJECT." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/gnu/gettext/" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 +if test "$(pwd)" != "`pwd`" +then + echo "Urgh. Dinosaur shell, eh?" + exit 1 fi -test -f libgphoto2/gphoto2.h || { - echo "You must run this script in the top-level $PROJECT directory" - exit 1 + +######################################################################## +# Constant and initial values + +debug=false +self="$(basename "$0")" +autogen_version="0.3.2" + + +######################################################################## +# Print help message + +print_help() { + cat<...] [...] + +Runs given command sequence on all given directories, in sequence. +If there is no command given, --init is assumed. +If there is no directory given, the location of $self is assumed. + +Commands: + --help + Print this help text + --version + Print the tool versions + --verbose + Verbose output + + --clean + Clean all files and directories generated by "$self --init" + --init + Converts untouched CVS checkout into a build tree which + can be processed further by running the classic + ./configure && make && make install + +$self depends on automake, autoconf, libtool and gettext. + +You may want to set AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL, +AUTOPOINT, LIBTOOLIZE to use specific version of these tools, and +AUTORECONF_OPTS to add options to the call to autoreconf. +EOF } -case "$CC" in -*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; -esac -ACLOCAL_FLAGS="-I ${srcdir}/libgphoto2_port/m4 ${ACLOCAL_FLAGS}" +######################################################################## +# Print software versions -gettext_version=`gettextize --version 2>&1 | sed -n 's/^.*GNU gettext.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -case $gettext_version in -0.10.*) - ;; -*) - gettext_opt="$gettext_opt --no-changelog --intl";; -esac - -# Clean automake stuff; must be done *before* subprojects -find . -name '*.am' | -while read file -do # remove all .in files with a corresponding .am file - rm -f $(echo "$file" | sed s/\.am\$/.in/g) -done - -# do not change the sequence without understanding the implications -for dir in libgphoto2_port . -do -( - cd "$dir" || fail - echo "Processing ${dir} aka $(pwd)" - - # We explicitly delete files and directories which are not contained - # in the CVS repository and which are generated by the build tools - # called here. - # This makes changing build tool versions much easier, and removes - # the need for any --force parameters to the build tools which may - # do something we do want or something we do not. - - echo "Cleaning stuff generated by gettextize" - rm -f po/Makevars.template po/Makevars po/Makefile.in.in ABOUT-NLS - for file in codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 \ - lcmessage.m4 progtest.m4 +print_versions() { + echo "${self} (ndim's autogen) ${autogen_version}" + for tool in \ + "${AUTOCONF-autoconf}" \ + "${AUTOMAKE-automake}" \ + "${AUTOPOINT-autopoint}" \ + "${LIBTOOLIZE-libtoolize}" do - rm -f "m4/$file" + "$tool" --version 2>&1 | sed '1q' done - rm -rf intl/ - grep "intl/Makefile" configure.in > /dev/null && - ( sed -e 's#^AC_OUTPUT(\[.*intl/Makefile po/Makefile.in#AC_OUTPUT(\[#' \ - configure.in >configure.in.new && mv configure.in.new configure.in ) - grep "SUBDIRS.*intl" Makefile.am > /dev/null && - ( sed -e 's#\(^SUBDIRS.*\) intl#\1#' Makefile.am >Makefile.am.new \ - && mv Makefile.am.new Makefile.am ) +} - echo "Running gettextize $gettext_opt" - echo "########################################################################" - echo "# If gettextize asks you to acknowledge some stuff and press Return, #" - echo "# just do that. autogen.sh already does what gettextize wants done. #" - echo "########################################################################" - gettextize $gettext_opt || fail - if test -f po/Makevars.template - then - cp po/Makevars.template po/Makevars + +######################################################################## +# Initialize variables for configure.{in,ac} in $1 + +init_vars() { + dir="$1" + echo -n "Looking for \`${dir}/configure.{ac,in}'..." + # There are shells which don't understand {,} wildcards + CONFIGURE_AC="" + for tmp in "${dir}/configure.ac" "${dir}/configure.in"; do + if test -f "$tmp"; then + CONFIGURE_AC="$tmp" + echo " $tmp" + break + fi + done + if test "x$CONFIGURE_AC" = "x"; then + echo " no." + exit 1 fi - case $gettext_version in - 0.11.?) - ;; - *) - grep "intl/Makefile" configure.in > /dev/null || - ( sed -e 's#^AC_OUTPUT(\[#AC_OUTPUT(\[ intl/Makefile po/Makefile.in#' \ - configure.in >configure.in.new && mv configure.in.new configure.in ) - grep "SUBDIRS.*intl" Makefile.am > /dev/null || - ( sed -e 's#\(^SUBDIRS.*\)$#\1 intl#' Makefile.am >Makefile.am.new \ - && mv Makefile.am.new Makefile.am ) + if "$debug"; then + if test "$(uname -o)" = "Cygwin"; then + # Cygwin autoreconf doesn't understand -Wall + AUTORECONF_OPTS="$AUTORECONF_OPTS --verbose" + else + AUTORECONF_OPTS="$AUTORECONF_OPTS --verbose -Wall" + fi + fi + + echo -n "Initializing variables for \`${dir}'..." + # FIXME: Just getting those directories and cleaning them isn't enough. + # OK, the "init" part is done recursively by autopoint, so that is easy. + # But the cleaning should also work recursively, but that is difficult + # with the current structure of the script. + AG_SUBDIRS="$(for k in $(sed -n 's/^[[:space:]]*AC_CONFIG_SUBDIRS(\[\{0,1\}\([^])]*\).*/\1/p' "$CONFIGURE_AC"); do echo "${dir}/${k}"; done)" + AG_LIBLTDL_DIR="$(sed -n 's/^[[:space:]]*AC_LIBLTDL_\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\2/p' < "$CONFIGURE_AC")" + if test "x$AG_LIBLTDL_DIR" = "x"; then + tmp="$(sed -n 's/^[[:space:]]*\(AC_LIBLTDL_\)\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")" + if test "x$tmp" = "xAC_LIBLTDL_"; then + AG_LIBLTDL_DIR="libltdl" + else + AG_LIBLTDL_DIR="" + fi + fi + AG_AUX="$(sed -n 's/^AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")" + if test "x$AG_AUX" = "x"; then + AG_AUX="." + fi + AG_CONFIG_H="$(sed -n 's/^\(A[CM]_CONFIG_HEADERS\?\)(\[\{0,1\}\([^]),]*\).*/\2/p' < "$CONFIGURE_AC")" + AG_CONFIG_K="$(sed -n 's/^\(A[CM]_CONFIG_HEADERS\?\)(\[\{0,1\}\([^]),]*\).*/\1/p' < "$CONFIGURE_AC")" + if echo "x$AG_CONFIG_H" | grep -q ':'; then + echo "$AG_CONFIG_K contains unsupported \`:' character: \`$AG_CONFIG_H'" + exit 13 + fi + if test "x$AG_CONFIG_H" != "x"; then + AG_CONFIG_DIR="$(dirname "${AG_CONFIG_H}")" + AG_GEN_CONFIG_H="${AG_CONFIG_H} ${AG_CONFIG_H}.in ${AG_CONFIG_DIR}/stamp-h1 ${AG_CONFIG_DIR}/stamp-h2" + else + AG_CONFIG_DIR="" + AG_GEN_CONFIG_H="" + fi + for d in "$AG_AUX" "$AG_CONFIG_DIR"; do + if test -n "$d" && test ! -d "$d"; then + mkdir "$d" + fi + done + AG_GEN_ACAM="aclocal.m4 configure $AG_AUX/config.guess $AG_AUX/config.sub $AG_AUX/compile" + AG_GEN_RECONF="$AG_AUX/install-sh $AG_AUX/missing $AG_AUX/depcomp" + AG_GEN_LIBTOOL="$AG_AUX/ltmain.sh libtool" + while read file; do + AG_GEN_LIBTOOL="${AG_GEN_LIBTOOL} ${AG_LIBLTDL_DIR}/${file}" + done <>" + ${LIBTOOLIZE-"libtoolize"} --ltdl + # And we have to clean up the generated files after libtoolize because + # - we still want symlinks for the files + # - but we want to (implicitly) AC_CONFIG_SUBDIR and that writes to + # these files. + (cd "${AG_LIBLTDL_DIR}" && rm -f aclocal.m4 config.guess config.sub configure install-sh ltmain.sh Makefile.in missing) + fi + echo "Running <<" autoreconf --install --symlink ${AUTORECONF_OPTS} ">>" + if autoreconf --install --symlink ${AUTORECONF_OPTS}; then + :; else + status="$?" + echo "autoreconf quit with exit code $status, aborting." + exit "$status" + fi + echo "You may run ./configure now in \`${dir}'." + echo "Run as \"./configure --help\" to find out about config options." +else + exit "$?" +fi +) + # Just error propagation + status="$?" + echo "$self:init: Left directory \`${dir}'" + if test "$status" -ne "0"; then + exit "$status" + fi +} + + +######################################################################## +# Parse command line. +# This still accepts more than the help text says it does, but that +# isn't supported. + +commands="init" # default command in case none is given +pcommands="" +check_versions=false +dirs="$(dirname "$0")" +#dirs="$(cd "$dirs" && pwd)" +pdirs="" +# Yes, unquoted $@ isn't space safe, but it works with simple shells. +for param in $@; do + case "$param" in + --clean) + pcommands="$pcommands clean" + ;; + --init) + pcommands="$pcommands init" + check_versions=: + ;; + --verbose) + debug="true" + ;; + --version) + print_versions + exit 0 + ;; + -h|--help) + print_help + exit 0 + ;; + -*) + echo "Unhandled $self option: $param" + exit 1 + ;; + *) + pdirs="${pdirs} ${param}" + ;; esac +done +if test "x$pcommands" != "x"; then + # commands given on command line? use them! + commands="$pcommands" +else + check_versions=: +fi +if test "x$pdirs" != "x"; then + # dirs given on command line? use them! + dirs="$pdirs" +fi - echo "Cleaning stuff generated by libtoolize" - rm -f ltmain.sh config.guess config.sub +if "$check_versions"; then + # check tool versions + errors=false + lf=" +" + while read tool minversion; do + version="$("$tool" --version | sed 's/^.*(.*) *\(.*\)$/\1/g;1q')" + first="$(echo "$version$lf$minversion" | sort -n | sed '1q')" + if test "x$minversion" != "x$first" && test "x$version" = "x$first"; then + echo "Version \`$version' of \`$tool' not sufficient. At least \`$minversion' required." + errors=: + fi + done < po/Makevars - AC_MSG_RESULT([yes. done.]) -else - AC_MSG_RESULT([no]) -fi -AM_GNU_GETTEXT -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 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. +dnl BUILD_INCLUDED_LIBINTL=no +dnl AC_SUBST(BUILD_INCLUDED_LIBINTL) +dnl USE_INCLUDED_LIBINTL=no +dnl AC_SUBST(USE_INCLUDED_LIBINTL) + +GP_GETTEXT_HACK([${PACKAGE}-${LIBGPHOTO2_PORT_CURRENT}],[Lutz Mueller and others]) +ALL_LINGUAS="cs da de fr es it ja nb pt_BR ru sl sv uk zh_CN" +AM_GNU_GETTEXT_VERSION([0.14.1]) +AM_GNU_GETTEXT([external]) +AM_PO_SUBDIRS() +AM_ICONV() AC_CHECK_FUNC(gettext, gettext_without_libintl=true) # same trick as with libdl in libgphoto2: @@ -116,24 +94,31 @@ if test "$gettext_without_libintl" != "true" -a "$USE_NLS" = "yes"; then AC_CHECK_LIB(intl, gettext, [INTLLIBS="$INTLLIBS -lintl"]) fi -dnl Turn on debugging and catch GNU features incompatible with ANSI C. -if test "$ac_cv_prog_gcc" = "yes"; then - CFLAGS="$CFLAGS -g -Wall -Wmissing-declarations -Wmissing-prototypes" - LDFLAGS="$LDFLAGS -g -Wall" -fi +dnl --------------------------------------------------------------------------- dnl Checks for header files. +dnl --------------------------------------------------------------------------- AC_HEADER_DIRENT AC_HEADER_STDC -AC_INLINE -AC_CONST +AC_C_INLINE([]) +AC_C_CONST([]) AC_CHECK_HEADERS(stdlib.h unistd.h stdio.h fcntl.h errno.h sys/time.h \ sys/param.h termios.h sgetty.h ttold.h ioctl-types.h \ fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h unistd.h \ endian.h byteswap.h asm/io.h) +dnl FIXME: Provide regex.h with the corresponding object code for +dnl platforms which do not have it, e.g. Windows. +AC_CHECK_HEADER([regex.h], + [AC_DEFINE([HAVE_REGEX],1,[whether we have regex.h])], + [AC_MSG_ERROR([ +*** We need regex.h and its object code to compile +*** But we could not find it. +]) +]) + dnl Checks for library functions. AC_CHECK_FUNCS(strerror snprintf vsnprintf) @@ -147,21 +132,21 @@ AC_TRY_COMPILE([#include ], [int foo = TIOCM_RTS;], AC_TRY_COMPILE([#include ], [int foo = TIOCM_RTS;], AC_DEFINE(HAVE_RTS_IOCTL,1,[Define if you have TIOCM_TRS.])) -dnl ****** + +dnl --------------------------------------------------------------------------- dnl serial -dnl ****** +dnl --------------------------------------------------------------------------- serial_msg=yes have_serial=true -baudboy_msg=no -ttylock_msg=no -lockdev_msg=no -resmgr_msg=no try_baudboy_msg=true try_ttylock=true try_lockdev=true try_resmgr=true -AC_ARG_WITH(serial, [ --without-serial Don't compile in SERIAL support], - if test x$withval = xno; then +AC_ARG_ENABLE([serial], + [AS_HELP_STRING([--disable-serial], + [do not compile in SERIAL support])], +[ + if test x$enableval = xno; then have_serial=false serial_msg=no try_baudboy=false @@ -169,15 +154,16 @@ AC_ARG_WITH(serial, [ --without-serial Don't compile in SERIAL support], try_lockdev=false try_resmgr=false fi -) +]) if $have_serial; then IOLIB_SUBDIRS="$IOLIB_SUBDIRS serial" + AC_DEFINE([HAVE_SERIAL],1,[Whether you have serial support enabled]) fi -case "$serial_msg" in -yes*) - AC_DEFINE(HAVE_SERIAL,1,[Whether you have serial support enabled]) - ;; -esac +GP_CONFIG_MSG([Serial support],[$serial_msg]) + +if $have_serial; then + +GP_CONFIG_MSG([Serial locking mechanisms]) dnl ----------------------------------------- dnl Serial port locking: We try to use either @@ -186,27 +172,23 @@ dnl (2) baudboy.h dnl (3) ttylock.h dnl (4) lockdev.h dnl ----------------------------------------- -AC_ARG_WITH(baudboy, [ --without-baudboy Don't use baudboy library], - if test x$withval = xno; then - try_baudboy=false +AC_DEFUN([GP_SERLOCK],[dnl +# $0([$1]) +AC_ARG_ENABLE([$1], +[AS_HELP_STRING([--disable-][$1], + [do not use ][$1][ library]) +],[ + if test x$enableval = xno; then + try_[$1]=false fi -) -AC_ARG_WITH(ttylock, [ --without-ttylock Don't use ttylock library], - if test x$withval = xno; then - try_ttylock=false - fi -) -AC_ARG_WITH(lockdev, [ --without-lockdev Don't use lockdev library], - if test x$withval = xno; then - try_lockdev=false - fi -) -AC_ARG_WITH(resmgr, [ --without-resmgr Don't use resmgr library], - if test x$withval = xno; then - try_resmgr=false - fi -) +]) +])dnl +GP_SERLOCK([baudboy])dnl +GP_SERLOCK([ttylock])dnl +GP_SERLOCK([lockdev])dnl +GP_SERLOCK([resmgr])dnl +resmgr_msg=no if $try_resmgr; then AC_CHECK_HEADER(resmgr.h, AC_CHECK_LIB(resmgr, rsm_lock_device,[ @@ -216,7 +198,9 @@ if $try_resmgr; then ]) ) fi +GP_CONFIG_MSG([Using resmgr],[${resmgr_msg}]) +baudboy_msg=no if $try_baudboy; then AC_CHECK_HEADER(baudboy.h, baudboy_msg=yes @@ -225,7 +209,9 @@ if $try_baudboy; then AC_DEFINE(HAVE_BAUDBOY,1,[Define if you have Baudboy serial locking.]) ) fi +GP_CONFIG_MSG([Using baudboy],[${baudboy_msg}]) +ttylock_msg=no if $try_ttylock; then AC_CHECK_HEADER(ttylock.h, AC_MSG_CHECKING(if ttylock needs lockdev) @@ -240,14 +226,17 @@ if $try_ttylock; then AC_DEFINE(HAVE_TTYLOCK,1,[Define if you have ttylock based tty locking.]) ttylock_msg=yes try_lockdev=false - SERIAL_LFLAGS=-llockdev, - AC_MSG_RESULT(unknown), + SERIAL_LFLAGS=-llockdev AC_MSG_RESULT(unknown) - ), + AC_MSG_RESULT(unknown) + ) AC_MSG_RESULT(unknown) ) ) fi +GP_CONFIG_MSG([Using ttylock],[${ttylock_msg}]) + +lockdev_msg=no if $try_lockdev; then AC_CHECK_LIB(lockdev, dev_lock,[ AC_CHECK_HEADER(lockdev.h,[ @@ -259,88 +248,65 @@ if $try_lockdev; then ] ) fi -AC_SUBST(SERIAL_LFLAGS) +GP_CONFIG_MSG([Using lockdev],[${lockdev_msg}]) -dnl ****** +fi # have_serial + +AC_SUBST([SERIAL_LFLAGS]) + + +dnl --------------------------------------------------------------------------- dnl libusb -dnl ****** -usb_msg="no (required for USB cameras, http://sourceforge.net/projects/libusb/)" -try_usb=true -AC_ARG_WITH(usb, [ --without-usb Don't compile in USB support], - if test x$withval = xno; then - try_usb=false - fi -) -if $try_usb; then - AC_PATH_PROG(LIBUSB_CONFIG,libusb-config) - if test -n "${LIBUSB_CONFIG}"; then - CPPFLAGS_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS `$LIBUSB_CONFIG --cflags`" - AC_CHECK_HEADER(usb.h,[ - LDFLAGS_orig="$LDFLAGS" - LDFLAGS="`$LIBUSB_CONFIG --libs`" - AC_CHECK_LIB(usb,usb_busses,[ - usb_msg="yes, from `$LIBUSB_CONFIG --prefix`" - IOLIB_SUBDIRS="$IOLIB_SUBDIRS usb" - USB_LIBS="`$LIBUSB_CONFIG --libs`" - USB_CFLAGS="`$LIBUSB_CONFIG --cflags`" - LIBUSB_VER="`$LIBUSB_CONFIG --version`"],[ - usb_msg="no (available libusb version too old)"]) - LDFLAGS="$LDFLAGS_orig"]) - CPPFLAGS="$CPPFLAGS_save" - fi +dnl --------------------------------------------------------------------------- +GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.5],[usb.h],[usb_busses],[ + IOLIB_SUBDIRS="$IOLIB_SUBDIRS usb" +],[],[http://libusb.sourceforge.net/]) - # This 'test' call uses non-standard syntax and will fail on most - # systems, but it's just informational so any warning can be ignored. - if test "$LIBUSB_VER" \< "0.1.5"; then - AC_MSG_WARN([ -*** You need at least version 0.1.5 of the libusb library for USB support -*** http://sourceforge.net/projects/libusb/ -*** If you cannot find the appropriate version, try CVS - ]) - fi -fi -case "$usb_msg" in -yes*) - AC_DEFINE(HAVE_USB,1,[Whether you have USB support enabled]) - ;; -esac -AC_SUBST(USB_CFLAGS) -AC_SUBST(USB_LIBS) +# ---------------------------------------------------------------------- +# Define IOLIB stuff +# ---------------------------------------------------------------------- AC_SUBST(IOLIB_SUBDIRS) +AC_SUBST([iolibdir],["\$(libdir)/gphoto2_port/\$(VERSION)"]) +AM_CPFLAGS="$AM_CPPFLAGS -DIOLIBS=\\\"${iolibdir}\\\"" -dnl ********** + +dnl ---------------------------------------------------------------------- dnl GNU regex? -dnl ********** +dnl ---------------------------------------------------------------------- AC_CHECK_FUNC(re_compile_pattern, AC_DEFINE(HAVE_GNU_REGEX,1,[Define if you have GNU regex.])) -dnl ****************************** -dnl disable debugging if requested -dnl ****************************** -AC_ARG_ENABLE(debugging, - [ --disable-debugging do not include debugging code], - [if test "$enableval" = "no"; then - AC_DEFINE(DISABLE_DEBUGGING,1,[Define if you want to disabled debugging.]) - fi]) -dnl ******** -dnl gtk-doc? -dnl ******** +dnl ---------------------------------------------------------------------- +dnl disable debugging if requested +dnl ---------------------------------------------------------------------- +AC_ARG_ENABLE([debug], + AS_HELP_STRING([--disable-debug],[do not include debugging code]), +[ + if test "$enableval" = "no"; then + AC_DEFINE(DISABLE_DEBUGGING,1,[Define if you want to disabled debugging.]) + fi +]) + + +# ---------------------------------------------------------------------- +# gtk-doc? +# ---------------------------------------------------------------------- GP_CHECK_DOC_DIR()dnl GP_BUILD_GTK_DOCS()dnl -dnl --------------------------------------------------------------------------- -dnl Reference definitions -dnl --------------------------------------------------------------------------- + ---------------------------------------------------------------------- +# References to external resources (web sites, mailing listes, etc.) +# ---------------------------------------------------------------------- GP_REFERENCES()dnl -AC_OUTPUT([ +AC_CONFIG_FILES([ Makefile +po/Makefile.in libgphoto2_port/Makefile serial/Makefile usb/Makefile @@ -349,6 +315,7 @@ test/Makefile doc/Makefile m4/Makefile ]) +AC_OUTPUT echo " @@ -370,3 +337,6 @@ Configuration (libgphoto2_port) Build API documentation: $gtkdoc_msg Use ltdl.h: $ltdl_msg " + + +GP_CONFIG_OUTPUT diff --git a/libgphoto2_port/libgphoto2_port/Makefile.am b/libgphoto2_port/libgphoto2_port/Makefile.am index 87f242dc5..6633c9b71 100644 --- a/libgphoto2_port/libgphoto2_port/Makefile.am +++ b/libgphoto2_port/libgphoto2_port/Makefile.am @@ -1,13 +1,22 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -DIOLIBS=\"$(libdir)/gphoto2_port/$(VERSION)\" \ - -DLOCALEDIR=\"$(datadir)/locale\" - -## Compile the IO library into a shared library lib_LTLIBRARIES = libgphoto2_port.la -libgphoto2_port_la_LDFLAGS = -version-info @LIBGPHOTO2_PORT_VERSION_INFO@ -libgphoto2_port_la_LIBADD = $(LTDL_LIBS) $(INTLLIBS) + +libgphoto2_port_la_CPPFLAGS = + $(LTDLINCL) \ + $(AM_CPPFLAGS) $(CPPFLAGS) + +# FIXME: -export-symbols $(srcdir)/libgphoto2_port.sym +libgphoto2_port_la_LDFLAGS = \ + -no-undefined \ + -version-info @LIBGPHOTO2_PORT_VERSION_INFO@ + +libgphoto2_port_la_LIBADD = \ + $(LIBLTDL) \ + $(INTLLIBS) +# The libtool docs describe these params, but they don't build. +# "-dlopen" self \ +# "-dlopen" $(top_builddir)/serial/....la \ +# "-dlopen" $(top_builddir)/usb/....la + libgphoto2_port_la_SOURCES = \ gphoto2-port-info-list.c \ gphoto2-port-log.c \ @@ -18,6 +27,9 @@ libgphoto2_port_la_SOURCES = \ gphoto2-port-portability.c \ gphoto2-port-result.c +libgphoto2_port_la_DEPENDENCIES = \ + $(LIBLTDL) + libgphoto2_portincludedir = $(includedir)/gphoto2 libgphoto2_portinclude_HEADERS = \ gphoto2-port.h \