configure.ac 4.84 KB
Newer Older
Bernhard Link's avatar
Bernhard Link committed
1 2 3 4
dnl
dnl Process this file with autoconf to produce a configure script
dnl

Bernhard Link's avatar
Bernhard Link committed
5
AC_INIT(reprepro, 4.14.0, brlink@debian.org)
6 7 8
AC_CONFIG_SRCDIR(main.c)
AC_CONFIG_AUX_DIR(ac)
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability])
Bernhard Link's avatar
Bernhard Link committed
9 10
AM_CONFIG_HEADER(config.h)

11
if test "${CFLAGS+set}" != set ; then
Bernhard Link's avatar
Bernhard Link committed
12 13 14
	CFLAGS="-Wall -O2 -g -Wmissing-prototypes -Wstrict-prototypes -Wshadow"
fi

15 16 17
AM_MAINTAINER_MODE
AC_GNU_SOURCE

Bernhard Link's avatar
Bernhard Link committed
18
AC_PROG_CC_C99
Bernhard Link's avatar
Bernhard Link committed
19
AC_PROG_INSTALL
Bernhard Link's avatar
Bernhard Link committed
20
AC_SYS_LARGEFILE
Bernhard Link's avatar
Bernhard Link committed
21

22
AC_C_BIGENDIAN()
23
AC_HEADER_STDBOOL
24
AC_CHECK_FUNCS([closefrom strndup dprintf tdestroy])
25 26 27 28 29
found_mktemp=no
AC_CHECK_FUNCS([mkostemp mkstemp],[found_mktemp=yes ; break],)
if test "$found_mktemp" = "no" ; then
	AC_MSG_ERROR([Missing mkstemp or mkostemp])
fi
30
AC_CHECK_FUNC([vasprintf],,[AC_MSG_ERROR([Could not find vasprintf implementation!])])
31

32
DBLIBS=""
33 34
# the only way to find out which is compileable is to look into db.h:

35
AC_CHECK_HEADER(db.h,,[AC_MSG_ERROR(["no db.h found"])])
36

37 38
AC_CHECK_LIB(db, db_create, [DBLIBS="-ldb $DBLIBS"
	],[AC_MSG_ERROR(["no libdb found"])],[$DBLIBS])
39 40
AC_SUBST([DBLIBS])

41
AC_CHECK_LIB(z,gzopen,,[AC_MSG_ERROR(["no zlib found"])],)
42 43

AC_ARG_WITH(libgpgme,
44
[  --with-libgpgme=path|yes|no	Give path to prefix libgpgme was installed with],[dnl
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
	case "$withval" in
	no)
	;;
	yes)
	AC_CHECK_HEADER(gpgme.h,,[AC_MSG_ERROR(["no gpgme.h found"])])
	AC_CHECK_LIB(gpg-error,gpg_strsource,,[AC_MSG_ERROR(["no libgpg-error found"])],)
	AC_CHECK_LIB(gpgme,gpgme_get_protocol_name,,[AC_MSG_ERROR(["no libgpgme found (need at least 0.4.1)"])],)
	;;
	*)
	CPPFLAGS="$CPPFLAGS -I$withval/include"
	LIBS="$LIBS -L$withval/lib"
	AC_CHECK_HEADER(gpgme.h,,[AC_MSG_ERROR(["no gpgme.h found"])])
	AC_CHECK_LIB(gpg-error,gpg_strsource,,[AC_MSG_ERROR(["no libgpg-error found"])],)
	AC_CHECK_LIB(gpgme,gpgme_get_protocol_name,,[AC_MSG_ERROR(["no libgpgme found (need at least 0.4.1)"])],)
	;;
	esac
],[dnl default is to behave like yes (for libgpgme only)
	AC_CHECK_HEADER(gpgme.h,,[AC_MSG_ERROR(["no gpgme.h found (to disable run with --without-libgpgme)"])])
	AC_CHECK_LIB(gpg-error,gpg_strsource,,[AC_MSG_ERROR(["no libgpg-error found (to disable run with --without-libgpgme)"])],)
	AC_CHECK_LIB(gpgme,gpgme_get_protocol_name,,[AC_MSG_ERROR(["did not find libgpgme versoion 0.4.1 or later (to disable run with --without-libgpgme)"])],)
])
66

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
AC_ARG_WITH(libbz2,
[  --with-libbz2=path|yes|no	Give path to prefix libbz2 was installed with],[dnl
	case "$withval" in
	no)
	;;
	yes)
	AC_CHECK_LIB(bz2,BZ2_bzCompressInit,,[AC_MSG_ERROR(["no libbz2 found, despite being told to use it"])],)
	;;
	*)
	AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[dnl
		AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBBZ2))
		LIBS="$LIBS -L$withval/lib -lbz2"
		CPPFLAGS="$CPPFLAGS -I$withval/include"
	],[AC_MSG_ERROR(["no libbz2 found, despite being told to use it"])],[-L$withval/lib])
	;;
	esac
],[dnl without --with-libbz2 we look for it but not finding it is no error:
	AC_CHECK_LIB(bz2,BZ2_bzCompressInit,,[AC_MSG_WARN(["no libbz2 found, compiling without"])],)
])

