updates.
[crypto.git] / configure.in.pre
index b0c9371bf2540f9b80a85f7b8f58602d328c8a8d..13f401053a3bd984604449756f1f53d8bb300036 100644 (file)
@@ -34,7 +34,7 @@ case "$target" in
 esac
 
 # ./prepare script will automatically put the correct version. Do not edit!
-AM_INIT_AUTOMAKE(silc, SILC_VERSION)
+AM_INIT_AUTOMAKE(SILC_PACKAGE, SILC_VERSION)
 AC_PREREQ(2.3)
 AM_CONFIG_HEADER(includes/silcdefs.h)
 
@@ -94,12 +94,23 @@ AC_CHECK_SIZEOF(void *, 0)
 AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
 
 # Function and library checking
-AC_CHECK_FUNCS(initscr)
-AC_CHECK_LIB(ncurses, initscr, LIBS="$LIBS -lncurses")
-AC_CHECK_FUNCS(gethostbyname)
-#AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl -lresolv")
-AC_CHECK_FUNCS(socket)
-AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
+AC_CHECK_FUNC(initscr, ac_initscr_found=1, ac_initscr_found=0)
+if test x$ac_initscr_found = x0; then
+    AC_CHECK_LIB(ncurses, initscr, LIBS="$LIBS -lncurses")
+fi
+AC_CHECK_FUNC(gethostbyname, ac_gethostbyname_found=1,
+ac_gethostbyname_found=0)
+if test x$ac_gethostbyname_found = x0; then
+    AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
+    AC_CHECK_FUNC(res_gethostbyname, ac_res_ghbn_found=1, ac_res_ghbn_found=0)
+    if test x$ac_res_ghbn_found = x0; then
+        AC_CHECK_LIB(resolv, res_gethostbyname,  LIBS="$LIBS -lresolv")
+    fi
+fi
+AC_CHECK_FUNC(socket, ac_socket_found=1, ac_socket_found=0)
+if test x$ac_socket_found = x0; then
+    AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
+fi
 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
 AC_CHECK_FUNCS(select listen bind shutdown close connect)
 AC_CHECK_FUNCS(fcntl setsockopt)
@@ -112,10 +123,14 @@ AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
 # SIM support checking
 # XXX These needs to be changed as more supported platforms appear.
 # XXX This probably needs to be made platform dependant check.
+sim_support=false
+AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
 AC_CHECKING(for SIM support)
 AC_CHECK_HEADERS(dlfcn.h, 
   AC_CHECK_LIB(dl, dlopen, 
     AC_DEFINE(SILC_SIM) 
+    sim_support=true
+    AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
     AC_MSG_RESULT(enabled SIM support)
     LIBS="$LIBS -ldl",
     AC_MSG_RESULT(no SIM support found)),
@@ -337,6 +352,7 @@ AC_ARG_WITH(gmp,
     AC_CHECK_HEADER(gmp.h,
       AC_CHECK_LIB(gmp, __gmpz_init,
         AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = yes)
+        LIBS="$LIBS -L/usr/lib -L/usr/local/lib -lgmp"
         AC_MSG_RESULT(GMP will not be compiled),
         AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes)
         AC_MSG_RESULT(GMP will be compiled)
@@ -350,6 +366,7 @@ esac ], [
     AC_CHECK_LIB(gmp, __gmpz_init,
       build_gmp=false
       AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
+      LIBS="$LIBS -L/usr/lib -L/usr/local/lib -lgmp"
       AC_MSG_RESULT(GMP will not be compiled),
       build_gmp=true
       AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
@@ -371,13 +388,20 @@ AC_ARG_WITH(silcd-config-file,
 #LIBS="$LIBS -lefence"
 
 # Other configure scripts
-#AC_CONFIG_SUBDIRS(lib/zlib)
+AC_CONFIG_SUBDIRS(irssi)
 AC_CONFIG_SUBDIRS(lib/dotconf)
 AC_CONFIG_SUBDIRS(lib/silcmath/gmp)
 AC_CONFIG_SUBDIRS(lib/trq)
+#AC_CONFIG_SUBDIRS(lib/zlib)
+
+# Some final substitutions
+SILC_TOP_SRCDIR=`pwd`
+AC_SUBST(SILC_TOP_SRCDIR)
+AC_SUBST(LIBS)
 
 AC_OUTPUT( \
 Makefile
+Makefile.defines
 doc/Makefile
 includes/Makefile
 lib/Makefile
@@ -392,3 +416,4 @@ lib/silcske/Makefile
 lib/silcutil/Makefile
 silc/Makefile
 silcd/Makefile)
+