configure.in 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(src/main.c)
  3. PACKAGE=sylpheed
  4. dnl version number
  5. MAJOR_VERSION=0
  6. MINOR_VERSION=8
  7. MICRO_VERSION=2
  8. INTERFACE_AGE=0
  9. BINARY_AGE=0
  10. EXTRA_VERSION=claws17
  11. EXTRA_VERSION=${EXTRA_VERSION}-endian
  12. VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
  13. dnl set $target
  14. AC_CANONICAL_SYSTEM
  15. dnl
  16. AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
  17. dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
  18. dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
  19. AC_SUBST(PACKAGE)
  20. AC_SUBST(VERSION)
  21. dnl GNOME installed?
  22. AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
  23. if test "$GNOME_CONFIG" != no; then
  24. gnomedir="`gnome-config --prefix`"
  25. AC_SUBST(gnomedir)
  26. fi
  27. AM_CONDITIONAL(SYLPHEED_GNOME, test -d "$gnomedir")
  28. dnl Claws version
  29. AC_DEFINE(CLAWS, 1)
  30. dnl libtool versioning
  31. LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
  32. LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
  33. LT_REVISION=$INTERFACE_AGE
  34. LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
  35. AC_SUBST(LT_RELEASE)
  36. AC_SUBST(LT_CURRENT)
  37. AC_SUBST(LT_REVISION)
  38. AC_SUBST(LT_AGE)
  39. dnl Specify a header configuration file
  40. AM_CONFIG_HEADER(config.h)
  41. AM_MAINTAINER_MODE
  42. dnl Checks for programs.
  43. AC_ARG_PROGRAM
  44. AC_PROG_CC
  45. AC_ISC_POSIX
  46. AM_PROG_CC_STDC
  47. AC_PROG_INSTALL
  48. AC_PROG_LN_S
  49. AC_PROG_MAKE_SET
  50. AC_PROG_CPP
  51. dnl AC_PROG_RANLIB
  52. AM_PROG_LEX
  53. AC_PROG_YACC
  54. AM_PROG_LIBTOOL
  55. SYLPHEED_ACLOCAL_INCLUDE(ac)
  56. case "$target" in
  57. *-darwin*)
  58. CFLAGS="$CFLAGS -traditional-cpp -fno-common"
  59. ;;
  60. esac
  61. dnl for gettext
  62. ALL_LINGUAS="cs de el en_GB es fr hr it ja ko nl pl pt_BR ru sr sv"
  63. AM_GNU_GETTEXT
  64. dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
  65. localedir='${prefix}/${DATADIRNAME}/locale'
  66. AC_SUBST(localedir)
  67. manualdir='${prefix}/${DATADIRNAME}/${PACKAGE}/manual'
  68. AC_SUBST(manualdir)
  69. faqdir='${prefix}/${DATADIRNAME}/${PACKAGE}/faq'
  70. AC_SUBST(faqdir)
  71. dnl Set PACKAGE_DATA_DIR in config.h.
  72. if test "x${datadir}" = 'x${prefix}/share'; then
  73. if test "x${prefix}" = "xNONE"; then
  74. AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
  75. else
  76. AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
  77. fi
  78. else
  79. AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
  80. fi
  81. dnl Checks for libraries.
  82. AM_PATH_GLIB(1.2.6,,
  83. AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
  84. gthread)
  85. AM_PATH_GTK(1.2.6,,
  86. AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
  87. dnl Check for built-in image view support
  88. AC_ARG_ENABLE(gdk-pixbuf,
  89. [ --disable-gdk-pixbuf Do not use gdk-pixbuf],
  90. [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
  91. AC_ARG_ENABLE(imlib,
  92. [ --disable-imlib Do not use imlib],
  93. [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
  94. if test "$ac_cv_enable_gdk_pixbuf" = yes; then
  95. AM_PATH_GDK_PIXBUF(0.8.0,
  96. [AC_DEFINE(HAVE_GDK_PIXBUF)
  97. ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
  98. fi
  99. if test "$ac_cv_enable_imlib" = yes; then
  100. AM_PATH_GDK_IMLIB(1.9,
  101. AC_DEFINE(HAVE_GDK_IMLIB), [ac_cv_enable_imlib=no])
  102. fi
  103. if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
  104. AC_MSG_WARN(*** Built-in image view will not be supported ***)
  105. fi
  106. dnl GPGME is used to support OpenPGP
  107. AC_ARG_ENABLE(gpgme,
  108. [ --enable-gpgme Enable GnuPG support using GPGME [default=no]],
  109. [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
  110. AC_MSG_CHECKING([whether to use GPGME])
  111. if test $ac_cv_enable_gpgme = yes; then
  112. AC_MSG_RESULT(yes)
  113. AM_PATH_GPGME(0.3.5, AC_DEFINE(USE_GPGME), [use_gpgme=no
  114. ac_cv_enable_gpgme=no])
  115. else
  116. AC_MSG_RESULT(no)
  117. fi
  118. dnl for JPilot support in addressbook
  119. dnl no check for libraries; these are dynamically loaded
  120. AC_ARG_ENABLE(jpilot,
  121. [ --enable-jpilot Enable JPilot support [default=no]],
  122. [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
  123. AC_MSG_CHECKING([whether to use JPilot])
  124. if test "$ac_cv_enable_jpilot" = yes; then
  125. AC_MSG_RESULT(yes)
  126. AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
  127. [ AC_DEFINE(USE_JPILOT) ],
  128. [ ac_cv_enable_jpilot=no ])
  129. if test "$ac_cv_enable_jpilot" = no; then
  130. AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
  131. [ ac_cv_enable_jpilot=yes
  132. AC_DEFINE(USE_JPILOT) ])
  133. fi
  134. AC_MSG_CHECKING([whether jpilot is available])
  135. AC_MSG_RESULT($ac_cv_enable_jpilot)
  136. if test "$ac_cv_enable_jpilot" = yes; then
  137. LIBS="$LIBS -lpisock"
  138. fi
  139. else
  140. AC_MSG_RESULT(no)
  141. fi
  142. dnl for LDAP support in addressbook
  143. AC_ARG_ENABLE(ldap,
  144. [ --enable-ldap Enable LDAP support [default=no]],
  145. [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
  146. AC_MSG_CHECKING([whether to use LDAP])
  147. if test "$ac_cv_enable_ldap" = yes; then
  148. AC_MSG_RESULT(yes)
  149. dnl check for available libraries, and pull them in
  150. AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
  151. AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
  152. AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
  153. AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber")
  154. dnl we need libpthread for sylpheed ldap, until we find
  155. dnl a better way to handle ldap requests asynchronously...
  156. AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
  157. dnl the check for the headers
  158. AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
  159. [ ac_cv_enable_ldap=yes ],
  160. [ ac_cv_enable_ldap=no ])
  161. AC_MSG_CHECKING([whether ldap headers were detected])
  162. AC_MSG_RESULT($ac_cv_enable_ldap)
  163. if test "$ac_cv_enable_ldap" = yes; then
  164. AC_CHECK_LIB(ldap, ldap_open, [
  165. ac_cv_enable_ldap=yes
  166. CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
  167. LDAP_LIBS="$LDAP_LIBS -lldap `$GLIB_CONFIG --libs gthread`"
  168. AC_DEFINE(USE_LDAP)
  169. AC_SUBST(LDAP_LIBS)
  170. ],
  171. [ ac_cv_enable_ldap=no ], $LDAP_LIBS )
  172. AC_MSG_CHECKING([whether ldap libs were detected])
  173. AC_MSG_RESULT($ac_cv_enable_ldap)
  174. fi
  175. else
  176. AC_MSG_RESULT(no)
  177. fi
  178. dnl Check for OpenSSL
  179. AC_ARG_ENABLE(ssl,
  180. [ --enable-ssl Enable SSL support using OpenSSL [default=no]],
  181. [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=no])
  182. AC_MSG_CHECKING([whether to use OpenSSL])
  183. if test $ac_cv_enable_ssl = yes; then
  184. AC_MSG_RESULT(yes)
  185. AC_MSG_CHECKING([if openssl is available])
  186. LIBS="$LIBS -lssl -lcrypto"
  187. AC_TRY_LINK([
  188. #include <openssl/opensslv.h>
  189. ], [ return OPENSSL_VERSION_NUMBER; ],
  190. [ AC_MSG_RESULT(yes)
  191. AC_DEFINE(USE_SSL) ],
  192. [ AC_MSG_RESULT(no)
  193. LIBS="$ac_save_LIBS"
  194. ac_cv_enable_ssl=no ])
  195. else
  196. AC_MSG_RESULT(no)
  197. fi
  198. dnl Check for X-Face support
  199. AC_ARG_ENABLE(compface,
  200. [ --disable-compface Do not use compface (X-Face)],
  201. [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
  202. if test "$ac_cv_enable_compface" = yes; then
  203. AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
  204. fi
  205. dnl Check for libjconv
  206. AC_ARG_ENABLE(jconv,
  207. [ --disable-jconv Do not use libjconv],
  208. [ac_cv_enable_jconv=$enableval], [ac_cv_enable_jconv=yes])
  209. if test "$ac_cv_enable_jconv" = yes; then
  210. AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_enable_jconv=no])
  211. fi
  212. AC_CHECK_LIB(xpg4, setlocale)
  213. dnl for GThread support (currently disabled)
  214. dnl AC_ARG_ENABLE(threads,
  215. dnl [ --enable-threads Enable multithread support [default=no]],
  216. dnl [use_threads=$enableval], [use_threads=no])
  217. AC_MSG_CHECKING([whether to use threads])
  218. if test x"$use_threads" = xyes ; then
  219. AC_MSG_RESULT(yes)
  220. if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
  221. CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
  222. LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
  223. AC_DEFINE(USE_THREADS)
  224. else
  225. AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
  226. fi
  227. else
  228. AC_MSG_RESULT(no)
  229. fi
  230. dnl check for IPv6 option
  231. AC_ARG_ENABLE(ipv6,
  232. [ --enable-ipv6 Enable IPv6 support [default=no]],
  233. [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
  234. dnl automated checks for IPv6 support.
  235. AC_MSG_CHECKING([whether to use IPv6])
  236. if test x"$ac_cv_enable_ipv6" = xyes; then
  237. AC_MSG_RESULT(yes)
  238. AC_MSG_CHECKING([for IPv6 support])
  239. AC_CACHE_VAL(ac_cv_ipv6,[
  240. AC_TRY_COMPILE([#define INET6
  241. #include <sys/types.h>
  242. #include <netinet/in.h>],
  243. [int x = IPPROTO_IPV6; struct in6_addr a;],
  244. ac_cv_ipv6=yes, ac_cv_ipv6=no)
  245. ])
  246. AC_MSG_RESULT($ac_cv_ipv6)
  247. if test $ac_cv_ipv6 = yes; then
  248. AC_DEFINE(INET6)
  249. else
  250. AC_MSG_WARN(*** IPv6 will not be supported ***)
  251. ac_cv_enable_ipv6=no
  252. fi
  253. else
  254. AC_MSG_RESULT(no)
  255. fi
  256. dnl ASPELL is user for spell checking
  257. AC_ARG_ENABLE(aspell,
  258. [ --enable-aspell Enable GNU/aspell support [default=no]],
  259. [ac_cv_enable_aspell=$enableval], [ac_cv_enable_aspell=no])
  260. AC_MSG_CHECKING([whether to use GNU/aspell])
  261. if test $ac_cv_enable_aspell = yes; then
  262. AC_MSG_RESULT(yes)
  263. AM_PATH_ASPELL(0.50, AC_DEFINE(USE_ASPELL), [use_aspell=no
  264. ac_cv_enable_aspell=no])
  265. aspell_path="`$ASPELL config dict-dir`"
  266. AC_DEFINE_UNQUOTED(ASPELL_PATH, "${aspell_path}/")
  267. else
  268. AC_MSG_RESULT(no)
  269. fi
  270. dnl check if gdk / gtk was compiled with USE_XIM
  271. AC_MSG_CHECKING([whether GTK was compiled with XIM support])
  272. CFLAGS_SAVE="$CFLAGS"
  273. LDFLAGS_SAVE="$LDFLAGS"
  274. CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags` `gtk-config --cflags`"
  275. LDFLAGS="$LIBS `$GLIB_CONFIG --libs` `gtk-config --libs`"
  276. AC_CACHE_VAL(ac_cv_use_gtkgdk_xim, [
  277. AC_TRY_LINK_FUNC([ gdk_ic_attr_new ],
  278. ac_cv_use_gtkgdk_xim=yes, ac_cv_use_gtkgdk_xim=no)
  279. ])
  280. AC_MSG_RESULT($ac_cv_use_gtkgdk_xim)
  281. if test $ac_cv_use_gtkgdk_xim = yes; then
  282. AC_DEFINE(USE_GTKGDK_XIM)
  283. fi
  284. CFLAGS="$CFLAGS_SAVE"
  285. LDFLAGS="$LDFLAGS_SAVE"
  286. dnl want crash dialog
  287. AC_ARG_ENABLE(crash-dialog,
  288. [ --enable-crash-dialog Enable crash dialog [default=no]],
  289. [ac_cv_enable_crash_dialog=$enableval], [ac_cv_enable_crash_dialog=no])
  290. if test $ac_cv_enable_crash_dialog = yes; then
  291. dnl check if GDB is somewhere
  292. AC_CHECK_PROG(ac_cv_enable_crash_dialog, gdb, yes, no)
  293. AC_MSG_CHECKING([whether to use crash dialog])
  294. if test $ac_cv_enable_crash_dialog = yes; then
  295. AC_DEFINE(CRASH_DIALOG)
  296. fi
  297. AC_MSG_RESULT($ac_cv_enable_crash_dialog)
  298. fi
  299. dnl Checks for header files.
  300. AC_HEADER_DIRENT
  301. AC_HEADER_STDC
  302. AC_HEADER_SYS_WAIT
  303. AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
  304. sys/param.h sys/utsname.h sys/select.h \
  305. wchar.h wctype.h)
  306. dnl Checks for typedefs, structures, and compiler characteristics.
  307. AC_C_CONST
  308. AC_TYPE_OFF_T
  309. AC_TYPE_PID_T
  310. AC_TYPE_SIZE_T
  311. AC_STRUCT_TM
  312. dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
  313. dnl may be defined only in wchar.h (this happens with gcc-2.96).
  314. dnl So we need to use this extended macro.
  315. SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
  316. [
  317. #if HAVE_WCHAR_H
  318. #include <wchar.h>
  319. #endif
  320. ])
  321. GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
  322. AC_CHECK_SIZEOF(unsigned short, 2)
  323. AC_CHECK_SIZEOF(unsigned int, 4)
  324. AC_CHECK_SIZEOF(unsigned long, 4)
  325. dnl Checks for library functions.
  326. AC_FUNC_ALLOCA
  327. AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
  328. wcsstr wcswcs iswalnum iswspace towlower \
  329. wcslen wcscpy wcsncpy \
  330. uname flock lockf inet_aton inet_addr \
  331. fchmod mkstemp)
  332. AC_OUTPUT([
  333. Makefile
  334. sylpheed.spec
  335. intl/Makefile
  336. ac/Makefile
  337. po/Makefile.in
  338. src/version.h
  339. src/Makefile
  340. faq/Makefile
  341. faq/de/Makefile
  342. faq/en/Makefile
  343. faq/es/Makefile
  344. faq/fr/Makefile
  345. faq/it/Makefile
  346. man/Makefile
  347. manual/Makefile
  348. manual/de/Makefile
  349. manual/en/Makefile
  350. manual/es/Makefile
  351. manual/fr/Makefile
  352. manual/ja/Makefile
  353. tools/Makefile
  354. ])
  355. dnl Output the configuration summary
  356. echo ""
  357. echo "$PACKAGE $VERSION"
  358. echo ""
  359. if test "$ac_cv_enable_gdk_pixbuf" = yes; then
  360. echo "image support : yes (gdk-pixbuf)"
  361. elif test "$ac_cv_enable_imlib" = yes; then
  362. echo "image support : yes (gdk_imlib)"
  363. else
  364. echo "image support : no"
  365. fi
  366. echo "GPGME : $ac_cv_enable_gpgme"
  367. echo "JPilot : $ac_cv_enable_jpilot"
  368. echo "LDAP : $ac_cv_enable_ldap"
  369. echo "OpenSSL : $ac_cv_enable_ssl"
  370. echo "compface : $ac_cv_enable_compface"
  371. echo "libjconv : $ac_cv_enable_jconv"
  372. echo "IPv6 : $ac_cv_enable_ipv6"
  373. echo "GNU/aspell : $ac_cv_enable_aspell"
  374. echo "Crash dialog : $ac_cv_enable_crash_dialog"
  375. echo ""
  376. echo "The binary will be installed in $prefix/bin"
  377. echo ""
  378. echo "Configure finished, type 'make' to build."