Code

assorted build system updates
[fusedav.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # $Id$
6 # This file is part of fusedav.
7 #
8 # fusedav is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # fusedav is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with fusedav; if not, write to the Free Software Foundation,
20 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 AC_PREREQ(2.59)
23 AC_INIT([fusedav],[0.2],[mzshfrqni (at) 0pointer (dot) de])
24 AC_CONFIG_SRCDIR([src/fusedav.c])
25 AC_CONFIG_HEADERS([config.h])
26 AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
27 AC_REVISION($Id$)
29 AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/fusedav/])
31 if type -p stow > /dev/null && test -d /usr/local/stow ; then
32    AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
33    ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
34 fi
36 AC_GNU_SOURCE
38 # Checks for programs.
39 AC_PROG_CC
40 AC_PROG_CPP
41 AC_PROG_INSTALL
42 AC_PROG_LN_S
43 AC_PROG_MAKE_SET
45 test_gcc_flag() {
46     AC_LANG_CONFTEST([int main() {}])
47     $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
48     ret=$?
49     rm -f conftest.o
50     return $ret
51 }
53 # If using GCC specify some additional parameters
54 if test "x$GCC" = "xyes" ; then
56     DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"
58     if test "x$HAVE_NETLINK" = "xyes" ; then
59         # Test whether rtnetlink.h can be included when compiled with -std=c99
60         # some distributions (e.g. archlinux) have broken headers that dont
61         # define __u64 with -std=c99
62         AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
63         OLDCFLAGS="$CFLAGS"
64         CFLAGS="-std=c99"
65         AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
66             use_stdc99=yes, use_stdc99=no)
68         if test x"$use_stdc99" = xyes; then
69             DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
70             AC_MSG_RESULT([yes])
71         else
72             AC_MSG_RESULT([no])
73         fi
75         CFLAGS="$OLDCFLAGS"
76     else
77         DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
78     fi
80     for flag in $DESIRED_FLAGS ; do
81         AC_MSG_CHECKING([whether $CC accepts $flag])
82         if test_gcc_flag $flag ; then 
83            CFLAGS="$CFLAGS $flag"
84            AC_MSG_RESULT([yes])
85         else
86            AC_MSG_RESULT([no])
87         fi
88     done 
89 fi
91 # 64 Bit LFS support
92 AC_SYS_LARGEFILE
94 # Checks for header files.
95 AC_HEADER_DIRENT
96 AC_HEADER_STDC
97 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stdlib.h string.h sys/statfs.h termios.h unistd.h])
99 # Checks for typedefs, structures, and compiler characteristics.
100 AC_C_CONST
101 AC_TYPE_MODE_T
102 AC_TYPE_OFF_T
103 AC_TYPE_SIZE_T
104 AC_STRUCT_ST_BLOCKS
106 # Checks for library functions.
107 AC_FUNC_MALLOC
108 AC_CHECK_FUNCS([ftruncate memset strdup strerror strrchr memchr strchr strcspn])
110 AC_CHECK_LIB([pthread], [pthread_create])
112 PKG_CHECK_MODULES(NEON, [ neon >= 0.26 ])
113 PKG_CHECK_MODULES(FUSE, [ fuse >= 2.5 ])
115 # LYNX documentation generation
116 AC_ARG_ENABLE(lynx,
117         AS_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation),
118 [case "${enableval}" in
119   yes) lynx=yes ;;
120   no)  lynx=no ;;
121   *) AC_MSG_ERROR(bad value ${enableval} for --disable-lynx) ;;
122 esac],[lynx=yes])
124 if test x$lynx = xyes ; then
125    AC_CHECK_PROG(have_lynx, lynx, yes, no)
127    if test x$have_lynx = xno ; then
128      AC_MSG_ERROR([*** Sorry, you have to install lynx or use --disable-lynx ***])
129    fi
130 fi
132 AM_CONDITIONAL([USE_LYNX], [test "x$lynx" = xyes])
134 AC_CONFIG_FILES([src/Makefile Makefile doc/Makefile doc/README.html])
135 AC_OUTPUT