configure.ac 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. # Process this file with autoconf to produce a configure script
  2. AC_INIT([opkg], [0.1.8])
  3. AC_CONFIG_SRCDIR([libopkg/pkg.c])
  4. AC_CONFIG_AUX_DIR([conf])
  5. AC_CONFIG_MACRO_DIR([m4])
  6. AM_INIT_AUTOMAKE
  7. AM_CONFIG_HEADER(libopkg/config.h)
  8. AC_CANONICAL_HOST
  9. AC_GNU_SOURCE
  10. # Disable C++/Fortran checks
  11. define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])
  12. define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
  13. for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
  14. test -f $top_builddir/configure && break
  15. done
  16. # large file support can be useful for gpgme
  17. AC_SYS_LARGEFILE
  18. # Checks for programs
  19. AC_PROG_AWK
  20. AC_PROG_CC
  21. AC_PROG_INSTALL
  22. AC_PROG_LN_S
  23. AM_PROG_INSTALL_STRIP
  24. AC_PROG_LIBTOOL
  25. PKG_PROG_PKG_CONFIG([0.20])
  26. # Checks for libraries
  27. dnl extra argument: --enable-pathfinder
  28. AC_ARG_ENABLE(pathfinder,
  29. AC_HELP_STRING([--enable-pathfinder], [Enable libpathfinder support.
  30. [[default=no]] ]),
  31. [want_pathfinder="$enableval"], [want_pathfinder="no"])
  32. dnl Check for libpathfinder
  33. if test "x$want_pathfinder" = "xyes"; then
  34. PKG_CHECK_MODULES([PATHFINDER], [pathfinder-openssl dbus-1 openssl])
  35. if test -n "$PATHFINDER_CFLAGS$PATHFINDER_LIBS"; then
  36. AC_DEFINE(HAVE_PATHFINDER, 1, [we have pathfinder])
  37. fi
  38. AC_SUBST(PATHFINDER_CFLAGS)
  39. AC_SUBST(PATHFINDER_LIBS)
  40. fi
  41. AM_CONDITIONAL(HAVE_PATHFINDER, test "x$want_pathfinder" = "xyes")
  42. # check for libcurl
  43. AC_ARG_ENABLE(curl,
  44. AC_HELP_STRING([--enable-curl], [Enable downloading with curl
  45. [[default=yes]] ]),
  46. [want_curl="$enableval"], [want_curl="yes"])
  47. if test "x$want_curl" = "xyes"; then
  48. PKG_CHECK_MODULES(CURL, [libcurl])
  49. AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
  50. fi
  51. # check for sha256
  52. AC_ARG_ENABLE(sha256,
  53. AC_HELP_STRING([--enable-sha256], [Enable sha256sum check
  54. (sha256.{c,h} are GPLv3 licensed) [[default=no]] ]),
  55. [want_sha256="$enableval"], [want_sha256="no"])
  56. AC_ARG_ENABLE(md5,
  57. AC_HELP_STRING([--enable-md5], [Enable md5sum check
  58. (md5.{c,h} are GPLv3 licensed) [[default=no]] ]),
  59. [want_md5="$enableval"], [want_md5="yes"])
  60. if test "x$want_sha256" = "xyes"; then
  61. AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
  62. fi
  63. if test "x$want_md5" = "xyes"; then
  64. AC_DEFINE(HAVE_MD5, 1, [Define if you want md5 support])
  65. fi
  66. AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
  67. AM_CONDITIONAL(HAVE_MD5, test "x$want_md5" = "xyes")
  68. # check for openssl
  69. AC_ARG_ENABLE(openssl,
  70. AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
  71. [[default=no]] ]),
  72. [want_openssl="$enableval"], [want_openssl="no"])
  73. if test "x$want_openssl" = "xyes"; then
  74. AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
  75. NEED_SSL_LIBS="yes"
  76. fi
  77. # check for libssl-curl
  78. AC_ARG_ENABLE(ssl-curl,
  79. AC_HELP_STRING([--enable-ssl-curl], [Enable certificate authentication with curl
  80. [[default="yes"]] ]),
  81. [want_sslcurl="$enableval"], [want_sslcurl="yes"])
  82. if test "x$want_curl" = "xyes" -a "x$want_sslcurl" = "xyes"; then
  83. AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
  84. AC_DEFINE(HAVE_SSLCURL, 1, [Define if you want certificate authentication with curl])
  85. NEED_SSL_LIBS="yes"
  86. fi
  87. if test "x$NEED_SSL_LIBS" = "xyes"; then
  88. AC_MSG_CHECKING([if openssl is available])
  89. PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
  90. if test "x$OPENSSL_LIBS" != "x"; then
  91. AC_MSG_RESULT(yes)
  92. else
  93. OPENSSL_LIBS="-lcrypto -lssl"
  94. dnl If pkg-config fails, run compile/link test.
  95. AC_TRY_LINK([
  96. #include <openssl/opensslv.h>
  97. ], [
  98. return OPENSSL_VERSION_NUMBER; ],
  99. [
  100. AC_MSG_RESULT(yes)
  101. ], [
  102. AC_MSG_RESULT(no)
  103. AC_MSG_ERROR(OpenSSL not found)
  104. ])
  105. fi
  106. AC_SUBST(OPENSSL_LIBS)
  107. fi
  108. dnl **********
  109. dnl GPGME
  110. dnl **********
  111. AC_ARG_ENABLE(gpg,
  112. AC_HELP_STRING([--enable-gpg], [Enable signature checking with gpgme
  113. [[default=yes]] ]),
  114. [want_gpgme="$enableval"], [want_gpgme="yes"])
  115. if test "x$want_gpgme" = "xyes"; then
  116. ok="no"
  117. min_gpgme_version=1.0.0
  118. AC_PATH_PROG(GPGME_CONFIG, gpgme-config, "failed")
  119. if test $GPGME_CONFIG != "failed" ; then
  120. AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
  121. req_major=`echo $min_gpgme_version | \
  122. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  123. req_minor=`echo $min_gpgme_version | \
  124. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  125. req_micro=`echo $min_gpgme_version | \
  126. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
  127. gpgme_config_version=`$GPGME_CONFIG --version`
  128. major=`echo $gpgme_config_version | \
  129. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
  130. minor=`echo $gpgme_config_version | \
  131. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
  132. micro=`echo $gpgme_config_version | \
  133. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
  134. if test "$major" -eq "$req_major"; then
  135. if test "$minor" -ge "$req_minor"; then
  136. if test "$micro" -ge "$req_micro"; then
  137. ok="yes"
  138. fi
  139. fi
  140. fi
  141. fi
  142. if test $ok = "yes"; then
  143. GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
  144. GPGME_LIBS=`$GPGME_CONFIG --libs`
  145. AC_MSG_RESULT(yes)
  146. AC_DEFINE(HAVE_GPGME, 1, [Define if you want GPG support])
  147. else
  148. AC_MSG_ERROR(GPGME $min_gpgme_version or later needed)
  149. fi
  150. fi
  151. AC_ARG_ENABLE(usign,
  152. AC_HELP_STRING([--enable-usign], [Enable signature checking with usign
  153. [[default=yes]] ]),
  154. [want_usign="$enableval"], [want_usign="yes"])
  155. if test "x$want_usign" = "xyes"; then
  156. AC_DEFINE(HAVE_USIGN, 1, [Define if you want usign support])
  157. fi
  158. AC_SUBST(GPGME_CFLAGS)
  159. AC_SUBST(GPGME_LIBS)
  160. # Checks for header files
  161. AC_HEADER_DIRENT
  162. AC_HEADER_STDC
  163. AC_HEADER_SYS_WAIT
  164. AC_CHECK_HEADERS([errno.h fcntl.h memory.h regex.h stddef.h stdlib.h string.h strings.h unistd.h utime.h])
  165. # Checks for typedefs, structures, and compiler characteristics.
  166. AC_C_CONST
  167. AC_TYPE_UID_T
  168. AC_TYPE_MODE_T
  169. AC_TYPE_OFF_T
  170. AC_TYPE_PID_T
  171. AC_TYPE_SIZE_T
  172. AC_CHECK_MEMBERS([struct stat.st_rdev])
  173. # Checks endianness
  174. AC_C_BIGENDIAN(BIGENDIAN_CFLAGS="-DWORDS_BIGENDIAN=1",)
  175. AC_SUBST(BIGENDIAN_CFLAGS)
  176. # Don't do annoying tests that don't work when cross-compiling, just trust them.
  177. # The AC_FUNC_MEMCMP test doesn't work during a cross-compile, disable.
  178. # AC_FUNC_MEMCMP
  179. # The AC_FUNC_STAT test doesn't work during a cross-compile, disable.
  180. # AC_FUNC_STAT
  181. # Checks for library functions
  182. AC_FUNC_CHOWN
  183. AC_FUNC_FORK
  184. AC_TYPE_SIGNAL
  185. AC_FUNC_UTIME_NULL
  186. AC_FUNC_VPRINTF
  187. AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
  188. opkglibdir=
  189. AC_ARG_WITH(opkglibdir,
  190. [ --with-opkglibdir=DIR specifies directory to put status and info files.
  191. "/opkg" is always added so if you want your files
  192. to be in /var/lib/opkg instead of /usr/lib/opkg
  193. you should indicate
  194. --with-opkglibdir=/var/lib ],
  195. [case "${withval}" in
  196. yes) AC_MSG_ERROR(bad value ${withval} given for opkg libs directories ) ;;
  197. no) ;;
  198. *) opkglibdir=$with_opkglibdir ;;
  199. esac])
  200. # Default local prefix if it is empty
  201. if test x$opkglibdir = x; then
  202. opkglibdir=/usr/lib
  203. fi
  204. opkgetcdir=
  205. AC_ARG_WITH(opkgetcdir,
  206. [ --with-opkgetcdir=DIR specifies directory for opkg.conf file,
  207. "/opkg" is always added so if you want your files
  208. to be in /usr/etc/opkg instead of /etc/opkg
  209. you should indicate
  210. --with-opkgetcdir=/usr/etc ],
  211. [case "${withval}" in
  212. yes) AC_MSG_ERROR(bad value ${withval} given for opkg.conf directory ) ;;
  213. no) ;;
  214. *) opkgetcdir=$with_opkgetcdir ;;
  215. esac])
  216. # Default local prefix if it is empty
  217. if test x$opkgetcdir = x; then
  218. opkgetcdir=/etc
  219. fi
  220. opkglockfile=
  221. AC_ARG_WITH(opkglockfile,
  222. [ --with-opkglockfile=FILE specifies the file used to make sure there is only
  223. one instance of opkg runnning.
  224. Defaults to ${opkglibdir}/opkg/lock, i.e.
  225. /usr/lib/opkg/lock ],
  226. [case "${withval}" in
  227. yes) AC_MSG_ERROR(bad value ${withval} given for opkg lock file ) ;;
  228. no) ;;
  229. *) opkglockfile=$with_opkglockfile ;;
  230. esac])
  231. # Default if empty
  232. if test x$opkglockfile = x; then
  233. opkglockfile=${opkglibdir}/opkg/lock
  234. fi
  235. dnl Some special cases for the wow64 build
  236. if test "x$want_gpgme" = "xyes"
  237. then
  238. if test "x$want_openssl" = "xyes"
  239. then
  240. AC_MSG_ERROR([--enable-gpg and --enable-openssl are mutually exclusive.
  241. Use --disable-gpg if you want OpenSSL smime signatures])
  242. fi
  243. fi
  244. CLEAN_DATE=`date +"%B %Y" | tr -d '\n'`
  245. AC_SUBST(opkglibdir)
  246. AC_SUBST(opkgetcdir)
  247. AC_SUBST(opkglockfile)
  248. AC_SUBST([CLEAN_DATE])
  249. AC_OUTPUT(
  250. Makefile
  251. libopkg/Makefile
  252. tests/Makefile
  253. src/Makefile
  254. libbb/Makefile
  255. utils/Makefile
  256. utils/update-alternatives
  257. libopkg.pc
  258. man/Makefile
  259. man/opkg-cl.1
  260. man/opkg-key.1
  261. )