📄 aclocal.m4
字号:
AC_DEFUN(wi_ARG_ENABLE_DEBUG, [
# if DEBUGBUILD is yes, other macros try to set up a compilation environment
# with debugging symbols enabled. Example macros which are affected are
# wi_CFLAGS and wi_SFLAG.
#
DEBUGBUILD=no
DEBUGCONFIGUREFLAG=""
AC_ARG_ENABLE(debug,
[ --enable-debug enable debugging symbols],
[
DEBUGBUILD=yes
DEBUGCONFIGUREFLAG="--enable-debug"
],[
DEBUGBUILD=no
DEBUGCONFIGUREFLAG=""
])
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_EXTRA_IDIR, [
incdir="$1"
if test -r $incdir ; then
case "$CPPFLAGS" in
*${incdir}*)
# echo " + already had $incdir" 1>&6
;;
*)
if test "$CPPFLAGS" = "" ; then
CPPFLAGS="-I$incdir"
else
CPPFLAGS="$CPPFLAGS -I$incdir"
fi
echo " + found $incdir" 1>&6
;;
esac
fi
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_PROG_TAR, [
TAR=""
AC_PATH_PROG(TAR, "tar")
if test -x "$TAR" ; then
AC_DEFINE_UNQUOTED(TAR, "$TAR")
fi
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_EXTRA_LDIR, [
libdir="$1"
if test -r $libdir ; then
case "$LDFLAGS" in
*${libdir}*)
# echo " + already had $libdir" 1>&6
;;
*)
if test "$LDFLAGS" = "" ; then
LDFLAGS="-L$libdir"
else
LDFLAGS="$LDFLAGS -L$libdir"
fi
echo " + found $libdir" 1>&6
;;
esac
fi
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_GNU_LD, [
AC_MSG_CHECKING([for GNU ld])
wi_cv_prog_ld="ld"
result="no"
x=`ld --version 2>/dev/null | fgrep GNU`
if test "$x" != "" ; then
wi_cv_prog_ld="gld"
result="yes"
fi
AC_MSG_RESULT($result)
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_LD_READONLY_TEXT, [
if test "$SYS$wi_cv_prog_ld" = "linuxgld" ; then
LDFLAGS="$LDFLAGS -Xlinker -n"
fi
])
dnl
dnl
dnl
dnl
AC_DEFUN(wi_EXTRA_SYSV_SUNOS_DIRS, [
AC_MSG_CHECKING([for System V compatibility directories])
AC_MSG_RESULT([])
wi_EXTRA_IDIR("/usr/5include")
wi_EXTRA_LDIR("/usr/5lib")
])
dnl
dnl
dnl If you want to also look for include and lib subdirectories in the
dnl $HOME tree, you supply "yes" as the first argument to this macro.
dnl
dnl If you want to look for subdirectories in include/lib directories,
dnl you pass the names in argument 3, otherwise pass a dash.
dnl
AC_DEFUN(wi_EXTRA_DIRS, [
AC_MSG_CHECKING([for extra include and lib directories])
AC_MSG_RESULT([])
ifelse([$1], yes, [dnl
b1=`cd .. ; pwd`
b2=`cd ../.. ; pwd`
exdirs="$HOME $j $b1 $b2 $prefix $2"
if test -x "$HOME/bin/OS" ; then
b3=`$HOME/bin/OS`
b3="$HOME/$b3"
if test -d "$b3" ; then
exdirs="$b3 $exdirs"
fi
fi
],[dnl
exdirs="$prefix $2"
])
subexdirs="$3"
if test "$subexdirs" = "" ; then
subexdirs="-"
fi
for subexdir in $subexdirs ; do
if test "$subexdir" = "-" ; then
subexdir=""
else
subexdir="/$subexdir"
fi
for exdir in $exdirs ; do
case "$exdir" in
"/usr"|"/"|"//")
if test "$exdir" = "//" ; then exdir="/" ; fi
if test "$subexdir" != ""; then
incdir="${exdir}/include${subexdir}"
wi_EXTRA_IDIR($incdir)
libdir="${exdir}/lib${subexdir}"
wi_EXTRA_LDIR($libdir)
fi
;;
*)
if test "$subexdir" = ""; then
incdir="${exdir}/include${subexdir}"
wi_EXTRA_IDIR($incdir)
libdir="${exdir}/lib${subexdir}"
wi_EXTRA_LDIR($libdir)
fi
;;
esac
done
done
])
dnl
dnl
dnl
AC_DEFUN(wi_HPUX_CFLAGS,
[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([wi_OS_VAR])
ac_cv_hpux_flags=no
if test "$os" = hp-ux ; then
if test "$ac_cv_prog_gcc" = yes ; then
if test "$CFLAGS" != "" ; then
# Shouldn't be in there.
changequote(<<, >>)dnl
CFLAGS=`echo "$CFLAGS" | sed 's/-A[ae]//g'`
changequote([, ])dnl
case "$CFLAGS" in
*_HPUX_SOURCE*)
;;
*)
# This is required for the extended
# namespace.
#
CFLAGS="-D_HPUX_SOURCE $CFLAGS"
;;
esac
fi
else
# If you're not using gcc, then you better have a cc/c89
# that is usable. If you have the barebones compiler, it
# won't work. The good compiler uses -Aa for the ANSI
# compatible stuff.
changequote(<<, >>)dnl
x=`echo "$CFLAGS" | grep 'A[ae]' 2>/dev/null`
changequote([, ])dnl
if test "$x" = "" ; then
CFLAGS="$CFLAGS -Ae"
fi
fi
ac_cv_hpux_flags=yes
fi
AC_MSG_RESULT($ac_cv_hpux_flags)
])
dnl
dnl
dnl
AC_DEFUN(wi_SFLAG, [AC_REQUIRE([AC_PROG_CC])
STRIP="strip"
if test "$SFLAG" = "" ; then
SFLAG="-s"
case "$OS" in
macosx*)
SFLAG='-Wl,-x'
;;
esac
fi
#
# Was it ./configure --enable-debug ?
#
if test "$DEBUGBUILD" = yes ; then
SFLAG=""
STRIP=":"
fi
case "$CFLAGS" in
"-g"|"-g "*|*" -g"|*" -g "*|*"-g"[0-9]*)
# SFLAG="# $SFLAG"
SFLAG=""
STRIP=":"
;;
esac
STRIPFLAG="$SFLAG"
])
dnl
dnl
dnl
AC_DEFUN(wi_REQUEST_NO_Y2K_WARNINGS, [
wi_cv_request_no_y2k=yes
])
dnl
dnl
dnl
AC_DEFUN(wi_CFLAGS_NO_Y2K_WARNINGS, [AC_REQUIRE([AC_PROG_CC])
if test "$ac_cv_prog_gcc" = yes ; then
case "$CFLAGS" in
*-Wno-format-y2k*)
;;
*)
oldCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-format-y2k"
#
# Now check if this version of GCC
# accepts this flag...
#
AC_TRY_COMPILE([],[int junk;],[],[CFLAGS="$oldCFLAGS"])
unset oldCFLAGS
;;
esac
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE_CPP()
wi_HPUX_CFLAGS
if test "$CFLAGS" = "" ; then
AC_MSG_WARN([Your CFLAGS environment variable was not set. A default of \"-g\" will be used.])
CFLAGS="-g"
fi
if test "x$wi_cv_request_no_y2k" = xyes ; then
wi_CFLAGS_NO_Y2K_WARNINGS
fi
if test "$NOOPTCFLAGS" = "" ; then
changequote(<<, >>)dnl
NOOPTCFLAGS=`echo "$CFLAGS" | sed 's/[-+]O[0-9A-Za-z]*//g;s/-xO[0-9]//g;s/-Wc,-O3//g;s/-IPA//g;s/\ \ */ /g;s/^\ *//;s/\ *$//;'`
changequote([, ])dnl
fi
if test "$DEBUGCFLAGS" = "" ; then
DEBUGCFLAGS="-g $NOOPTCFLAGS"
fi
#
# Was it ./configure --enable-debug ?
#
AC_MSG_CHECKING([if this is a debug build])
if test "$DEBUGBUILD" = yes ; then
AC_MSG_RESULT(yes)
CFLAGS="$DEBUGCFLAGS"
SFLAG=""
STRIPFLAG=""
STRIP=":"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([NOOPTCFLAGS])
AC_MSG_RESULT($NOOPTCFLAGS)
AC_MSG_CHECKING([DEBUGCFLAGS])
AC_MSG_RESULT($DEBUGCFLAGS)
AC_MSG_CHECKING([CFLAGS])
AC_MSG_RESULT($CFLAGS)
])
dnl
dnl
dnl
AC_DEFUN(wi_CFLAGS_LFS64, [AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([wi_OS_VAR])
wi_CFLAGS
if test "os_${os}_gcc_${ac_cv_prog_gcc}" = os_hp-ux_gcc_yes ; then
case "$CFLAGS" in
*__STDC_EXT__*)
;;
*)
# This is required for the extended
# namespace symbols for Large Files.
#
CFLAGS="-D__STDC_EXT__ $CFLAGS"
;;
esac
fi
case "$CFLAGS" in
*-D_LARGEFILE64_SOURCE*)
;;
*)
CFLAGS="-D_LARGEFILE64_SOURCE $CFLAGS"
;;
esac
AC_MSG_CHECKING([additional CFLAGS for LFS64 support])
AC_MSG_RESULT($CFLAGS)
])
dnl
dnl
dnl
AC_DEFUN(wi_PROTOTYPES, [
AC_MSG_CHECKING(if the compiler supports function prototypes)
AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
AC_MSG_RESULT($wi_cv_prototypes)
])
dnl
dnl
dnl
AC_DEFUN(wi_INSECURE_CHOWN, [
AC_MSG_CHECKING(if chown can be used to subvert security)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
main()
{
int result;
char fn[64];
FILE *fp;
struct stat st;
setuid(1); /* if you're root, try set to someone else. */
sprintf(fn, "/tmp/fu%06ld", (long) getpid());
unlink(fn);
fp = fopen(fn, "w");
if (fp == NULL)
exit(1); /* assume the worst */
fprintf(fp, "%s\n", "hello world");
fclose(fp);
result = chown(fn, 0, 0);
if (stat(fn, &st) < 0) {
unlink(fn);
exit((result == 0) ? 0 : 1);
}
unlink(fn);
/* exit(0) if the insecure chown to uid 0 succeeded. */
exit((st.st_uid == 0) ? 0 : 1);
}],[
# action if true
wi_cv_insecure_chown=yes
AC_DEFINE(INSECURE_CHOWN)
],[
# action if false
wi_cv_insecure_chown=no
],[
# action if cross-compiling, guess
wi_cv_insecure_chown=no
])
AC_MSG_RESULT($wi_cv_insecure_chown)
])
dnl
dnl
dnl
AC_DEFUN(wi_LIB_SNPRINTF, [
if test "$ac_cv_func_snprintf" = "no" ; then
AC_CHECK_LIB(snprintf,snprintf)
if test "$ac_cv_lib_snprintf_snprintf" = yes ; then
unset ac_cv_func_snprintf
AC_CHECK_FUNCS(snprintf)
fi
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_SNPRINTF_TERMINATES, [
if test "$ac_cv_func_snprintf" != "no" ; then
AC_MSG_CHECKING(if snprintf always NUL terminates)
if test "$ac_cv_func_snprintf" = "no" ; then
AC_CHECK_LIB(snprintf,snprintf)
fi
AC_TRY_RUN([
/* program */
#include <stdio.h>
#include <string.h>
main()
{
char s[10];
int i, result;
for (i=0; i<(int)(sizeof(s)/sizeof(char)); i++)
s[i] = 'x';
result = (int) snprintf(s, sizeof(s), "%s %s!", "hello", "world");
if (s[sizeof(s) - 1] == '\0')
exit(0);
exit(1);
}
],[
# action if true
wi_cv_snprintf_terminates=no
AC_DEFINE(SNPRINTF_TERMINATES)
x="yes";
],[
# action if false
wi_cv_snprintf_terminates=yes
x="no";
],[
# action if cross compiling
wi_cv_snprintf_terminates=no
x="unknown";
])
AC_MSG_RESULT($x)
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_SNPRINTF, [
wi_SPRINTF_RETVAL
dnl Uncache these -- config.cache doesn't cache it right for this case.
unset ac_cv_func_snprintf
unset ac_cv_func_vsnprintf
AC_CHECK_FUNCS(snprintf vsnprintf)
wi_SNPRINTF_TERMINATES
AC_CHECK_HEADERS(snprintf.h)
wi_LIB_SNPRINTF
])
dnl
dnl
dnl
AC_DEFUN(wi_HEADER_HPSECURITY_H, [
AC_MSG_CHECKING(for hpsecurity.h)
wi_cv_header_hpsecurity_h=no
if test -f /usr/include/hpsecurity.h ; then
wi_cv_header_hpsecurity_h=yes
AC_DEFINE(HAVE_HPSECURITY_H)
fi
AC_MSG_RESULT($wi_cv_header_hpsecurity_h)
])
dnl
dnl
dnl
AC_DEFUN(wi_HEADER_SYS_SELECT_H, [
# See if <sys/select.h> is includable after <sys/time.h>
if test "$ac_cv_header_sys_time_h" = no ; then
AC_CHECK_HEADERS(sys/time.h sys/select.h)
else
AC_CHECK_HEADERS(sys/select.h)
fi
if test "$ac_cv_header_sys_select_h" = yes ; then
AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
selecth=yes
if test "$ac_cv_header_sys_time_h" = yes ; then
AC_TRY_COMPILE([
#if defined(_AIX) || defined(__aix) || defined(__AIX)
# define _ALL_SOURCE 1
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <sys/select.h>],[
fd_set a;
struct timeval tmval;
tmval.tv_sec = 0;],selecth=yes,selecth=no)
fi
if test "$selecth" = yes ; then
AC_DEFINE(CAN_USE_SYS_SELECT_H)
fi
AC_MSG_RESULT($selecth)
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_LIB_44BSD, [
AC_CHECK_FUNC(strerror,[a=yes],[a=no])
if test "$a" = no ; then
# Not in libc, try lib44bsd.
AC_CHECK_LIB(44bsd,strerror)
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_LIB_NSL, [
dnl Note: Check for socket lib first, then nsl.
case "$OS" in
hpux1[123456789]*)
# HP-UX 11 uses NSL for YP services
AC_CHECK_LIB(nsl,getpwent)
;;
*)
AC_CHECK_FUNC(gethostbyname,[a=yes],[a=no])
if test "$a" = no ; then
# Not in libc, try libnsl.
AC_CHECK_LIB(nsl,gethostbyname)
fi
;;
esac
])
dnl
dnl
dnl
AC_DEFUN(wi_LIB_SOCKET, [
AC_CHECK_FUNC(socket,[a=yes],[a=no])
if test "$a" = no ; then
# Not in libc, try libsocket.
AC_CHECK_LIB(socket,socket)
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_LIB_RESOLV, [
# See if we could access two well-known sites without help of any special
# libraries, like resolv.
dnl
AC_MSG_WARN([the following check may take several minutes if networking is not up. You may want to bring it up now and restart configure, otherwise please be patient.])
dnl
AC_MSG_CHECKING([if we need to look for -lresolv])
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
main()
{
struct hostent *hp1, *hp2;
int result;
hp1 = gethostbyname("gatekeeper.dec.com");
hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
exit(! result);
}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
AC_MSG_RESULT($look_for_resolv)
if test "$look_for_resolv" = yes ; then
AC_CHECK_LIB(resolv,main)
else
ac_cv_lib_resolv=no
fi
])
dnl
dnl
dnl
AC_DEFUN(wi_LIB_TCP_WRAPPERS, [
AC_MSG_CHECKING([for tcp wrappers library (libwrap)])
AC_TRY_LINK([
/* includes */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <stdio.h>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -