2701422 [rkeene@sledge /home/rkeene/devel/dact]$ cat -n aclocal.m4
  1 AC_DEFUN(DC_PROG_GCC, [
  2   AC_SUBST(DEPEND)
  3 
  4   if test -n "$GCC"; then
  5     CFLAGS="$CFLAGS -Wall"
  6     DEPEND="Makefile.dep"
  7   fi
  8 ])
  9 
 10 AC_DEFUN(DC_CHK_URANDOM, [
 11   if test "$cross_compiling" = "no"; then
 12     AC_MSG_CHECKING(to see if you have /dev/urandom)
 13     if test -r "/dev/urandom"; then
 14       AC_MSG_RESULT(yes)
 15       AC_DEFINE([HAVE_DEV_URANDOM], [], [Have random device?])
 16     else
 17       AC_MSG_RESULT(no)
 18     fi
 19   fi
 20 ])
 21 
 22 AC_DEFUN(DC_CHK_MODULE, [
 23   AC_SUBST(ALGO)
 24   AC_SUBST(MODLIBS)
 25 
 26   AC_CHECK_LIB($1, main, [
 27     ALGO="$2 $ALGO"
 28     MODLIBS="-l$1 $MODLIBS"
 29     AC_DEFINE($3, [], [Something])
 30   ])
 31 ])
 32 
 33 AC_DEFUN(DC_CHK_MODULE_VAR, [
 34   AC_SUBST(ALGO)
 35   AC_SUBST($4)
 36 
 37   AC_CHECK_LIB($1, main, [
 38     ALGO="$2 $ALGO"
 39     $4="-l$1 $(eval echo $(echo \$$4))"
 40     AC_DEFINE($3, [], [Also something])
 41   ])
 42 ])
 43 
 44 AC_DEFUN(DC_DO_WIN32, [
 45   AC_CHECK_HEADERS(windows.h windowsx.h winsock2.h)
 46   AC_CHECK_LIB(wsock32, main, [
 47     AC_DEFINE(HAVE_LIBWSOCK32, [], [Have libwsock32])
 48       LIBS="${LIBS} -lwsock32"
 49   ])
 50 ])
 51 
 52 AC_DEFUN(DC_DO_NETSET, [
 53   AC_SEARCH_LIBS(socket, socket nsl ws2_32 wsock32, AC_DEFINE(HAVE_SOCKET, [], [Have socket()]))
 54   AC_SEARCH_LIBS(gethostbyname, nsl ws2_32 wsock32, AC_DEFINE(HAVE_GETHOSTBYNAME, [], [Have gethostbyname()]))
 55   AC_SEARCH_LIBS(inet_aton, xnet ws2_32 wsock32, AC_DEFINE(HAVE_INET_ATON, [], [Have inet_aton()]),
	AC_SEARCH_LIBS(inet_addr, nsl ws2_32 wsock32, AC_DEFINE(HAVE_INET_ADDR, [], [Have inet_addr()])))
 56 ])
 57 
 58 
 59 AC_DEFUN(DC_ASK_CHKVERS, [
 60   AC_ARG_ENABLE(chkvers, [  --disable-chkvers       Completely disable the ability to check for new versions], [
 61     case "$enableval" in
 62       no)
 63       ;;
 64       *)
 65   AC_DEFINE(CHECK_VERSION, [], [Check for new versions over the network?])
 66       ;;
 67     esac
 68   ], AC_DEFINE(CHECK_VERSION, [], [Check for new versions over the network?]))
 69 ])
 70 
 71 AC_DEFUN(DC_ASK_DEBIAN, [
 72   AC_ARG_ENABLE(debianupgrade, [  --enable-debianupgrade  Use the Debian upgrade procedure instead of the DACT one], [
 73     case "$enableval" in
 74       no)
 75       ;;
 76       *)
 77         AC_DEFINE(DACT_DEBIAN_UPGRADE_PROC, [], [Use the Debian upgrade procedure instead of DACTs internal one])
 78       ;;
 79     esac
 80   ])
 81 ])
 82 
 83 AC_DEFUN(DC_ASK_NETWORK, [
 84   AC_ARG_ENABLE(network, [  --disable-network       Disable DACT's network activity completely], [
 85     case "$enableval" in
 86       no)
 87     AC_DEFINE(NO_NETWORK, [], [Disable all network support])
 88       ;;
 89       *)
 90     DC_DO_NETSET
 91       ;;
 92     esac
 93   ], DC_DO_NETSET )
 94 ])
 95 
 96 AC_DEFUN(DC_DO_DEBUG, [
 97   ALGO="$ALGO \$(DEBUGALGO)"
 98   AC_DEFINE(DEBUG, [1], [Debug])
 99 ])
100 
101 AC_DEFUN(DC_ASK_DEBUG, [
102   AC_ARG_ENABLE(debug, [  --enable-debug          Enable developmental code], [
103     if test "$enable_version" != "no"; then
104       DC_DO_DEBUG
105     fi
106   ], [
107     case "`uname -n`" in
108       rkeene | unleaded | *.saurik.com )
109     DC_DO_DEBUG
110       ;;
111     esac
112   ])
113 ])
114 
115 AC_DEFUN(DC_NO_MODULE, [
116   DEFAULT="static"
117   MODS="# "
118 ])
119 
120 AC_DEFUN(DC_GET_SHARED, [
121   AC_SUBST(SHARED)
122 
123   OLD_LDFLAGS="$LDFLAGS"
124   SHARED=""
125   if test -z "$SHARED"; then
126     LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic -fPIC"
127     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared -Wl,-G,-z,textoff -fPIC";
	ADD_LDFLAGS="-rdynamic" ], SHARED="", SHARED="");
