]> git.armaanb.net Git - opendoas.git/blobdiff - configure
Update README
[opendoas.git] / configure
index 82b9331eba8ab60f2f0171fe6b25b252f3937600..b42152735c34d50b717582149c8a1a549054edbe 100755 (executable)
--- a/configure
+++ b/configure
@@ -15,7 +15,6 @@ usage: configure [options]
   --datadir=DIR          architecture-independent data files [PREFIX/share]
   --mandir=DIR           manual pages [DATADIR/man]
   --sysconfdir=DIR       directory for configuration files [/etc]
-  --pamdir=DIR           PAM directory [SYSCONFDIR/pam.d]
 
   --build=build-alias    a cpu-vendor-opsys for the system where the application will be built
   --host=host-alias      a cpu-vendor-opsys for the system where the application will run
@@ -24,11 +23,10 @@ usage: configure [options]
   --enable-debug         enable debugging
   --enable-static        prepare for static build
 
-  --without-pam          disable pam support
-  --without-shadow       disable shadow support
-
   --with-timestamp       enable timestamp support
 
+  --without-insults      disable insults
+
   --uid-max=NUM          set UID_MAX (default 65535)
   --gid-max=NUM          set GID_MAX (default 65535)
 
@@ -52,16 +50,12 @@ for x; do
        --datadir) SHAREDIR=$var ;;
        --mandir) MANDIR=$var ;;
        --sysconfdir) SYSCONFDIR=$var ;;
-       --pamdir) PAMDIR=$var ;;
        --build) BUILD=$var ;;
        --host) HOST=$var ;;
        --target) TARGET=$var ;;
        --enable-debug) DEBUG=yes ;;
        --enable-static) BUILD_STATIC=yes ;;
-       --with-pam) WITHOUT_PAM=; WITHOUT_SHADOW=yes ;;
-       --with-shadow) WITHOUT_SHADOW=; WITHOUT_PAM=yes ;;
-       --without-pam) WITHOUT_PAM=yes ;;
-       --without-shadow) WITHOUT_SHADOW=yes ;;
+       --without-insults) WITHOUT_INSULTS=yes ;;
        --with-timestamp) WITHOUT_TIMESTAMP= ;;
        --without-timestamp) WITHOUT_TIMESTAMP=yes ;;
        --uid-max) UID_MAX=$var ;;
@@ -116,11 +110,11 @@ case "$OS" in
                ;;
        netbsd)
                OS_CFLAGS="$OS_CFLAGS -D_OPENBSD_SOURCE"
-               printf 'LDFLAGS  +=     -lutil\n' >>$CONFIG_MK
+               printf 'LDLIBS +=       -lutil\n' >>$CONFIG_MK
                : ${BINGRP:=wheel}
                ;;
        freebsd)
-               printf 'LDFLAGS  +=     -lutil\n' >>$CONFIG_MK
+               printf 'LDLIBS +=       -lutil\n' >>$CONFIG_MK
                : ${BINGRP:=wheel}
                ;;
        darwin)
@@ -134,7 +128,6 @@ esac
 : ${SHAREDIR:=${PREFIX}/share}
 : ${MANDIR:=${SHAREDIR}/man}
 : ${SYSCONFDIR:=/etc}
-: ${PAMDIR:=${SYSCONFDIR}/pam.d}
 : ${BINMODE:=4755}
 : ${BINOWN:=root}
 : ${BINGRP:=root}
@@ -146,14 +139,13 @@ BINDIR   ?=       ${BINDIR}
 SHAREDIR ?=    ${SHAREDIR}
 MANDIR   ?=    ${MANDIR}
 SYSCONFDIR?=   ${SYSCONFDIR}
-PAMDIR   ?=    ${PAMDIR}
 BINMODE  ?=    ${BINMODE}
 BINOWN  ?=     ${BINOWN}
 BINGRP  ?=     ${BINGRP}
 EOF
 
 [ -n "$OS_CFLAGS" ] && \
