1 # Process this file with autoconf to produce a configure script
2 AC_INIT([opkg], [0.1.8])
3 AC_CONFIG_SRCDIR([libopkg/pkg.c])
5 AC_CONFIG_AUX_DIR([conf])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_MACRO_DIR([shave])
10 AM_CONFIG_HEADER(libopkg/config.h)
15 # Disable C++/Fortran checks
16 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])
17 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
20 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
21 test -f $top_builddir/configure && break
24 # large file support can be useful for gpgme
35 PKG_PROG_PKG_CONFIG([0.20])
37 # Checks for libraries
39 dnl extra argument: --enable-pathfinder
40 AC_ARG_ENABLE(pathfinder,
41 AC_HELP_STRING([--enable-pathfinder], [Enable libpathfinder support.
43 [want_pathfinder="$enableval"], [want_pathfinder="no"])
44 dnl Check for libpathfinder
45 if test "x$want_pathfinder" = "xyes"; then
46 PKG_CHECK_MODULES([PATHFINDER], [pathfinder-openssl dbus-1 openssl])
47 if test -n "$PATHFINDER_CFLAGS$PATHFINDER_LIBS"; then
48 AC_DEFINE(HAVE_PATHFINDER, 1, [we have pathfinder])
50 AC_SUBST(PATHFINDER_CFLAGS)
51 AC_SUBST(PATHFINDER_LIBS)
53 AM_CONDITIONAL(HAVE_PATHFINDER, test "x$want_pathfinder" = "xyes")
57 AC_HELP_STRING([--enable-curl], [Enable downloading with curl
59 [want_curl="$enableval"], [want_curl="yes"])
61 if test "x$want_curl" = "xyes"; then
62 PKG_CHECK_MODULES(CURL, [libcurl])
63 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
68 AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
70 [want_sha256="$enableval"], [want_sha256="yes"])
72 if test "x$want_sha256" = "xyes"; then
73 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
75 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
78 AC_ARG_ENABLE(openssl,
79 AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
81 [want_openssl="$enableval"], [want_openssl="no"])
83 if test "x$want_openssl" = "xyes"; then
84 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
88 # check for libssl-curl
89 AC_ARG_ENABLE(ssl-curl,
90 AC_HELP_STRING([--enable-ssl-curl], [Enable certificate authentication with curl
92 [want_sslcurl="$enableval"], [want_sslcurl="yes"])
94 if test "x$want_curl" = "xyes" -a "x$want_sslcurl" = "xyes"; then
95 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
96 AC_DEFINE(HAVE_SSLCURL, 1, [Define if you want certificate authentication with curl])
100 if test "x$NEED_SSL_LIBS" = "xyes"; then
101 AC_MSG_CHECKING([if openssl is available])
103 PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
104 if test "x$OPENSSL_LIBS" != "x"; then
107 OPENSSL_LIBS="-lcrypto -lssl"
108 dnl If pkg-config fails, run compile/link test.
110 #include <openssl/opensslv.h>
112 return OPENSSL_VERSION_NUMBER; ],
118 AC_MSG_ERROR(OpenSSL not found)
121 AC_SUBST(OPENSSL_LIBS)
130 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
132 [want_gpgme="$enableval"], [want_gpgme="yes"])
134 if test "x$want_gpgme" = "xyes"; then
136 min_gpgme_version=1.0.0
137 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
138 if test $GPGME_CONFIG != "failed" ; then
139 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
140 req_major=`echo $min_gpgme_version | \
141 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
142 req_minor=`echo $min_gpgme_version | \
143 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
144 req_micro=`echo $min_gpgme_version | \
145 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
146 gpgme_config_version=`$GPGME_CONFIG --version`
147 major=`echo $gpgme_config_version | \
148 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
149 minor=`echo $gpgme_config_version | \
150 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
151 micro=`echo $gpgme_config_version | \
152 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
154 if test "$major" -eq "$req_major"; then
155 if test "$minor" -ge "$req_minor"; then
156 if test "$micro" -ge "$req_micro"; then
163 if test $ok = "yes"; then
164 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
165 GPGME_LIBS=`$GPGME_CONFIG --libs`
167 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
169 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
173 AC_SUBST(GPGME_CFLAGS)
177 # Checks for header files
181 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
183 # Checks for typedefs, structures, and compiler characteristics.
190 AC_CHECK_MEMBERS([struct stat.st_rdev])
193 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
194 AC_SUBST(BIGENDIAN_CFLAGS)
196 # Don't do annoying tests that don't work when cross-compiling, just trust them.
197 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
199 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
202 # Checks for library functions
208 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
211 AC_ARG_WITH(opkglibdir,
212 [ --with-opkglibdir=DIR specifies directory to put status and info files.
213 "/opkg" is always added so if you want your files
214 to be in /var/lib/opkg instead of /usr/lib/opkg
216 --with-opkglibdir=/var/lib ],
217 [case "${withval}" in
218 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
220 *) opkglibdir=$with_opkglibdir ;;
223 # Default local prefix if it is empty
224 if test x$opkglibdir = x; then
229 AC_ARG_WITH(opkgetcdir,
230 [ --with-opkgetcdir=DIR specifies directory for opkg.conf file,
231 "/opkg" is always added so if you want your files
232 to be in /usr/etc/opkg instead of /etc/opkg
234 --with-opkgetcdir=/usr/etc ],
235 [case "${withval}" in
236 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
238 *) opkgetcdir=$with_opkgetcdir ;;
241 # Default local prefix if it is empty
242 if test x$opkgetcdir = x; then
247 AC_ARG_WITH(opkglockfile,
248 [ --with-opkglockfile=FILE specifies the file used to make sure there is only
249 one instance of opkg runnning.
250 Defaults to ${opkglibdir}/opkg/lock, i.e.
251 /usr/lib/opkg/lock ],
252 [case "${withval}" in
253 yes) AC_MSG_ERROR(bad value ${withval} given for opkg lock file ) ;;
255 *) opkglockfile=$with_opkglockfile ;;
259 if test x$opkglockfile = x; then
260 opkglockfile=${opkglibdir}/opkg/lock
263 dnl Some special cases for the wow64 build
264 if test "x$want_gpgme" = "xyes"
266 if test "x$want_openssl" = "xyes"
268 AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
269 Use --disable-gpg if you want OpenSSL smime signatures])
273 CLEAN_DATE=`date +"%B %Y" | tr -d '\n'`
277 AC_SUBST(opkglockfile)
278 AC_SUBST([CLEAN_DATE])
280 # Setup output beautifier.
281 SHAVE_INIT([shave], [enable])
290 utils/update-alternatives