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
This commit is contained in:
Hans Ulrich Niedermann
2005-04-14 18:14:09 +00:00
parent 5d2686e35e
commit 898ff8fe4b
7 changed files with 600 additions and 373 deletions

View File

@@ -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

View File

@@ -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<<EOF
$self - initialize automake/autoconf/gettext/libtool based build system
Usage:
$self [<command>...] [<directory>...]
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 <<EOF
aclocal.m4
config.guess
config-h.in
config.sub
configure
configure.ac
COPYING.LIB
install-sh
ltdl.c
ltdl.h
ltmain.sh
Makefile.am
Makefile.in
missing
README
EOF
AG_GEN_GETTEXT="$AG_AUX/mkinstalldirs $AG_AUX/config.rpath ABOUT-NLS"
while read file; do
AG_GEN_GETTEXT="${AG_GEN_GETTEXT} ${file}"
done <<EOF
m4/codeset.m4
m4/gettext.m4
m4/glibc21.m4
m4/iconv.m4
m4/intdiv0.m4
m4/intmax.m4
m4/inttypes-pri.m4
m4/inttypes.m4
m4/inttypes_h.m4
m4/isc-posix.m4
m4/lcmessage.m4
m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
m4/longdouble.m4
m4/longlong.m4
m4/nls.m4
m4/po.m4
m4/printf-posix.m4
m4/progtest.m4
m4/signed.m4
m4/size_max.m4
m4/stdint_h.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/wchar_t.m4
m4/wint_t.m4
m4/xsize.m4
m4m/codeset.m4
m4m/gettext.m4
m4m/glibc21.m4
m4m/iconv.m4
m4m/intdiv0.m4
m4m/intmax.m4
m4m/inttypes-pri.m4
m4m/inttypes.m4
m4m/inttypes_h.m4
m4m/isc-posix.m4
m4m/lcmessage.m4
m4m/lib-ld.m4
m4m/lib-link.m4
m4m/lib-prefix.m4
m4m/longdouble.m4
m4m/longlong.m4
m4m/nls.m4
m4m/po.m4
m4m/printf-posix.m4
m4m/progtest.m4
m4m/signed.m4
m4m/size_max.m4
m4m/stdint_h.m4
m4m/uintmax_t.m4
m4m/ulonglong.m4
m4m/wchar_t.m4
m4m/wint_t.m4
m4m/xsize.m4
po/Makefile.in.in
po/Makevars.template
po/Rules-quot
po/boldquot.sed
po/en@boldquot.header
po/en@quot.header
po/insert-header.sin
po/quot.sed
po/remove-potcdate.sin
po/stamp-po
EOF
AG_GEN_CONF="config.status config.log"
AG_GEN_FILES="$AG_GEN_ACAM $AG_GEN_RECONF $AG_GEN_GETTEXT"
AG_GEN_FILES="$AG_GEN_FILES $AG_GEN_CONFIG_H $AG_GEN_CONF $AG_GEN_LIBTOOL"
AG_GEN_DIRS="autom4te.cache ${AG_LIBLTDL_DIR}/autom4te.cache ${AG_LIBLTDL_DIR}"
echo " done."
if "$debug"; then set | grep '^AG_'; fi
}
########################################################################
# Clean generated files from $* directories
clean() {
if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi
dir="$1"
while test "$dir"; do
echo "$self:clean: Entering directory \`${dir}'"
(
if cd "$dir"; then
echo -n "Cleaning autogen generated files..."
rm -rf ${AG_GEN_DIRS}
rm -f ${AG_GEN_FILES}
echo " done."
if test -h INSTALL; then rm -f INSTALL; fi
echo -n "Cleaning generated Makefile, Makefile.in files..."
if "$debug"; then echo; fi
find . -type f -name 'Makefile.am' -print | \
while read file; do
echo "$file" | grep -q '/{arch}' && continue
echo "$file" | grep -q '/\.svn' && continue
echo "$file" | grep -q '/CVS' && continue
base="$(dirname "$file")/$(basename "$file" .am)"
if "$debug"; then
echo -e " Removing files created from ${file}"
fi
rm -f "${base}" "${base}.in"
done
if "$debug"; then :; else echo " done."; fi
echo -n "Removing *~ backup files..."
find . -type f -name '*~' -exec rm -f {} \;
echo " done."
fi
)
echo "$self:clean: Left directory \`${dir}'"
shift
dir="$1"
done
}
########################################################################
# Initialize build system in $1 directory
init() {
dir="$1"
if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi
echo "$self:init: Entering directory \`${dir}'"
(
if cd "${dir}"; then
if test "x$AG_LIBLTDL_DIR" != "x"; then
# We have to run libtoolize --ltdl ourselves because
# - autoreconf doesn't run it at all
echo "Running <<" ${LIBTOOLIZE-"libtoolize"} --ltdl ">>"
${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 <<EOF
${ACLOCAL-"aclocal"} 1.8
${AUTOMAKE-"automake"} 1.8
${AUTOCONF-"autoconf"} 2.59
${AUTOHEADER-"autoheader"} 2.59
${AUTOPOINT-"autopoint"} 0.14.1
${LIBTOOLIZE-"libtoolize"} 1.4
EOF
if "$errors"; then
echo "Please update your toolset."
echo "If you want to continue regardless of your old toolset, press ENTER."
read
fi
fi
echo "Running libtoolize"
libtoolize || fail
echo "Cleaning stuff generated by aclocal"
rm -f aclocal.m4
########################################################################
# Actually run the commands
echo "Running aclocal${AUTOMAKE_SUFFIX} $ACLOCAL_FLAGS"
aclocal${AUTOMAKE_SUFFIX} $ACLOCAL_FLAGS || fail
echo "Cleaning stuff generated by autoheader"
rm -f config.h.in libgphoto2/config.h.in
echo "Running autoheader${AUTOCONF_SUFFIX}"
autoheader${AUTOCONF_SUFFIX} || fail
echo "Cleaning stuff generated by automake"
rm -f depcomp install-sh missing mkinstalldirs
rm -f stamp-h* libgphoto2/stamp-h*
echo "Running automake${AUTOMAKE_SUFFIX} --add-missing --gnu $am_opt"
automake${AUTOMAKE_SUFFIX} --add-missing --gnu $am_opt || fail
echo "Cleaning stuff generated by autoconf"
rm -f configure
rm -rf autom4te*.cache/
echo "Running autoconf${AUTOCONF_SUFFIX}"
autoconf${AUTOCONF_SUFFIX} || fail
echo "Finished in directory $(pwd)"
) || fail
for dir in ${dirs}; do
echo "Running commands on directory \`${dir}'"
if test ! -d "$dir"; then
echo "Could not find directory \`${dir}'"
fi
init_vars "$dir"
for command in ${commands}; do
"$command" "$dir" ${AG_SUBDIRS}
done
done
echo
echo "$PROJECT is now ready for configuration."
exit 0
# Please do not remove this:
# filetype: 89b1e88e-4cf2-44f1-980d-730067367775
# I use this to find all the different instances of this file which
# are supposed to be synchronized.

View File

@@ -1,6 +1,6 @@
dnl Process this file with autoreconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([libgphoto2], [2.1.5head], [gphoto-devel@lists.sourceforge.net], [libgphoto2])
AC_INIT([libgphoto2], [2.2head], [gphoto-devel@lists.sourceforge.net], [libgphoto2])
AC_CONFIG_SRCDIR([libgphoto2/gphoto2.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([libgphoto2_port/m4])

View File

@@ -1,14 +1,14 @@
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/libgphoto2_port/libgphoto2_port \
-DLOCALEDIR=\"$(datadir)/locale\" \
-DCAMLIBS=\"$(camlibdir)\" \
$(EXIF_CFLAGS)
lib_LTLIBRARIES = libgphoto2.la
libgphoto2_la_LDFLAGS = -version-info @LIBGPHOTO2_VERSION_INFO@
libgphoto2_la_CPPFLAGS = \
$(LTDLINCL) \
$(AM_CPPFLAGS) $(CPPFLAGS) \
$(LIBEXIF_CFLAGS)
# FIXME: -export-symbols $(srcdir)/libgphoto2.sym
libgphoto2_la_LDFLAGS = \
-no-undefined \
-version-info @LIBGPHOTO2_VERSION_INFO@
libgphoto2_la_SOURCES = \
gphoto2-abilities-list.c\
@@ -27,11 +27,20 @@ libgphoto2_la_SOURCES = \
gphoto2-version.h \
gphoto2-setting.c \
gphoto2-widget.c
libgphoto2_la_LIBADD = \
$(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la\
$(LTDL_LIBS) \
$(EXIF_LIBS) \
$(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \
$(LIBLTDL) \
$(LIBEXIF_LIBS) \
-lm $(INTLLIBS)
# The libtool docs describe these params, but they don't build.
# "-dlopen" self \
# "-dlopen" $(top_builddir)/camlibs/canon/....la \
# "-dlopen" $(top_builddir)/camlibs/ptp2/....la
libgphoto2_la_DEPENDENCIES = \
$(LIBLTDL)
libgphoto2includedir = $(includedir)/gphoto2
libgphoto2include_HEADERS = \

View File

@@ -7,7 +7,7 @@ VERSION_FLAGS = -DLIBGPPORT_VERSION=\"@LIBGPPORT_VERSION@\" -DHAVE_TERMIOS_H
## Executable files
bin_SCRIPTS = gphoto2-port-config
SUBDIRS = po libgphoto2_port test @IOLIB_SUBDIRS@ doc m4
SUBDIRS = po @subdirs@ libgphoto2_port test @IOLIB_SUBDIRS@ doc m4
EXTRA_DIST = \
AUTHORS \

View File

@@ -1,7 +1,11 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(libgphoto2_port/gphoto2-port.c)
AM_CONFIG_HEADER(config.h)
dnl Process this file with autoreconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([libgphoto2_port], [0.5.2], [gphoto-devel@lists.sourceforge.net], [libgphoto2_port])
AC_CONFIG_SRCDIR([libgphoto2_port/gphoto2-port.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([gnu 1.8 dist-bzip2])
dnl ---------------------------------------------------------------------------
dnl Versioning (libgphoto2_port-(AGE.)CURRENT.REVISION):
@@ -22,89 +26,63 @@ AC_SUBST(LIBGPHOTO2_PORT_CURRENT)
LIBGPHOTO2_PORT_VERSION_INFO=`expr $LIBGPHOTO2_PORT_CURRENT + $LIBGPHOTO2_PORT_REVISION`:$LIBGPHOTO2_PORT_AGE:$LIBGPHOTO2_PORT_REVISION
AC_SUBST(LIBGPHOTO2_PORT_VERSION_INFO)
LIBGPHOTO2_PORT_VERSION=$LIBGPHOTO2_PORT_CURRENT.$LIBGPHOTO2_PORT_REVISION.$LIBGPHOTO2_PORT_AGE
AC_SUBST(LIBGPHOTO2_PORT_VERSION)
dnl obsolete
dnl LIBGPHOTO2_PORT_VERSION=$LIBGPHOTO2_PORT_CURRENT.$LIBGPHOTO2_PORT_REVISION.$LIBGPHOTO2_PORT_AGE
dnl AC_SUBST(LIBGPHOTO2_PORT_VERSION)
VERSION=${LIBGPHOTO2_PORT_VERSION}
AM_INIT_AUTOMAKE(libgphoto2_port, $VERSION)
AM_MAINTAINER_MODE
AC_LIBTOOL_DLOPEN
dnl ---------------------------------------------------------------------------
dnl Checks for programs.
dnl ---------------------------------------------------------------------------
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
dnl Something with the sequences is not quite alright yet.
dnl SED is supposed to be set in AC_LIBTOOL_SETUP, but the
dnl sequence seems to get mixed up.
SED=${SED-sed}
dnl check for/set up libtool and libltdl
dnl AC_DISABLE_STATIC
dnl AC_DISABLE_SHARED
AC_LIBLTDL_CONVENIENCE([libltdl])
AC_WITH_LTDL
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_SUBST([LTDLINCL])
AC_SUBST([LIBLTDL])
# report on compiler/libtool setup
GP_CONFIG_MSG([Compiler],[${CC}])
GP_CONFIG_MSG([libltdl includes],[$LTDLINCL])
GP_CONFIG_MSG([libltdl library],[$LIBLTDL])
GP_CONFIG_MSG()
AC_DEFINE_UNQUOTED(HAVE_CC,"$CC",[The C compiler we're using])
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)
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 i18n support
dnl ---------------------------------------------------------------------------
ALL_LINGUAS="cs da de fr es it ja nb pt_BR ru sl sv uk zh_CN"
# EVIL HACKS
AC_MSG_CHECKING([for po/Makevars requiring evil hack])
GETTEXT_PACKAGE="${PACKAGE}-${LIBGPHOTO2_PORT_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}/" < po/Makevars.template > 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 <ioctl-types.h>], [int foo = TIOCM_RTS;],
AC_TRY_COMPILE([#include <sys/ioctl.h>], [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

View File

@@ -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 \