Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autotools updates #180

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ language: c

os:
- linux
dist: xenial

compiler:
- gcc

env:
- EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev gettext"
- EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev libaa1-dev gettext"
- EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev libaa1-dev libcdk5-dev gettext"
- EXTRALIBS="autoconf-archive libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev gettext"
- EXTRALIBS="autoconf-archive libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev libaa1-dev gettext"
- EXTRALIBS="autoconf-archive libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev libaa1-dev libcdk5-dev gettext"

# Note: Keep the sudo commands in .travis.yml - they do not work from
# a helper shell script.
Expand Down
212 changes: 86 additions & 126 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
AC_PREREQ(2.59)
AC_PREREQ([2.69])
dnl Next stable release must be 2.5.21 or later
AC_INIT([gphoto2 command line interface], [2.5.20.1], [[email protected]], [gphoto2])
AC_CONFIG_SRCDIR([gphoto2/main.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([auto-m4])
AC_CONFIG_AUX_DIR([auto-aux])
AM_INIT_AUTOMAKE([-Wall -Werror gnu 1.9 dist-bzip2 check-news])

if test ! -d "$srcdir/gphoto-m4"; then
AC_MSG_ERROR([
You are missing the gphoto-m4/ directory in your top
$PACKAGE_TARNAME source directory.

copying it from the gphoto/gphoto-m4 github repository

and re-running autogen.sh might help.
])
fi
AM_INIT_AUTOMAKE([-Wall -Werror gnu 1.15 dist-xz check-news silent-rules])

GP_CHECK_SHELL_ENVIRONMENT
GP_CONFIG_MSG([Build])
GP_CONFIG_MSG([Source code location],[${srcdir}])
AM_CPPFLAGS=""
AM_LDFLAGS=""

AX_IS_RELEASE([git-directory])
AX_CHECK_ENABLE_DEBUG()


dnl ---------------------------------------------------------------------------
Expand All @@ -31,8 +21,7 @@ dnl ---------------------------------------------------------------------------
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
m4_pattern_allow([AM_PROG_AR], [AM_PROG_AR])
AM_PROG_LIBTOOL
LT_INIT
AC_PROG_INSTALL
AC_SYS_LARGEFILE

Expand All @@ -56,18 +45,11 @@ dnl ---------------------------------------------------------------------------
dnl i18n support
dnl ---------------------------------------------------------------------------
GP_GETTEXT_HACK([],[Lutz Müller and others],[${MAIL_GPHOTO_TRANSLATION}])
ALL_LINGUAS="az cs da de en_GB es eu fi fr hu id is it ja nl pa pl pt_BR ro ru rw sk sr sv uk vi zh_CN zh_TW"
AM_GNU_GETTEXT_VERSION([0.14.1])
AM_GNU_GETTEXT_VERSION([0.19.1])
AM_GNU_GETTEXT([external])
AM_PO_SUBDIRS()
AM_ICONV()
GP_GETTEXT_FLAGS()

dnl We cannot use AC_DEFINE_UNQUOTED() for these definitions, as
dnl we require make to do insert the proper $(datadir) value
AC_SUBST([localedir],["\$(datadir)/locale"])
AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\""


dnl ---------------------------------------------------------------------------
dnl Check for libgphoto2
Expand All @@ -94,27 +76,18 @@ dnl camera. Some cameras need to be sent keep-alive-messages
dnl in order to prevent a shut-down. This is what we need
dnl pthread for.
dnl ---------------------------------------------------------------------------
pthread_msg=no
try_pthread=:
AC_ARG_WITH(pthread, [ --without-pthread Don't use pthread],
if test x$withval = xno; then
try_pthread=false
fi)
if $try_pthread; then
AC_CHECK_HEADER(pthread.h, [
AC_CHECK_LIB(pthread, pthread_exit, [
AC_DEFINE(HAVE_PTHREAD,1,[Define if we use pthread.h.])
pthread_msg="yes (-lpthread)"
PTHREAD_LIBS="-lpthread"],[
AC_CHECK_LIB(c_r, pthread_create, [
AC_DEFINE(HAVE_PTHREAD,1,[Define if we use pthread.h.])
pthread_msg="yes (-pthread)"
PTHREAD_LIBS="-pthread"
])
])
])
fi
AC_SUBST([PTHREAD_LIBS])
pthread_msg="no"
AC_ARG_WITH([pthread],
AS_HELP_STRING([--without-pthread], [Don't use pthread]),
[],
[with_pthread=yes])

AS_IF([test "$with_pthread" = "yes"], [
AX_PTHREAD([
AC_DEFINE(HAVE_PTHREAD,1,[Define if we use pthread.h.])
pthread_msg="yes"
])
])
GP_CONFIG_MSG([pthread support],[$pthread_msg])


Expand All @@ -125,32 +98,29 @@ dnl command-line access to the config, you don't need CDK, though.
dnl Old versions of CDK don't include fscale, therefore check for it here.
dnl ---------------------------------------------------------------------------
cdk_msg="no (http://dickey.his.com/cdk/cdk.html)"
try_cdk=:
have_cdk=false
AC_ARG_WITH([cdk],AS_HELP_STRING([--without-cdk],[Do not use cdk]), [
if test x$withval = xno; then
try_cdk=false
cdk_msg="no (not requested)"
fi
])
cdk_prefix=$ac_default_prefix
AC_ARG_WITH([cdk-prefix],AS_HELP_STRING([--with-cdk-prefix=PREFIX],
[Location of cdk]), [
cdk_prefix="$withval"
])
if $try_cdk; then
AC_ARG_WITH([cdk],
AS_HELP_STRING([--without-cdk],[Do not use cdk]),
[],
[with_cdk=auto])
AC_ARG_WITH([cdk-prefix],
AS_HELP_STRING([--with-cdk-prefix=PREFIX], [Location of cdk]),
[],
[with_cdk_prefix=$ac_default_prefix])

AS_IF([test "$with_cdk" != "no"], [
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="-I$cdk_prefix/include $CPPFLAGS"
CPPFLAGS="-I$with_cdk_prefix/include $CPPFLAGS"
AC_CHECK_HEADER([cdk/cdk.h], [
have_cdk=:
AC_PATH_PROG([CDK_CONFIG], [cdk5-config])
if test -n "${CDK_CONFIG}"; then
AC_CHECK_TOOL([CDK_CONFIG], [cdk5-config])
AS_IF([test -n "${CDK_CONFIG}"], [
CDK_CFLAGS=`$CDK_CONFIG --cflags`
CDK_LIBS=`$CDK_CONFIG --libs`
else
CDK_CFLAGS="-I$cdk_prefix/include"
CDK_LIBS="-L$cdk_prefix/lib -lcdk -lncurses"
fi
], [
CDK_CFLAGS="-I$with_cdk_prefix/include"
CDK_LIBS="-L$with_cdk_prefix/lib -lcdk -lncurses"
])
AC_DEFINE([HAVE_CDK],1,[whether we have CDK])
LDFLAGS_save="$LDFLAGS"
LDFLAGS="$CDK_LIBS"
Expand All @@ -162,7 +132,9 @@ if $try_cdk; then
LDFLAGS="$LDFLAGS_save"
])
CPPFLAGS="$CPPFLAGS_save"
fi
], [
cdk_msg="no (not requested)"
])
AM_CONDITIONAL([HAVE_CDK], [$have_cdk])
AC_SUBST([CDK_CFLAGS])
AC_SUBST([CDK_LIBS])
Expand Down Expand Up @@ -225,23 +197,20 @@ dnl ---------------------------------------------------------------------------
dnl libjpeg: Right now, libjpeg is only used to interpret JPEG previews in
dnl order to feed them to aalib (see below).
dnl ---------------------------------------------------------------------------
jpeg_msg=no
try_jpeg=:
jpeg_msg="no"
have_jpeg=false
AC_ARG_WITH([jpeg],AS_HELP_STRING([--without-jpeg],[Do not use jpeg]),[
if test x$withval = xno; then
try_jpeg=false
jpeg_msg="no (not requested)"
fi
])
jpeg_prefix=$ac_default_prefix
AC_ARG_WITH(jpeg-prefix, AS_HELP_STRING([--with-jpeg-prefix=PREFIX],
[Location of jpeg]), [
jpeg_prefix="$withval"
])
if $try_jpeg; then
AC_ARG_WITH([jpeg],
AS_HELP_STRING([--without-jpeg],[Do not use jpeg]),
[],
[with_jpeg=auto])
AC_ARG_WITH([jpeg-prefix],
AS_HELP_STRING([--with-jpeg-prefix=PREFIX], [Location of jpeg]),
[],
[with_jpeg_prefix=$ac_default_prefix])

AS_IF([test "$with_jpeg" != "no"], [
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="-I$jpeg_prefix/include"
CPPFLAGS="-I$with_jpeg_prefix/include"
AC_CHECK_HEADER([jpeglib.h], [
AC_CHECK_LIB([jpeg], [jpeg_read_scanlines], [
have_jpeg=:
Expand All @@ -251,22 +220,24 @@ if $try_jpeg; then
JPEG_CFLAGS=$CPPFLAGS
], [
LDFLAGS_save="$LDFLAGS"
LDFLAGS="-L$jpeg_prefix/lib"
LDFLAGS="-L$with_jpeg_prefix/lib"
AC_CHECK_LIB([jpeg], [jpeg_stdio_src], [
have_jpeg=:
jpeg_msg="yes (in '$jpeg_prefix')"
jpeg_msg="yes (in '$with_jpeg_prefix')"
AC_DEFINE([HAVE_JPEG],1,
[whether we use libjpeg])
JPEG_LIBS="-L$jpeg_prefix/lib -ljpeg"
JPEG_LIBS="-L$with_jpeg_prefix/lib -ljpeg"
JPEG_CFLAGS=$CPPFLAGS
], [
jpeg_msg="no (could not link)"
])
], [
jpeg_msg="no (could not link)"
])
LDFLAGS=$LDFLAGS_save
])
])
CPPFLAGS="$CPPFLAGS_save"
fi
], [
jpeg_msg="no (not requested)"
])
AM_CONDITIONAL([HAVE_JPEG], [$have_jpeg])
AC_SUBST([JPEG_LIBS])
AC_SUBST([JPEG_CFLAGS])
Expand Down Expand Up @@ -303,28 +274,28 @@ dnl see the preview. This is where aalib fits in - it gives you the
dnl possibility to view live previews on any console.
dnl ---------------------------------------------------------------------------
aa_msg="no (http://www.sourceforge.net/projects/aa-project)"
try_aa=:
have_aa=false
AC_ARG_WITH([aalib],AS_HELP_STRING([--with-aalib],[Do use aalib for preview ASCII rendering]),[
if test x$withval = xno; then
try_aa=false
aa_msg="no (not requested)"
fi
])
if $try_aa; then
AC_ARG_WITH([aalib],
AS_HELP_STRING([--with-aalib],[Do use aalib for preview ASCII rendering]),
[],
[with_aalib=auto])

AS_IF([test "$with_aalib" != "no"], [
AC_CHECK_HEADER([aalib.h],[
have_aa=:
aa_msg=yes
AC_DEFINE([HAVE_AA], [1], [whether we use aalib])
AC_PATH_PROG([AALIB_CONFIG], [aalib-config])
if test -n "${AALIB_CONFIG}"; then
AC_CHECK_TOOL([AALIB_CONFIG], [aalib-config])
AS_IF([test -n "${AALIB_CONFIG}"], [
AA_CFLAGS=`$AALIB_CONFIG --cflags`
AA_LIBS=`$AALIB_CONFIG --libs`
else
], [
AA_LIBS="-laa"
fi
])
fi
])
])
], [
aa_msg="no (not requested)"
])
AM_CONDITIONAL([HAVE_AA], [$have_aa])
AC_SUBST([AA_LIBS])
AC_SUBST([AA_CFLAGS])
Expand All @@ -343,16 +314,13 @@ dnl commands in the gphoto2 shell or to use <up> or <down> to
dnl navigate through the history.
dnl ---------------------------------------------------------------------------
rl_msg="no (http://cnswww.cns.cwru.edu/~chet/readline/rltop.html)"
try_readline=:
have_readline=false
AC_ARG_WITH([readline],AS_HELP_STRING([--without-readline],
[Do not use readline]),[
if test "x${withval}" = "xno"; then
try_readline=false
rl_msg="no (not requested)"
fi
])
if $try_readline; then
AC_ARG_WITH([readline],
AS_HELP_STRING([--without-readline], [Do not use readline]),
[],
[with_readline=auto])

AS_IF([test "$with_readline" != "no"], [
AC_CHECK_HEADER([readline/readline.h], [
AC_CHECK_LIB([readline], [rl_completion_append_character], [
AC_CHECK_LIB([readline], [rl_completion_matches], [
Expand All @@ -362,7 +330,7 @@ if $try_readline; then
RL_CFLAGS=""
AC_DEFINE([HAVE_RL], [1], [whether we use readline])
], [
rl_msg="no (available version too old)"
rl_msg="no (available version too old)"
])
], [
LDFLAGS_save="$LDFLAGS"
Expand All @@ -374,12 +342,14 @@ if $try_readline; then
RL_CFLAGS=""
AC_DEFINE(HAVE_RL,1,[whether we use readline])
], [
rl_msg="no (couldn't link against it or version too old)"
rl_msg="no (couldn't link against it or version too old)"
])
LDFLAGS="$LDFLAGS_save"
])
])
fi
], [
rl_msg="no (not requested)"
])
AM_CONDITIONAL([HAVE_RL], [$have_readline])
AC_SUBST([RL_LIBS])
AC_SUBST([RL_CFLAGS])
Expand All @@ -389,17 +359,7 @@ GP_CONFIG_MSG([Readline support], [$rl_msg])
dnl ---------------------------------------------------------------------------
dnl Turn on all warnings when using gcc
dnl ---------------------------------------------------------------------------
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Wmissing-declarations -Wmissing-prototypes"
# FIXME: Check for --enable-debug here
CFLAGS="$CFLAGS -g"
LDFLAGS="$LDFLAGS -g"
fi

AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE"
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
AX_APPEND_COMPILE_FLAGS([-Wall -Wmissing-declarations -Wmissing-prototypes])


# ---------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
man_MANS = gphoto2.1

EXTRA_DIST = gphoto2.1
dist_man_MANS = gphoto2.1
Loading