configure.ac
changeset 0 d6d9e95a4ae5
child 1 99fd216641d8
equal deleted inserted replaced
-1:000000000000 0:d6d9e95a4ae5
       
     1 #                                               -*- Autoconf -*-
       
     2 # Process this file with autoconf to produce a configure script.
       
     3 
       
     4 AC_PREREQ(2.59)
       
     5 AC_INIT([mcabber],[0.10.0-dev],[mcabber@lilotux.net])
       
     6 AM_INIT_AUTOMAKE
       
     7 AC_CONFIG_SRCDIR([mcabber])
       
     8 AM_CONFIG_HEADER(mcabber/config.h)
       
     9 AC_CONFIG_HEADER(include/config.h)
       
    10 
       
    11 AC_PROG_LIBTOOL
       
    12 AC_PROG_RANLIB
       
    13 
       
    14 # Checks for programs.
       
    15 AC_PROG_CC
       
    16 AC_PROG_INSTALL
       
    17 
       
    18 if test "x$GCC" = "xyes"; then
       
    19     dnl Get gcc version
       
    20     AC_MSG_CHECKING([gcc version])
       
    21         gccver=$($CC -dumpversion)
       
    22         gccvermajor=$(echo $gccver | cut -d . -f1)
       
    23         gccverminor=$(echo $gccver | cut -d . -f2)
       
    24         gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
       
    25     AC_MSG_RESULT($gccver)
       
    26 
       
    27     CFLAGS="$CFLAGS -Wall"
       
    28     if test x"$gccvermajor" = x"4" -a x"$gccverminor" = x"2"; then
       
    29         DBGCFLAGS="-fgnu89-inline"
       
    30     fi
       
    31 fi
       
    32 
       
    33 AC_SYS_LARGEFILE
       
    34 
       
    35 # Checks for header files.
       
    36 AC_HEADER_STDC
       
    37 AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \
       
    38                   stdlib.h string.h strings.h sys/socket.h sys/time.h \
       
    39                   syslog.h termios.h wchar.h wctype.h localcharset.h])
       
    40 AC_CHECK_HEADERS([unistd.h], , AC_MSG_ERROR([Missing header file]))
       
    41 AC_VAR_TIMEZONE_EXTERNALS
       
    42 
       
    43 # Checks for typedefs, structures, and compiler characteristics.
       
    44 AC_HEADER_STDBOOL
       
    45 AC_C_CONST
       
    46 AC_C_INLINE
       
    47 AC_TYPE_SIZE_T
       
    48 AC_HEADER_TIME
       
    49 AC_STRUCT_TM
       
    50 
       
    51 # Checks for library functions.
       
    52 AC_FUNC_ERROR_AT_LINE
       
    53 AC_FUNC_MALLOC
       
    54 AC_FUNC_MEMCMP
       
    55 AC_FUNC_REALLOC
       
    56 AC_FUNC_SELECT_ARGTYPES
       
    57 AC_TYPE_SIGNAL
       
    58 AC_FUNC_STRFTIME
       
    59 AC_FUNC_VPRINTF
       
    60 AC_CHECK_FUNCS([alarm arc4random bzero gethostbyname gethostname inet_ntoa \
       
    61                 isascii memmove memset modf select setlocale socket strcasecmp \
       
    62                 strchr strdup strncasecmp strrchr strstr strcasestr vsnprintf \
       
    63                 iswblank])
       
    64 
       
    65 
       
    66 AC_CHECK_DECLS([strptime],,,
       
    67 [#define _GNU_SOURCE
       
    68 #include <time.h>])
       
    69 
       
    70 # Check for tm_gmtoff
       
    71 MC_TM_GMTOFF
       
    72 
       
    73 # Check if we must provide a SIGWINCH handler
       
    74 AC_ARG_ENABLE(sigwinch,
       
    75         [  --enable-sigwinch       compile with SIGWINCH handler],
       
    76         [with_sigwinch=$enableval],
       
    77         [with_sigwinch=$with_ext_funcs])
       
    78 AC_MSG_RESULT($with_sigwinch)
       
    79 if test "$with_sigwinch" = yes; then
       
    80     AC_DEFINE([USE_SIGWINCH], [], [Provide own SIGWINCH handler])
       
    81 fi
       
    82 
       
    83 # Checks for libraries.
       
    84 
       
    85 AC_CHECK_LIB(charset, locale_charset)
       
    86 
       
    87 AC_CHECK_FUNC(initscr,,
       
    88 [
       
    89     cf_ncurses="ncurses"
       
    90     for lib in ncursesw ncurses
       
    91     do
       
    92         AC_CHECK_LIB($lib, waddnwstr,
       
    93             [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
       
    94     done
       
    95     AC_CHECK_LIB($cf_ncurses, initscr,
       
    96         [LIBS="$LIBS -l$cf_ncurses"
       
    97          if test "$cf_ncurses" = ncursesw; then
       
    98             AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/panel.h],,
       
    99                  [AC_CHECK_HEADERS([ncurses.h panel.h],,
       
   100                                    AC_MSG_ERROR([Missing header file]))])
       
   101          else
       
   102              AC_CHECK_HEADERS([ncurses/ncurses.h ncurses/panel.h],,
       
   103                  [AC_CHECK_HEADERS([ncurses.h panel.h],,
       
   104                                    AC_MSG_ERROR([Missing header file]))])
       
   105          fi
       
   106         ],
       
   107         [CF_CURSES_LIBS])
       
   108 ])
       
   109 
       
   110 AC_CHECK_LIB([panelw], [new_panel],,
       
   111              AC_CHECK_LIB([panel], [new_panel])
       
   112             )
       
   113 
       
   114 if test x"$cf_ncurses_unicode" = x"yes"; then
       
   115     AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
       
   116 else
       
   117     AC_MSG_WARN([Your ncurses installation does not support unicode])
       
   118 fi
       
   119 
       
   120 AC_CACHE_CHECK([for ESCDELAY variable],
       
   121                [mc_cv_ncurses_escdelay],
       
   122                [AC_TRY_LINK([], [
       
   123                             extern int ESCDELAY;
       
   124                             ESCDELAY = 0;
       
   125                             ],
       
   126                             [mc_cv_ncurses_escdelay=yes],
       
   127                             [mc_cv_ncurses_escdelay=no])
       
   128                ])
       
   129 if test "$mc_cv_ncurses_escdelay" = yes; then
       
   130     AC_DEFINE([HAVE_ESCDELAY], 1,
       
   131               [Define if ncurses has ESCDELAY variable])
       
   132 fi
       
   133 
       
   134 AC_ARG_ENABLE(modules, [  --enable-modules        enable dynamic modules loading],
       
   135               enable_modules=$enableval)
       
   136 if test "x$enable_modules" = "xyes"; then
       
   137   AC_DEFINE(MODULES_ENABLE, 1, [Define if you want dynamic modules loading])
       
   138   gmodule_module=gmodule
       
   139 else
       
   140   gmodule_module=''
       
   141 fi
       
   142 
       
   143 # Check for glib
       
   144 AM_PATH_GLIB_2_0(2.14.0,
       
   145                  [AC_DEFINE([HAVE_GLIB_REGEX], 1,
       
   146                             [Define if GLib has regex support])],
       
   147                  [AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR([glib is required]),
       
   148                                   [g_list_append], ["$gmodule_module"])],
       
   149                  [g_regex_new "$gmodule_module"])
       
   150 
       
   151 # Check for loudmouth
       
   152 PKG_CHECK_MODULES(LOUDMOUTH, loudmouth-1.0 >= 1.4.2)
       
   153 AC_SUBST(LOUDMOUTH_CFLAGS)
       
   154 AC_SUBST(LOUDMOUTH_LIBS)
       
   155 
       
   156 # Check for libidn
       
   157 AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
       
   158                                    [Support IDN (needs GNU Libidn)]),
       
   159             libidn=$withval, libidn=yes)
       
   160 if test "$libidn" != "no" ; then
       
   161   PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
       
   162   if test "$libidn" != "yes" ; then
       
   163     libidn=no
       
   164     AC_MSG_WARN([Libidn not found])
       
   165   else
       
   166     libidn=yes
       
   167     AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
       
   168   fi
       
   169 fi
       
   170 
       
   171 # Check for gpgme
       
   172 AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
       
   173     [ if test x"$enableval" = x"no"; then
       
   174         enable_gpgme=no
       
   175       fi
       
   176     ])
       
   177 
       
   178 if test x"${enable_gpgme}" != x"no"; then
       
   179     AM_PATH_GPGME(1.0.0, AC_DEFINE([HAVE_GPGME], 1,
       
   180         [Define if you use GPGME to support OpenPGP]))
       
   181 fi
       
   182 
       
   183 # Check for otr
       
   184 AC_ARG_ENABLE(otr, [  --enable-otr            enable OTR (Off-the-Record) messaging support],
       
   185               enable_otr=$enableval, otr="")
       
   186 if test "x$enable_otr" = "xyes"; then
       
   187   # Look for libgcrypt and libotr
       
   188   AM_PATH_LIBGCRYPT(1.2.2, [
       
   189           AM_PATH_LIBOTR(3.1.0, ,
       
   190                          AC_MSG_ERROR(libotr 3.1.0 or newer is required.))
       
   191       ], AC_MSG_ERROR(libgcrypt 1.2.2 or newer is required.)
       
   192   )
       
   193 fi
       
   194 
       
   195 # Check for Enchant stuff
       
   196 AC_ARG_ENABLE(enchant, [  --enable-enchant        enable enchant support],
       
   197               enable_enchant=$enableval, enchant="")
       
   198 # Check for Aspell stuff
       
   199 AC_ARG_ENABLE(aspell, [  --enable-aspell         enable aspell support],
       
   200               enable_aspell=$enableval, aspell="")
       
   201 
       
   202 if test "x$enable_enchant" = "xyes"; then
       
   203  PKG_CHECK_MODULES(ENCHANT, [enchant],
       
   204    AC_DEFINE(WITH_ENCHANT, 1, [Define if you want enchant support])
       
   205  )
       
   206 else
       
   207  if test "x$enable_aspell" = "xyes"; then
       
   208     AC_CHECK_HEADERS(aspell.h, [ have_aspell_includes=yes ])
       
   209     if test "x$have_aspell_includes" = "xyes"; then
       
   210         AC_CHECK_LIB(aspell, new_aspell_config, [ have_aspell_libs=yes ])
       
   211         if test "x$have_aspell_libs" = "xyes"; then
       
   212             AC_DEFINE([WITH_ASPELL], 1, [Define if you want aspell support])
       
   213             LIBS="$LIBS -laspell"
       
   214         else
       
   215             enable_aspell=no
       
   216         fi
       
   217     else
       
   218         enable_aspell=no
       
   219     fi
       
   220  fi
       
   221 fi
       
   222 
       
   223 AC_DEFINE([BUILD_JABBER], 1, [build with jabber support])
       
   224 
       
   225 # Export $datadir to the source tree.
       
   226 if test x"${datadir}" != x""; then
       
   227     AC_DEFINE_DIR(DATA_DIR, datadir, [Data files directory])
       
   228 fi
       
   229 
       
   230 # Export $libexecdir to the source tree
       
   231 AC_DEFINE_DIR(PKGLIB_DIR, "${libdir}/${PACKAGE}", [Modules directory])
       
   232 
       
   233 AC_ARG_ENABLE(debug,
       
   234     [AC_HELP_STRING(--enable-debug, add development compilation options)],
       
   235     debug=$enableval, debug="")
       
   236 if test x"${debug}" = x"yes"; then
       
   237     AC_DEFINE_UNQUOTED([ENABLE_DEBUG],[1],[Devel compilation options])
       
   238     if test "x$GCC" = "xyes"; then
       
   239         if test "$gccvernum" -ge "400"; then
       
   240             CFLAGS="$CFLAGS -Wextra"
       
   241         else
       
   242             CFLAGS="$CFLAGS -W"
       
   243         fi
       
   244         CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
       
   245     fi # gcc
       
   246     CFLAGS="$CFLAGS -g"
       
   247 else
       
   248     CFLAGS="-O2 $CFLAGS"
       
   249 fi
       
   250 
       
   251 AC_ARG_ENABLE(hgcset,
       
   252     [AC_HELP_STRING(--disable-hgcset, do not use Mercurial changeset value)],
       
   253     hgcset=$enableval, hgcset="yes")
       
   254 AM_CONDITIONAL(HGCSET, [test x$hgcset = xyes])
       
   255 if test "${hgcset}" = "yes"; then
       
   256     AC_DEFINE([ENABLE_HGCSET], 1, [Use Mercurial changeset])
       
   257 fi
       
   258 
       
   259 AM_CONDITIONAL([OTR], [test x$libotr_found = xyes])
       
   260 AM_CONDITIONAL([INSTALL_HEADERS], [test x$enable_modules = xyes])
       
   261 
       
   262 # We need _GNU_SOURCE for strptime() and strcasestr()
       
   263 CFLAGS="$CFLAGS -D_GNU_SOURCE"
       
   264 
       
   265 AC_CONFIG_FILES([mcabber/Makefile
       
   266                  modules/Makefile
       
   267                  modules/beep/Makefile
       
   268                  modules/comment/Makefile
       
   269                  modules/extsay/Makefile
       
   270                  doc/Makefile
       
   271                  doc/guide/Makefile
       
   272                  doc/help/Makefile
       
   273                  mcabber.pc
       
   274                  Makefile])
       
   275 AC_OUTPUT