dnl dnl Process this file with GNU autoconf to produce a configure script. dnl $Id: configure.in,v 1.10 2003/03/24 01:04:49 millert Exp $ dnl dnl Copyright (c) 2000, 2001 Todd C. Miller dnl AC_INIT(mktemp, 1.5) AC_CONFIG_HEADER(config.h) dnl dnl Variables that get substituted in the Makefile dnl AC_SUBST(CFLAGS)dnl AC_SUBST(CPPFLAGS)dnl AC_SUBST(LDFLAGS)dnl AC_SUBST(LIBS)dnl AC_SUBST(MANTYPE)dnl dnl dnl Options for --with dnl AC_ARG_WITH(CC, [ --with-CC C compiler to use], [case $with_CC in yes) AC_MSG_ERROR(["must give --with-CC an argument."]) ;; no) AC_MSG_ERROR(["illegal argument: --without-CC."]) ;; *) CC=$with_CC ;; esac]) AC_ARG_WITH(incpath, [ --with-incpath additional places to look for include files], [case $with_incpath in yes) AC_MSG_ERROR(["must give --with-incpath an argument."]) ;; no) AC_MSG_ERROR(["--without-incpath not supported."]) ;; *) AC_MSG_NOTICE([Adding ${with_incpath} to CPPFLAGS]) for i in ${with_incpath}; do CPPFLAGS="${CPPFLAGS} -I${i}" done ;; esac]) AC_ARG_WITH(libpath, [ --with-libpath additional places to look for libraries], [case $with_libpath in yes) AC_MSG_ERROR(["must give --with-libpath an argument."]) ;; no) AC_MSG_ERROR(["--without-libpath not supported."]) ;; *) AC_MSG_NOTICE([Adding ${with_libpath} to LDFLAGS]) for i in ${with_libpath}; do LDFLAGS="${LDFLAGS} -L${i}" done ;; esac]) AC_ARG_WITH(libraries, [ --with-libraries additional libraries to link with], [case $with_libraries in yes) AC_MSG_ERROR(["must give --with-libraries an argument."]) ;; no) AC_MSG_ERROR(["--without-libraries not supported."]) ;; *) AC_MSG_NOTICE([Adding ${with_libraries} to LIBS]) for i in ${with_libraries}; do case $i in -l*) ;; *.a) ;; *.o) ;; *) i="-l${i}";; esac LIBS="${LIBS} ${i}" done ;; esac]) AC_ARG_WITH(man, [ --with-man manual page uses man macros (default)], [case $with_man in yes) MANTYPE=man ;; no) AC_MSG_ERROR(["--without-man not supported."]) ;; *) AC_MSG_ERROR(["ignoring unknown argument to --with-man: $with_man."]) ;; esac]) AC_ARG_WITH(mdoc, [ --with-mdoc manual page uses mdoc macros], [case $with_mdoc in yes) MANTYPE=mdoc ;; no) AC_MSG_ERROR(["--without-mdoc not supported."]) ;; *) AC_MSG_ERROR(["ignoring unknown argument to --with-mdoc: $with_mdoc."]) ;; esac]) AC_ARG_WITH(random, [ --with-random=/path path to random device], [case $with_random in # $with_random is checked for (and cached) below yes) with_random= ;; esac]) AC_ARG_WITH(libc, [ --with-libc don't link with private mk{s,d}temp], [case $with_libc in # $with_libc is checked for (and cached) below yes|no) ;; *) AC_MSG_ERROR(["ignoring unknown argument to --with-libc: $with_libc."]) with_libc= ;; esac]) dnl dnl What kind of beastie are we being run on? dnl Barf if config.cache was generated on another host. dnl AC_CANONICAL_HOST if test -n "$mktemp_cv_prev_host"; then if test "$mktemp_cv_prev_host" != "$host"; then AC_MSG_ERROR([config.cache was created on a different host; remove it and re-run configure.]) else AC_MSG_CHECKING(previous host type) AC_CACHE_VAL(mktemp_cv_prev_host, mktemp_cv_prev_host="$host") AC_MSG_RESULT([$mktemp_cv_prev_host]) fi else # this will produce no output since there is no cached value AC_CACHE_VAL(mktemp_cv_prev_host, mktemp_cv_prev_host="$host") fi dnl dnl Check for programs we need dnl AC_CHECK_PROG(NROFF, nroff, ["$ac_dir/$ac_word"], no, [/usr/bin /usr/ucb /usr/bsd /usr/contrib/bin /usr/local/bin $PATH]) dnl dnl C compiler checks dnl AC_PROG_GCC_TRADITIONAL AC_C_CONST dnl dnl Header file checks dnl AC_HEADER_TIME AC_CHECK_HEADERS(paths.h) dnl dnl check for ssize_t type dnl AC_CHECK_TYPE(ssize_t, int) dnl dnl Function checks dnl AC_CHECK_FUNCS(random lrand48, [if test "$ac_func" = "random"; then AC_CHECK_FUNCS(srandomdev) fi break]) AC_REPLACE_FUNCS(strerror strdup) dnl dnl Check for __progname dnl AC_MSG_CHECKING([for __progname]) AC_CACHE_VAL(mktemp_cv_progname, [ AC_TRY_LINK(, [extern char *__progname; (void)puts(__progname);], [mktemp_cv_progname=yes], [mktemp_cv_progname=no])]) test "$mktemp_cv_progname" = "yes" && AC_DEFINE(HAVE_PROGNAME, 1, [Define if your crt0.o defines the __progname symbol for you.]) AC_MSG_RESULT($mktemp_cv_progname) dnl dnl Look for /dev/urandom dnl AC_MSG_CHECKING([for random device]) test -n "$with_random" && mktemp_cv_dev_urandom="with_random=$with_random" AC_CACHE_VAL(mktemp_cv_dev_urandom, [ if test -n "$with_random"; then mktemp_cv_dev_urandom="with_random=$with_random" elif test -r /dev/urandom; then mktemp_cv_dev_urandom="with_random=/dev/urandom" else mktemp_cv_dev_urandom="with_random=no" fi ]) eval $mktemp_cv_dev_urandom if test "$with_random" != "no"; then AC_DEFINE_UNQUOTED(_PATH_RANDOM, "$with_random", [Location of random device/stream if you have one.]) fi AC_MSG_RESULT($with_random) dnl dnl If the user wants to use libc's mkstemp/mkdtemp don't include ours dnl AC_MSG_CHECKING([whether to use mk{s,d}temp from libc]) test -n "$with_libc" && mktemp_cv_system_mktemp="$with_libc" AC_CACHE_VAL(mktemp_cv_system_mktemp, [ if test -n "$with_libc"; then mktemp_cv_system_mktemp="$with_libc" else mktemp_cv_system_mktemp="no" fi ]) AC_MSG_RESULT($mktemp_cv_system_mktemp) if test $mktemp_cv_system_mktemp = yes; then AC_REPLACE_FUNCS(mkdtemp) AC_DEFINE(MKSTEMP, mkstemp, [Use the system or private version of mkstemp?]) AC_DEFINE(MKDTEMP, mkdtemp, [Use the system or private version of mkdtemp?]) else AC_LIBOBJ(priv_mktemp) AC_LIBOBJ(random) AC_DEFINE(MKSTEMP, priv_mkstemp, [Use the system or private version of mkstemp?]) AC_DEFINE(MKDTEMP, priv_mkdtemp, [Use the system or private version of mkdtemp?]) AC_MSG_CHECKING([for EBCDIC]) AC_CACHE_VAL(sudo_cv_ebcdic, [AC_RUN_IFELSE( [AC_LANG_SOURCE([int main() { char c='i'; exit(++c == 'j'); }])], [sudo_cv_ebcdic=yes], [sudo_cv_ebcdic=no]) ]) test "$sudo_cv_ebcdic" = "yes" && AC_DEFINE(HAVE_EBCDIC, 1, [Define if your OS uses EBCDIC, not ASCII.]) AC_MSG_RESULT($sudo_cv_ebcdic) fi dnl dnl Does the user want to use man or mdoc macros? dnl AC_MSG_CHECKING([which macro set to use for manual]) test -n "$MANTYPE" && mktemp_cv_mantype="$MANTYPE" AC_CACHE_VAL(mktemp_cv_mantype, [ if test -n "$MANTYPE"; then mktemp_cv_mantype="$MANTYPE" else mktemp_cv_mantype="man" if test "$NROFF" != "no"; then $NROFF -mdoc < /dev/null > conftest 2>&1 test -s conftest || mktemp_cv_mantype="mdoc" rm -f conftest fi fi ]) AC_MSG_RESULT($mktemp_cv_mantype) MANTYPE="$mktemp_cv_mantype" dnl dnl Set exec_prefix dnl test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)' dnl dnl Substitute into the Makefiles dnl AC_OUTPUT(Makefile) dnl dnl Special bits for autoheader dnl AH_TOP([#ifndef _MKTEMP_CONFIG_H #define _MKTEMP_CONFIG_H]) AH_BOTTOM([#endif /* _MKTEMP_CONFIG_H */]) AH_VERBATIM([__P], [/* Deal with ANSI stuff reasonably. */ /* XXX */ #undef __P #if defined (__cplusplus) || defined (__STDC__) # define __P(args) args #else # define __P(args) () #endif]) AH_VERBATIM([__attribute__], [/* Ignore __attribute__ if non-gcc or gcc < 2.5 */ #if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) #define __attribute__(args) #endif])