aclocal.m4
上传用户:sddyfurun
上传日期:2007-01-04
资源大小:525k
文件大小:11k
源码类别:

代理服务器

开发平台:

Unix_Linux

  1. dnl try to find an ansi compiler.
  2. AC_DEFUN(AC_PROG_ANSI_CC, [
  3. if test -n "$CC"; then use_env_cc="yes"; fi
  4. AC_CHECK_PROG(CC, gcc2, gcc2)
  5. dnl We want to put the -g -O stuff from AC_PROG_CC in CDEBUG_FLAGS, not CFLAGS, so
  6. dnl store the old ones...then switch back
  7. OCFLAGS="$CFLAGS"
  8. CFLAGS=
  9. AC_PROG_CC
  10. CDEBUG_FLAGS="$CFLAGS"
  11. CFLAGS="$OCFLAGS"
  12. savedcc="$CC"
  13. OS=`uname -s`
  14. OSVER=`uname -r`
  15. if test "$OS" = "SunOS"; then
  16.     case $OSVER in
  17.     5.5*)
  18.     AC_DEFINE(USE_SYSTEM_SEMAPHORE)
  19.     esac
  20. fi
  21. if test "$GCC" = "yes"; then
  22.         CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
  23. elif test "$OS" = "HP-UX" -a "$use_env_cc" != "yes"; then
  24.         CFLAGS="-Ae"
  25.         AC_TRY_COMPILE([void foo(int bar){}],,s5_have_ansi_cc="yes",s5_have_ansi_cc="no")
  26.         if test "$s5_have_ansi_cc" = "no"; then
  27.                 CFLAGS=""
  28.                 unset CC
  29.                 unset ac_cv_prog_CC   #unset cached CC
  30.                 AC_CHECK_PROG(CC, c89, c89, $savedcc)
  31.                 if test "$CC" = "c89" ; then CFLAGS="-D_HPUX_SOURCE"; fi
  32.         fi
  33. elif test "$OS" = "SunOS"  -a "$use_env_cc" != "yes"; then
  34.         AC_TRY_COMPILE([void foo(int bar){}],,s5_have_ansi_cc="yes",s5_have_ansi_cc="no")
  35.         if test "$s5_have_ansi_cc" = "no"; then
  36.          unset CC
  37.          unset ac_cv_prog_CC   #unset cached CC
  38.          AC_CHECK_PROG(CC, acc, acc, $savedcc)
  39.          if test "$CC" = "acc" ; then CFLAGS=""; fi
  40. fi
  41. fi
  42. if test "$savedcc" != "$CC"; then AC_MSG_RESULT(resetting CC to $CC); fi
  43. AC_TRY_COMPILE([void foo(int bar){}],,AC_DEFINE(HAVE_FUNC_PROTOTYPE), AC_MSG_WARN(--> no ANSI C compiler found!n))
  44. ])dnl
  45. AC_DEFUN(AC_KERBEROS5, [
  46. AC_ARG_WITH(krb5,           --with-krb5 Turn on Kerberos 5,                             [KRB5="$withval"], [KRB5="no"])
  47. if test "$KRB5" != "no"; then
  48. echo
  49. AC_MSG_CHECKING(Kerberos 5)
  50. AC_CACHE_VAL(r_cv_krb5_home, [
  51. if test "$KRB5" = "yes" -o "$KRB5" = ""; then
  52. r_cv_krb5_home=`egrep ^klogin /etc/inetd.conf|awk '{print [$]6;}'|awk -F/ '{ORS="/";for(i=1;i<=NF-2;i++) print $i;}'`
  53. else
  54. r_cv_krb5_home=$KRB5
  55. fi])dnl
  56. if test "$KRB5" = "" -a "$r_cv_krb5_home" != "" -a  ! -d $r_cv_krb5_home/include/krb5; then
  57. r_cv_krb5_home=""
  58. fi
  59. KRB5_HOME=$r_cv_krb5_home
  60. if test "$KRB5_HOME" != ""; then
  61. AC_MSG_RESULT("$KRB5_HOME")
  62. elif test "$KRB5" != ""; then
  63. AC_MSG_RESULT("default")
  64. else 
  65. AC_MSG_RESULT("no")
  66. fi
  67. if test "$KRB5" != "" -o "$KRB5_HOME" != ""; then
  68. if test "$KRB5_HOME" != ""; then
  69. [CFLAGS="$CFLAGS -I$KRB5_HOME/include"]
  70. [LDFLAGS="$LDFLAGS -L$KRB5_HOME/lib"]
  71. fi
  72. AC_CHECK_LIB(db,          main)
  73. dnl check whether db has been found
  74. if test "$ac_cv_lib_db_main" = "no"; then
  75. AC_CHECK_LIB(ndbm,main)
  76. fi
  77. AC_CHECK_LIB(isode,       main)
  78. AC_CHECK_LIB(com_err,     main)
  79. AC_CHECK_LIB(crypto,      main)
  80. AC_CHECK_LIB(krb5,        main)
  81. AC_CHECK_LIB(gssapi_krb5, main)
  82. fi
  83. fi
  84. ])dnl
  85. AC_DEFUN(AC_MAKE_SHAREDLIB, [
  86. SHLIB_LD="ld"
  87. SHLIB_LIB=""
  88. SHLIB_LFLAGS="-shared"
  89. SHLIB_CFLAGS="-r"
  90. SHLIB_OFLAGS="-o "
  91. if test "$exec_prefix" != "NONE"; then
  92. SHLIB_DIR=$exec_prefix/lib
  93. elif test "$prefix" != "NONE"; then
  94. SHLIB_DIR=$prefix/lib
  95. else
  96. SHLIB_DIR=/usr/local/lib
  97. fi
  98. PRELOADS="echo Shared libraries not supported; exit; :"
  99. PRELOADA=""
  100. AC_MSG_CHECKING(shared library support)
  101. if test "$ac_cv_func_dlopen" = "yes" -o "$ac_cv_func_shl_load" = "yes"; then
  102. if test "$with_plugins" = "yes"; then
  103. PLUGIN_LIBS="libs5auth_u.so libs5auth_k.so libs5auth_c.so libs5filter_p.so"
  104. else
  105. SHARED_LIBSOCKS5_CFLAGS="-DFOR_SHARED_LIBRARY -DIN_LIBRARY"
  106. fi
  107. dnl can't socksify HP 9.* applications even it has shl_load()
  108. if test  "$ac_cv_func_dlopen" = "yes"; then SHLIB_LIB="libsocks5_sh.so"; fi
  109. case `uname -rs` in
  110. UNIX_SV*|UNIX_System_V*)
  111. SHLIB_LFLAGS="-G"
  112. ;;
  113. FreeBSD*|NetBSD*)
  114. SHLIB_LFLAGS="-Bshareable"
  115. SHLIB_CFLAGS="-fpic"
  116. PRELOADS="LD_PRELOAD"
  117. ;;
  118. SunOS*4.*)
  119.   SHLIB_CFLAGS="-P"
  120. SHLIB_LFLAGS="-dp -assert pure-text -assert nodefinitions"
  121. PRELOADS="LD_PRELOAD"
  122. ;;
  123. SunOS*5.*)
  124. SHLIB_LD="cc"
  125. SHLIB_CFLAGS="-KPIC"
  126. SHLIB_LFLAGS="-G"
  127. SHLIB_OFLAGS="-W0,-y-o -W0,-y"
  128. PRELOADS="LD_PRELOAD"
  129. ;;
  130. IRIX*5.*|IRIX*6.*)
  131. SHLIB_CFLAGS="-KPIC"
  132. PRELOADS="_RLD_LIST"
  133. PRELOADA=":DEFAULT"
  134. ;;
  135. BSD/OS*)
  136. SHLIB_LIB=
  137. ;;
  138. OSF1*)
  139. PRELOADS="_RLD_LIST"
  140. PRELOADA=":DEFAULT"
  141. ;;
  142. AIX*)
  143. SHLIB_LIB=""
  144. ;;
  145. *)
  146. PRELOADS="LD_PRELOAD"
  147. ;;
  148. esac
  149. if test "$GCC" = "yes" ; then
  150. SHLIB_CFLAGS="-fpic"
  151. case `uname -rs` in
  152. SunOS*4.*)
  153. DLLIBS="-lc"
  154. ;;
  155. SunOS*5.*)
  156. SHLIB_LD="gcc"
  157. SHLIB_OFLAGS="-o "
  158. SHLIB_LFLAGS="-shared"
  159. ;;
  160. UNIX_SV*|UNIX_System_V*)
  161. SHLIB_CFLAGS=
  162. ;;
  163. FreeBSD*|NetBSD*)
  164. ;;
  165. *)
  166. SHLIB_LD="gcc"
  167. SHLIB_LFLAGS="-shared"
  168. esac
  169. fi
  170. dnl I don't think this works, -r should produce the svr3.2 
  171. dnl shared libs, not the svr4 ones that we want...
  172. if test `uname -s` = "FreeBSD"; then
  173. SHLIB_CFLAGS="-fpic -r"
  174. fi
  175. AC_MSG_RESULT("lflags: $SHLIB_LFLAGS cflags: $SHLIB_CFLAGS")
  176.     else
  177. AC_MSG_RESULT(no)
  178. fi
  179. dnl server and client should include the objects which are not to be plugins
  180. if test "$PLUGIN_LIBS" = "" ; then
  181. AUTHS="upwd.o gss.o"
  182. FILTERS="packet.o"
  183. SERVER_PLUGIN_OBJS="$AUTHS $FILTERS"
  184. CLIENT_PLUGIN_OBJS="$AUTHS"
  185. fi
  186. SHLIB_LIBS="$SHLIB_LIBS $LIBS"
  187. if test "`uname`" = "Linux"; then
  188. SHLIB_LIBS="$SHLIB_LIBS -lc"
  189. fi
  190. AC_SUBST(DLLIBS)
  191. AC_SUBST(SHLIB_LD)
  192. AC_SUBST(SHLIB_DIR)
  193. AC_SUBST(SHLIB_LIB)
  194. AC_SUBST(SHLIB_CFLAGS)
  195. AC_SUBST(SHLIB_OFLAGS)
  196. AC_SUBST(SERVER_PLUGIN_OBJS)
  197. AC_SUBST(CLIENT_PLUGIN_OBJS)
  198. AC_SUBST(SHARED_LIBSOCKS5_CFLAGS)
  199. AC_SUBST(PLUGIN_LIBS)
  200. AC_SUBST(PRELOADS)
  201. AC_SUBST(PRELOADA)
  202. ])dnl
  203. AC_DEFUN(AC_CHECK_SHLIB, [
  204. ac_safe=`echo "$1" | tr './55' '___'`
  205. AC_MSG_CHECKING(for shared $1)
  206. AC_CACHE_VAL(r_cv_name_$ac_safe, [
  207. case `uname -rs` in
  208. IRIX*5.*)
  209. dnl  1 versioned number takes precedence over unversioned...
  210. dnl  2 /usr/lib, lib
  211. if test -n "`ls /usr/lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  212. eval "r_cv_name_$ac_safe=`ls /usr/lib/$ac_safe.so.* | sort -r | head -1`"
  213. elif test -n "`ls /lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  214. eval "r_cv_name_$ac_safe=`ls /lib/$ac_safe.so.* | sort -r | head -1`"
  215. elif test -f /usr/lib/$ac_safe.so; then
  216. eval "r_cv_name_$ac_safe=/usr/lib/$ac_safe.so"
  217. elif test -f /lib/$ac_safe.so; then
  218. eval "r_cv_name_$ac_safe=/lib/$ac_safe.so"
  219. fi
  220. ;;
  221. OSF1*)
  222. dnl 1 no versioning
  223. dnl     2 /usr/shlib, /usr/lib, /lib
  224. if test -f /usr/shlib/$ac_safe.so; then
  225. eval "r_cv_name_$ac_safe=/usr/shlib/$ac_safe.so"
  226. elif test -f /usr/lib/$ac_safe.so; then
  227. eval "r_cv_name_$ac_safe=/usr/lib/$ac_safe.so"
  228. elif test -f /lib/$ac_safe.so; then
  229. eval "r_cv_name_$ac_safe=/lib/$ac_safe.so"
  230. fi
  231. ;;
  232. Linux*)
  233. dnl 1 versioned (w/o maj/min), versioned, unversioned 
  234. dnl 2 /lib, /usr/lib
  235. dnl no path
  236. if test -n "`ls /lib/$ac_safe.so.? 2>/dev/null | sort -r | head -1`"; then
  237. eval "r_cv_name_$ac_safe=`cd /lib; ls $ac_safe.so.? | sort -r | head -1`"
  238. elif test -n "`ls /usr/lib/$ac_safe.so.? 2>/dev/null | sort -r | head -1`"; then
  239. eval "r_cv_name_$ac_safe=`cd /usr/lib; ls $ac_safe.so.* | sort -r | head -1`"
  240. elif test -n "`ls /lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  241. eval "r_cv_name_$ac_safe=`cd /lib; ls $ac_safe.so.* | sort -r | head -1`"
  242. elif test -n "`ls /usr/lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  243. eval "r_cv_name_$ac_safe=`cd /usr/lib; ls $ac_safe.so.* | sort -r | head -1`"
  244. elif test -f /lib/$ac_safe.so; then
  245. eval "r_cv_name_$ac_safe=/lib/$ac_safe.so"
  246. elif test -f /usr/lib/$ac_safe.so; then
  247. eval "r_cv_name_$ac_safe=/usr/lib/$ac_safe.so"
  248. fi
  249. ;;
  250. SunOS*)
  251. dnl 1 unversioned takes precedence over versioned
  252. dnl 2 /usr/lib /lib
  253. if test -f /usr/lib/$ac_safe.so; then
  254. eval "r_cv_name_$ac_safe=/usr/lib/$ac_safe.so"
  255. elif test -n "`ls /usr/lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  256. eval "r_cv_name_$ac_safe=`ls /usr/lib/$ac_safe.so.* | sort -r | head -1`"
  257. elif test -f /lib/$ac_safe.so; then
  258. eval "r_cv_name_$ac_safe=/lib/$ac_safe.so"
  259. elif test -n "`ls /lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  260. eval "r_cv_name_$ac_safe=`ls /lib/$ac_safe.so.* | sort -r | head -1`"
  261. fi
  262. ;;
  263. dgux*)
  264. dnl 1 /usr/dglib 
  265. dnl 2 versioned, unversioned
  266. if test -f /usr/dglib/$ac_safe.so; then
  267. eval "r_cv_name_$ac_safe=/usr/dglib/$ac_safe.so"
  268. elif test -n "`ls /usr/dglib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  269. eval "r_cv_name_$ac_safe=`ls /usr/dglib/$ac_safe.so.* | sort -r | head -1`"
  270. fi
  271. ;;
  272. *)
  273. dnl 1 unversioned number takes precedence over versioned...
  274. dnl 2 /lib, /usr/lib
  275. if test -f /lib/$ac_safe.so; then
  276. eval "r_cv_name_$ac_safe=/lib/$ac_safe.so"
  277. elif test -n "`ls /lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  278. eval "r_cv_name_$ac_safe=`ls /lib/$ac_safe.so.* | sort -r | head -1`"
  279. elif test -f /usr/lib/$ac_safe.so; then
  280. eval "r_cv_name_$ac_safe=/usr/lib/$ac_safe.so"
  281. elif test -n "`ls /usr/lib/$ac_safe.so.* 2>/dev/null | sort -r | head -1`"; then
  282. eval "r_cv_name_$ac_safe=`ls /usr/lib/$ac_safe.so.* | sort -r | head -1`"
  283. fi
  284. ;;
  285. esac
  286. ])dnl
  287. ac_result=`eval echo '$r_cv_name_'$ac_safe`
  288. if test "$ac_result" != ""; then
  289. AC_MSG_RESULT($ac_result)
  290. ifelse([$2], , :, [$2])dnl
  291. else 
  292. AC_MSG_RESULT(no)
  293. ifelse([$3], , , [$3])dnl
  294. fi
  295. ])dnl
  296. AC_DEFUN(AC_CHECK_SHLIBS, [
  297. for r_lib_name in $1
  298. do
  299. AC_CHECK_SHLIB($r_lib_name, [
  300. changequote(, )dnl
  301. r_fixed=`echo $r_lib_name | tr '[a-z]./55' '[A-Z]___'`_NAME
  302. changequote([, ])dnl
  303. AC_DEFINE_UNQUOTED($r_fixed, "$ac_result") $2], $3)dnl
  304. done
  305. ])
  306. AC_DEFUN(AC_IDENT, [
  307. AC_ARG_WITH(ident,           --with-ident Turn on ident verification, [IDENT="$withval"], [IDENT="no"])
  308. if test "$IDENT" != "no"; then
  309.     if test "$IDENT" != "yes"; then
  310. [CFLAGS="$CFLAGS -I$IDENT/include"]
  311. [LDFLAGS="$LDFLAGS -L$IDENT/lib -lident"]
  312.     fi
  313.     S5_CHECK_HEADERS(ident.h, $IDENT)
  314.     AC_CHECK_LIB(ident, main, [AC_DEFINE(HAVE_LIBIDENT) SERVER_LIBS="$SERVER_LIBS -lident"])
  315. fi
  316. ])
  317. dnl Check if struct sockaddr_un has sun_len
  318. AC_DEFUN(AC_SOCKADDR_SUN_LEN,[
  319. AC_MSG_CHECKING(whether sockaddr_un has sun_len)
  320. AC_CACHE_VAL(sc_cv_sockaddr_sun_len,
  321. [AC_TRY_COMPILE([#include <sys/types.h>
  322. #include <sys/un.h>],
  323. [struct sockaddr_un s_un; s_un.sun_len=0;],
  324. sc_cv_sockaddr_sun_len=yes, sc_cv_sockaddr_sun_len=no)])
  325. if test "$sc_cv_sockaddr_sun_len" = "yes"; then AC_DEFINE(HAVE_SOCKADDR_SUN_LEN) fi
  326. AC_MSG_RESULT($sc_cv_sockaddr_sun_len)
  327. ])
  328. AC_DEFUN(AC_CC_EXPORT_SYMBOL, [
  329. if test "$with_plugins" = "yes" ; then
  330. case `uname -rs` in
  331. AIX*)
  332. SHLIB_LIBS="$SHLIB_LIBS -L../lib -ls5util"
  333. ;;
  334. HP-UX*)
  335. EXPORT_LDFLAGS="-Wl,-E"
  336. ;;
  337. Linux*)
  338. EXPORT_LDFLAGS="-export-dynamic"
  339. ;;
  340. OSF1*)
  341. EXPORT_LDFLAGS="-Wl,-non_hidden"
  342. SHLIB_LFLAGS="$SHLIB_LFLAGS -Wl,-warning_unresolved"
  343. esac
  344. fi
  345. ])
  346. dnl check headers by temporarily appending an include directory
  347. AC_DEFUN(S5_CHECK_HEADERS, [
  348. SAVED_CPPFLAGS="$CPPFLAGS"
  349. if test "$2" != ""; then
  350. CPPFLAGS="$CPPFLAGS -I$2/include"
  351. fi
  352. AC_CHECK_HEADERS($1)
  353. CPPFLAGS="$SAVED_CPPFLAGS"
  354. ])