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
27 # Checks for libraries
31 AC_HELP_STRING([--enable-curl], [Enable downloading with curl
33 [want_curl="$enableval"], [want_curl="yes"])
35 if test "x$want_curl" = "xyes"; then
36 PKG_CHECK_MODULES(CURL, libcurl)
37 AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
42 AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
44 [want_sha256="$enableval"], [want_sha256="yes"])
46 if test "x$want_sha256" = "xyes"; then
47 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
49 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
52 AC_ARG_ENABLE(openssl,
53 AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
55 [want_openssl="$enableval"], [want_openssl="no"])
57 if test "x$want_openssl" = "xyes"; then
58 PKG_CHECK_MODULES(OPENSSL, openssl)
59 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
68 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
70 [want_gpgme="$enableval"], [want_gpgme="yes"])
72 if test "x$want_gpgme" = "xyes"; then
74 min_gpgme_version=1.0.0
75 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
76 if test $GPGME_CONFIG != "failed" ; then
77 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
78 req_major=`echo $min_gpgme_version | \
79 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
80 req_minor=`echo $min_gpgme_version | \
81 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
82 req_micro=`echo $min_gpgme_version | \
83 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
84 gpgme_config_version=`$GPGME_CONFIG --version`
85 major=`echo $gpgme_config_version | \
86 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
87 minor=`echo $gpgme_config_version | \
88 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
89 micro=`echo $gpgme_config_version | \
90 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
92 if test "$major" -eq "$req_major"; then
93 if test "$minor" -ge "$req_minor"; then
94 if test "$micro" -ge "$req_micro"; then
101 if test $ok = "yes"; then
102 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
103 GPGME_LIBS=`$GPGME_CONFIG --libs`
105 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
107 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
111 AC_SUBST(GPGME_CFLAGS)
115 # Checks for header files
119 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
121 # Checks for typedefs, structures, and compiler characteristics.
128 AC_CHECK_MEMBERS([struct stat.st_rdev])
131 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
132 AC_SUBST(BIGENDIAN_CFLAGS)
134 # Don't do annoying tests that don't work when cross-compiling, just trust them.
135 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
137 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
140 # Checks for library functions
146 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
149 AC_ARG_WITH(opkglibdir,
150 [ --with-opkglibdir=DIR specifies directory to put status and info files.
151 "/opkg" is always added so if you want your files
152 to be in /var/lib/opkg instead of /usr/lib/opkg
154 --with-opkglibdir=/var/lib ],
155 [case "${withval}" in
156 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
158 *) opkglibdir=$with_opkglibdir ;;
161 # Default local prefix if it is empty
162 if test x$opkglibdir = x; then
167 AC_ARG_WITH(opkgetcdir,
168 [ --with-ipkgetcdir=DIR specifies directory for opkg.conf file,
169 "/opkg" is always added so if you want your files
170 to be in /usr/etc/opkg instead of /etc/opkg
172 --with-ipkgetcdir=/usr/etc ],
173 [case "${withval}" in
174 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
176 *) opkgetcdir=$with_opkgetcdir ;;
179 # Default local prefix if it is empty
180 if test x$opkgetcdir = x; then
185 dnl Some special cases for the wow64 build
186 if test "x$want_gpgme" = "xyes"
188 if test "x$want_openssl" = "xyes"
190 AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
191 Use --disable-gpg if you want OpenSSL smime signatures])