-       printf 'CFLAGS   +=     %s\n' "$OS_CFLAGS" >>$CONFIG_MK
+       printf 'OS_CFLAGS   +=  %s\n' "$OS_CFLAGS" >>$CONFIG_MK
 
 [ -n "$DEBUG" ] && \
        printf 'CFLAGS   +=     -O0 -g\n' >>$CONFIG_MK
@@ -161,8 +153,8 @@ EOF
 [ -n "$BUILD_STATIC" ] && \
        printf 'CFLAGS   +=     -static\n' >>$CONFIG_MK
 
-# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
-XCC="${CC:=cc} $CFLAGS $OS_CFLAGS $CPPFLAGS $LDFLAGS"
+# Add CPPFLAGS/CFLAGS/LDFLAGS/LDLIBS to CC for testing features
+XCC="${CC:=cc} $CFLAGS $OS_CFLAGS $CPPFLAGS $LDFLAGS $LDLIBS"
 # Make sure to disable --as-needed for CC tests.
 
 case "$OS" in
@@ -190,44 +182,26 @@ check_func() {
 }
 
 authmethod() {
-       #
-       # Check for pam_appl.h.
-       #
-       src='
-#include <security/pam_appl.h>
-int main(void) {
-       return 0;
-}'
-       [ -z "$WITHOUT_PAM" ] && check_func "pam_appl_h" "$src" && {
-               printf 'SRCS     +=     pam.c\n' >>$CONFIG_MK
-               printf 'LDFLAGS  +=     -lpam\n' >>$CONFIG_MK
-               printf '#define USE_PAM\n' >>$CONFIG_H
-               printf 'pam\n'
-
-               pam_file="pam.d__doas__${OS}"
-               [ -e "$pam_file" ] && printf 'PAM_DOAS  =       %s\n' "$pam_file" >>$CONFIG_MK
-               return 0
-       }
-
-       #
-       # Check for shadow.h.
-       #
        src='
 #include <shadow.h>
 int main(void) {
        return 0;
 }'
-       [ -z "$WITHOUT_SHADOW" ] && check_func "shadow_h" "$src" && {
-               printf 'SRCS     +=     shadow.c\n' >>$CONFIG_MK
-               printf 'LDFLAGS  +=     -lcrypt\n' >>$CONFIG_MK
-               printf '#define USE_SHADOW\n' >>$CONFIG_H
-               printf 'shadow\n'
-               return 0
-       }
 
-       return 1
+printf 'SRCS     +=    shadow.c\n' >>$CONFIG_MK
+printf 'LDLIBS +=      -lcrypt\n' >>$CONFIG_MK
+return 0
 }
 
+definsults() {
+       printf 'SRCS    += insults.c\n' >>$CONFIG_MK
+       [ -z "$WITHOUT_INSULTS" ] && {
+               printf '#define DOAS_INSULTS\n' >>$CONFIG_H
+       }
+       return 0
+}
+
+
 persistmethod() {
        [ -z "$WITHOUT_TIMESTAMP" ] && {
                printf '#define USE_TIMESTAMP\n' >>$CONFIG_H
@@ -545,16 +519,12 @@ int main(void){return 0;}
 __attribute__((__unused__)) static void foo(void){return;}
 '
 check_func "__attribute__" "$src" || {
-       printf 'CFLAGS  +=      -DNO_ATTRIBUTE_ON_RETURN_TYPE=1\n' >>$CONFIG_MK
+       printf 'OS_CFLAGS       +=      -DNO_ATTRIBUTE_ON_RETURN_TYPE=1\n' >>$CONFIG_MK
 }
 
 auth=$(authmethod)
-if [ $? -eq 0 ]; then
-       printf 'Using auth method\t\t\t%s.\n' "$auth" >&2
-else
-       printf 'Error auth method\t\t\n' >&2
-       exit 1
-fi
+
+insults=$(definsults)
 
 persist=$(persistmethod)
 if [ $? -eq 0 ]; then