128   fi
129   if test -z "$SHARED"; then
130     LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic"
131     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared -Wl,-G,-z,textoff";
	ADD_LDFLAGS="-rdynamic" ], SHARED="", SHARED="");
132   fi
133   if test -z "$SHARED"; then
134     LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -fPIC"
135     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared -Wl,-G,-z,textoff -fPIC";
	ADD_LDFLAGS="" ], SHARED="", SHARED="");
136   fi
137   if test -z "$SHARED"; then
138     LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff"
139     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared -Wl,-G,-z,textoff";
	ADD_LDFLAGS="" ], SHARED="", SHARED="");
140   fi
141   if test -z "$SHARED"; then
142     LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic -fPIC"
143     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-Wl,-G,-z,textoff -fPIC";
	ADD_LDFLAGS="-rdynamic" ], SHARED="", SHARED="");
144   fi
145   if test -z "$SHARED"; then
146     LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic"
147     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-Wl,-G,-z,textoff";
	ADD_LDFLAGS="-rdynamic" ], SHARED="", SHARED="");
148   fi
149   if test -z "$SHARED"; then
150     LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -fPIC"
151     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-Wl,-G,-z,textoff -fPIC";
	ADD_LDFLAGS="" ], SHARED="", SHARED="");
152   fi
153   if test -z "$SHARED"; then
154     LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff"
155     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-Wl,-G,-z,textoff"; ADD_LDFLAGS="" ],
	SHARED="", SHARED="");
156   fi
157   if test -z "$SHARED"; then
158     LDFLAGS="$LDFLAGS -shared -rdynamic -fPIC"
159     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared -fPIC";
	ADD_LDFLAGS="-rdynamic" ], SHARED="", SHARED="");
160   fi
161   if test -z "$SHARED"; then
162     LDFLAGS="$OLD_LDFLAGS -shared -fPIC"
163     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared -fPIC"; ADD_LDFLAGS="" ],
	SHARED="", SHARED="");
164   fi
165   if test -z "$SHARED"; then
166     LDFLAGS="$OLD_LDFLAGS -shared"
167     AC_TRY_LINK([#include <stdio.h>], [ printf("okay\n"); return(0); ], [ SHARED="-shared"; ADD_LDFLAGS="" ], SHARED="",
	SHARED="");
168   fi
169   LDFLAGS="$ADD_LDFLAGS $OLD_LDFLAGS"
170 
171   
172 ])
173 
174 
175 AC_DEFUN(DC_ASK_MODULE, [
176   AC_SUBST(DEFAULT)
177   AC_SUBST(MODS)
178   AC_SUBST(NOMODS)
179 
180   DC_CHK_DLOPEN
181   AC_MSG_CHECKING(to use modules)
182   AC_ARG_ENABLE(modules, [  --disable-modules       Disable use of modules], [
183     case "$enableval" in
184       no)
185     AC_MSG_RESULT(no)
186     DC_NO_MODULE
187       ;;
188       *)
189     DC_GET_SHARED
190     if test "$HAVEDLOPEN" = yes -a -n "$SHARED"; then
191       AC_MSG_RESULT(yes)
192       AC_DEFINE(USE_MODULES, [], [Enable use of dynamically loadable modules?])
193           NOMODS="#"
194       DEFAULT="module"
195     else
196       AC_MSG_RESULT(can't)
197       DC_NO_MODULE
198     fi
199       ;;
200     esac
201   ], [
202     DC_GET_SHARED
203     if test "$HAVEDLOPEN" = yes -a -n "$SHARED"; then
204       AC_MSG_RESULT(yes)
205       AC_DEFINE(USE_MODULES, [Enable use of dynamically loadable modules?])
206           NOMODS="#"
207       DEFAULT="module"
208     else
209       AC_MSG_RESULT(can't)
210       DC_NO_MODULE
211     fi
212   ])
213 ])
214 
215 AC_DEFUN(DC_DO_TYPE, [
216     if test -z "$ac_cv_sizeof_long"; then
217         AC_C_INLINE
218         AC_CHECK_SIZEOF(long, 4)
219         AC_CHECK_SIZEOF(int, 4)
220         AC_CHECK_SIZEOF(short, 2)
221     fi
222     FOUND=0
223     for dc_cv_loop in \$ac_cv_sizeof_int \$ac_cv_sizeof_long \$ac_cv_sizeof_short; do
224         dc_cv_size=`eval echo $dc_cv_loop`
225         dc_cv_name=`echo $dc_cv_loop | sed s/\\\$ac_cv_sizeof_//`
226         if test "$dc_cv_size" = "$3"; then
227             if test "$dc_cv_name" = "int"; then 
228                 AC_CHECK_TYPE($1, $2 int)
229             fi
230             if test "$dc_cv_name" = "long"; then
231                 AC_CHECK_TYPE($1, $2 long)
232             fi
233             if test "$dc_cv_name" = "short"; then
234                 AC_CHECK_TYPE($1, $2 short)
235             fi
236             FOUND=1
237             break
238         fi
239     done
240 ])
241 
242 AC_DEFUN(DC_CHK_DLOPEN, [
243     AC_CHECK_FUNC(dlopen, [
244         AC_DEFINE(HAVE_DLOPEN, [1], [Have dlopen()?])
245         HAVEDLOPEN=yes
246     ])
247     if test "$ac_cv_func_dlopen" = "no"; then
248         AC_CHECK_LIB(dl, dlopen, [
249             AC_DEFINE(HAVE_DLOPEN, [1], [Have dlopen()?])
250             ALLMODLIBS=-ldl
251             AC_SUBST(ALLMODLIBS)
252             HAVEDLOPEN=yes
253         ])
254     fi
255 ])
2701423 [rkeene@sledge /home/rkeene/devel/dact]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2004-03-08 08:28:05