1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(src/main.c)
3
4dnl check for --with options
5FIGURINE_EXTRA_PATHS
6
7dnl Checks for programs.
8AC_PROG_CC
9AC_MINIX
10AC_ISC_POSIX
11AC_MSG_CHECKING("whether $CC accepts -Wall")
12SAVE_CFLAGS=$CFLAGS
13CFLAGS="-Wall $CFLAGS"
14AC_TRY_COMPILE(,,AC_MSG_RESULT("yes"),AC_MSG_RESULT("no");CFLAGS=$SAVE_CFLAGS)
15AC_ARG_PROGRAM
16AC_PROG_INSTALL
17AM_INIT_AUTOMAKE(figurine, 1.0.5)
18dnl Checks for libraries.
19
20dnl we need the following line to allow out of place libXpm
21CPPFLAGS="$CPPFLAGS $extra_libraries"
22
23# maintainer's glibc20 compat rpm
24AC_ARG_WITH(glibc20, [  --with-glibc20          Maintainer only],
25CC=i386-glibc20-linux-gcc
26RPMRELEASE=glibc20
27GLIBC2_0_OPTION=--with-glibc20
28echo "Using compatibility gcc $CC" ,
29RPMRELEASE=glibc21
30GLIBC2_0_OPTION=
31)
32
33AC_SUBST(RPMRELEASE)
34AC_SUBST(GLIBC2_0_OPTION)
35
36dnl Checks for header files.
37AC_PATH_XTRA
38AC_HEADER_DIRENT
39AC_HEADER_STDC
40AC_CHECK_HEADERS(limits.h sys/time.h unistd.h)
41
42dnl Attempt to determine a suitable xpm.h
43SAVE_CPPFLAGS=$CPPFLAGS
44if test -z "$x_includes"
45then
46	CPPFLAGS="-Isrc/ $CPPFLAGS"
47else
48	CPPFLAGS="-Isrc/ -I$x_includes $CPPFLAGS"
49fi
50AC_CHECK_HEADERS(X11/xpm.h xpm.h)
51CPPFLAGS=$SAVE_CPPFLAGS
52
53
54if test "$ac_cv_header_X11_xpm_h" = "no" -a "$ac_cv_header_xpm_h" = "no"
55then
56	echo "Error: could not find xpm.h header."
57	echo
58	echo "Please see the file INSTALL which describes"
59	echo "how to use --with-extra-includes"
60	exit 1
61fi
62
63dnl Checks for typedefs, structures, and compiler characteristics.
64AM_C_PROTOTYPES
65AC_C_CONST
66AC_C_INLINE
67AC_HEADER_TIME
68AC_TYPE_UID_T
69
70LIBS="$X_LIBS -lX11 $X_EXTRA_LIBS $LIBS -lm"
71CFLAGS="$X_CFLAGS $CFLAGS"
72
73AC_CHECK_LIB(X11,XSetWMNormalHints, true,
74echo "Error: figurine requires at least X11 Release 4."
75echo
76exit 1)
77
78dnl Checks for library functions.
79AC_CHECK_FUNCS(getcwd gethostname usleep)
80
81dnl The user can specify XPMLIB as the library file to use
82dnl when libXpm is not available on the library path
83AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData, LIBS="-lXpm $LIBS" ,
84echo "Error: could not find Xpm library."
85echo
86echo "Please see the file INSTALL"
87exit 1
88)
89
90dnl for the man page
91DATE="`date '+%a %d %B %Y'`"
92AC_SUBST(DATE)
93
94dnl this is just a hack to give us a usable
95dnl $prefix earlier in the script than usual, for the
96dnl case when datadir has not been specified separately,
97dnl and neither has prefix
98if test "$prefix" = "NONE"
99then
100prefix=$ac_default_prefix
101fi
102DOCDIR=`eval echo $datadir`
103DOCDIR=`echo $DOCDIR | sed 's+/$++g'`
104AC_SUBST(DOCDIR)
105
106AC_OUTPUT(Doc/Makefile Makefile examples/Makefile src/Makefile figurine.spec figurine.1)
107