chiark / gitweb /
@@@ more mess
[mLib] / configure.ac
index 416b25f12bfafe295de6ef15b7da4549893d9fad..2b7bcd7d2330450b03124c10f8c4469b7e52751b 100644 (file)
@@ -56,6 +56,7 @@ dnl Headers.
 AC_CHECK_HEADERS([float.h])
 AC_CHECK_HEADERS([stdint.h])
 AC_CHECK_HEADERS([valgrind/valgrind.h])
+AC_CHECK_HEADERS([wchar.h])
 
 dnl Libraries.
 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
@@ -65,7 +66,9 @@ AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
 MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
 
 dnl Functions.
+AC_CHECK_FUNCS([mbrtowc])
 AC_CHECK_FUNCS([snprintf])
+AC_CHECK_FUNCS([wcwidth])
 
 dnl Types.
 AC_CHECK_TYPE([socklen_t], [],
@@ -90,6 +93,106 @@ mdw_PROBE_FLTFMT
 dnl Set the master library list.
 AC_SUBST([MLIB_LIBS])
 
+dnl--------------------------------------------------------------------------
+dnl Terminal characteristics.
+
+mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
+
+AC_ARG_WITH([unibilium],
+  AS_HELP_STRING([--with-unibilium], [support `unibilium' library]),
+  [want_unibilium=$withval],
+  [want_unibilium=auto])
+
+case $want_unibilium in no) ;; *) have_unibilium=check ;; esac
+case $have_unibilium in
+  check)
+    PKG_CHECK_MODULES([unibilium], [unibilium >= 2.0.0],
+                     [], [have_unibilium=no])
+    ;;
+esac
+case $have_unibilium in check) have_unibilium=yes ;; esac
+
+case $want_unibilium,$have_unibilium in
+  yes,no)
+    AC_MSG_ERROR([`unibilium' library not found but explicitly requested])
+    ;;
+  yes,yes | auto,yes)
+    use_unibilium=yes
+    AC_DEFINE([HAVE_UNIBILIUM], [1],
+             [define if you have (and want to use) the `unibilium' library.])
+    ;;
+  no,* | auto,no)
+    use_unibilium=no
+    ;;
+esac
+AM_CONDITIONAL([WITH_UNIBILIUM], [test "$use_unibilium" = yes])
+
+AC_ARG_WITH([terminfo],
+  AS_HELP_STRING([--with-terminfo], [support `terminfo' library]),
+  [want_terminfo=$withval],
+  [want_terminfo=auto])
+
+case $want_terminfo in no) ;; *) have_terminfo=check ;; esac
+case $have_terminfo in
+  check) AC_CHECK_HEADERS([term.h], [], [have_terminfo=no]) ;;
+esac
+case $have_terminfo in
+  check)
+    AC_SEARCH_LIBS([tparm], [tinfo], [], [have_terminfo=no])
+    AC_CHECK_FUNCS([tiparm])
+    ;;
+esac
+case $have_terminfo in check) have_terminfo=yes ;; esac
+
+case $want_terminfo,$have_terminfo in
+  yes,no)
+    AC_MSG_ERROR([`terminfo' library not found but explicitly requested])
+    ;;
+  yes,yes | auto,yes)
+    use_terminfo=yes
+    AC_DEFINE([HAVE_TERMINFO], [1],
+             [define if you have (and want to use) the `terminfo' library.])
+    ;;
+  no,* | auto,no)
+    use_terminfo=no
+    ;;
+esac
+AM_CONDITIONAL([WITH_TERMINFO], [test "$use_terminfo" = yes])
+
+AC_ARG_WITH([termcap],
+  AS_HELP_STRING([--with-termcap], [support `termcap' library]),
+  [want_termcap=$withval],
+  [want_termcap=auto])
+
+case $want_termcap in no) ;; *) have_termcap=check ;; esac
+case $have_termcap in
+  check) AC_CHECK_HEADERS([termcap.h], [], [have_termcap=no]) ;;
+esac
+case $have_termcap in
+  check)
+    AC_SEARCH_LIBS([tgoto], [termcap], [], [have_termcap=no])
+    AC_SEARCH_LIBS([tgetstr], [termcap], [], [have_termcap=no])
+    ;;
+esac
+case $have_termcap in check) have_termcap=yes ;; esac
+
+case $want_termcap,$have_termcap in
+  yes,no)
+    AC_MSG_ERROR([`termcap' library not found but explicitly requested])
+    ;;
+  yes,yes | auto,yes)
+    use_termcap=yes
+    AC_DEFINE([HAVE_TERMCAP], [1],
+             [define if you have (and want to use) the `termcap' library.])
+    ;;
+  no,* | auto,no)
+    use_termcap=no
+    ;;
+esac
+AM_CONDITIONAL([WITH_TERMCAP], [test "$use_termcap" = yes])
+
+MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
+
 dnl--------------------------------------------------------------------------
 dnl Name resolution.
 
@@ -100,11 +203,16 @@ AC_ARG_WITH([adns],
   [want_adns=auto])
 
 mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
-case $want_adns in
-  no) ;;
-  *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
+
+case $want_adns in no) ;; *) have_adns=check ;; esac
+case $have_adns in
+  check) AC_CHECK_HEADERS([adns.h], [], [have_adns=no]) ;;
 esac
-MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
+case $have_adns in
+  check) AC_SEARCH_LIBS([adns_init], [adns], [], [have_adns=no]) ;;
+esac
+case $have_adns in check) have_adns=yes ;; esac
+
 case $want_adns,$have_adns in
   yes,no)
     AC_MSG_ERROR([ADNS library not found but explicitly requested])
@@ -125,6 +233,8 @@ case $want_adns,$have_adns in
 esac
 AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes])
 
+MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
+
 dnl--------------------------------------------------------------------------
 dnl Timers.