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")
57 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
59 [want_gpgme="$enableval"], [want_gpgme="yes"])
61 if test "x$want_gpgme" = "xyes"; then
63 min_gpgme_version=1.0.0
64 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
65 if test $GPGME_CONFIG != "failed" ; then
66 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
67 req_major=`echo $min_gpgme_version | \
68 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
69 req_minor=`echo $min_gpgme_version | \
70 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
71 req_micro=`echo $min_gpgme_version | \
72 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
73 gpgme_config_version=`$GPGME_CONFIG --version`
74 major=`echo $gpgme_config_version | \
75 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
76 minor=`echo $gpgme_config_version | \
77 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
78 micro=`echo $gpgme_config_version | \
79 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
81 if test "$major" -eq "$req_major"; then
82 if test "$minor" -ge "$req_minor"; then
83 if test "$micro" -ge "$req_micro"; then
90 if test $ok = "yes"; then
91 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
92 GPGME_LIBS=`$GPGME_CONFIG --libs`
94 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
96 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
100 AC_SUBST(GPGME_CFLAGS)
104 # Checks for header files
108 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
110 # Checks for typedefs, structures, and compiler characteristics.
117 AC_CHECK_MEMBERS([struct stat.st_rdev])
120 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
121 AC_SUBST(BIGENDIAN_CFLAGS)
123 # Don't do annoying tests that don't work when cross-compiling, just trust them.
124 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
126 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
129 # Checks for library functions
135 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
138 AC_ARG_WITH(opkglibdir,
139 [ --with-opkglibdir=DIR specifies directory to put status and info files.
140 "/opkg" is always added so if you want your files
141 to be in /var/lib/opkg instead of /usr/lib/opkg
143 --with-opkglibdir=/var/lib ],
144 [case "${withval}" in
145 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
147 *) opkglibdir=$with_opkglibdir ;;
150 # Default local prefix if it is empty
151 if test x$opkglibdir = x; then
156 AC_ARG_WITH(opkgetcdir,
157 [ --with-ipkgetcdir=DIR specifies directory for opkg.conf file,
158 "/opkg" is always added so if you want your files
159 to be in /usr/etc/opkg instead of /etc/opkg
161 --with-ipkgetcdir=/usr/etc ],
162 [case "${withval}" in
163 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
165 *) opkgetcdir=$with_opkgetcdir ;;
168 # Default local prefix if it is empty
169 if test x$opkgetcdir = x; then