📄 aclocal.m4
字号:
changequote(<^, ^>)dnl
changequote([, ])dnl
])
dnl
dnl
dnl
AC_DEFUN(wi__RES_DEFDNAME, [
AC_MSG_CHECKING([for useable _res global variable])
AC_TRY_LINK([
/* includes */
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
],[
/* function-body */
int len;
res_init();
len = (int) strlen(_res.defdname);
],[
wi_cv__res_defdname=yes
AC_DEFINE(HAVE__RES_DEFDNAME)
],[
wi_cv__res_defdname=no
])
AC_MSG_RESULT($wi_cv__res_defdname)
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_TYPE_SIG_ATOMIC_T, [
AC_MSG_CHECKING([for sig_atomic_t])
AC_TRY_LINK([
/* includes */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/signal.h>
#include <signal.h> /* MG: for IRIX */
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
],[
/* function-body */
sig_atomic_t sample;
sample = (sig_atomic_t) getpid(); /* bogus code, of course */
exit((sample > 0) ? 0 : 1);
],[
ac_cv_type_sig_atomic_t=yes
],[
ac_cv_type_sig_atomic_t=no
])
AC_MSG_RESULT($ac_cv_type_sig_atomic_t)
if test $ac_cv_type_sig_atomic_t = no ; then
AC_DEFINE(sig_atomic_t, int)
fi
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_LIB_READLINE, [
AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer])
wi_cv_lib_readline=no
wi_cv_lib_readline_result=no
ac_save_LIBS="$LIBS"
# Note: $LIBCURSES is permitted to be empty.
for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
do
LIBS="$ac_save_LIBS $LIBREADLINE"
AC_TRY_RUN([
/* program */
#include <stdio.h>
#include <stdlib.h>
main(int argc, char **argv)
{
/* Note: don't actually call readline, since it may block;
* We just want to see if it (dynamic) linked in okay.
*/
if (argc == 0) /* never true */
readline(0);
exit(0);
}
],[
# action if true
wi_cv_lib_readline=yes
],[
# action if false
wi_cv_lib_readline=no
],[
# action if cross compiling
wi_cv_lib_readline=no
])
if test "$wi_cv_lib_readline" = yes ; then break ; fi
done
# Now try it again, to be sure it is recent enough.
# rl_function_of_keyseq appeared in version 2.0
#
dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[
dnl wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)"
dnl ])
AC_TRY_LINK([
/* includes */
],[
/* function-body */
readline(0);
rl_function_of_keyseq(0);
],[
wi_cv_lib_readline=yes
],[
wi_cv_lib_readline=no
wi_cv_lib_readline_result="no (it is present but too old to use)"
])
if test "$wi_cv_lib_readline" = no ; then
LIBREADLINE=""
# restore LIBS
LIBS="$ac_save_LIBS"
else
/bin/rm -f readline.ver
touch readline.ver
AC_TRY_RUN([
/* program */
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
extern char *rl_library_version;
main()
{
FILE *fp;
double d;
sscanf(rl_library_version, "%lf", &d);
fp = fopen("readline.ver", "w");
if (fp == NULL) exit(1);
if (fprintf(fp, "%s\n", rl_library_version) < 0) exit(1);
if (fprintf(fp, "%03d\n", (int) (d * 100.0)) < 0) exit(1);
if (fclose(fp) < 0) exit(1);
exit(0);
}
],[
# action if true
rl_library_version=`sed -n 1,1p readline.ver 2>/dev/null`
rlver=`sed -n 2,2p readline.ver 2>/dev/null`
/bin/rm -f readline.ver
],[
# action if false
rl_library_version=''
rlver=''
/bin/rm -f readline.ver
],[
# action if cross compiling
rl_library_version=''
rlver=''
/bin/rm -f readline.ver
])
case "$rlver" in
???)
wi_cv_lib_readline_result="yes, installed version is $rl_library_version"
;;
*)
# Test using current LIBS.
AC_TRY_LINK([
/* includes */
extern int rl_completion_append_character;
],[
/* function-body */
readline(0);
rl_completion_append_character = 0;
],[
rlver="210"
],[
rlver="200"
])
if test "$rlver" = "210" ; then
wi_cv_lib_readline_result="yes, version 2.1 or higher"
else
wi_cv_lib_readline_result="yes, version 2.0"
fi
;;
esac
wi_cv_lib_readline=yes
# restore LIBS
LIBS="$ac_save_LIBS"
fi
AC_MSG_RESULT($wi_cv_lib_readline_result)
AC_SUBST(LIBREADLINE)
if test "$wi_cv_lib_readline" = yes ; then
# Now verify that all the headers are installed.
#
AC_REQUIRE_CPP()
unset ac_cv_header_readline_chardefs_h
unset ac_cv_header_readline_history_h
unset ac_cv_header_readline_keymaps_h
unset ac_cv_header_readline_readline_h
unset ac_cv_header_readline_tilde_h
AC_CHECK_HEADERS([readline/chardefs.h readline/history.h readline/keymaps.h readline/readline.h readline/tilde.h])
for xxwi in \
"$ac_cv_header_readline_chardefs_h" \
"$ac_cv_header_readline_history_h" \
"$ac_cv_header_readline_keymaps_h" \
"$ac_cv_header_readline_readline_h" \
"$ac_cv_header_readline_tilde_h"
do
if test "$xxwi" = no ; then
break
fi
done
if test "$xxwi" = no ; then
AC_MSG_WARN([GNU Readline headers are not installed or could not be found -- GNU Readline will not be used.])
wi_cv_lib_readline=no
wi_cv_lib_readline_result="no (headers not installed)"
else
AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver)
fi
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_USE_LONG_LONG, [
AC_MSG_CHECKING([for 64-bit integral type: long long])
LONGEST_INT="long"
AC_TRY_RUN([
/* program */
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
long long hugeNumvar = 1;
main()
{
long long hugeNumtoo = 2;
if (hugeNumtoo > hugeNumvar)
hugeNumvar++;
if (sizeof(hugeNumvar) < 8)
exit(1);
exit(0);
}
],[
# action if true
wi_cv_type_long_long=yes
LONGEST_INT="long long"
],[
# action if false
wi_cv_type_long_long=no
],[
# action if cross compiling
wi_cv_type_long_long=no
])
AC_MSG_RESULT($wi_cv_type_long_long)
if test "$wi_cv_type_long_long" = yes ; then
AC_MSG_CHECKING([how to print a 64-bit integral type])
wi_cv_printf_long_long=fail
AC_TRY_RUN([
/* program */
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{
char s[80];
long long hugeNum;
hugeNum = (long long) 1000000000;
hugeNum = hugeNum * (long long) 99;
hugeNum = hugeNum + (long long) 1;
(void) sprintf(s, "%lld", hugeNum);
exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
}
],[
# action if true
wi_cv_printf_long_long="%lld"
],[
# action if false
:
],[
# action if cross compiling
:
])
if test "$wi_cv_printf_long_long" = fail ; then
AC_TRY_RUN([
/* program */
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{
char s[80];
long long hugeNum;
hugeNum = (long long) 1000000000;
hugeNum = hugeNum * (long long) 99;
hugeNum = hugeNum + (long long) 1;
(void) sprintf(s, "%qd", hugeNum);
exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
}
],[
# action if true
wi_cv_printf_long_long="%qd"
],[
# action if false
:
],[
# action if cross compiling
:
])
fi
if test "$wi_cv_printf_long_long" = fail ; then
wi_cv_printf_long_long_msg_result='cannot print'
else
wi_cv_printf_long_long_msg_result="$wi_cv_printf_long_long"
fi
AC_MSG_RESULT($wi_cv_printf_long_long_msg_result)
AC_MSG_CHECKING([how to scan a 64-bit integral type])
wi_cv_scanf_long_long=fail
AC_TRY_RUN([
/* program */
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{
long long hugeNum, justAsHugeNum;
hugeNum = (long long) 1000000000;
hugeNum = hugeNum * (long long) 99;
hugeNum = hugeNum + (long long) 1;
justAsHugeNum = (long long) 0;
--justAsHugeNum;
sscanf("99000000001", "%lld", &justAsHugeNum);
if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
exit(0);
exit(1);
}
],[
# action if true
wi_cv_scanf_long_long="%lld"
],[
# action if false
:
],[
# action if cross compiling
:
])
if test "$wi_cv_scanf_long_long" = fail ; then
AC_TRY_RUN([
/* program */
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{
long long hugeNum, justAsHugeNum;
hugeNum = (long long) 1000000000;
hugeNum = hugeNum * (long long) 99;
hugeNum = hugeNum + (long long) 1;
justAsHugeNum = (long long) 0;
--justAsHugeNum;
sscanf("99000000001", "%qd", &justAsHugeNum);
if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
exit(0);
exit(1);
}
],[
# action if true
wi_cv_scanf_long_long="%qd"
],[
# action if false
:
],[
# action if cross compiling
:
])
fi
if test "$wi_cv_scanf_long_long" = fail ; then
wi_cv_scanf_long_long_msg_result='cannot scan'
else
wi_cv_scanf_long_long_msg_result="$wi_cv_scanf_long_long"
fi
AC_MSG_RESULT($wi_cv_scanf_long_long_msg_result)
fi
AC_MSG_CHECKING([if everything was available to use the 64-bit integral type])
if test "$wi_cv_type_long_long" = no ; then
wi_cv_use_long_long_msg_result="no (long long type not available)"
wi_cv_use_long_long="no"
wi_cv_scanf_long_long="fail"
wi_cv_prihtf_long_long="fail"
LONGEST_INT="long"
elif test "$wi_cv_printf_long_long" = fail ; then
wi_cv_use_long_long_msg_result="no (libc printf() does not support them)"
wi_cv_use_long_long="no"
wi_cv_scanf_long_long="fail"
wi_cv_prihtf_long_long="fail"
LONGEST_INT="long"
elif test "$wi_cv_scanf_long_long" = fail ; then
wi_cv_use_long_long_msg_result="no (libc scanf() does not support them)"
wi_cv_use_long_long="no"
wi_cv_scanf_long_long="fail"
wi_cv_prihtf_long_long="fail"
LONGEST_INT="long"
else
AC_DEFINE(HAVE_LONG_LONG)
if test "$wi_cv_printf_long_long$wi_cv_scanf_long_long" = "%lld%qd" ; then
# FreeBSD 3.2 has %lld and %qd, but we want to
# run on 3.1 and 3.0.
#
wi_cv_printf_long_long="%qd"
fi
AC_DEFINE_UNQUOTED(PRINTF_LONG_LONG, "$wi_cv_printf_long_long")
AC_DEFINE_UNQUOTED(SCANF_LONG_LONG , "$wi_cv_scanf_long_long")
if test "$wi_cv_printf_long_long" = "%qd" ; then
AC_DEFINE(PRINTF_LONG_LONG_QD)
else
AC_DEFINE(PRINTF_LONG_LONG_LLD)
fi
if test "$wi_cv_scanf_long_long" = "%qd" ; then
AC_DEFINE(SCANF_LONG_LONG_QD)
else
AC_DEFINE(SCANF_LONG_LONG_LLD)
fi
wi_cv_use_long_long="yes"
wi_cv_use_long_long_msg_result="yes"
fi
AC_MSG_RESULT($wi_cv_use_long_long_msg_result)
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_CREATE_TAR_FILES, [
AC_MSG_CHECKING([how to create TAR files])
changequote(<<, >>)dnl
TAR=/usr/bin/tar
if [ ! -f /usr/bin/tar ] && [ -f /bin/tar ] ; then
TAR=/bin/tar
fi
x=""
if [ -x /usr/bin/what ] ; then
x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
elif [ -x /bin/what ] ; then
x=`/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
fi
if [ "x$x" != "xpax" ] ; then
# The junk above is because Mac OS X Server's tar freaks out
# and does not exit if you do "tar --help".
#
x=`$TAR --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
fi
case "$x" in
*owner=NAME*)
TARFLAGS="-c --owner=root --group=bin --verbose -f"
;;
*)
TARFLAGS="cvf"
x2=`gtar --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
case "$x2" in
*owner=NAME*)
TARFLAGS="-c --owner=root --group=bin --verbose -f"
TAR=gtar
;;
esac
;;
esac
changequote([, ])dnl
AC_SUBST(TARFLAGS)
AC_SUBST(TAR)
AC_MSG_RESULT([$TAR $TARFLAGS])
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_HEADER_CURSES, [
AC_MSG_CHECKING([for curses library headers])
if test "$nc_cv_ncurses" != "no" ; then
AC_CHECK_HEADERS(ncurses.h curses.h)
else
AC_CHECK_HEADERS(curses.h)
fi
dnl needed for Solaris 7
if test "$ac_cv_header_curses_h" = no ; then
if test -f /usr/include/curses.h ; then
AC_DEFINE(HAVE_CURSES_H)
ac_cv_header_curses_h=yes
fi
fi
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_LIB_CURSES, [
wi_HEADER_CURSES
AC_MSG_CHECKING([for curses library])
wi_cv_lib_curses=no
wi_cv_lib_curses_result=no
ac_save_LIBS="$LIBS"
for LIBCURSES in "-lncurses" "-lcurses" "-lcurses -ltermcap" "-ltermcap -lcurses"
do
if test "x$LIBCURSES-$nc_cv_ncurses" = "x-lncurses-no" ; then
# This should never work
LIBCURSES="-lkdfjkdjfs"
fi
LIBS="$ac_save_LIBS $LIBCURSES"
AC_TRY_RUN([
/* program */
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_NCURSES_H
# include <ncurses.h>
#else
# include <curses.h>
#endif
main(int argc, char **argv)
{
/* Note: don't actually call curses, since it may block;
* We just want to see if it (dynamic) linked in okay.
*/
if (argc == 4)
initscr();
exit(0);
}
],[
# action if true
wi_cv_lib_curses=yes
wi_cv_lib_curses_result="yes"
],[
# action if false
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -