configure.in reorder patch

Tim Rice tim at multitalents.net
Tue Feb 13 17:02:03 EST 2001


 
Feb 12 CVS (sort of, see warning below)

I've had to change around some of the code in configure.in
to get some platforms to compile with the --with-tcp-wrappers option.

Basicly I have set it up to
check headers
check system libraries
check for optional packages
check functions

I have also tried to clean up the library order as it is important
on some platforms.

This patch works on 
Solaris 8
UnixWare 2.03
UnixWare 2.1.3
UnixWare 7.1.0
SCO Open Server 3 (3.2v4.2)
SCO Open Server 5.0.4
Caldera 2.4
Redhat 6.2

Warning:
This patch has stdargs.h added to AC_CHECK_HEADERS
and fchown added to AC_CHECK_FUNCS. They were recently applied but
as of Mon Feb 12 21:37:00 PST 2001 they don't show up in the CVS
Make sure the AC_CHECK_HEADERS and AC_CHECK_FUNCS sections match
what is in the patch or the patch will fail.

-- 
Tim Rice				Multitalents	(707) 887-1469
tim at multitalents.net

-------------- next part --------------
--- openssh_cvs/configure.in.orig	Mon Feb 12 17:47:05 2001
+++ openssh_cvs/configure.in	Mon Feb 12 17:47:55 2001
@@ -223,7 +223,7 @@
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	MANTYPE='$(CATMAN)'
 	mansubdir=cat
-	LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
+	LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
 	no_dev_ptmx=1
 	RANLIB=true
 	AC_DEFINE(BROKEN_SYS_TERMIO_H)
@@ -295,93 +295,41 @@
 	]	
 )
 
+# Checks for header files.
+AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h regex.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stdarg.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
+
 
+saved_LIBS="$LIBS"
 # Checks for libraries.
-if test -z "$no_libsocket" ; then
-	AC_CHECK_LIB(nsl, yp_match, , )
-fi
 if test -z "$no_libnsl" ; then
-	AC_CHECK_LIB(socket, main, , )
+	AC_CHECK_LIB(nsl, yp_match, LIBS="$LIBS -lnsl")
 fi
+if test -z "$no_libsocket" ; then
+	AC_CHECK_LIB(socket, main,
+		[
+			if test "$saved_LIBS" = "$LIBS" ; then
+				LIBS="$LIBS -lsocket"
+			else
+				LIBS="$saved_LIBS -lsocket -lnsl"
+			fi
+		] )
+fi
+
+dnl SCO OS3 needs this for libwrap
+AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
 
-AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
+AC_CHECK_LIB(gen, getspnam)
 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
-AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
+AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="-lutil $LIBS")
 
 AC_CHECK_FUNC(regcomp, 
 	[ AC_DEFINE(HAVE_REGCOMP)],
 	[
 		AC_CHECK_LIB(pcre, pcre_info, 
-			AC_DEFINE(HAVE_LIBPCRE) LIBS="$LIBS -lpcreposix -lpcre")
+			AC_DEFINE(HAVE_LIBPCRE) LIBS="-lpcreposix -lpcre $LIBS")
 	]
 )
 
