dnl dnl "$Id: configure.in 427 2006-11-21 03:09:10Z mike $" dnl dnl Configuration script for flphoto. dnl dnl Copyright 2002-2006 by Michael Sweet dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl We need at least autoconf 2.50... AC_PREREQ(2.50) AC_INIT(main.cxx) AC_CONFIG_HEADER(config.h) #AC_PREFIX_DEFAULT(/usr) dnl Version number... VERSION=1.3.1 VERNUMBER=131 AC_SUBST(VERSION) AC_DEFINE_UNQUOTED(FLPHOTO_VERSION, "v$VERSION") AC_DEFINE_UNQUOTED(FLPHOTO_VERNUMBER, $VERNUMBER) dnl Get the operating system... uname=`uname` uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` if test "$uname" = "IRIX64"; then uname="IRIX" fi dnl Clear default debugging options and set normal optimization by dnl default unless the user asks for debugging specifically. CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" LDFLAGS="${LDFLAGS:=}" AC_SUBST(LDFLAGS) OPTIM="-O" AC_SUBST(OPTIM) AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], if eval "test x$enable_debug = xyes"; then OPTIM="-g" else LDFLAGS="$LDFLAGS -s" fi) AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation], docdir="$withval", docdir="NONE") AC_SUBST(docdir) dnl Checks for programs... AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_PATH_PROG(CP,cp) AC_PATH_PROG(MKDIR,mkdir) AC_PATH_PROG(MSGFMT,msgfmt) if test x$MSGFMT = x; then MSGFMT="echo" fi AC_PATH_PROG(NROFF,nroff) if test x$NROFF = x; then AC_PATH_PROG(GROFF,groff) if test x$GROFF = x; then NROFF="echo" else NROFF="$GROFF -T ascii" fi fi AC_PATH_PROG(RM,rm) dnl Architecture checks... AC_EXEEXT AC_C_CONST AC_C_CHAR_UNSIGNED dnl Checks for header files. AC_HEADER_STDC dnl Checks for string functions. AC_CHECK_FUNCS(strcasecmp) AC_CHECK_FUNCS(strdup) AC_CHECK_FUNCS(strlcat) AC_CHECK_FUNCS(strlcpy) AC_CHECK_FUNCS(strncasecmp) case $uname in HP-UX*) AC_MSG_WARN(Forcing snprintf emulation for HP-UX.) ;; OSF1*) AC_MSG_WARN(Forcing snprintf emulation for Tru64 UNIX.) ;; *) AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(vsnprintf) ;; esac dnl Check for FLTK... AC_PATH_PROG(FLTKCONFIG,fltk-config) if test "x$FLTKCONFIG" = x; then AC_MSG_ERROR([Sorry, flphoto requires FLTK 1.1.x.]) else CFLAGS="`$FLTKCONFIG --use-images --cflags` $CFLAGS" CXXFLAGS="`$FLTKCONFIG --use-images --cflags` $CXXFLAGS" LIBS="`$FLTKCONFIG --use-images --ldflags` $LIBS" fi AC_SUBST(FLTKCONFIG) jpeg=`$FLTKCONFIG --use-images --ldflags | grep jpeg` if test "x$jpeg" != x; then AC_DEFINE(HAVE_LIBJPEG) fi png=`$FLTKCONFIG --use-images --ldflags | grep png` if test "x$png" != x; then AC_DEFINE(HAVE_LIBPNG) fi dnl Check for CUPS... AC_PATH_PROG(CUPSCONFIG,cups-config) if test "x$CUPSCONFIG" != x; then AC_DEFINE(HAVE_LIBCUPS) CFLAGS="`$CUPSCONFIG --cflags` $CFLAGS" CXXFLAGS="`$CUPSCONFIG --cflags` $CXXFLAGS" LIBS="`$CUPSCONFIG --libs` $LIBS" fi dnl Check for gPhoto2... AC_PATH_PROG(PKGCONFIG,pkg-config) if test "x$PKGCONFIG" != x; then if $PKGCONFIG libgphoto2; then AC_DEFINE(HAVE_LIBGPHOTO2) if $PKGCONFIG libexif; then CFLAGS="`$PKGCONFIG --cflags libexif` $CFLAGS" CXXFLAGS="`$PKGCONFIG --cflags libexif` $CXXFLAGS" LIBS="`$PKGCONFIG --libs libexif` $LIBS" fi CFLAGS="`$PKGCONFIG --cflags libgphoto2` $CFLAGS" CXXFLAGS="`$PKGCONFIG --cflags libgphoto2` $CXXFLAGS" LIBS="`$PKGCONFIG --libs libgphoto2` $LIBS" fi fi dnl Update compiler options... if test -n "$GCC"; then if test -z "$OPTIM"; then OPTIM="-Os" fi OPTIM="-Wall -Wno-return-type $OPTIM" # See if GCC supports -fno-rtti... AC_MSG_CHECKING(if GCC supports -fno-rtti) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti" AC_TRY_COMPILE(,, CXXFLAGS="$CXXFLAGS -fno-rtti" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" # See if GCC supports -fno-exceptions... AC_MSG_CHECKING(if GCC supports -fno-exceptions) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-exceptions" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fno-exceptions" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" # See if we are running HP-UX or Solaris; if so, try the # -fpermissive option... case $uname in SunOS* | HP-UX*) AC_MSG_CHECKING(if GCC supports -fpermissive) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fpermissive" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fpermissive" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" ;; *) ;; esac else case $uname in AIX*) if test -z "$OPTIM"; then OPTIM="-O2" fi ;; HP-UX*) if test -z "$OPTIM"; then OPTIM="+O2" fi OPTIM="$OPTIM +DAportable" ;; IRIX*) if test -z "$OPTIM"; then OPTIM="-O2" fi if test $uversion -ge 62; then OPTIM="$OPTIM -n32 -mips3" OPTIM="$OPTIM -OPT:Olimit=3000" OPTIM="-fullwarn -woff 1209,1506,1692 $OPTIM" else OPTIM="-fullwarn $OPTIM" fi ;; SunOS*) # Solaris if test -z "$OPTIM"; then OPTIM="-xO4" fi ;; *) # Running some other operating system; inform the user they # should contribute the necessary options to # epm@easysw.com... echo "Building EPM with default compiler optimizations; contact" echo "epm@easysw.com with the uname and compiler options needed for" echo "your platform, or set the CFLAGS and CXXFLAGS environment" echo "variable before running configure." ;; esac fi dnl Fix "prefix" variable if it hasn't been specified... if test "$prefix" = "NONE"; then prefix="/usr/local" fi dnl Fix "exec_prefix" variable if it hasn't been specified... if test "$exec_prefix" = "NONE"; then exec_prefix="$prefix" fi dnl Fix "datadir" variable if it hasn't been specified... if test "$datadir" = "\${prefix}/share"; then datadir="$prefix/share" fi dnl Fix "docdir" variable if it hasn't been specified... if test "$docdir" = "NONE"; then docdir="$datadir/doc/flphoto" fi AC_DEFINE_UNQUOTED(FLPHOTO_DATADIR, "$datadir") AC_DEFINE_UNQUOTED(FLPHOTO_DOCDIR, "$docdir") dnl Set the FLPHOTO_LOCALE directory... case "$uname" in Linux* | *BSD* | Darwin*) FLPHOTO_LOCALE="$datadir/locale" AC_DEFINE_UNQUOTED(FLPHOTO_LOCALE, "$datadir/locale") ;; OSF1* | AIX*) FLPHOTO_LOCALE="$exec_prefix/lib/nls/msg" AC_DEFINE_UNQUOTED(FLPHOTO_LOCALE, "$exec_prefix/lib/nls/msg") ;; *) # This is the standard System V location... FLPHOTO_LOCALE="$exec_prefix/lib/locale" AC_DEFINE_UNQUOTED(FLPHOTO_LOCALE, "$exec_prefix/lib/locale") ;; esac AC_SUBST(FLPHOTO_LOCALE) dnl Fix "mandir" variable if it hasn't been specified... if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" ;; IRIX*) # SGI IRIX mandir="/usr/share/catman/u_man" ;; *) # All others mandir="/usr/man" ;; esac fi dnl More manpage stuff... case "$uname" in *BSD* | Darwin*) # *BSD CAT1EXT="0" MAN1EXT="1" CAT5EXT="0" MAN5EXT="5" ;; *) # All others CAT1EXT="1" MAN1EXT="1" CAT5EXT="5" MAN5EXT="5" ;; esac AC_SUBST(CAT1EXT) AC_SUBST(MAN1EXT) AC_SUBST(CAT5EXT) AC_SUBST(MAN5EXT) dnl See if we have the X11 desktop stuff used by GNOME and KDE... AC_MSG_CHECKING(if GNOME/KDE desktop is in use) if test -d /etc/X11/applnk; then AC_MSG_RESULT(yes) INSTALLDESKTOP="install-desktop" UNINSTALLDESKTOP="uninstall-desktop" else AC_MSG_RESULT(no) INSTALLDESKTOP="" UNINSTALLDESKTOP="" fi AC_SUBST(INSTALLDESKTOP) AC_SUBST(UNINSTALLDESKTOP) dnl Output the makefile, list file, and config header... AC_OUTPUT(Makefile flphoto.list) dnl dnl End of "$Id: configure.in 427 2006-11-21 03:09:10Z mike $". dnl