瀏覽代碼

getopt_long fixes for Solaris

Ethan Galstad 22 年之前
父節點
當前提交
46deb20766
共有 5 個文件被更改,包括 128 次插入24 次删除
  1. 1 0
      Changelog
  2. 113 15
      configure
  3. 4 0
      configure.in
  4. 4 3
      src/Makefile.in
  5. 6 6
      src/dh.h

+ 1 - 0
Changelog

@@ -6,6 +6,7 @@ NRPE Changelog
 2.1 - ??/??/2003
 ----------------
 - Host names can now be specified in allowed host list
+- Configure script patch for getopt_long on Solaris
 
 
 2.0 - 09/08/2003

+ 113 - 15
configure

@@ -1803,8 +1803,105 @@ EOF
 fi
 
 
+for ac_func in getopt_long
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1810: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1815 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getopt_long in -liberty""... $ac_c" 1>&6
+echo "configure:1860: checking for getopt_long in -liberty" >&5
+ac_lib_var=`echo iberty'_'getopt_long | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-liberty  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1868 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getopt_long();
+
+int main() {
+getopt_long()
+; return 0; }
+EOF
+if { (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  OTHERLIBS="$OTHERLIBS -liberty"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+done
+
+
+
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:1808: checking for main in -lnsl" >&5
+echo "configure:1905: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1812,14 +1909,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1816 "configure"
+#line 1913 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1840,7 +1937,7 @@ else
 fi
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1844: checking for socket in -lsocket" >&5
+echo "configure:1941: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1848,7 +1945,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1852 "configure"
+#line 1949 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1859,7 +1956,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:1863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1883,12 +1980,12 @@ fi
 for ac_func in strdup strstr strtoul initgroups
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1887: checking for $ac_func" >&5
+echo "configure:1984: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1892 "configure"
+#line 1989 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1911,7 +2008,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1937,9 +2034,9 @@ done
 
 
 echo $ac_n "checking for type of socket size""... $ac_c" 1>&6
-echo "configure:1941: checking for type of socket size" >&5
+echo "configure:2038: checking for type of socket size" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1943 "configure"
+#line 2040 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <sys/types.h>
@@ -1949,7 +2046,7 @@ int main() {
 int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);
 ; return 0; }
 EOF
-if { (eval echo configure:1953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define SOCKET_SIZE_TYPE size_t
@@ -2010,7 +2107,7 @@ fi
 
 if test x$check_for_ssl = xyes; then
 	echo $ac_n "checking for SSL""... $ac_c" 1>&6
-echo "configure:2014: checking for SSL" >&5
+echo "configure:2111: checking for SSL" >&5
 	found_ssl=no
 	for dir in $ssl_inc_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
 		ssldir="$dir"
@@ -2053,7 +2150,7 @@ EOF
 	fi
 
 		echo $ac_n "checking for Kerberos include files""... $ac_c" 1>&6
-echo "configure:2057: checking for Kerberos include files" >&5
+echo "configure:2154: checking for Kerberos include files" >&5
 	found_kerberos=no
 	for dir in $kerberos_inc_dir /usr/kerberos/include; do
 		kerbdir="$dir"
@@ -2123,7 +2220,7 @@ fi
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2127: checking for $ac_word" >&5
+echo "configure:2224: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2249,6 +2346,7 @@ s%@INSTALL@%$INSTALL%g
 s%@CC@%$CC%g
 s%@SET_MAKE@%$SET_MAKE%g
 s%@CPP@%$CPP%g
+s%@OTHERLIBS@%$OTHERLIBS%g
 s%@SOCKETLIBS@%$SOCKETLIBS%g
 s%@HAVE_SSL@%$HAVE_SSL%g
 s%@nrpe_user@%$nrpe_user%g

+ 4 - 0
configure.in

@@ -80,6 +80,10 @@ if test "$ac_cv_type_int32_t" = no ; then
 fi
 
 
+dnl Check for getopt_long (Solaris)
+AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty"))
+AC_SUBST(OTHERLIBS)
+
 dnl Checks for library functions.
 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")

+ 4 - 3
src/Makefile.in

@@ -1,7 +1,7 @@
 ###############################
 # Makefile for NRPE
 #
-# Last Modified: 08-04-2003
+# Last Modified: 10-05-2003
 ###############################
 
 
@@ -12,6 +12,7 @@ CC=@CC@
 CFLAGS=@CFLAGS@ @DEFS@
 LDFLAGS=@LDFLAGS@ @LIBS@
 SOCKETLIBS=@SOCKETLIBS@
+OTHERLIBS=@OTHERLIBS@
 
 CP=@CP@
 
@@ -19,10 +20,10 @@ CP=@CP@
 all: nrpe check_nrpe
 
 nrpe: nrpe.c nrpe.h utils.c utils.h $(SRC_COMMON)/common.h $(SRC_COMMON)/config.h
-	$(CC) $(CFLAGS) -o $@ nrpe.c utils.c $(LDFLAGS) $(SOCKETLIBS)
+	$(CC) $(CFLAGS) -o $@ nrpe.c utils.c $(LDFLAGS) $(SOCKETLIBS) $(OTHERLIBS)
 
 check_nrpe: check_nrpe.c utils.c utils.h $(SRC_COMMON)/common.h $(SRC_COMMON)/config.h
-	$(CC) $(CFLAGS) -o $@ check_nrpe.c utils.c $(LDFLAGS) $(SOCKETLIBS)
+	$(CC) $(CFLAGS) -o $@ check_nrpe.c utils.c $(LDFLAGS) $(SOCKETLIBS) $(OTHERLIBS)
 
 clean:
 	rm -f core nrpe check_nrpe

+ 6 - 6
src/dh.h

@@ -4,12 +4,12 @@
 DH *get_dh512()
 	{
 	static unsigned char dh512_p[]={
-		0x81,0xC3,0x30,0xAC,0x8E,0xF9,0x3D,0x54,0x19,0xF8,0x85,0x93,
-		0xF8,0x4A,0xE4,0x22,0x7B,0xD4,0x8F,0x25,0xAC,0xDC,0x21,0xE6,
-		0x70,0xB5,0x1D,0x01,0x7C,0x8F,0x75,0xE9,0xEC,0xA2,0x48,0x0A,
-		0xD3,0xFC,0x8B,0xA0,0xFE,0x77,0x21,0x5D,0xDD,0x76,0x4C,0x65,
-		0xAB,0x09,0x0D,0x0D,0x64,0x92,0xFD,0xB3,0xDA,0x37,0xB9,0x0B,
-		0x39,0xDC,0xC6,0x6B,
+		0x8A,0x10,0xFF,0x62,0x71,0x55,0xC2,0x7A,0xAF,0xF9,0x9B,0x5E,
+		0x7F,0xFF,0xBF,0x22,0x44,0x18,0x5F,0x07,0x82,0x91,0xBE,0xDC,
+		0xFF,0xEB,0x6E,0x95,0xA3,0xB1,0xA3,0x88,0x5C,0x93,0xFE,0x94,
+		0x77,0x6D,0xA3,0x84,0x40,0xAC,0xBF,0x4C,0x46,0xC2,0x9B,0x33,
+		0xFC,0xBE,0x3E,0x93,0x38,0xEC,0xC6,0x45,0xB7,0x3F,0xDF,0x4E,
+		0x23,0xFA,0x5C,0x73,
 		};
 	static unsigned char dh512_g[]={
 		0x02,