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