Add sha256 ckecksums to okpg
[project/opkg-lede.git] / configure.ac
1 # Process this file with autoconf to produce a configure script
2 AC_INIT(libopkg/libopkg.c)
3
4 AC_CONFIG_AUX_DIR([conf])
5 AC_CONFIG_MACRO_DIR([m4])
6
7 AM_INIT_AUTOMAKE([opkg], [0.1.6])
8 AM_CONFIG_HEADER(libopkg/config.h)
9
10 AC_CANONICAL_HOST
11 AC_GNU_SOURCE
12
13
14 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
15 test -f $top_builddir/configure && break
16 done
17
18
19 # Checks for programs
20 AC_PROG_AWK
21 AC_PROG_CC
22 AC_PROG_INSTALL
23 AC_PROG_LN_S
24 AM_PROG_INSTALL_STRIP
25 AC_PROG_LIBTOOL
26
27 # Checks for libraries
28
29 # check for libcurl
30 AC_ARG_ENABLE(curl,
31 AC_HELP_STRING([--enable-curl], [Enable downloading with curl
32 [[default=yes]] ]),
33 [want_curl="$enableval"], [want_curl="yes"])
34
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])
38 fi
39
40 # check for sha256
41 AC_ARG_ENABLE(sha256,
42 AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
43 [[default=yes]] ]),
44 [want_sha256="$enableval"], [want_sha256="yes"])
45
46 if test "x$want_sha256" = "xyes"; then
47 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
48 fi
49 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
50
51
52 dnl **********
53 dnl GPGME
54 dnl **********
55
56 AC_ARG_ENABLE(gpg,
57 AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
58 [[default=yes]] ]),
59 [want_gpgme="$enableval"], [want_gpgme="yes"])
60
61 if test "x$want_gpgme" = "xyes"; then
62 ok="no"
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/'`
80
81 if test "$major" -eq "$req_major"; then
82 if test "$minor" -ge "$req_minor"; then
83 if test "$micro" -ge "$req_micro"; then
84 ok="yes"
85 fi
86 fi
87 fi
88 fi
89
90 if test $ok = "yes"; then
91 GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
92 GPGME_LIBS=`$GPGME_CONFIG --libs`
93 AC_MSG_RESULT(yes)
94 AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
95 else
96 AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
97 fi
98 fi
99
100 AC_SUBST(GPGME_CFLAGS)
101 AC_SUBST(GPGME_LIBS)
102
103
104 # Checks for header files
105 AC_HEADER_DIRENT
106 AC_HEADER_STDC
107 AC_HEADER_SYS_WAIT
108 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
109
110 # Checks for typedefs, structures, and compiler characteristics.
111 AC_C_CONST
112 AC_TYPE_UID_T
113 AC_TYPE_MODE_T
114 AC_TYPE_OFF_T
115 AC_TYPE_PID_T
116 AC_TYPE_SIZE_T
117 AC_CHECK_MEMBERS([struct stat.st_rdev])
118
119 # Checks endianness
120 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
121 AC_SUBST(BIGENDIAN_CFLAGS)
122
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.
125 # AC_FUNC_MEMCMP
126 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
127 # AC_FUNC_STAT
128
129 # Checks for library functions
130 AC_FUNC_CHOWN
131 AC_FUNC_FORK
132 AC_TYPE_SIGNAL
133 AC_FUNC_UTIME_NULL
134 AC_FUNC_VPRINTF
135 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
136
137 opkglibdir=
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
142 you should indicate
143 --with-opkglibdir=/var/lib ],
144 [case "${withval}" in
145 yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
146 no) ;;
147 *) opkglibdir=$with_opkglibdir ;;
148 esac])
149
150 # Default local prefix if it is empty
151 if test x$opkglibdir = x; then
152 opkglibdir=/usr/lib
153 fi
154
155 ipkgetcdir=
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
160 you should indicate
161 --with-ipkgetcdir=/usr/etc ],
162 [case "${withval}" in
163 yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
164 no) ;;
165 *) opkgetcdir=$with_opkgetcdir ;;
166 esac])
167
168 # Default local prefix if it is empty
169 if test x$opkgetcdir = x; then
170 opkgetcdir=/etc
171 fi
172
173
174 AC_SUBST(opkglibdir)
175 AC_SUBST(opkgetcdir)
176
177 AC_OUTPUT(
178 Makefile
179 libopkg/Makefile
180 tests/Makefile
181 src/Makefile
182 libbb/Makefile
183 utils/Makefile
184 libopkg.pc
185 )