1dnl 2dnl Caching is usually WRONG for systems with cross-mounted file systems 3dnl (the cache file may correspond to a different system). Since configure 4dnl is not on a performance-critical path, go for robustness over speed. 5dnl 6define([AC_CACHE_LOAD], )dnl 7define([AC_CACHE_SAVE], )dnl 8dnl 9dnl 10dnl Process this file with autoconf to produce a configure script. 11AC_INIT() 12AC_PREREQ(2.52) 13AC_CONFIG_MACRO_DIR([confdb]) 14AC_CONFIG_AUX_DIR([.]) 15AC_CONFIG_HEADER([trace_impl.h]) 16 17AC_ARG_ENABLE(strict, 18[--enable-strict - Turn on strict compilation testing 19 when using gcc], 20COPTIONS="${COPTIONS} -Wall -O -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL") 21 22AC_ARG_ENABLE(echo, 23[--enable-echo - Turn on strong echoing. The default 24 is enable=no.] ,set -x) 25 26AC_ARG_ENABLE(softerror, 27[--enable-softerror - Turn on soft error, i.e. instead of 28 issuing MSG_ERROR, MSG_WARN + exit 0 29 are used. The default is enable=no.], 30, enable_softerror=${slog2_enable_softerror:-no}) 31 32# Find the home directory if not specified 33if test "X$srcdir" != "X." -a -s $srcdir/src/Makefile.in ; then 34 top_srcdir_abs=$srcdir 35else 36 PAC_GETWD(top_srcdir_abs,src/Makefile.in) 37fi 38 39if test -z "$top_srcdir_abs" ; then 40 top_srcdir_abs=`pwd` 41fi 42 43if test ! -d "$top_srcdir_abs" ; then 44 PAC_MSG_ERROR($enable_softerror, [*** $top_srcdir_abs is not a valid directory - cannot continue]) 45fi 46 47AC_SUBST(top_srcdir_abs) 48 49# Determine this package's name based on its directory name 50changequote(,) 51tmpname="`echo $top_srcdir_abs | sed -e 's%\(.*\)/\([^/]*\)%\2%'`" 52pkgname="`echo $tmpname | sed -e 'y%abcdefghijklmnopqrstuvwxyz/%ABCDEFGHIJKLMNOPQRSTUVWXYZ_%'`" 53changequote([,]) 54if test "x$pkgname" = "x" ; then 55 pkgname="TRACE-IMPL" 56fi 57 58echo "Configuring $pkgname implementation with $ac_configure_args" 59 60# Cannot use JAVA_HOME here in this configure.ac. 61# Because JAVA_HOME is used in Blackdown's .java_wrapper in jdk117_v3 62# Using JAVA_HOME here would mistakenly set some variable in .java_wrapper 63# when .java_wrapper is invoked. i.e. causes mysterious error in tests. 64AC_ARG_WITH(java, 65[--with-java=JDK_TOPDIR - The path of the top-level directory of 66 the Java SDK installation. If this option 67 or with-java2 is not given, configure 68 will try to locate java for you. Also, 69 with-java2 option overwrites the 70 with-java option to set JDK_TOPDIR.], 71JDK_TOPDIR=$withval, JDK_TOPDIR="") 72 73AC_ARG_WITH(java2, 74[--with-java2=JDK_TOPDIR - The path of the top-level directory of 75 the Java SDK installation. If this option 76 or with-java is not given, configure will 77 try to locate java for you. Also, 78 with-java2 option overwrites the 79 with-java option to set JDK_TOPDIR.], 80JDK_TOPDIR=$withval, ) 81 82AC_ARG_WITH(jvmflags, 83[--with-jvmflags=JVMFLAGS - supply java virtual machine flags, 84 e.g. -Xms32m -Xmx256m.], 85JVMFLAGS="$withval") 86 87MAKE=${MAKE:-"make"} 88PAC_MAKE_IS_GNUMAKE 89PAC_MAKE_IS_BSD44 90PAC_MAKE_IS_OSF 91PAC_MAKE_VPATH 92if test ! -s src/rlog.h -a -z "$VPATH" ; then 93 AC_MSG_ERROR([No virtual MAKE path command found. 94 You may need to set your make command 95 The GNU make (sometimes available as gnumake) can be used.]) 96fi 97VPATH_EXTRA="" 98case $VPATH in 99 VPATH=*) 100 VPATH_EXTRA=":\$(TRACE_SRCDIR)" 101 ;; 102 .PATH:*) 103 VPATH_EXTRA=" \$(TRACE_SRCDIR)" 104 ;; 105esac 106AC_SUBST(VPATH_EXTRA) 107AC_SUBST(MAKE) 108 109# Check if --without-java is specified 110if test "$JDK_TOPDIR" = "no" ; then 111 PAC_MSG_ERROR($enable_softerror, [--without-java is specified, exit!]) 112fi 113 114AC_ARG_VAR(TRACE_CC,[TRACE_CC overrides CC if it exists.]) 115AC_ARG_VAR(TRACE_CFLAGS,[TRACE_CFLAGS overrides CFLAGS if it exists.]) 116dnl Check if TRACE_CC has been set before AC_PROG_CC 117if test -n "$TRACE_CC" ; then 118 TRACE_ORIG_CC="$CC" 119 CC="$TRACE_CC" 120fi 121dnl Check if TRACE_CFLAGS has been set before AC_PROG_CC 122if test -n "$TRACE_CFLAGS" ; then 123 TRACE_ORIG_CFLAGS="$CFLAGS" 124 CFLAGS="$TRACE_CFLAGS" 125fi 126dnl Checks for programs. 127AC_PROG_CC 128dnl Checks for header files. 129AC_HEADER_STDC 130AC_CHECK_HEADERS( stdlib.h stdio.h string.h ctype.h errno.h ) 131dnl Checks for typedefs, structures, and compiler characteristics. 132AC_C_CONST 133dnl SIZEOF_VOID_P, SIZEOF_LONG, SIZEOF_LONG_LONG and SIZEOF__INT64 created 134dnl by AC_CHECK_SIZEOF( *, * ) are needed to compile 135dnl slog2sdk/src/logformat/trace/logformat_trace_InputLog.c 136AC_CHECK_SIZEOF(void *) 137AC_CHECK_SIZEOF(int) 138AC_CHECK_SIZEOF(long) 139AC_CHECK_SIZEOF(long long) 140AC_CHECK_SIZEOF(__int64) 141dnl -- Check if byteswapping needs to be done. 142if test "$cross_compiling" = "yes" -o "$cross_compiling" = 1 ; then 143 AC_MSG_CHECKING([for byte ordering]) 144 if test "X$CROSS_BIGENDIAN" != "X" ; then 145 if test "$CROSS_BIGENDIAN" = "true" \ 146 -o "$CROSS_BIGENDIAN" = "false" ; then 147 if test "$CROSS_BIGENDIAN" = "true" ; then 148 AC_DEFINE( WORDS_BIGENDIAN, 1, 149 [Define if byte order is bigendian] ) 150 AC_MSG_RESULT( [defined to be big endian] ) 151 else 152 AC_MSG_RESULT( [defined to be little endian] ) 153 fi 154 else 155 AC_DEFINE( WORDS_BIGENDIAN, 1, 156 [Define if byte order is bigendian] ) 157 AC_MSG_RESULT( [Unknown CROSS_BIGENDIAN, $CROSS_BIGENDIAN! Assumed big endian] ) 158 fi 159 else 160 AC_DEFINE( WORDS_BIGENDIAN, 1, [Define if byte order is bigendian] ) 161 AC_MSG_RESULT( [Undefined CROSS_BIGENDIAN! Assumed big endian] ) 162 fi 163else 164 AC_C_BIGENDIAN 165fi 166 167LIBSO_PREFIX="lib" 168AC_CANONICAL_HOST 169case "$host_os" in 170 aix4* | aix5* ) 171 dnl temporary fix to force libtool on AIX to generate .so file, 172 dnl i.e. inform libtool to do runtime linking. 173 LIBSO_LDFLAGS="-brtl" 174 ;; 175 *darwin* ) 176 dnl force libtool to build .jnilib which is needed by Mac's JVM 177 LIBSO_LDFLAGS="-shrext .jnilib" 178 ;; 179 *cygwin* ) 180 dnl Since SUN's JDK assumes a win32 compiler, so force cygwin/gcc 181 dnl to be in MINGW32 mode. 182 LIBSO_CFLAGS="-mno-cygwin" 183 LIBSO_LDFLAGS="-Wl,--enable-stdcall-fixup" 184 LIBSO_PREFIX="" 185 ;; 186esac 187dnl Strictly speaking, we need to test LIBSO_CFLAGS and LIBSO_LDFLAGS 188dnl with libtool before using them in Makefile. **FIXME** 189AC_SUBST(LIBSO_CFLAGS) 190AC_SUBST(LIBSO_LDFLAGS) 191AC_SUBST(LIBSO_PREFIX) 192 193dnl intel compiler does not need shared library symbol exported. 194EXPORT_SYMBOLS=yes 195case "$CC" in 196 *icc* ) 197 EXPORT_SYMBOLS=no 198 ;; 199 *pgcc ) 200 ;; 201esac 202AC_SUBST(EXPORT_SYMBOLS) 203 204AC_DISABLE_STATIC 205AC_LIBTOOL_WIN32_DLL 206dnl Set SED that is not set in AC_PROG_LIBTOOL in autoconf 2.5x 207AC_CHECK_PROG(SED, sed, sed, ;) 208AC_PROG_LIBTOOL 209AC_SUBST(LIBTOOL_DEPS) 210 211dnl Checks for libraries. 212dnl Replace `main' with a function in -lefence: 213AC_CHECK_LIB(efence, malloc, [DEBUG_LIBS="-lefence"; AC_SUBST(DEBUG_LIBS)]) 214 215dnl Checks for library functions. 216AC_CHECK_FUNCS(strstr) 217 218JAC_JNI_HEADERS(JNI_INC, JDK_TOPDIR) 219if test "x$JNI_INC" = "x" ; then 220 PAC_MSG_ERROR($enable_softerror, [Invalid JNI include dir, exit!]) 221fi 222AC_DEFINE(HAVE_JNI_H,1,[Define if <jni.h> is found]) 223AC_SUBST(JNI_INC) 224 225JVM="$JDK_TOPDIR/bin/java" 226 227AC_SUBST(JVM) 228AC_SUBST(JVMFLAGS) 229 230JAC_CHECK_CYGPATH(JPATH_START, JPATH_FINAL) 231AC_SUBST(JPATH_START) 232AC_SUBST(JPATH_FINAL) 233 234dnl Checking for working INSTALL 235AC_PROG_INSTALL 236PAC_PROG_CHECK_INSTALL_WORKS 237PAC_PROG_INSTALL_BREAKS_LIBS 238 239CPRP=cp 240RM="rm -f" 241MV="mv -f" 242MKDIR=mkdir 243 244AC_SUBST(RM) 245# 246# libbuild_dir is used to build the libraries in before they are installed. 247# binbuild_dir is for the scripts/programs 248# includebuild_dir is for all user header files 249# 250rootbuild_dir=`pwd` 251for dir in lib bin share sbin ; do 252 dirname=${dir}build_dir 253 eval dirvalue=\$"$dirname" 254 eval $dirname=$rootbuild_dir/$dir 255done 256# echo "rootbuild_dir = $rootbuild_dir" 257changequote(,) 258gui_libbuild_dir="`echo $rootbuild_dir | sed -e 's%\(.*\)/[^/]*$%\1/lib%'`" 259changequote([,]) 260# echo "gui_libbuild_dir = $gui_libbuild_dir" 261 262# VPATH build: Set the libbuild_dir 263if test ! -d $libbuild_dir ; then 264 AC_MSG_NOTICE([creating directory $libbuild_dir]) 265 $MKDIR $libbuild_dir 266fi 267 268# VPATH build: Set the sharebuild_dir 269if test ! -d $sharebuild_dir ; then 270 AC_MSG_NOTICE([creating directory $sharebuild_dir]) 271 $MKDIR $sharebuild_dir 272fi 273 274logfilesbuild_dir="$sharebuild_dir/examples/logfiles" 275if test ! -d $logfilesbuild_dir ; then 276 AC_MSG_NOTICE([creating directory $logfilesbuild_dir]) 277 AS_MKDIR_P($logfilesbuild_dir) 278fi 279 280# Copying $srcdir/logfiles to logfilesbuild_dir 281if test -d $srcdir/logfiles ; then 282 AC_MSG_NOTICE([creating sample logfiles from source]) 283 $CPRP -pr $srcdir/logfiles/*.rlog $logfilesbuild_dir 284fi 285 286AC_SUBST(libbuild_dir) 287AC_SUBST(binbuild_dir) 288AC_SUBST(sbinbuild_dir) 289AC_SUBST(sharebuild_dir) 290AC_SUBST(logfilesbuild_dir) 291AC_SUBST(gui_libbuild_dir) 292 293# Define bindir's executables, and pass them down to sbindir's install-package 294OLD_EXEFILES="traceprint traceTOslog2" 295 296PATH_OLD_EXEFILES="sbin/install-package" 297for exefile in $OLD_EXEFILES ; do 298 PATH_OLD_EXEFILES="$PATH_OLD_EXEFILES bin/$exefile" 299done 300 301TRACE_NAME=rlog 302AC_SUBST(TRACE_NAME) 303 304if test "X$TRACE_NAME" != "X" -a "$TRACE_NAME" != "trace" ; then 305 for oldpgm in $OLD_EXEFILES ; do 306 newpgm=$TRACE_NAME`echo $oldpgm | sed -e 's%trace%%'` 307 EXEFILES="$EXEFILES $newpgm" 308 done 309fi 310AC_SUBST(EXEFILES) 311 312AC_OUTPUT(Makefile src/Makefile $PATH_OLD_EXEFILES) 313 314for script in $PATH_OLD_EXEFILES ; do 315 if test -f "$script" ; then 316 chmod a+x $script 317 else 318 PAC_MSG_ERROR([*** $script is not a valid file - check if $srcdir is a valid TRACE-API implementation.]) 319 fi 320done 321 322dnl Rename all the scripts in bindir according to the TRACE_NAME 323if test "X$TRACE_NAME" != "X" -a "$TRACE_NAME" != "trace" ; then 324 for oldpgm in $OLD_EXEFILES ; do 325 newpgm=$TRACE_NAME`echo $oldpgm | sed -e 's%trace%%'` 326 $MV bin/$oldpgm bin/$newpgm 327 done 328fi 329 330dnl Restore the original CC if it is needed 331if test -n "$TRACE_CC" ; then 332 CC="$TRACE_ORIG_CC" 333fi 334dnl Restore the original CFLAGS if it is needed 335if test -n "$TRACE_CFLAGS" ; then 336 CFLAGS="$TRACE_ORIG_CFLAGS" 337fi 338