opkg: restore original ipkg ChangeLog
[oweals/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 # Don't do annoying tests that don't work when cross-compiling, just trust them.
97 # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
98 # AC_FUNC_MEMCMP
99 # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
100 # AC_FUNC_STAT
101
102 # Checks for library functions
103 AC_FUNC_CHOWN
104 AC_FUNC_FORK
105 AC_TYPE_SIGNAL
106 AC_FUNC_UTIME_NULL
107 AC_FUNC_VPRINTF
108 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
109
110 opkglibdir=
111 AC_ARG_WITH(opkglibdir,
112 [  --with-opkglibdir=DIR   specifies directory to put status and info files.
113                           "/opkg" is always added so if you want your files 
114                           to be in /usr/lib/opkg you should indicate 
115                           --with-opkglibdir=/usr/lib ],
116 [case "${withval}" in
117 yes)    AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
118 no)     ;;
119 *)      opkglibdir=$with_opkglibdir ;;
120 esac])
121
122 # Default local prefix if it is empty
123 if test x$opkglibdir = x; then
124         opkglibdir=/usr/lib
125 fi
126
127 AC_SUBST(opkglibdir)
128
129 AC_OUTPUT(
130     Makefile
131     libopkg/Makefile
132     tests/Makefile
133     src/Makefile
134     libbb/Makefile
135     libopkg.pc
136     opkg.h)