Browse Source

Check for regex.h in configure

git-svn-id: https://klish.googlecode.com/svn/trunk@511 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 12 years ago
parent
commit
c449a48f53
5 changed files with 54 additions and 12 deletions
  1. 4 0
      clish/callback_access.c
  2. 3 0
      config.h.in
  3. 28 10
      configure
  4. 7 1
      configure.ac
  5. 12 1
      lub/db.h

+ 4 - 0
clish/callback_access.c

@@ -11,7 +11,9 @@
 #include <sys/types.h>
 #include <assert.h>
 #include <string.h>
+#ifdef HAVE_GRP_H
 #include <grp.h>
+#endif
 
 #include "lub/string.h"
 #include "lub/db.h"
@@ -21,6 +23,7 @@
 bool_t clish_access_callback(const clish_shell_t * shell, const char *access)
 {
 	bool_t allowed = BOOL_FALSE; /* assume the user is not allowed */
+#ifdef HAVE_GRP_H
 	int num_groups;
 	long ngroups_max;
 	gid_t *group_list;
@@ -59,6 +62,7 @@ bool_t clish_access_callback(const clish_shell_t * shell, const char *access)
 
 	lub_string_free(full_access);
 	free(group_list);
+#endif
 	return allowed;
 }
 

+ 3 - 0
config.h.in

@@ -48,6 +48,9 @@
 /* Define to 1 if you have the <pwd.h> header file. */
 #undef HAVE_PWD_H
 
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 

+ 28 - 10
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for klish 1.5.0.
+# Generated by GNU Autoconf 2.68 for klish 1.5.1.
 #
 # Report bugs to <serj.kalichev at gmail dot com>.
 #
@@ -570,8 +570,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='klish'
 PACKAGE_TARNAME='klish'
-PACKAGE_VERSION='1.5.0'
-PACKAGE_STRING='klish 1.5.0'
+PACKAGE_VERSION='1.5.1'
+PACKAGE_STRING='klish 1.5.1'
 PACKAGE_BUGREPORT='serj.kalichev at gmail dot com'
 PACKAGE_URL=''
 
@@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures klish 1.5.0 to adapt to many kinds of systems.
+\`configure' configures klish 1.5.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1397,7 +1397,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of klish 1.5.0:";;
+     short | recursive ) echo "Configuration of klish 1.5.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1509,7 +1509,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-klish configure 1.5.0
+klish configure 1.5.1
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2177,7 +2177,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by klish $as_me 1.5.0, which was
+It was created by klish $as_me 1.5.1, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -15127,7 +15127,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='klish'
- VERSION='1.5.0'
+ VERSION='1.5.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16120,6 +16120,24 @@ else
 $as_echo "$as_me: WARNING: Skipping BFD library checks because of GPL Licence" >&2;}
 fi
 
+################################
+# Check for regex.h
+################################
+for ac_header in regex.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default"
+if test "x$ac_cv_header_regex_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_REGEX_H 1
+_ACEOF
+
+else
+  as_fn_error $? "regex.h not found: regular expressions are not supported" "$LINENO" 5
+fi
+
+done
+
+
 ################################
 # Check for getopt_long()
 ################################
@@ -16800,7 +16818,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by klish $as_me 1.5.0, which was
+This file was extended by klish $as_me 1.5.1, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16866,7 +16884,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-klish config.status 1.5.0
+klish config.status 1.5.1
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 

+ 7 - 1
configure.ac

@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 m4_define([MAJOR_VERSION], 1)
 m4_define([MINOR_VERSION], 5)
-m4_define([MICRO_VERSION], 0)
+m4_define([MICRO_VERSION], 1)
 
 AC_PREREQ(2.59)
 AC_INIT([klish],
@@ -235,6 +235,12 @@ else
     AC_MSG_WARN([Skipping BFD library checks because of GPL Licence])
 fi
 
+################################
+# Check for regex.h
+################################
+AC_CHECK_HEADERS(regex.h, [],
+    AC_MSG_ERROR([regex.h not found: regular expressions are not supported]))
+
 ################################
 # Check for getopt_long()
 ################################

+ 12 - 1
lub/db.h

@@ -1,12 +1,23 @@
 #ifndef _lub_passwd_h
 #define _lub_passwd_h
+
 #include <stddef.h>
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
 
-/* wrappers for ugly getpwnam_r()-like functions */
+/* Wrappers for ugly getpwnam_r()-like functions */
+#ifdef HAVE_PWD_H
 struct passwd *lub_db_getpwnam(const char *name);
 struct passwd *lub_db_getpwuid(uid_t uid);
+#endif
+#ifdef HAVE_GRP_H
 struct group *lub_db_getgrnam(const char *name);
 struct group *lub_db_getgrgid(gid_t gid);
+#endif
 
 #endif