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
30 # Checks for libraries
34 AC_HELP_STRING([--enable-curl], [Enable downloading with curl
36 [want_curl="$enableval"], [want_curl="yes"])
38 if test "x$want_curl" = "xyes"; then
39 PKG_CHECK_MODULES(CURL, libcurl)
40 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
45 AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
47 [want_sha256="$enableval"], [want_sha256="yes"])
49 if test "x$want_sha256" = "xyes"; then
50 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
52 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
55 AC_ARG_ENABLE(openssl,
56 AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
58 [want_openssl="$enableval"], [want_openssl="no"])
60 if test "x$want_openssl" = "xyes"; then
61 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
65 # check for libssl-curl
66 AC_ARG_ENABLE(ssl-curl,
67 AC_HELP_STRING([--enable-ssl-curl], [Enable certificate authentication with curl
68 [[default="$default_sslcurl"]] ]),
69 [want_sslcurl="$enableval"], [want_sslcurl="yes"])
71 if test "x$want_curl" = "xyes" -a "x$want_sslcurl" = "xyes"; then
72 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
73 AC_DEFINE(HAVE_SSLCURL, 1, [Define if you want certificate authentication with curl])
77 if test "x$NEED_SSL_LIBS" = "xyes"; then
78 AC_MSG_CHECKING([if openssl is available])
80 PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
81 if test "x$OPENSSL_LIBS" != "x"; then
84 OPENSSL_LIBS="-lcrypto -lssl"
85 dnl If pkg-config fails, run compile/link test.
87 #include <openssl/opensslv.h>
89 return OPENSSL_VERSION_NUMBER; ],
95 AC_MSG_ERROR(OpenSSL not found)
98 AC_SUBST(OPENSSL_LIBS)
107 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
109 [want_gpgme="$enableval"], [want_gpgme="yes"])
111 if test "x$want_gpgme" = "xyes"; then
113 min_gpgme_version=1.0.0
114 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
115 if test $GPGME_CONFIG != "failed" ; then
116 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
117 req_major=`echo $min_gpgme_version | \
118 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
119 req_minor=`echo $min_gpgme_version | \
120 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
121 req_micro=`echo $min_gpgme_version | \
122 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
123 gpgme_config_version=`$GPGME_CONFIG --version`
124 major=`echo $gpgme_config_version | \
125 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
126 minor=`echo $gpgme_config_version | \
127 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
128 micro=`echo $gpgme_config_version | \
129 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
131 if test "$major" -eq "$req_major"; then
132 if test "$minor" -ge "$req_minor"; then
133 if test "$micro" -ge "$req_micro"; then
140 if test $ok = "yes"; then
141 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
142 GPGME_LIBS=`$GPGME_CONFIG --libs`
144 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
146 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
150 AC_SUBST(GPGME_CFLAGS)
154 # Checks for header files
158 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
160 # Checks for typedefs, structures, and compiler characteristics.
167 AC_CHECK_MEMBERS([struct stat.st_rdev])
170 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
171 AC_SUBST(BIGENDIAN_CFLAGS)
173 # Don't do annoying tests that don't work when cross-compiling, just trust them.
174 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
176 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
179 # Checks for library functions
185 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
188 AC_ARG_WITH(opkglibdir,
189 [ --with-opkglibdir=DIR specifies directory to put status and info files.
190 "/opkg" is always added so if you want your files
191 to be in /var/lib/opkg instead of /usr/lib/opkg
193 --with-opkglibdir=/var/lib ],
194 [case "${withval}" in
195 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
197 *) opkglibdir=$with_opkglibdir ;;
200 # Default local prefix if it is empty
201 if test x$opkglibdir = x; then
206 AC_ARG_WITH(opkgetcdir,
207 [ --with-ipkgetcdir=DIR specifies directory for opkg.conf file,
208 "/opkg" is always added so if you want your files
209 to be in /usr/etc/opkg instead of /etc/opkg
211 --with-ipkgetcdir=/usr/etc ],
212 [case "${withval}" in
213 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
215 *) opkgetcdir=$with_opkgetcdir ;;
218 # Default local prefix if it is empty
219 if test x$opkgetcdir = x; then
224 dnl Some special cases for the wow64 build
225 if test "x$want_gpgme" = "xyes"
227 if test "x$want_openssl" = "xyes"
229 AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
230 Use --disable-gpg if you want OpenSSL smime signatures])