opkg: various white space cleanups and implement opkg_update_package_lists
[oweals/opkg-lede.git] / configure.ac
1 # Process this file with autoconf to produce a configure script
2 AC_INIT(libopkg/libopkg.c)
3 AM_INIT_AUTOMAKE([opkg], [0.99.163])
4 AM_CONFIG_HEADER(libopkg/config.h)
5
6 AC_CANONICAL_HOST
7 AC_GNU_SOURCE 
8
9
10 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
11   test -f $top_builddir/configure && break
12 done
13
14
15 # Checks for programs
16 AC_PROG_AWK
17 AC_PROG_CC
18 AC_PROG_INSTALL
19 AC_PROG_LN_S
20 AM_PROG_INSTALL_STRIP
21 AC_PROG_LIBTOOL
22
23 # Checks for libraries
24
25 # check for libcurl
26 PKG_CHECK_MODULES(CURL, libcurl)
27
28
29
30 dnl **********
31 dnl GPGME
32 dnl **********
33
34 AC_ARG_ENABLE(gpg,
35     AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
36       [[default=yes]] ]),
37     [want_gpgme="$enableval"], [want_gpgme="yes"])
38
39 if test "x$want_gpgme" = "xyes"; then
40   ok="no"
41   min_gpgme_version=1.0.0
42   AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
43   if test $GPGME_CONFIG != "failed" ; then
44         AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
45         req_major=`echo $min_gpgme_version | \
46                    sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
47         req_minor=`echo $min_gpgme_version | \
48                    sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
49         req_micro=`echo $min_gpgme_version | \
50                    sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
51         gpgme_config_version=`$GPGME_CONFIG --version`
52         major=`echo $gpgme_config_version | \
53                    sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
54         minor=`echo $gpgme_config_version | \
55                    sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
56         micro=`echo $gpgme_config_version | \
57                    sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
58
59           if test "$major" -eq "$req_major"; then
60              if test "$minor" -ge "$req_minor"; then
61                if test "$micro" -ge "$req_micro"; then
62                  ok="yes"
63                fi
64              fi
65           fi
66   fi
67
68   if test $ok = "yes"; then
69     GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
70     GPGME_LIBS=`$GPGME_CONFIG --libs`
71     AC_MSG_RESULT(yes)
72     AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
73   else
74     AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
75   fi
76 fi
77
78 AC_SUBST(GPGME_CFLAGS)
79 AC_SUBST(GPGME_LIBS)
80
81
82 # Checks for header files
83 AC_HEADER_DIRENT
84 AC_HEADER_STDC
85 AC_HEADER_SYS_WAIT
86 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
87
88 # Checks for typedefs, structures, and compiler characteristics.
89 AC_C_CONST
90 AC_TYPE_UID_T
91 AC_TYPE_MODE_T
92 AC_TYPE_OFF_T
93 AC_TYPE_PID_T
94 AC_TYPE_SIZE_T
95 AC_CHECK_MEMBERS([struct stat.st_rdev])
96
97 # Checks endianness
98 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
99 AC_SUBST(BIGENDIAN_CFLAGS)
100
101 # Don't do annoying tests that don't work when cross-compiling, just trust them.
102 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
103 # AC_FUNC_MEMCMP
104 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
105 # AC_FUNC_STAT
106
107 # Checks for library functions
108 AC_FUNC_CHOWN
109 AC_FUNC_FORK
110 AC_TYPE_SIGNAL
111 AC_FUNC_UTIME_NULL
112 AC_FUNC_VPRINTF
113 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
114
115 opkglibdir=
116 AC_ARG_WITH(opkglibdir,
117 [  --with-opkglibdir=DIR   specifies directory to put status and info files.
118                           "/opkg" is always added so if you want your files 
119                           to be in /usr/lib/opkg you should indicate 
120                           --with-opkglibdir=/usr/lib ],
121 [case "${withval}" in
122 yes)    AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
123 no)     ;;
124 *)      opkglibdir=$with_opkglibdir ;;
125 esac])
126
127 # Default local prefix if it is empty
128 if test x$opkglibdir = x; then
129         opkglibdir=/usr/lib
130 fi
131
132 AC_SUBST(opkglibdir)
133
134 AC_OUTPUT(
135     Makefile
136     libopkg/Makefile
137     tests/Makefile
138     src/Makefile
139     libbb/Makefile
140     libopkg.pc
141     )