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