]> granicus.if.org Git - linux-pam/blob - m4/libprelude.m4
pam_unix: Change the salt length for new hashes to 16 characters
[linux-pam] / m4 / libprelude.m4
1 dnl Autoconf macros for libprelude
2 dnl $id$
3
4 # Modified for LIBPRELUDE -- Yoann Vandoorselaere
5 # Modified for LIBGNUTLS -- nmav
6 # Configure paths for LIBGCRYPT
7 # Shamelessly stolen from the one of XDELTA by Owen Taylor
8 # Werner Koch   99-12-09
9
10 dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
11 dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
12 dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
13 dnl
14 AC_DEFUN([AM_PATH_LIBPRELUDE],
15 [dnl
16 dnl Get the cflags and libraries from the libprelude-config script
17 dnl
18 AC_ARG_WITH(libprelude-prefix, AC_HELP_STRING(--with-libprelude-prefix=PFX,
19             Prefix where libprelude is installed (optional)),
20             libprelude_config_prefix="$withval", libprelude_config_prefix="")
21
22   if test x$libprelude_config_prefix != x ; then
23      if test x${LIBPRELUDE_CONFIG+set} != xset ; then
24         LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
25      fi
26   fi
27
28   AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
29   min_libprelude_version=ifelse([$1], ,0.1.0,$1)
30   AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
31   no_libprelude=""
32   if test "$LIBPRELUDE_CONFIG" = "no" ; then
33     no_libprelude=yes
34   else
35     LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
36     LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
37     LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
38     LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
39     LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
40     LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
41     libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
42
43
44       ac_save_CFLAGS="$CFLAGS"
45       ac_save_LDFLAGS="$LDFLAGS"
46       ac_save_LIBS="$LIBS"
47       CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
48       LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
49       LIBS="$LIBS $LIBPRELUDE_LIBS"
50 dnl
51 dnl Now check if the installed libprelude is sufficiently new. Also sanity
52 dnl checks the results of libprelude-config to some extent
53 dnl
54       rm -f conf.libpreludetest
55       AC_TRY_RUN([
56 #include <stdio.h>
57 #include <stdlib.h>
58 #include <string.h>
59 #include <libprelude/prelude.h>
60
61 int
62 main ()
63 {
64     system ("touch conf.libpreludetest");
65
66     if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
67     {
68       printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
69              "$libprelude_config_version", prelude_check_version(NULL) );
70       printf("*** was found! If libprelude-config was correct, then it is best\n");
71       printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
72       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
73       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
74       printf("*** required on your system.\n");
75       printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
76       printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
77       printf("*** before re-running configure\n");
78     }
79     else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
80     {
81       printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
82       printf("*** library (version %s)\n", prelude_check_version(NULL) );
83     }
84     else
85     {
86       if ( prelude_check_version( "$min_libprelude_version" ) )
87       {
88         return 0;
89       }
90      else
91       {
92         printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
93                 prelude_check_version(NULL) );
94         printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
95                "$min_libprelude_version" );
96         printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
97         printf("*** \n");
98         printf("*** If you have already installed a sufficiently new version, this error\n");
99         printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
100         printf("*** being found. The easiest way to fix this is to remove the old version\n");
101         printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
102         printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
103         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
104         printf("*** so that the correct libraries are found at run-time))\n");
105       }
106     }
107   return 1;
108 }
109 ],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
110        CFLAGS="$ac_save_CFLAGS"
111        LIBS="$ac_save_LIBS"
112        LDFLAGS="$ac_save_LDFLAGS"
113   fi
114
115   if test "x$no_libprelude" = x ; then
116      AC_MSG_RESULT(yes)
117      ifelse([$2], , :, [$2])
118   else
119      if test -f conf.libpreludetest ; then
120         :
121      else
122         AC_MSG_RESULT(no)
123      fi
124      if test "$LIBPRELUDE_CONFIG" = "no" ; then
125        echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
126        echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
127        echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
128        echo "*** full path to libprelude-config."
129      else
130        if test -f conf.libpreludetest ; then
131         :
132        else
133           echo "*** Could not run libprelude test program, checking why..."
134           CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
135           LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
136           LIBS="$LIBS $LIBPRELUDE_LIBS"
137           AC_TRY_LINK([
138 #include <stdio.h>
139 #include <stdlib.h>
140 #include <string.h>
141 #include <libprelude/prelude.h>
142 ],      [ return !!prelude_check_version(NULL); ],
143         [ echo "*** The test program compiled, but did not run. This usually means"
144           echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
145           echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
146           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
147           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
148           echo "*** is required on your system"
149           echo "***"
150           echo "*** If you have an old version installed, it is best to remove it, although"
151           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
152           echo "***" ],
153         [ echo "*** The test program failed to compile or link. See the file config.log for the"
154           echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
155           echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
156           echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
157           CFLAGS="$ac_save_CFLAGS"
158           LDFLAGS="$ac_save_LDFLAGS"
159           LIBS="$ac_save_LIBS"
160        fi
161      fi
162      LIBPRELUDE_CFLAGS=""
163      LIBPRELUDE_LDFLAGS=""
164      LIBPRELUDE_LIBS=""
165      ifelse([$3], , :, [$3])
166   fi
167   rm -f conf.libpreludetest
168   AC_SUBST(LIBPRELUDE_CFLAGS)
169   AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
170   AC_SUBST(LIBPRELUDE_LDFLAGS)
171   AC_SUBST(LIBPRELUDE_LIBS)
172   AC_SUBST(LIBPRELUDE_PREFIX)
173   AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
174 ])
175
176 dnl *-*wedit:notab*-*  Please keep this as the last line.