1dnl# -*- sh -*- 2dnl# 3dnl# This file requires JD_* m4 macros that are defined in 4dnl# the aclocal.m4 file. 5dnl# 6 7AC_INIT(src/slang.c) 8#AC_PREFIX_DEFAULT($MY_PREFIX_DEAULT) 9 10# Installation location 11AC_PREFIX_DEFAULT("/usr/local" 12dnl# if test -f "/usr/include/slang.h"; then 13dnl# ac_default_prefix="/usr" 14dnl# fi 15) 16 17AC_CONFIG_AUX_DIR(autoconf) 18AC_CANONICAL_HOST 19 20JD_INIT 21JD_ANSI_CC 22 23AC_PROG_MAKE_SET 24AC_PROG_RANLIB 25AC_PROG_INSTALL 26 27AC_ARG_WITH(pkgconfigdir, 28 AC_HELP_STRING([--with-pkgconfigdir=DIR], 29 [pkgconfig dir (libdir/pkgconfig)]), 30 [pkgconfigdir=${withval}], 31 [pkgconfigdir='${libdir}/pkgconfig']) 32AC_SUBST(pkgconfigdir) 33 34dnl # Terminfo binary format 35AC_ARG_WITH(terminfo, 36 [ --with-terminfo=xxx Terminfo layout: default, hpux11, osf1r5, aix4, uwin ], 37 [ jd_with_terminfo_arg=$withval ], [jd_with_terminfo_arg=default]) 38AC_MSG_CHECKING(terminfo layout) 39if test "x$jd_with_terminfo_arg" = "x" 40then 41 jd_with_terminfo_arg="default" 42fi 43if test -r src/terminfo/$jd_with_terminfo_arg.inc 44then 45 AC_MSG_RESULT($jd_with_terminfo_arg) 46 TERMINFO_LAYOUT="$jd_with_terminfo_arg" 47else 48 AC_MSG_ERROR(-"-with-terminfo=$jd_with_terminfo_arg is invalid. src/terminfo/$jd_with_terminfo_arg.inc does not exist") 49fi 50AC_SUBST(TERMINFO_LAYOUT) 51 52dnl # Readline support for slsh 53AC_ARG_WITH(readline, 54 [ --with-readline=xxx Use slang(default) or gnu readline for slsh ], 55 [ jd_with_readline_arg=$withval ], [jd_with_readline_arg=slang]) 56AC_MSG_CHECKING(type of readline support for slsh) 57case "x$jd_with_readline_arg" in 58 xgnu|xGNU ) 59 GNU_READLINE=1 60 LIB_READLINE=-lreadline 61 AC_MSG_RESULT(gnu); 62 ;; 63 *) 64 GNU_READLINE=0 65 LIB_READLINE="# -lreadline" 66 AC_MSG_RESULT(slang); 67 ;; 68esac 69AC_SUBST(GNU_READLINE) 70AC_SUBST(LIB_READLINE) 71 72dnl # 73AC_ARG_WITH(slsyswrap, 74 [ --with-slsyswrap=DIR Not for production use], 75 [ jd_with_slsyswrap_arg=$withval ], [jd_with_slsyswrap_arg=no]) 76AC_MSG_CHECKING(for slsyswrap) 77 78case "x$jd_with_slsyswrap_arg" in 79 x|xno) 80 DSLSYSWRAP="" 81 LIB_SLSYSWRAP="" 82 AC_MSG_RESULT(no); 83 ;; 84 *) 85 DSLSYSWRAP="-I$jd_with_slsyswrap_arg/include -DSLSYSWRAP=1" 86 LIB_SLSYSWRAP="-L$jd_with_slsyswrap_arg/lib -lslsyswrap" 87 AC_MSG_RESULT(yes); 88 ;; 89esac 90AC_SUBST(DSLSYSWRAP) 91AC_SUBST(LIB_SLSYSWRAP) 92 93# For the socket module 94AC_PATH_XTRA 95 96#Check these header since they cause trouble 97AC_CHECK_HEADERS( \ 98stdlib.h \ 99unistd.h \ 100memory.h \ 101termios.h \ 102malloc.h \ 103locale.h \ 104xlocale.h \ 105langinfo.h \ 106fcntl.h \ 107sys/fcntl.h \ 108sys/types.h \ 109sys/wait.h \ 110sys/utsname.h \ 111sys/times.h \ 112sys/statvfs.h \ 113sys/time.h \ 114utime.h \ 115floatingpoint.h \ 116ieeefp.h \ 117nan.h \ 118fenv.h \ 119sys/mman.h \ 120sys/socket.h \ 121netinet/in.h \ 122arpa/inet.h \ 123sys/un.h \ 124sys/resource.h \ 125) 126 127AC_TYPE_MODE_T 128AC_TYPE_PID_T 129AC_TYPE_UID_T 130dnl# AC_TYPE_OFF_T 131 132AC_MSG_CHECKING([for socklen_t]) 133AC_EGREP_HEADER(socklen_t, sys/socket.h, 134 AC_MSG_RESULT([yes]), 135 AC_MSG_RESULT([no]) 136 AC_DEFINE(socklen_t,int, 137 [ Define to 'int' if not in <sys/socket.h>])) 138 139AC_HEADER_DIRENT 140 141AC_CHECK_FUNCS(\ 142memset \ 143memcpy \ 144putenv \ 145getcwd \ 146setlocale \ 147tcgetattr \ 148tcsetattr \ 149cfgetospeed \ 150sigaction \ 151sigemptyset \ 152sigprocmask \ 153sigaddset \ 154alarm \ 155pause \ 156vfscanf \ 157lstat readlink symlink link \ 158kill killpg \ 159snprintf vsnprintf \ 160getppid getegid geteuid getuid getgid setgid setuid \ 161setpgid getpgid setpgrp getpgrp setsid getsid \ 162mmap \ 163chown lchown popen mkfifo \ 164atexit on_exit umask uname \ 165times gmtime mktime gettimeofday \ 166getitimer setitimer \ 167gmtime_r ctime_r localtime_r \ 168strtod atoll strtoll \ 169issetugid \ 170isnan \ 171finite \ 172isinf \ 173round \ 174siglongjmp \ 175fork waitpid \ 176socket socketpair \ 177confstr pathconf \ 178getpriority setpriority \ 179getrusage \ 180setvbuf \ 181utime utimes \ 182ttyname ttyname_r \ 183newlocale strtod_l localeconv \ 184statvfs \ 185) 186 187if test x"$ac_cv_func_socketpair" != x"yes"; then 188 AC_CHECK_LIB(socket, socketpair, AC_DEFINE(HAVE_SOCKETPAIR,1)) 189fi 190if test x"$ac_cv_func_socket" != x"yes"; then 191 AC_CHECK_LIB(socket, socket, AC_DEFINE(HAVE_SOCKET,1)) 192fi 193 194 195dnl# Systems that have nl_langinfo may not have CODESET. Test for both here 196AC_CACHE_CHECK([for nl_langinfo and CODESET], jd_cv_nl_langinfo_codeset, 197 [AC_TRY_LINK([#include <langinfo.h>], [char* cs = nl_langinfo(CODESET);], 198 jd_cv_nl_langinfo_codeset=yes, jd_cv_nl_langinfo_codeset=no) 199]) 200if test $jd_cv_nl_langinfo_codeset = yes 201then 202 AC_DEFINE(HAVE_NL_LANGINFO_CODESET, 1, [Set to 1 if you have the nl_langinfo(CODESET) function]) 203fi 204 205AC_MSG_CHECKING(for environ variable) 206AC_TRY_LINK([ 207#include <stdlib.h> 208extern char **environ; 209], 210[exit (environ == NULL);], 211have_environ=yes, have_environ=no) 212AC_MSG_RESULT([$have_environ]) 213if test $have_environ = yes 214then 215 AC_DEFINE(HAVE_ENVIRON, 1, [Set to 1 if environ exists]) 216fi 217 218 219AC_CHECK_LIB(m, acosh, [AC_DEFINE(HAVE_ACOSH,1,[Set to 1 if you have the acosh function])]) 220AC_CHECK_LIB(m, asinh, [AC_DEFINE(HAVE_ASINH,1,[Set to 1 if you have the asinh function])]) 221AC_CHECK_LIB(m, atanh, [AC_DEFINE(HAVE_ATANH,1,[Set to 1 if you have the atanh function])]) 222AC_CHECK_LIB(m, hypot, [AC_DEFINE(HAVE_HYPOT,1,[Set to 1 if you have the hypot function])]) 223AC_CHECK_LIB(m, atan2, [AC_DEFINE(HAVE_ATAN2,1,[Set to 1 if you have the atan2 function])]) 224AC_CHECK_LIB(m, frexp, [AC_DEFINE(HAVE_FREXP,1,[Set to 1 if you have the frexp function])]) 225AC_CHECK_LIB(m, frexpf, [AC_DEFINE(HAVE_FREXPF,1,[Set to 1 if you have the frexpf function])]) 226AC_CHECK_LIB(m, ldexp, [AC_DEFINE(HAVE_LDEXP,1,[Set to 1 if you have the ldexp function])]) 227AC_CHECK_LIB(m, ldexpf, [AC_DEFINE(HAVE_LDEXPF,1,[Set to 1 if you have the ldexpf function])]) 228AC_CHECK_LIB(m, sincos, [AC_DEFINE(HAVE_SINCOS,1,[Set to 1 if you have the sincos function])]) 229AC_CHECK_LIB(m, sincosf, [AC_DEFINE(HAVE_SINCOSF,1,[Set to 1 if you have the sincosf function])]) 230AC_CHECK_LIB(m, feclearexcept, [AC_DEFINE(HAVE_FECLEAREXCEPT,1,[Set to 1 if you have the feclearexcept function])]) 231AC_CHECK_LIB(m, fpsetsticky, [AC_DEFINE(HAVE_FPSETSTICKY,1,[Set to 1 if you have the fpsetsticky function])]) 232 233JD_ELF_COMPILER 234JD_IEEE_CFLAGS 235 236ELF_CFLAGS="$ELF_CFLAGS $IEEE_CFLAGS" 237CFLAGS="$CFLAGS $IEEE_CFLAGS" 238 239JD_SET_RPATH($libdir) 240 241AC_CHECK_SIZEOF(short, 2) 242AC_CHECK_SIZEOF(int, 4) 243AC_CHECK_SIZEOF(long, 4) 244AC_CHECK_SIZEOF(float, 4) 245AC_CHECK_SIZEOF(double, 8) 246 247AC_CHECK_TYPE(ptrdiff_t,long) 248 249AC_TYPE_SIZE_T 250AC_CHECK_SIZEOF(size_t) 251 252JD_CHECK_LONG_LONG 253JD_LARGE_FILE_SUPPORT 254 255JD_TERMCAP 256JD_GCC_WARNINGS 257 258JD_SET_OBJ_SRC_DIR(src) 259 260missingmodules="" 261extramodules="" 262JD_CHECK_FOR_LIBRARY(pcre) 263if test $jd_with_pcre_library = yes 264then 265 PCRE_MODULE="pcre-module.so" 266 AC_DEFINE(HAVE_PCRE_H,1,[Set to 1 if you have the pcre.h header]) 267 extramodules="$extramodules pcre" 268else 269 PCRE_MODULE="" 270 missingmodules="$missingmodules pcre" 271fi 272AC_SUBST(PCRE_MODULE) 273 274JD_CHECK_FOR_LIBRARY(onig,oniguruma.h) 275if test $jd_with_onig_library = yes 276then 277 ONIG_MODULE="onig-module.so" 278 AC_DEFINE(HAVE_ONIGURUMA_H,1,[Set to 1 if you have the oniguruma.h header]) 279 extramodules="$extramodules oniguruma" 280else 281 ONIG_MODULE="" 282 missingmodules="$missingmodules oniguruma" 283fi 284AC_SUBST(ONIG_MODULE) 285 286JD_CHECK_FOR_LIBRARY(png) 287if test $jd_with_png_library = yes 288then 289 PNG_MODULE="png-module.so" 290 AC_DEFINE(HAVE_PNG_H,1,[Set to 1 if you have the png.h header]) 291 extramodules="$extramodules png" 292else 293 PNG_MODULE="" 294 missingmodules="$missingmodules png" 295fi 296AC_SUBST(PNG_MODULE) 297 298JD_CHECK_FOR_LIBRARY(z,zlib.h) 299if test $jd_with_z_library = yes 300then 301 ZLIB_MODULE="zlib-module.so" 302 AC_DEFINE(HAVE_ZLIB_H,1,[Set to 1 if you have the zlib.h header]) 303 extramodules="$extramodules z" 304else 305 ZLIB_MODULE="" 306 missingmodules="$missingmodules z" 307fi 308AC_SUBST(ZLIB_MODULE) 309 310m4_include([./iconv.m4]) 311 312ICONV_MODULE="" 313JD_CHECK_FOR_LIBRARY(iconv) 314if test $jd_with_iconv_library = yes 315then 316 ICONV_MODULE="iconv-module.so" 317 AC_DEFINE(HAVE_ICONV_H,1,[Set to 1 if you have the iconv.h header]) 318 ICONV_LIB="$ICONV_LIB -liconv" 319 extramodules="$extramodules iconv" 320else 321 SLANG_AM_ICONV 322 if test "$am_cv_func_iconv" = yes 323 then 324 ICONV_MODULE="iconv-module.so" 325 extramodules="$extramodules iconv" 326 if test "X$am_cv_lib_iconv" = Xyes 327 then 328 ICONV_LIB=$LIBICONV 329 ICONV_INC="" 330 fi 331 else 332 missingmodules="$missingmodules iconv" 333 fi 334fi 335AC_SUBST(ICONV_MODULE) 336dnl # AC_SUBST(ICONV_LIB) 337dnl # AC_SUBST(ICONV_INC) 338 339AC_CHECK_FUNCS(sysconf, [ 340 SYSCONF_MODULE="sysconf-module.so" 341 ], [SYSCONF_MODULE=""]) 342AC_SUBST(SYSCONF_MODULE) 343 344JD_GET_MODULES(src/modules.unx) 345JD_CREATE_MODULE_ORULES 346 347AC_MSG_CHECKING(SLANG_VERSION) 348slang_version=`grep "^#define *SLANG_VERSION " $srcdir/src/slang.h | 349 awk '{ print [$]3 }'` 350slang_major_version=`echo $slang_version | 351 awk '{ print int([$]1/10000) }'` 352slang_minor_version=`echo $slang_version $slang_major_version | 353 awk '{ print int(([$]1 - [$]2*10000)/100) }'` 354slang_micro_version=`echo $slang_version $slang_major_version $slang_minor_version | 355 awk '{ print ([$]1 - [$]2*10000 - [$]3*100) }'` 356 357dnl# slang_minor_version="$slang_minor_version.$slang_mminor_version" 358slang_version="$slang_major_version.$slang_minor_version.$slang_micro_version" 359AC_MSG_RESULT($slang_version) 360AC_SUBST(slang_major_version) 361AC_SUBST(slang_minor_version) 362AC_SUBST(slang_micro_version) 363AC_SUBST(slang_version) 364 365AC_CONFIG_HEADER(src/sysconf.h:src/config.hin) 366 367dnl AC_CONFIG_SUBDIRS(demo) 368 369AC_OUTPUT(Makefile:autoconf/Makefile.in \ 370 src/Makefile slsh/Makefile modules/Makefile demo/Makefile \ 371 slang.pc:autoconf/slangpc.in \ 372) 373 374JD_CREATE_EXEC_RULE(calc) 375JD_CREATE_EXEC_RULE(untic) 376JD_APPEND_RULES(src/Makefile) 377JD_APPEND_ELFRULES(src/Makefile) 378 379echo "" 380echo "Configuration complete. You may need to edit src/Makefile." 381echo "You are compiling SLANG with the following compiler configuration:" 382echo " CC =" "$CC" 383echo " CFLAGS =" "$CFLAGS" 384echo " LDFLAGS =" "$LDFLAGS $DYNAMIC_LINK_FLAGS" 385echo "" 386echo " ELF_CC =" "$ELF_CC" 387echo " ELF_LINK =" "$ELF_LINK" 388echo "ELF_CFLAGS=" "$ELF_CFLAGS" 389echo "" 390echo " prefix:" "$prefix" 391echo " exec_prefix:" "$exec_prefix" 392echo " Installation Lib Dir:" "$libdir" 393echo "Installation Include Dir:" "$includedir" 394echo "" 395echo "See also src/sl-feat.h for various features." 396 397echo "" 398echo "The following modules that depend upon external libraries will be built:" 399echo " $extramodules" 400echo "" 401if test "X$missingmodules" != "X" 402then 403 echo "" 404 echo "While not required, it is recommended that you install the following" 405 echo "libraries and reconfigure so that the corresponding modules can be built:" 406 echo " $missingmodules" 407 echo "" 408fi 409echo "Type 'make' to build a shared version of the library." 410echo "Type 'make help' for more options" 411echo "" 412