[Rt-commit] r2379 - rt/branches/PLATANO-EXPERIMENTAL

jesse at bestpractical.com jesse at bestpractical.com
Mon Mar 14 02:33:20 EST 2005


Author: jesse
Date: Mon Mar 14 02:33:20 2005
New Revision: 2379

Modified:
   rt/branches/PLATANO-EXPERIMENTAL/   (props changed)
   rt/branches/PLATANO-EXPERIMENTAL/configure.ac
Log:
 r8483 at hualien:  jesse | 2005-03-14 02:27:32 -0500
  r5932 at hualien:  jesse | 2005-02-24 15:09:27 -0500
  Robert added new functionality to support autodetection of RT and Web users in ./configure
  
 


Modified: rt/branches/PLATANO-EXPERIMENTAL/configure.ac
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/configure.ac	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL/configure.ac	Mon Mar 14 02:33:20 2005
@@ -43,12 +43,40 @@
 AC_PREFIX_DEFAULT([/opt/rt3])
 RT_ENABLE_LAYOUT
 
+
+# ACRT_USER_EXISTS( users, variable, default )
+# - users is a list of users [www apache www-docs]
+#    from highest to lowest priority to high priority (i.e. first match)
+# - variable is what you set with the result
+#
+
+AC_DEFUN([ACRT_USER_GUESS],
+ [ 
+   $2=$3
+   for x in $1; do
+    AC_MSG_CHECKING([if user $x exists]) 
+     AS_IF([ $PERL -e"exit( defined getpwnam('$x') ? 0 : 1)" ],
+           [ AC_MSG_RESULT([found]); $2=$x ; break],
+           [ AC_MSG_RESULT([not found]) ])
+   done
+  ])
+AC_DEFUN([ACRT_GROUP_GUESS],
+ [ 
+   $2=$3
+   for x in $1; do
+    AC_MSG_CHECKING([if group $x exists]) 
+     AS_IF([ $PERL -e"exit( defined getgrnam('$x') ? 0 : 1)" ],
+           [ AC_MSG_RESULT([found]); $2=$x ; break],
+           [ AC_MSG_RESULT([not found]) ])
+   done
+  ])
+
 dnl RTGROUP
 AC_ARG_WITH(rt-group,
 	    AC_HELP_STRING([--with-rt-group=GROUP],
 	    		   [group to own all files (default: rt)]),
             RTGROUP=$withval,
-            RTGROUP=rt)
+            ACRT_GROUP_GUESS([rt3 rt],[RTGROUP], [rt]))
 AC_SUBST(RTGROUP)
 
 dnl BIN_OWNER
@@ -160,15 +188,16 @@
 	    AC_HELP_STRING([--with-web-user=USER],
 	    		   [user the web server runs as (default: www)]),
             WEB_USER=$withval,
-            WEB_USER=www)
+            ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
+)
 AC_SUBST(WEB_USER)
 
 dnl WEB_GROUP
 AC_ARG_WITH(web-group,
-            AC_HELP_STRING([--with-web-group=GROUP],
+	    AC_HELP_STRING([--with-web-group=GROUP],
 		           [group the web server runs as (default: www)]),
             WEB_GROUP=$withval,
-            WEB_GROUP=www)
+            ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
 AC_SUBST(WEB_GROUP)
 
 dnl INSTALL AS ME


More information about the Rt-commit mailing list