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])
6 AC_CONFIG_MACRO_DIR([shave])
8 AM_INIT_AUTOMAKE([opkg], [0.1.6])
9 AM_CONFIG_HEADER(libopkg/config.h)
14 # Disable C++/Fortran checks
15 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])
16 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
19 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
20 test -f $top_builddir/configure && break
23 # large file support can be useful for gpgme
34 PKG_PROG_PKG_CONFIG([0.20])
36 # Checks for libraries
38 dnl extra argument: --enable-pathfinder
39 AC_ARG_ENABLE(pathfinder,
40 AC_HELP_STRING([--enable-pathfinder], [Enable libpathfinder support.
42 [want_pathfinder="$enableval"], [want_pathfinder="no"])
43 dnl Check for libpathfinder
44 if test "x$want_pathfinder" = "xyes"; then
45 PKG_CHECK_MODULES([PATHFINDER], [pathfinder-openssl dbus-1 openssl])
46 if test -n "$PATHFINDER_CFLAGS$PATHFINDER_LIBS"; then
47 AC_DEFINE(HAVE_PATHFINDER, 1, [we have pathfinder])
49 AC_SUBST(PATHFINDER_CFLAGS)
50 AC_SUBST(PATHFINDER_LIBS)
52 AM_CONDITIONAL(HAVE_PATHFINDER, test "x$want_pathfinder" = "xyes")
56 AC_HELP_STRING([--enable-curl], [Enable downloading with curl
58 [want_curl="$enableval"], [want_curl="yes"])
60 if test "x$want_curl" = "xyes"; then
61 PKG_CHECK_MODULES(CURL, [libcurl])
62 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
67 AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
69 [want_sha256="$enableval"], [want_sha256="yes"])
71 if test "x$want_sha256" = "xyes"; then
72 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
74 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
77 AC_ARG_ENABLE(openssl,
78 AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
80 [want_openssl="$enableval"], [want_openssl="no"])
82 if test "x$want_openssl" = "xyes"; then
83 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
87 # check for libssl-curl
88 AC_ARG_ENABLE(ssl-curl,
89 AC_HELP_STRING([--enable-ssl-curl], [Enable certificate authentication with curl
91 [want_sslcurl="$enableval"], [want_sslcurl="yes"])
93 if test "x$want_curl" = "xyes" -a "x$want_sslcurl" = "xyes"; then
94 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
95 AC_DEFINE(HAVE_SSLCURL, 1, [Define if you want certificate authentication with curl])
99 if test "x$NEED_SSL_LIBS" = "xyes"; then
100 AC_MSG_CHECKING([if openssl is available])
102 PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
103 if test "x$OPENSSL_LIBS" != "x"; then
106 OPENSSL_LIBS="-lcrypto -lssl"
107 dnl If pkg-config fails, run compile/link test.
109 #include <openssl/opensslv.h>
111 return OPENSSL_VERSION_NUMBER; ],
117 AC_MSG_ERROR(OpenSSL not found)
120 AC_SUBST(OPENSSL_LIBS)
129 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
131 [want_gpgme="$enableval"], [want_gpgme="yes"])
133 if test "x$want_gpgme" = "xyes"; then
135 min_gpgme_version=1.0.0
136 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
137 if test $GPGME_CONFIG != "failed" ; then
138 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
139 req_major=`echo $min_gpgme_version | \
140 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
141 req_minor=`echo $min_gpgme_version | \
142 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
143 req_micro=`echo $min_gpgme_version | \
144 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
145 gpgme_config_version=`$GPGME_CONFIG --version`
146 major=`echo $gpgme_config_version | \
147 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
148 minor=`echo $gpgme_config_version | \
149 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
150 micro=`echo $gpgme_config_version | \
151 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
153 if test "$major" -eq "$req_major"; then
154 if test "$minor" -ge "$req_minor"; then
155 if test "$micro" -ge "$req_micro"; then
162 if test $ok = "yes"; then
163 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
164 GPGME_LIBS=`$GPGME_CONFIG --libs`
166 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
168 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
172 AC_SUBST(GPGME_CFLAGS)
176 # Checks for header files
180 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
182 # Checks for typedefs, structures, and compiler characteristics.
189 AC_CHECK_MEMBERS([struct stat.st_rdev])
192 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
193 AC_SUBST(BIGENDIAN_CFLAGS)
195 # Don't do annoying tests that don't work when cross-compiling, just trust them.
196 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
198 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
201 # Checks for library functions
207 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
210 AC_ARG_WITH(opkglibdir,
211 [ --with-opkglibdir=DIR specifies directory to put status and info files.
212 "/opkg" is always added so if you want your files
213 to be in /var/lib/opkg instead of /usr/lib/opkg
215 --with-opkglibdir=/var/lib ],
216 [case "${withval}" in
217 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
219 *) opkglibdir=$with_opkglibdir ;;
222 # Default local prefix if it is empty
223 if test x$opkglibdir = x; then
228 AC_ARG_WITH(opkgetcdir,
229 [ --with-ipkgetcdir=DIR specifies directory for opkg.conf file,
230 "/opkg" is always added so if you want your files
231 to be in /usr/etc/opkg instead of /etc/opkg
233 --with-ipkgetcdir=/usr/etc ],
234 [case "${withval}" in
235 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
237 *) opkgetcdir=$with_opkgetcdir ;;
240 # Default local prefix if it is empty
241 if test x$opkgetcdir = x; then
246 dnl Some special cases for the wow64 build
247 if test "x$want_gpgme" = "xyes"
249 if test "x$want_openssl" = "xyes"
251 AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
252 Use --disable-gpg if you want OpenSSL smime signatures])
261 # Setup output beautifier.
262 SHAVE_INIT([shave], [enable])
271 utils/update-alternatives