1dnl -*- autoconf -*-
2dnl
3AC_INIT([Jed],[0.99-19],[jed-users@jedsoft.org])
4AC_CONFIG_SRCDIR([src/ledit.c])
5JD_INIT
6AC_CONFIG_AUX_DIR(autoconf)
7
8m4_include([./include/pkgcfg.m4])
9
10dnl # infodir="\${JED_ROOT}/info"
11
12AC_CANONICAL_HOST
13AC_PROG_MAKE_SET
14AC_PROG_RANLIB
15AC_PROG_INSTALL
16
17JD_ANSI_CC
18JD_ELF_COMPILER
19
20PKG_PROG_PKG_CONFIG([0.14.0])
21
22# determine X include and libs for XJed
23AC_PATH_XTRA
24
25#Check these header since they cause trouble
26AC_CHECK_HEADERS( \
27stdlib.h \
28unistd.h \
29memory.h \
30glob.h \
31malloc.h \
32termios.h \
33fcntl.h \
34sys/fcntl.h \
35sys/pty.h \
36pty.h \
37)
38
39# special treatment for sys/wait.h
40AC_HEADER_SYS_WAIT
41AC_HEADER_DIRENT
42
43AC_TYPE_MODE_T
44AC_TYPE_PID_T
45AC_TYPE_UID_T
46
47AC_CHECK_LIB(util,openpty)
48
49AC_CHECK_FUNCS(\
50memset \
51memcpy \
52putenv \
53setenv \
54unsetenv \
55getcwd \
56setsid \
57tcgetattr tcsetattr cfgetospeed \
58grantpt \
59setlocale \
60utime \
61symlink \
62gethostname \
63tcgetpgrp \
64tcsetpgrp \
65getpgid \
66setpgid \
67openpty \
68snprintf vsnprintf \
69)
70
71AC_CHECK_SIZEOF(short, 2)
72AC_CHECK_SIZEOF(int, 4)
73AC_CHECK_SIZEOF(long, 4)
74AC_CHECK_SIZEOF(float, 4)
75AC_CHECK_SIZEOF(double, 8)
76JD_CHECK_LONG_LONG
77JD_LARGE_FILE_SUPPORT
78
79JD_SET_OBJ_SRC_DIR
80JD_TERMCAP
81JD_WITH_LIBRARY(slang)
82JD_GCC_WARNINGS
83
84AC_ARG_ENABLE(xft,
85  AS_HELP_STRING([--disable-xft],
86     [disable X FreeType library support (antialiased fonts)]),
87  [enable_xft=$enableval], [enable_xft=default])
88if test X"$enable_xft" = Xno
89then
90  AC_MSG_NOTICE(checking for xft disabled)
91else
92  AC_CHECK_LIB(Xft, XftFontOpen,
93    [XRENDERFONTLIBS="-lXft"
94     AC_SUBST(XRENDERFONTLIBS)
95     AC_DEFINE(XJED_HAS_XRENDERFONT, 1)
96     AC_PATH_PROG(PKGCONFIG, pkg-config)
97     if test -n "$PKGCONFIG"
98     then
99       X_CFLAGS="$X_CFLAGS $($PKGCONFIG --cflags xft)"
100     fi],
101    [if test X"$enable_xft" = Xyes
102     then
103       AC_MSG_FAILURE([libXft not found])
104     fi])
105fi
106
107dnl #------------------------------------------------------------------------
108AC_ARG_ENABLE(gpm,
109  AS_HELP_STRING([--disable-gpm], [disable gpm mouse support]),
110  [enable_gpm=$enableval], [enable_gpm=default])
111if test X"$enable_gpm" = Xno
112then
113  AC_MSG_NOTICE(checking for gpm disabled)
114  MOUSELIB=""
115  MOUSEDEFINES=""
116  MOUSE_O_FILE=""
117else
118  AC_CHECK_LIB(gpm, Gpm_Open,
119    [MOUSELIB="-lgpm"
120     MOUSEDEFINES="-DUSE_GPM_MOUSE"
121     MOUSE_O_FILE="gpmmouse.o"
122     MOUSE_OBJ_FILE="\${OBJDIR}/gpmmouse.o"
123     ],
124    [if test X"$enable_gpm" = Xyes
125     then
126       AC_MSG_FAILURE([libgpm not found])
127     fi])
128fi
129AC_SUBST(MOUSELIB)
130AC_SUBST(MOUSEDEFINES)
131AC_SUBST(MOUSE_O_FILE)
132AC_SUBST(MOUSE_OBJ_FILE)
133
134#---------------------------------------------------------------------------
135# gtk
136#---------------------------------------------------------------------------
137AC_DEFUN([WITH_GTK],[
138  AC_ARG_WITH( [gtk],
139               AC_HELP_STRING([--with-gtk=PATH], [Directory where the pkg-config file gtk+-2.0.pc can be found. This is often /usr/lib/pkgconfig, /usr/lib64/pkgconfig or in a default garnome build of gnome $HOME/garnome/lib/pkgconfig]),
140	       GTK_DIR="$withval", GTK_DIR="" )
141  PKG_CONFIG_PATH="$GTK_DIR"
142  export PKG_CONFIG_PATH
143  PKG_CHECK_MODULES( GTK, [gtk+-2.0 >= 2.8.0], [jd_with_gtk="yes"], [jd_with_gtk="no"] )
144  echo "GTK dir: $GTK_DIR"
145  AC_MSG_CHECKING([for gtk+-2.0 version >= 2.8.0])
146  AC_MSG_RESULT([$jd_with_gtk])
147  AC_MSG_RESULT([CFlags: $GTK_CFLAGS])
148  AC_MSG_RESULT([Libraries: $GTK_LIBS])
149  BUILD_GTKJED=$jd_with_gtk
150  AC_SUBST(BUILD_GTKJED)
151])
152
153WITH_GTK
154
155dnl #------------------------------------------------------------------------
156dnl JD_CHECK_FOR_LIBRARY(pcre)
157dnl if test $jd_with_pcre_library = yes
158dnl then
159dnl   LINK_LIBPCRE="-lpcre"
160dnl   AC_DEFINE(HAVE_PCRE_H)
161dnl else
162dnl   LINK_LIBPCRE=""
163dnl fi
164dnl AC_SUBST(LINK_LIBPCRE)
165dnl #------------------------------------------------------------------------
166if test "x$prefix" != xNONE; then
167  default_jed_root="$prefix/jed"
168else
169  default_jed_root="$ac_default_prefix/jed"
170fi
171JED_ROOT="${JED_ROOT:-$default_jed_root}"
172AC_SUBST(JED_ROOT)dnl
173
174dnl JD_GET_MODULES(src/modules.unx)
175dnl JD_CREATE_MODULE_ORULES
176
177AC_CONFIG_HEADER(src/sysconf.h:src/config.hin)
178AC_CONFIG_FILES([Makefile:autoconf/Makefile.in src/Makefile])
179AC_OUTPUT
180
181dnl JD_CREATE_ORULE(jprocess)
182dnl JD_CREATE_ORULE(chkslang)
183dnl JD_CREATE_ORULE(display)
184dnl JD_CREATE_ORULE(vterm)
185dnl JD_CREATE_ORULE(xterm)
186dnl JD_CREATE_ORULE(gpmmouse)
187dnl JD_CREATE_ORULE(rgrep)
188dnl JD_CREATE_ORULE(getmail)
189
190dnl JD_APPEND_RULES(src/Makefile)
191
192echo ""
193echo "You will need to edit src/Makefile if any of the following are not correct:"
194echo "        CC =" "$CC"
195echo "    CFLAGS =" "$CFLAGS"
196echo "   LDFLAGS =" "$LDFLAGS" "$DYNAMIC_LINK_FLAGS"
197echo "  JED_ROOT =" "$JED_ROOT"
198echo ""
199echo "Also edit src/Makefile to enable:"
200echo "  GPM Mouse support (Linux)"
201echo "You may also want to edit src/jed-feat.h to enable or disable some features."
202echo ""
203echo "Before typing 'make', type 'make clean' first."
204echo ""
205