opkg: add configure check for libgpgme
[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
70
71
72 # Checks for header files
73 AC_HEADER_DIRENT
74 AC_HEADER_STDC
75 AC_HEADER_SYS_WAIT
76 AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
77
78 # Checks for typedefs, structures, and compiler characteristics.
79 AC_C_CONST
80 AC_TYPE_UID_T
81 AC_TYPE_MODE_T
82 AC_TYPE_OFF_T
83 AC_TYPE_PID_T
84 AC_TYPE_SIZE_T
85 AC_CHECK_MEMBERS([struct stat.st_rdev])
86
87 # Don't do annoying tests that don't work when cross-compiling, just trust them.
88 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
89 # AC_FUNC_MEMCMP
90 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
91 # AC_FUNC_STAT
92
93 # Checks for library functions
94 AC_FUNC_CHOWN
95 AC_FUNC_FORK
96 AC_TYPE_SIGNAL
97 AC_FUNC_UTIME_NULL
98 AC_FUNC_VPRINTF
99 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
100
101 opkglibdir=
102 AC_ARG_WITH(opkglibdir,
103 [  --with-opkglibdir=DIR   specifies directory to put status and info files.
104                           "/opkg" is always added so if you want your files 
105                           to be in /usr/lib/opkg you should indicate 
106                           --with-opkglibdir=/usr/lib ],
107 [case "${withval}" in
108 yes)    AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
109 no)     ;;
110 *)      opkglibdir=$with_opkglibdir ;;
111 esac])
112
113 # Default local prefix if it is empty
114 if test x$opkglibdir = x; then
115         opkglibdir=/usr/lib
116 fi
117
118 AC_SUBST(opkglibdir)
119
120 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)