Opkg support for smime (pkcs7) packages list signing
[oweals/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 # check for openssl
52 AC_ARG_ENABLE(openssl,
53               AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
54       [[default=no]] ]),
55     [want_openssl="$enableval"], [want_openssl="no"])
56
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])
60 fi
61
62
63 dnl **********
64 dnl GPGME
65 dnl **********
66
67 AC_ARG_ENABLE(gpg,
68     AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
69       [[default=yes]] ]),
70     [want_gpgme="$enableval"], [want_gpgme="yes"])
71
72 if test "x$want_gpgme" = "xyes"; then
73   ok="no"
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/'`
91
92           if test "$major" -eq "$req_major"; then
93              if test "$minor" -ge "$req_minor"; then
94                if test "$micro" -ge "$req_micro"; then
95                  ok="yes"
96                fi
97              fi
98           fi
99   fi
100
101   if test $ok = "yes"; then
102     GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
103     GPGME_LIBS=`$GPGME_CONFIG --libs`
104     AC_MSG_RESULT(yes)
105     AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
106   else
107     AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
108   fi
109 fi
110
111 AC_SUBST(GPGME_CFLAGS)
112 AC_SUBST(GPGME_LIBS)
113
114
115 # Checks for header files
116 AC_HEADER_DIRENT
117 AC_HEADER_STDC
118 AC_HEADER_SYS_WAIT
119 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
120
121 # Checks for typedefs, structures, and compiler characteristics.
122 AC_C_CONST
123 AC_TYPE_UID_T
124 AC_TYPE_MODE_T
125 AC_TYPE_OFF_T
126 AC_TYPE_PID_T
127 AC_TYPE_SIZE_T
128 AC_CHECK_MEMBERS([struct stat.st_rdev])
129
130 # Checks endianness
131 AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
132 AC_SUBST(BIGENDIAN_CFLAGS)
133
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.
136 # AC_FUNC_MEMCMP
137 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
138 # AC_FUNC_STAT
139
140 # Checks for library functions
141 AC_FUNC_CHOWN
142 AC_FUNC_FORK
143 AC_TYPE_SIGNAL
144 AC_FUNC_UTIME_NULL
145 AC_FUNC_VPRINTF
146 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
147
148 opkglibdir=
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
153                           you should indicate 
154                           --with-opkglibdir=/var/lib ],
155 [case "${withval}" in
156 yes)    AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
157 no)     ;;
158 *)      opkglibdir=$with_opkglibdir ;;
159 esac])
160
161 # Default local prefix if it is empty
162 if test x$opkglibdir = x; then
163         opkglibdir=/usr/lib
164 fi
165
166 ipkgetcdir=
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
171                            you should indicate
172                            --with-ipkgetcdir=/usr/etc ],
173 [case "${withval}" in
174 yes)    AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
175 no)     ;;
176 *)      opkgetcdir=$with_opkgetcdir ;;
177 esac])
178
179 # Default local prefix if it is empty
180 if test x$opkgetcdir = x; then
181         opkgetcdir=/etc
182 fi
183
184
185 dnl Some special cases for the wow64 build
186 if test "x$want_gpgme" = "xyes"
187 then
188         if test "x$want_openssl" = "xyes"
189         then
190         AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
191 Use --disable-gpg if you want OpenSSL smime signatures])
192         fi
193 fi
194
195
196
197 AC_SUBST(opkglibdir)
198 AC_SUBST(opkgetcdir)
199
200 AC_OUTPUT(
201     Makefile
202     libopkg/Makefile
203     tests/Makefile
204     src/Makefile
205     libbb/Makefile
206     utils/Makefile
207     libopkg.pc
208     )