-dnl UnixWare 2.x
-AC_CHECK_FUNC(strcasecmp, 
-	[], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
-)
-AC_CHECK_FUNC(utimes, 
-	[], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
-)
-
-# Checks for header files.
-AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h regex.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stdarg.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
-
-dnl    Checks for library functions.
-AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
-dnl    Checks for time functions
-AC_CHECK_FUNCS(gettimeofday time)
-dnl    Checks for libutil functions
-AC_CHECK_HEADERS(libutil.h)
-AC_CHECK_FUNCS(login logout updwtmp logwtmp)
-dnl    Checks for utmp functions
-AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
-AC_CHECK_FUNCS(utmpname)
-dnl    Checks for utmpx functions
-AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
-AC_CHECK_FUNCS(setutxent utmpxname)
-
-AC_CHECK_FUNC(getuserattr, 
-	[AC_DEFINE(HAVE_GETUSERATTR)],
-	[AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
-)
-
-AC_CHECK_FUNC(login, 
-	[AC_DEFINE(HAVE_LOGIN)],
-	[AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
-)
-
-AC_CHECK_FUNC(daemon, 
-	[AC_DEFINE(HAVE_DAEMON)],
-	[AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
-)
-
-AC_CHECK_FUNC(getpagesize, 
-	[AC_DEFINE(HAVE_GETPAGESIZE)],
-	[AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
-)
-
-# Check for broken snprintf
-if test "x$ac_cv_func_snprintf" = "xyes" ; then
-	AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
-	AC_TRY_RUN(
-		[
-#include <stdio.h>
-int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
-		],
-		[AC_MSG_RESULT(yes)], 
-		[
-			AC_MSG_RESULT(no)
-			AC_DEFINE(BROKEN_SNPRINTF)
-			AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
-		]
-	)
-fi
-
-AC_FUNC_GETPGRP
-
-AC_FUNC_STRFTIME
-
 # Check for PAM libs
 PAM_MSG="no"
 AC_ARG_WITH(pam,
@@ -452,7 +400,7 @@
 			LDFLAGS="$saved_LDFLAGS"
 		fi
 
-		LIBS="$saved_LIBS -lcrypto"
+		LIBS="-lcrypto $saved_LIBS"
 
 		# Basic test to check for compatible version and correct linking
 		# *does not* test for RSA - that comes later.
@@ -505,7 +453,7 @@
 		fi
 	fi
 fi
-LIBS="$saved_LIBS -lcrypto"
+LIBS="-lcrypto $saved_LIBS"
 
 # Now test RSA support
 saved_LIBS="$LIBS"
@@ -514,7 +462,7 @@
 	if test -z "$WANTS_RSAREF" ; then
 		LIBS="$saved_LIBS"
 	else
-		LIBS="$saved_LIBS -lRSAglue -lrsaref"
+		LIBS="-lRSAglue -lrsaref $saved_LIBS"
 	fi
 	AC_TRY_RUN([
 #include <string.h>
@@ -552,7 +500,7 @@
 		else
 			RSA_MSG="yes (using RSAref)"
 			AC_MSG_RESULT(using RSAref)
-			LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
+			LIBS="-lcrypto -lRSAglue -lrsaref $saved_LIBS"
 		fi
 	fi
 fi
@@ -568,6 +516,189 @@
   LIBS="$LIBS -liberty";
 fi
 
+dnl UnixWare 2.x
+AC_CHECK_FUNC(strcasecmp, 
+	[], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
+)
+AC_CHECK_FUNC(utimes, 
+	[], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
+)
+
+# Check whether user wants Kerberos support
+KRB4_MSG="no" 
+AC_ARG_WITH(kerberos4,
+	[  --with-kerberos4=PATH   Enable Kerberos 4 support],
+	[
+		if test "x$withval" != "xno" ; then
+	
+			if test "x$withval" != "xyes" ; then
+				CPPFLAGS="$CPPFLAGS -I${withval}/include"
+				LDFLAGS="$LDFLAGS -L${withval}/lib"
+				if test ! -z "$need_dash_r" ; then
+					LDFLAGS="$LDFLAGS -R${withval}/lib"
+				fi
+				if test ! -z "$blibpath" ; then
+					blibpath="$blibpath:${withval}/lib"
+				fi
+			else
+				if test -d /usr/include/kerberosIV ; then
+					CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
+				fi
+			fi
+
+			AC_CHECK_HEADERS(krb.h)
+			AC_CHECK_LIB(krb, main)
+			if test "$ac_cv_header_krb_h" != yes; then
+				AC_MSG_WARN([Cannot find krb.h, build may fail])
+			fi
+			if test "$ac_cv_lib_krb_main" != yes; then
+				AC_MSG_WARN([Cannot find libkrb, build may fail])
+			fi
+
+			KLIBS="-lkrb -ldes"
+			AC_CHECK_LIB(resolv, dn_expand, , )
+			KRB4=yes
+			KRB4_MSG="yes" 
+			AC_DEFINE(KRB4)
+		fi
+	]
+)
+
+# Check whether user wants AFS support
+AFS_MSG="no" 
+AC_ARG_WITH(afs,
+	[  --with-afs=PATH         Enable AFS support],
+	[
+		if test "x$withval" != "xno" ; then
+
+			if test "x$withval" != "xyes" ; then
+				CPPFLAGS="$CPPFLAGS -I${withval}/include"
+				LDFLAGS="$LDFLAGS -L${withval}/lib"
+			fi
+
+			if test -z "$KRB4" ; then
+				AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
+			fi
+
+			LIBS="$LIBS -lkafs"
+			if test ! -z "$AFS_LIBS" ; then
+				LIBS="$LIBS $AFS_LIBS"
+			fi
+			AC_DEFINE(AFS)
+			AFS_MSG="yes" 
+		fi
+	]
+)
+LIBS="$LIBS $KLIBS"
+
+# Check whether user wants S/Key support
+SKEY_MSG="no" 
+AC_ARG_WITH(skey,
+	[  --with-skey=PATH         Enable S/Key support],
+	[
+		if test "x$withval" != "xno" ; then
+
+			if test "x$withval" != "xyes" ; then
+				CPPFLAGS="$CPPFLAGS -I${withval}/include"
+				LDFLAGS="$LDFLAGS -L${withval}/lib"
+			fi
+
+			AC_DEFINE(SKEY)
+			LIBS="-lskey $LIBS"
+			SKEY_MSG="yes" 
+	
+			AC_CHECK_FUNC(skey_keyinfo,
+				[],
+				[
+					AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
+				])
+		fi
+	]
+)
+
+# Check whether user wants TCP wrappers support
+TCPW_MSG="no" 
+AC_ARG_WITH(tcp-wrappers,
+	[  --with-tcp-wrappers     Enable tcpwrappers support],
+	[
+		if test "x$withval" != "xno" ; then
+			saved_LIBS="$LIBS"
+			LIBS="-lwrap $LIBS"
+			AC_MSG_CHECKING(for libwrap)
+			AC_TRY_LINK(
+				[
+#include <tcpd.h>
+					int deny_severity = 0, allow_severity = 0;
+				],
+				[hosts_access(0);],
+				[
+					AC_MSG_RESULT(yes)
+					AC_DEFINE(LIBWRAP)
+					TCPW_MSG="yes" 
+				],
+				[
+					AC_MSG_ERROR([*** libwrap missing])
+				]
+			)
+		fi
+	]
+)
+
+dnl    Checks for library functions.
+AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
+dnl    Checks for time functions
+AC_CHECK_FUNCS(gettimeofday time)
+dnl    Checks for libutil functions
+AC_CHECK_HEADERS(libutil.h)
+AC_CHECK_FUNCS(login logout updwtmp logwtmp)
+dnl    Checks for utmp functions
+AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
+AC_CHECK_FUNCS(utmpname)
+dnl    Checks for utmpx functions
+AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
+AC_CHECK_FUNCS(setutxent utmpxname)
+
+AC_CHECK_FUNC(getuserattr, 
+	[AC_DEFINE(HAVE_GETUSERATTR)],
+	[AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
+)
+
+AC_CHECK_FUNC(login, 
+	[AC_DEFINE(HAVE_LOGIN)],
+	[AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
+)
+
+AC_CHECK_FUNC(daemon, 
+	[AC_DEFINE(HAVE_DAEMON)],
+	[AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
+)
+
+AC_CHECK_FUNC(getpagesize, 
+	[AC_DEFINE(HAVE_GETPAGESIZE)],
+	[AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
+)
+
+# Check for broken snprintf
+if test "x$ac_cv_func_snprintf" = "xyes" ; then
+	AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
+	AC_TRY_RUN(
+		[
+#include <stdio.h>
+int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
+		],
+		[AC_MSG_RESULT(yes)], 
+		[
+			AC_MSG_RESULT(no)
+			AC_DEFINE(BROKEN_SNPRINTF)
+			AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
+		]
+	)
+fi
+
+AC_FUNC_GETPGRP
+
+AC_FUNC_STRFTIME
+
 # Checks for data types
 AC_CHECK_SIZEOF(char, 1)
 AC_CHECK_SIZEOF(short int, 2)
@@ -1151,126 +1282,6 @@
 )
 AC_SUBST(MANTYPE)
 AC_SUBST(mansubdir)
-
-# Check whether user wants Kerberos support
-KRB4_MSG="no" 
-AC_ARG_WITH(kerberos4,
-	[  --with-kerberos4=PATH   Enable Kerberos 4 support],
-	[
-		if test "x$withval" != "xno" ; then
-	
-			if test "x$withval" != "xyes" ; then
-				CPPFLAGS="$CPPFLAGS -I${withval}/include"
-				LDFLAGS="$LDFLAGS -L${withval}/lib"
-				if test ! -z "$need_dash_r" ; then
-					LDFLAGS="$LDFLAGS -R${withval}/lib"
-				fi
-				if test ! -z "$blibpath" ; then
-					blibpath="$blibpath:${withval}/lib"
-				fi
-			else
-				if test -d /usr/include/kerberosIV ; then
-					CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
-				fi
-			fi
-
-			AC_CHECK_HEADERS(krb.h)
-			AC_CHECK_LIB(krb, main)
-			if test "$ac_cv_header_krb_h" != yes; then
-				AC_MSG_WARN([Cannot find krb.h, build may fail])
-			fi
-			if test "$ac_cv_lib_krb_main" != yes; then
-				AC_MSG_WARN([Cannot find libkrb, build may fail])
-			fi
-
-			KLIBS="-lkrb -ldes"
-			AC_CHECK_LIB(resolv, dn_expand, , )
-			KRB4=yes
-			KRB4_MSG="yes" 
-			AC_DEFINE(KRB4)
-		fi
-	]
-)
-
-# Check whether user wants AFS support
-AFS_MSG="no" 
-AC_ARG_WITH(afs,
-	[  --with-afs=PATH         Enable AFS support],
-	[
-		if test "x$withval" != "xno" ; then
-
-			if test "x$withval" != "xyes" ; then
-				CPPFLAGS="$CPPFLAGS -I${withval}/include"
-				LDFLAGS="$LDFLAGS -L${withval}/lib"
-			fi
-
-			if test -z "$KRB4" ; then
-				AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
-			fi
-
-			LIBS="$LIBS -lkafs"
-			if test ! -z "$AFS_LIBS" ; then
-				LIBS="$LIBS $AFS_LIBS"
-			fi
-			AC_DEFINE(AFS)
-			AFS_MSG="yes" 
-		fi
-	]
-)
-LIBS="$LIBS $KLIBS"
-
-# Check whether user wants S/Key support
-SKEY_MSG="no" 
-AC_ARG_WITH(skey,
-	[  --with-skey=PATH         Enable S/Key support],
-	[
-		if test "x$withval" != "xno" ; then
-
-			if test "x$withval" != "xyes" ; then
-				CPPFLAGS="$CPPFLAGS -I${withval}/include"
-				LDFLAGS="$LDFLAGS -L${withval}/lib"
-			fi
-
-			AC_DEFINE(SKEY)
-			LIBS="-lskey $LIBS"
-			SKEY_MSG="yes" 
-	
-			AC_CHECK_FUNC(skey_keyinfo,
-				[],
-				[
-					AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
-				])
-		fi
-	]
-)
-
-# Check whether user wants TCP wrappers support
-TCPW_MSG="no" 
-AC_ARG_WITH(tcp-wrappers,
-	[  --with-tcp-wrappers     Enable tcpwrappers support],
-	[
-		if test "x$withval" != "xno" ; then
-			saved_LIBS="$LIBS"
-			LIBS="$LIBS -lwrap"
-			AC_MSG_CHECKING(for libwrap)
-			AC_TRY_LINK(
-				[
-#include <tcpd.h>
-					int deny_severity = 0, allow_severity = 0;
-				],
-				[hosts_access(0);],
-				[
-					AC_MSG_RESULT(yes)
-					AC_DEFINE(LIBWRAP)
-					TCPW_MSG="yes" 
-				],
-				[
-					AC_MSG_ERROR([*** libwrap missing])
-				]
-			)
-		fi
-	]
-)
 
 # Check whether to enable MD5 passwords
 MD5_MSG="no" 


More information about the openssh-unix-dev mailing list