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