configure.ac 2.52 KB
Newer Older
1 2 3
# Autoconf for axel
# Copyright 2016 Joao Eriberto Mota Filho
# Copyright 2016 Stephen Thirlwall
4 5
# Copyright 2017 Antonio Quartulli
# Copyright 2017 Ismael Luceno
6
# Copyright 2017 Vlad Glagolev
7
# This file is under same license of Axel
8 9

AC_PREREQ([2.69])
10
AC_INIT([axel], [2.14], [https://github.com/axel-download-accelerator/axel/issues])
11 12
AC_CONFIG_SRCDIR([src/conf.h])
AC_CONFIG_HEADERS([config.h])
13
AC_CONFIG_MACRO_DIR([m4])
14 15 16 17
AM_INIT_AUTOMAKE

# Checks for programs.
AC_PROG_CC
18 19 20 21 22
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
    AC_MSG_ERROR([C99 compiler required])
fi

23 24 25 26 27 28 29 30 31 32 33 34 35 36
AC_CHECK_PROGS([GETTEXT], [gettext], "no")
if test "x$GETTEXT" = "xno"; then
    AC_MSG_ERROR([axel requires gettext])
fi

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T

# Checks for library functions.
37
AC_CHECK_FUNCS([malloc realloc gettimeofday inet_ntoa memset select setlocale socket strncasecmp strchr strrchr strstr])
38

39 40 41
# Optional (but included-by-default) ssl support
AC_ARG_WITH([ssl],
    AC_HELP_STRING([--without-ssl],[disable TLS support]), [], [with_ssl=yes])
42

43 44
AS_IF([test "x$with_ssl" != xno], [
    AC_DEFINE([HAVE_SSL], [1], [SSL])
45
    AC_SEARCH_LIBS([SSL_new], [ssl], [], [
46 47 48 49 50
        AC_MSG_ERROR([libssl not found])
    ])
    AC_SEARCH_LIBS([ERR_get_error], [crypto], [], [
        AC_MSG_ERROR([libcrypto not found])
    ])
51
], AC_MSG_NOTICE([SSL support disabled]))
52

53 54
# Add Gettext
AM_GNU_GETTEXT([external])
55
AM_GNU_GETTEXT_VERSION([0.18])
56

57 58 59
# Large file support
AC_SYS_LARGEFILE

60 61 62 63 64 65
#### Definitions ####

# OS
arch=$(uname -s)
AC_DEFINE_UNQUOTED([ARCH], ["$arch"], ["Define architecture"])

66
# Flags
67 68
CFLAGS="$CFLAGS -Wall"
LDFLAGS="$LDFLAGS $LIBINTL"
69 70

case "$arch" in
71
Darwin )
72 73
;;
SunOS )
74
    LDFLAGS="$LDFLAGS -pthread -lsocket -lnsl"
75 76 77 78 79
;;
HP-UX )
    if [ -d /usr/local/lib/hpux32 ]; then
       AXEL_EXTRA_FLAGS="-L/usr/local/lib/hpux32"
    fi
80
    LDFLAGS="$LDFLAGS $AXEL_EXTRA_FLAGS -lpthread"
81 82
;;
* )
83
    LDFLAGS="$LDFLAGS -pthread"
84 85 86 87 88
;;
esac

#   ---> WARNING: NetBSD not tested! Using OpenBSD settings.

89 90 91 92 93 94 95 96 97 98 99 100 101
# etc path
AC_DEFINE_UNQUOTED([ETCDIR], ["/etc"], ["Define /etc directory path"])

# Other
AH_TEMPLATE([_REENTRANT], [Local definition])
AC_DEFINE_UNQUOTED([_REENTRANT])
AH_TEMPLATE([_THREAD_SAFE], [Local definition])
AC_DEFINE_UNQUOTED([_THREAD_SAFE])

#####################

AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in])
AC_OUTPUT