87 88 89 90 91 92 93 94 95 96 97
ARCHIVELIBS=""
ARCHIVECPP=""
AH_TEMPLATE([HAVE_LIBARCHIVE],[Defined if libarchive is available])
AC_ARG_WITH(libarchive,
[  --with-libarchive=path|yes|no  Give path to prefix libarchive was installed with],[dnl
	case "$withval" in
	no)
	;;
	yes)
	AC_CHECK_LIB(archive,archive_read_new,[dnl
		AC_CHECK_HEADER(archive.h,[dnl
98
			AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE),1)
99 100 101 102 103 104 105 106 107
			ARCHIVELIBS="-larchive"
		],[AC_MSG_ERROR([Could not find archive.h])])
	],[AC_MSG_ERROR([Could not find libarchive])])
	;;
	*)
	AC_CHECK_LIB(archive,archive_read_new,[dnl
		mysave_CPPFLAGS="$CPPFLAGS"
		CPPFLAGS="-I$withval/include $CPPFLAGS"
		AC_CHECK_HEADER(archive.h,[dnl
108
			AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE),1)
109 110 111 112 113 114 115 116 117 118
			ARCHIVELIBS="-L$withval/lib -larchive"
			ARCHIVECPP="-I$withval/include"
		],[AC_MSG_ERROR([Could not find archive.h])])
		CPPFLAGS="$mysave_CPPFLAGS"
	],[AC_MSG_ERROR([Could not find libarchive])],[-L$withval/lib])
	;;
	esac
],[dnl without --with-libarchive we look for it but not finding it is no error:
	AC_CHECK_LIB(archive,archive_read_new,[dnl
		AC_CHECK_HEADER(archive.h,[dnl
119
			AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE),1)
120
			ARCHIVELIBS="-larchive"
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
		],)
	],)
])
AC_ARG_WITH(static-libarchive,
[  --with-static-libarchive=.a-file  static libarchive library to be linked against],
[	case "$withval" in
	no|yes) AC_MSG_ERROR([--with-static-libarchive needs an .a file as parameter])
	;;
	*)
	AC_CHECK_LIB(c,archive_read_new,[dnl
		mysave_CPPFLAGS="$CPPFLAGS"
		CPPFLAGS="$ARCHIVECPP $CPPFLAGS"
		AC_CHECK_HEADER(archive.h,[dnl
			AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE))
			ARCHIVELIBS="$withval"
		],[AC_MSG_ERROR([Could not find archive.h])])
		CPPFLAGS="$mysave_CPPFLAGS"
	],[AC_MSG_ERROR([Error linking against $withval])],[$withval])
	esac
140 141 142 143
])
AM_CONDITIONAL([HAVE_LIBARCHIVE],[test -n "$ARCHIVELIBS"])
AC_SUBST([ARCHIVELIBS])
AC_SUBST([ARCHIVECPP])
Bernhard Link's avatar
Bernhard Link committed
144 145 146 147 148

dnl
dnl Create makefiles
dnl

Bernhard Link's avatar
Bernhard Link committed
149 150
AC_CONFIG_FILES([Makefile docs/Makefile tests/Makefile])
AC_OUTPUT