1 # Process this file with autoconf to produce a configure script
2 AC_INIT(libopkg/libopkg.c)
4 AC_CONFIG_AUX_DIR([conf])
5 AC_CONFIG_MACRO_DIR([m4])
7 AM_INIT_AUTOMAKE([opkg], [0.1.6])
8 AM_CONFIG_HEADER(libopkg/config.h)
14 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
15 test -f $top_builddir/configure && break
18 # large file support can be useful for gpgme
29 PKG_PROG_PKG_CONFIG([0.20])
31 # Checks for libraries
33 dnl extra argument: --enable-pathfinder
34 AC_ARG_ENABLE(pathfinder,
35 AC_HELP_STRING([--enable-pathfinder], [Enable libpathfinder support.
37 [want_pathfinder="$enableval"], [want_pathfinder="no"])
38 dnl Check for libpathfinder
39 if test "x$want_pathfinder" = "xyes"; then
40 PKG_CHECK_MODULES([PATHFINDER], [pathfinder-openssl dbus-1 openssl])
41 if test -n "$PATHFINDER_CFLAGS$PATHFINDER_LIBS"; then
42 AC_DEFINE(HAVE_PATHFINDER, 1, [we have pathfinder])
44 AC_SUBST(PATHFINDER_CFLAGS)
45 AC_SUBST(PATHFINDER_LIBS)
47 AM_CONDITIONAL(HAVE_PATHFINDER, test "x$want_pathfinder" = "xyes")
51 AC_HELP_STRING([--enable-curl], [Enable downloading with curl
53 [want_curl="$enableval"], [want_curl="yes"])
55 if test "x$want_curl" = "xyes"; then
56 PKG_CHECK_MODULES(CURL, [libcurl])
57 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
62 AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
64 [want_sha256="$enableval"], [want_sha256="yes"])
66 if test "x$want_sha256" = "xyes"; then
67 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
69 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
72 AC_ARG_ENABLE(openssl,
73 AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
75 [want_openssl="$enableval"], [want_openssl="no"])
77 if test "x$want_openssl" = "xyes"; then
78 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
82 # check for libssl-curl
83 AC_ARG_ENABLE(ssl-curl,
84 AC_HELP_STRING([--enable-ssl-curl], [Enable certificate authentication with curl
86 [want_sslcurl="$enableval"], [want_sslcurl="yes"])
88 if test "x$want_curl" = "xyes" -a "x$want_sslcurl" = "xyes"; then
89 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
90 AC_DEFINE(HAVE_SSLCURL, 1, [Define if you want certificate authentication with curl])
94 if test "x$NEED_SSL_LIBS" = "xyes"; then
95 AC_MSG_CHECKING([if openssl is available])
97 PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
98 if test "x$OPENSSL_LIBS" != "x"; then
101 OPENSSL_LIBS="-lcrypto -lssl"
102 dnl If pkg-config fails, run compile/link test.
104 #include <openssl/opensslv.h>
106 return OPENSSL_VERSION_NUMBER; ],
112 AC_MSG_ERROR(OpenSSL not found)
115 AC_SUBST(OPENSSL_LIBS)
124 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
126 [want_gpgme="$enableval"], [want_gpgme="yes"])
128 if test "x$want_gpgme" = "xyes"; then
130 min_gpgme_version=1.0.0
131 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
132 if test $GPGME_CONFIG != "failed" ; then
133 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
134 req_major=`echo $min_gpgme_version | \
135 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
136 req_minor=`echo $min_gpgme_version | \
137 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
138 req_micro=`echo $min_gpgme_version | \
139 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
140 gpgme_config_version=`$GPGME_CONFIG --version`
141 major=`echo $gpgme_config_version | \
142 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
143 minor=`echo $gpgme_config_version | \
144 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
145 micro=`echo $gpgme_config_version | \
146 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
148 if test "$major" -eq "$req_major"; then
149 if test "$minor" -ge "$req_minor"; then
150 if test "$micro" -ge "$req_micro"; then
157 if test $ok = "yes"; then
158 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
159 GPGME_LIBS=`$GPGME_CONFIG --libs`
161 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
163 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
167 AC_SUBST(GPGME_CFLAGS)
171 # Checks for header files
175 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
177 # Checks for typedefs, structures, and compiler characteristics.
184 AC_CHECK_MEMBERS([struct stat.st_rdev])
187 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
188 AC_SUBST(BIGENDIAN_CFLAGS)
190 # Don't do annoying tests that don't work when cross-compiling, just trust them.
191 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
193 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
196 # Checks for library functions
202 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
205 AC_ARG_WITH(opkglibdir,
206 [ --with-opkglibdir=DIR specifies directory to put status and info files.
207 "/opkg" is always added so if you want your files
208 to be in /var/lib/opkg instead of /usr/lib/opkg
210 --with-opkglibdir=/var/lib ],
211 [case "${withval}" in
212 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
214 *) opkglibdir=$with_opkglibdir ;;
217 # Default local prefix if it is empty
218 if test x$opkglibdir = x; then
223 AC_ARG_WITH(opkgetcdir,
224 [ --with-ipkgetcdir=DIR specifies directory for opkg.conf file,
225 "/opkg" is always added so if you want your files
226 to be in /usr/etc/opkg instead of /etc/opkg
228 --with-ipkgetcdir=/usr/etc ],
229 [case "${withval}" in
230 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
232 *) opkgetcdir=$with_opkgetcdir ;;
235 # Default local prefix if it is empty
236 if test x$opkgetcdir = x; then
241 dnl Some special cases for the wow64 build
242 if test "x$want_gpgme" = "xyes"
244 if test "x$want_openssl" = "xyes"
246 AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
247 Use --disable-gpg if you want OpenSSL smime signatures])