1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(src/xvpn.c)
3
4XVPN_MAJOR_VERSION=1
5XVPN_MINOR_VERSION=5
6XVPN_VERSION=$XVPN_MAJOR_VERSION.$XVPN_MINOR_VERSION
7
8AC_SUBST(XVPN_MAJOR_VERSION)
9AC_SUBST(XVPN_MINOR_VERSION)
10AC_SUBST(XVPN_VERSION)
11
12# For automake.
13VERSION=$XVPN_VERSION
14PACKAGE=xvpn
15
16dnl Initialize automake stuff
17AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
18
19dnl Checks for programs.
20AC_PROG_CC
21AM_PROG_LEX
22AC_PROG_YACC
23AM_PROG_LIBTOOL
24AC_PROG_MAKE_SET
25
26AC_CHECK_LIB(m, sqrt)
27
28AC_CHECK_PROGS(SED, gsed sed)
29AC_PATH_XTRA
30
31dnl
32dnl Check for X stuff
33dnl
34dnl
35dnl Check X options
36dnl
37if test "$with_x" = no; then
38AC_MSG_ERROR([requires the X window system to compile and run.
39                  Please do not use the configure option '--without-x'.])
40fi
41if test "$with_motif" = no; then
42AC_MSG_ERROR([requires Motif to compile and run.
43                  Please do not use the configure option '--without-motif'.])
44fi
45dnl
46dnl
47dnl Check for X libraries
48dnl
49if test "$with_x" != no; then
50ice_save_LIBS="$LIBS"
51ice_save_CFLAGS="$CFLAGS"
52ice_save_CXXFLAGS="$CXXFLAGS"
53ice_save_CPPFLAGS="$CPPFLAGS"
54ice_save_LDFLAGS="$LDFLAGS"
55
56dnl
57dnl
58
59AC_FIND_MOTIF
60
61dnl
62dnl
63dnl
64LIBS="$LIBS $X_EXTRA_LIBS"
65CFLAGS="$CFLAGS $X_CFLAGS"
66CPPFLAGS="$CPPFLAGS $X_CFLAGS"
67LDFLAGS="$LDFLAGS $X_LIBS"
68dnl
69dnl Check for X library
70
71dnl
72X11_LIBS=""
73AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS} ${X_EXTRA_LIBS})
74if test "$X11_LIBS" = ""; then
75dnl Not having X is fatal.  Let the user fix this.
76AC_MSG_ERROR([The X11 library '-lX11' could not be found.
77                  Please use the configure options '--x-includes=DIR'
78                  and '--x-libraries=DIR' to specify the X location.])
79fi
80AC_SUBST(X_LIBS)
81AC_SUBST(X11_LIBS)
82AC_SUBST(X_PRE_LIBS)
83dnl
84dnl
85dnl Check for -lXintl library.  Lutz Kittler <kittler@sse-erfurt.de> says
86dnl that DLD-Linux with CDE wants `-lXintl' to refine `Xlcmbcurmax'.
87dnl Guenther Roehrich <guenther@studbox.uni-stuttgart.de> says that
88dnl we must check for `_Xlcmbcurmax' instead of `Xlcmbcurmax'.
89dnl
90AC_CHECK_LIB(Xintl, _Xlcmbcurmax, X11_LIBS="${X11_LIBS} -lXintl",,
91	${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
92dnl
93dnl
94dnl Check for -lipc library.  SCO unix is said to want that.
95dnl
96AC_CHECK_LIB(ipc, shmap, X11_LIBS="${X11_LIBS} -lipc",,
97	${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
98dnl
99dnl
100dnl Check for X toolkit libraries
101dnl
102XT_LIBS=""
103AC_CHECK_LIB(Xt, XtToolkitInitialize, XT_LIBS="-lXt",,
104	${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
105if test "$XT_LIBS" = ""; then
106dnl Not having Xt is fatal.  Let the user fix this.
107AC_MSG_ERROR([The X toolkit library '-lXt' could not be found.
108                  Please use the configure options '--x-includes=DIR'
109                  and '--x-libraries=DIR' to specify the X location.
110                  See the files 'config.log' and 'ddd/config.log'
111                  for further diagnostics.])
112fi
113AC_SUBST(XT_LIBS)
114dnl
115dnl
116dnl Check for X extension libraries
117dnl
118dnl
119XEXT_LIBS=""
120AC_CHECK_LIB(Xext, XShapeQueryVersion, XEXT_LIBS="-lXext",,
121	${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
122AC_SUBST(XEXT_LIBS)
123
124dnl Check for Motif widget libraries
125dnl
126
127XM_LIBS=""
128XP_LIBS=""
129if test "$motif_includes" != "no" && test "$motif_libraries" != "no"
130then
131dnl Motif 2.1 wants `-lXp' (X11R6.3 print server)
132AC_CHECK_LIB(Xp, XpSelectInput,
133	XP_LIBS="-lXp"
134	AC_DEFINE(HAVE_XP),,
135                   ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
136dnl
137AC_CHECK_LIB(Xm, XmCreateOptionMenu,
138	XM_LIBS="-lXm"
139	AC_DEFINE(HAVE_MOTIF),,
140	${XP_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
141dnl
142AC_CHECK_LIB(Xm, xmUseVersion,
143	AC_DEFINE(HAVE_XMUSEVERSION),,
144	${XP_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
145dnl
146AC_CHECK_LIB(Xm, XmInstallImage,
147	AC_DEFINE(HAVE_XMINSTALLIMAGE),,
148	${XP_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
149dnl
150AC_CHECK_LIB(Xm, Xm21InstallImage,
151	AC_DEFINE(HAVE_XM21INSTALLIMAGE),,
152	${XP_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS})
153fi
154if test "$XM_LIBS" = ""; then
155dnl Without Motif, we won't get far.  Let the user fix this.
156AC_MSG_ERROR([The Motif library '-lXm' could not be found.
157                  Please use the configure options '--with-motif-includes=DIR'
158                  and '--with-motif-libraries=DIR' to specify the Xm location.
159                  See the files 'config.log'
160                  for further diagnostics.])
161fi
162
163AC_SUBST(XP_LIBS)
164AC_SUBST(XM_LIBS)
165
166LIBS="$LIBS ${XM_LIBS} ${XP_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${X_PRE_LIBS} ${X11_LIBS} ${X_EXTRA_LIBS}"
167
168
169LIBS="$ice_save_LIBS"
170CFLAGS="$ice_save_CFLAGS"
171CXXFLAGS="$ice_save_CXXFLAGS"
172CPPFLAGS="$ice_save_CPPFLAGS"
173LDFLAGS="$ice_save_LDFLAGS"
174fi
175
176dnl Checks for typedefs, structures, and compiler characteristics.
177AC_C_CONST
178
179AM_ALLIANCE
180
181AC_OUTPUT([
182Makefile
183src/Makefile
184etc/Makefile
185])
186