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