]> git.deb.at Git - pkg/abook.git/blobdiff - configure.in
wide character support
[pkg/abook.git] / configure.in
index f85da8daa196126e2ad8a40ecf1ec0ae1fca0cf5..0ba524c8bd284aa4c6d8a2c7a52dbabe4e28d1c1 100644 (file)
@@ -1,9 +1,14 @@
 dnl abook configure.in
 
 AC_INIT(abook.c)
-AM_INIT_AUTOMAKE(abook, 0.4.13)
+AM_INIT_AUTOMAKE(abook, 0.5.2pre)
 AM_CONFIG_HEADER(config.h)
 
+AC_DEFINE(HAVE_SNPRINTF, 0, [Define if snprintf is available.])
+AC_DEFINE(HAVE_VSNPRINTF, 0, [Define if vsnprintf is available.])
+AC_DEFINE(HAVE_STDARG_H, 0, [Define if you have the <stdarg.h> header file.])
+AC_DEFINE(HAVE_NCURSES, 0, [Define if you have the <ncurses.h> header file.])
+
 AC_CANONICAL_HOST
 
 AC_PROG_CC
@@ -17,14 +22,36 @@ AC_PROG_INSTALL
 AC_HEADER_STDC
 AC_CHECK_HEADERS(unistd.h locale.h termios.h linux/termios.h sys/ioctl.h)
 AC_CHECK_HEADER(stdarg.h,AC_DEFINE(HAVE_STDARG_H),AC_MSG_ERROR([*** stdarg.h is missing on your system ***]))
+AC_FUNC_STRCOLL
 AC_CHECK_FUNCS(setlocale)
 
+ac_widec_funcs=yes
+AC_CHECK_HEADER(wchar.h,[ac_have_wchar_h=yes], [ac_have_wchar_h=no])
+AC_CHECK_FUNCS(mbtowc wcwidth,,ac_widec_funcs=no)
+AC_CHECK_TYPE(wchar_t,,ac_widec_funcs=no)
+
+if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
+       ac_widec_possible=yes
+else
+       ac_widec_possible=no
+fi
+
+AC_ARG_ENABLE(widec, [  --enable-widec          Enable wide character support (experimental) ], [case "${enableval}" in
+       yes) ac_widec_support=true ;;
+       no) ac_widec_support=false ;;
+       *) AC_MSG_ERROR(bad value ${enableval} for --enable-widec) ;;
+       esac], [ac_widec_support=false])
+
+if test x$ac_widec_support = xtrue -a x$ac_widec_possible != xyes; then
+       AC_MSG_ERROR(Wide character support is not possible due to missing wide character functions or wchar.h)
+fi
+
 dnl -------------------
 dnl (n)curses detection
 dnl -------------------
 
 abook_cv_curses=/usr
-AC_ARG_WITH(curses, [  --with-curses=DIR          Where ncurses is installed ],
+AC_ARG_WITH(curses, [  --with-curses=DIR       Where ncurses is installed ],
        [if test $withval != yes; then
                abook_cv_curses=$withval
        fi
@@ -33,24 +60,62 @@ AC_ARG_WITH(curses, [  --with-curses=DIR          Where ncurses is installed ],
                CPPFLAGS="$CPPFLAGS -I${abook_cv_curses}/include"
        fi])
 
-AC_CHECK_LIB(ncurses, initscr,
-       [LIBS="$LIBS -lncurses"
-       if test x$abook_cv_curses = x/usr -a -d /usr/include/ncurses; then
-               CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
-       fi
-       AC_CHECK_HEADERS(ncurses.h)],
-       [CF_CURSES_LIBS])
+if test x$ac_widec_support = xtrue; then
+       AC_CHECK_LIB(ncursesw, initscr,
+               [LIBS="$LIBS -lncursesw"
+               if test x$abook_cv_curses = x/usr -a -d /usr/include/ncursesw; then
+                       CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+               fi
+               AC_CHECK_HEADERS(ncurses.h)],[
+               AC_MSG_ERROR("Wide character support is not possible due to missing ncursesw library. Please install it or disable wide character support")])
+else
+       AC_CHECK_LIB(ncurses, initscr,
+               [LIBS="$LIBS -lncurses"
+               if test x$abook_cv_curses = x/usr -a -d /usr/include/ncurses; then
+                       CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
+               fi
+               AC_CHECK_HEADERS(ncurses.h)],
+               [CF_CURSES_LIBS])
+fi
 
 dnl --------------------------
 dnl end of (n)curses detection
 dnl --------------------------
 
+dnl ------------------
+dnl readline detection
+dnl ------------------
+
+abook_cv_readline=/usr
+AC_ARG_WITH(readline, [  --with-readline=DIR     Where readline is installed ],
+       [if test $withval != yes; then
+               abook_cv_readline=$withval
+       fi
+       if test x$abook_cv_readline != x/usr; then
+               LDFLAGS="-L${abook_cv_readline}/lib $LDFLAGS"
+               CPPFLAGS="$CPPFLAGS -I${abook_cv_readline}/include"
+       fi])
+
+AC_LIB_READLINE
+
+if test x$ac_cv_lib_readline = xno -o x$ac_cv_lib_readline_history = xno; then
+       AC_MSG_ERROR([*** readline library not found or it doesn't support history ***])
+fi
+
+dnl -------------------------
+dnl end of readline detection
+dnl -------------------------
+
+if test x$ac_widec_support = xtrue; then
+       AC_DEFINE(HANDLE_MULTIBYTE, 1, [Handle multibyte characters])
+fi
+
 AC_CHECK_FUNCS(resizeterm)
 
 AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)],)
 AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)],)
 
-AC_ARG_ENABLE(debug, [  --enable-debug Enable debugging support ], [case "${enableval}" in
+AC_ARG_ENABLE(debug, [  --enable-debug          Enable debugging support ], [case "${enableval}" in
        yes) debug=true ;;
        no) debug=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
@@ -65,5 +130,5 @@ if test x$GCC = xyes; then
        CFLAGS="-Wall $CFLAGS"
 fi
 
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile abook.spec)